Doxygen
Loading...
Searching...
No Matches
groupdef.h File Reference
#include <memory>
#include "definition.h"
#include "dirdef.h"
#include "layout.h"
#include "membergroup.h"
#include "linkedmap.h"
+ Include dependency graph for groupdef.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GroupDef
 A model of a group of symbols. More...
 
class  GroupLinkedMap
 
class  GroupList
 

Functions

std::unique_ptr< GroupDefcreateGroupDef (const QCString &fileName, int line, const QCString &name, const QCString &title, const QCString &refFileName=QCString())
 
GroupDeftoGroupDef (Definition *d)
 
const GroupDeftoGroupDef (const Definition *d)
 
void addClassToGroups (const Entry *root, ClassDef *cd)
 
void addConceptToGroups (const Entry *root, ConceptDef *cd)
 
void addModuleToGroups (const Entry *root, ModuleDef *mod)
 
void addNamespaceToGroups (const Entry *root, NamespaceDef *nd)
 
void addGroupToGroups (const Entry *root, GroupDef *subGroup)
 
void addMemberToGroups (const Entry *root, MemberDef *md)
 
void addPageToGroups (const Entry *root, PageDef *pd)
 
void addExampleToGroups (const Entry *root, PageDef *eg)
 
void addDirToGroups (const Entry *root, DirDef *dd)
 

Function Documentation

◆ addClassToGroups()

void addClassToGroups ( const Entry * root,
ClassDef * cd )

Definition at line 1412 of file groupdef.cpp.

1413{
1414 for (const Grouping &g : root->groups)
1415 {
1416 GroupDef *gd=nullptr;
1417 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1418 if (gd && gd->addClass(cd))
1419 {
1421 if (cdm)
1422 {
1423 cdm->makePartOfGroup(gd);
1424 }
1425 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1426 }
1427 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1428 {
1429 warn(root->fileName, root->startLine,
1430 "Found non-existing group '%s' for the command '%s', ignoring command",
1432 );
1433 }
1434 }
1435}
virtual void makePartOfGroup(GroupDef *gd)=0
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:114
QCString fileName
file this entry was extracted from
Definition entry.h:223
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:221
int startLine
start line of entry in the source
Definition entry.h:224
A model of a group of symbols.
Definition groupdef.h:52
virtual bool addClass(ClassDef *def)=0
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
ClassDefMutable * toClassDefMutable(Definition *d)
#define warn(file, line, fmt,...)
Definition message.h:59
const char * qPrint(const char *s)
Definition qcstring.h:661
Grouping info.
Definition types.h:65
QCString groupname
name of the group
Definition types.h:95
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:74
static const char * getGroupPriName(GroupPri_t priority)
Definition types.h:78
GroupPri_t pri
priority of this definition
Definition types.h:96

References GroupDef::addClass(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, QCString::isEmpty(), DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, toClassDefMutable(), and warn.

Referenced by addClassToContext().

◆ addConceptToGroups()

void addConceptToGroups ( const Entry * root,
ConceptDef * cd )

Definition at line 1437 of file groupdef.cpp.

1438{
1439 for (const Grouping &g : root->groups)
1440 {
1442 if (gd && gd->addConcept(cd))
1443 {
1445 if (cdm)
1446 {
1447 cdm->makePartOfGroup(gd);
1448 }
1449 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1450 }
1451 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1452 {
1453 warn(root->fileName, root->startLine,
1454 "Found non-existing group '%s' for the command '%s', ignoring command",
1456 );
1457 }
1458 }
1459}
virtual bool addConcept(ConceptDef *def)=0
ConceptDefMutable * toConceptDefMutable(Definition *d)

References GroupDef::addConcept(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, toConceptDefMutable(), and warn.

Referenced by addConceptToContext().

◆ addDirToGroups()

void addDirToGroups ( const Entry * root,
DirDef * dd )

Definition at line 1509 of file groupdef.cpp.

1510{
1511 //printf("*** root->groups.size()=%d\n",root->groups.size());
1512 for (const Grouping &g : root->groups)
1513 {
1515 //printf("group '%s'\n",qPrint(g->groupname));
1516 if (gd)
1517 {
1518 gd->addDir(dd);
1519 dd->makePartOfGroup(gd);
1520 //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1521 }
1522 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1523 {
1524 warn(root->fileName, root->startLine,
1525 "Found non-existing group '%s' for the command '%s', ignoring command",
1527 );
1528 }
1529 }
1530}
virtual void addDir(DirDef *dd)=0

References GroupDef::addDir(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, and warn.

Referenced by findDirDocumentation().

◆ addExampleToGroups()

void addExampleToGroups ( const Entry * root,
PageDef * eg )

Definition at line 1693 of file groupdef.cpp.

1694{
1695 for (const Grouping &g : root->groups)
1696 {
1698 if (gd)
1699 {
1700 gd->addExample(eg);
1701 eg->makePartOfGroup(gd);
1702 //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1703 }
1704 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1705 {
1706 warn(root->fileName, root->startLine,
1707 "Found non-existing group '%s' for the command '%s', ignoring command",
1709 );
1710 }
1711 }
1712}
virtual void addExample(PageDef *def)=0

References GroupDef::addExample(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, and warn.

◆ addGroupToGroups()

void addGroupToGroups ( const Entry * root,
GroupDef * subGroup )

Definition at line 1532 of file groupdef.cpp.

1533{
1534 //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
1535 for (const Grouping &g : root->groups)
1536 {
1538 if (gd)
1539 {
1540 if (gd==subGroup)
1541 {
1542 warn(root->fileName,root->startLine,"Refusing to add group %s to itself",
1543 qPrint(gd->name()));
1544 }
1545 else if (subGroup->findGroup(gd))
1546 {
1547 warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a "
1548 "subgroup of the former", qPrint(subGroup->name()),qPrint(gd->name()));
1549 }
1550 else if (!gd->findGroup(subGroup))
1551 {
1552 gd->addGroup(subGroup);
1553 subGroup->makePartOfGroup(gd);
1554 }
1555 }
1556 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1557 {
1558 warn(root->fileName, root->startLine,
1559 "Found non-existing group '%s' for the command '%s', ignoring command",
1561 );
1562 }
1563 }
1564}
virtual const QCString & name() const =0
virtual void addGroup(GroupDef *def)=0
virtual bool findGroup(const GroupDef *def) const =0

References GroupDef::addGroup(), Entry::fileName, GroupDef::findGroup(), Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Definition::name(), Grouping::pri, qPrint(), Entry::startLine, and warn.

Referenced by organizeSubGroupsFiltered().

◆ addMemberToGroups()

void addMemberToGroups ( const Entry * root,
MemberDef * md )

Add a member to the group with the highest priority

Definition at line 1567 of file groupdef.cpp.

1568{
1569 //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
1570 // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
1571
1572 // Search entry's group list for group with highest pri.
1574 GroupDef *fgd=nullptr;
1575 for (const Grouping &g : root->groups)
1576 {
1577 GroupDef *gd=nullptr;
1578 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1579 if (gd && g.pri >= pri)
1580 {
1581 if (fgd && gd!=fgd && g.pri==pri)
1582 {
1583 warn(root->fileName, root->startLine,
1584 "Member %s found in multiple %s groups! "
1585 "The member will be put in group %s, and not in group %s",
1586 qPrint(md->name()), Grouping::getGroupPriName( pri ),
1587 qPrint(gd->name()), qPrint(fgd->name())
1588 );
1589 }
1590
1591 fgd = gd;
1592 pri = g.pri;
1593 }
1594 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1595 {
1596 warn(root->fileName, root->startLine,
1597 "Found non-existing group '%s' for the command '%s', ignoring command",
1599 );
1600 }
1601 }
1602 //printf("fgd=%p\n",fgd);
1603
1604 // put member into group defined by this entry?
1605 if (fgd)
1606 {
1607 GroupDef *mgd = md->getGroupDef();
1608 //printf("mgd=%p\n",mgd);
1609 bool insertit = FALSE;
1610 if (mgd==nullptr)
1611 {
1612 insertit = TRUE;
1613 }
1614 else if (mgd!=fgd)
1615 {
1616 bool moveit = FALSE;
1617
1618 // move member from one group to another if
1619 // - the new one has a higher priority
1620 // - the new entry has the same priority, but with docs where the old one had no docs
1621 if (md->getGroupPri()<pri)
1622 {
1623 moveit = TRUE;
1624 }
1625 else
1626 {
1627 if (md->getGroupPri()==pri)
1628 {
1629 if (!root->doc.isEmpty() && !md->getGroupHasDocs())
1630 {
1631 moveit = TRUE;
1632 }
1633 else if (!root->doc.isEmpty() && md->getGroupHasDocs())
1634 {
1636 "Member documentation for %s found several times in %s groups!\n"
1637 "%s:%d: The member will remain in group %s, and won't be put into group %s",
1638 qPrint(md->name()), Grouping::getGroupPriName( pri ),
1639 qPrint(root->fileName), root->startLine,
1640 qPrint(mgd->name()),
1641 qPrint(fgd->name())
1642 );
1643 }
1644 }
1645 }
1646
1647 if (moveit)
1648 {
1649 //printf("removeMember\n");
1650 mgd->removeMember(md);
1651 insertit = TRUE;
1652 }
1653 }
1654
1655 if (insertit)
1656 {
1657 //printf("insertMember found at %s line %d: %s: related %s\n",
1658 // qPrint(md->getDefFileName()),md->getDefLine(),
1659 // qPrint(md->name()),qPrint(root->relates));
1660 bool success = fgd->insertMember(md);
1661 if (success)
1662 {
1664 if (mdm)
1665 {
1666 //printf("insertMember successful\n");
1667 mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
1669 if (cdm)
1670 {
1671 cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
1672 }
1673 if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong())
1674 {
1675 for (const auto &emd : mdm->enumFieldList())
1676 {
1678 if (emdm && emdm->getGroupDef()==nullptr)
1679 {
1680 emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(),
1681 mdm->getGroupFileName(),mdm->getGroupStartLine(),
1682 mdm->getGroupHasDocs());
1683 }
1684 }
1685 }
1686 }
1687 }
1688 }
1689 }
1690}
virtual void setGroupDefForAllMembers(GroupDef *g, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs)=0
QCString doc
documentation block (partly parsed)
Definition entry.h:200
virtual void removeMember(MemberDef *md)=0
virtual bool insertMember(MemberDef *def, bool docOnly=FALSE)=0
virtual bool getGroupHasDocs() const =0
virtual GroupDef * getGroupDef()=0
virtual const MemberVector & enumFieldList() const =0
virtual int getGroupStartLine() const =0
virtual ClassDef * getClassDefOfAnonymousType() const =0
virtual Grouping::GroupPri_t getGroupPri() const =0
virtual bool isEnumerate() const =0
virtual QCString getGroupFileName() const =0
virtual bool isStrong() const =0
virtual void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=nullptr)=0
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
MemberDefMutable * toMemberDefMutable(Definition *d)
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
GroupPri_t
Grouping priority.
Definition types.h:68
@ GROUPING_LOWEST
Definition types.h:69

References Entry::doc, MemberDef::enumFieldList(), FALSE, Entry::fileName, MemberDef::getClassDefOfAnonymousType(), MemberDef::getGroupDef(), MemberDef::getGroupFileName(), MemberDef::getGroupHasDocs(), MemberDef::getGroupPri(), Grouping::getGroupPriName(), MemberDef::getGroupStartLine(), Grouping::GROUPING_INGROUP, Grouping::GROUPING_LOWEST, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, GroupDef::insertMember(), QCString::isEmpty(), MemberDef::isEnumerate(), MemberDef::isStrong(), QCString::length(), Definition::name(), Grouping::pri, qPrint(), GroupDef::removeMember(), MemberDefMutable::setGroupDef(), ClassDefMutable::setGroupDefForAllMembers(), Entry::startLine, toClassDefMutable(), toMemberDefMutable(), TRUE, and warn.

Referenced by addDefineDoc(), addEnumDocs(), addMemberDocs(), addVariableToClass(), addVariableToFile(), findEnums(), and findMember().

◆ addModuleToGroups()

void addModuleToGroups ( const Entry * root,
ModuleDef * mod )

Definition at line 1461 of file groupdef.cpp.

1462{
1463 for (const Grouping &g : root->groups)
1464 {
1466 if (gd && gd->addModule(mod))
1467 {
1468 mod->makePartOfGroup(gd);
1469 //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle());
1470 }
1471 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1472 {
1473 warn(root->fileName, root->startLine,
1474 "Found non-existing group '%s' for the command '%s', ignoring command",
1476 );
1477 }
1478 }
1479}
virtual bool addModule(ModuleDef *def)=0

References GroupDef::addModule(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, and warn.

Referenced by ModuleManager::addDocs().

◆ addNamespaceToGroups()

void addNamespaceToGroups ( const Entry * root,
NamespaceDef * nd )

Definition at line 1482 of file groupdef.cpp.

1483{
1484 //printf("root->groups.size()=%zu\n",root->groups.size());
1485 for (const Grouping &g : root->groups)
1486 {
1487 GroupDef *gd=nullptr;
1488 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1489 //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1490 if (gd && gd->addNamespace(nd))
1491 {
1493 if (ndm)
1494 {
1495 ndm->makePartOfGroup(gd);
1496 }
1497 //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1498 }
1499 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1500 {
1501 warn(root->fileName, root->startLine,
1502 "Found non-existing group '%s' for the command '%s', ignoring command",
1504 );
1505 }
1506 }
1507}
virtual bool addNamespace(NamespaceDef *def)=0
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)

References GroupDef::addNamespace(), Entry::fileName, Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, QCString::isEmpty(), DefinitionMutable::makePartOfGroup(), Grouping::pri, qPrint(), Entry::startLine, toNamespaceDefMutable(), and warn.

Referenced by buildNamespaceList().

◆ addPageToGroups()

void addPageToGroups ( const Entry * root,
PageDef * pd )

◆ createGroupDef()

std::unique_ptr< GroupDef > createGroupDef ( const QCString & fileName,
int line,
const QCString & name,
const QCString & title,
const QCString & refFileName = QCString() )

Definition at line 174 of file groupdef.cpp.

176{
177 return std::make_unique<GroupDefImpl>(fileName,line,name,title,refFileName);
178}

Referenced by buildGroupListFiltered().

◆ toGroupDef() [1/2]

const GroupDef * toGroupDef ( const Definition * d)

Definition at line 1978 of file groupdef.cpp.

1979{
1980 if (d==nullptr) return nullptr;
1981 if (d && typeid(*d)==typeid(GroupDefImpl))
1982 {
1983 return static_cast<const GroupDef*>(d);
1984 }
1985 else
1986 {
1987 return nullptr;
1988 }
1989}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 1965 of file groupdef.cpp.

1966{
1967 if (d==nullptr) return nullptr;
1968 if (d && typeid(*d)==typeid(GroupDefImpl))
1969 {
1970 return static_cast<GroupDef*>(d);
1971 }
1972 else
1973 {
1974 return nullptr;
1975 }
1976}

Referenced by DocRef::DocRef(), DocParser::handleLinkedWord(), SearchTerm::makeTitle(), DefinitionImpl::navigationPathAsString(), DefinitionImpl::pathFragment(), SearchIndex::setCurrentDoc(), SearchIndexExternal::setCurrentDoc(), validatingParseDoc(), MemberDefImpl::writeDocumentation(), and writeJavasScriptSearchDataPage().