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 1447 of file groupdef.cpp.

1448{
1449 for (const Grouping &g : root->groups)
1450 {
1451 GroupDef *gd=nullptr;
1452 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1453 if (gd && gd->addClass(cd))
1454 {
1456 if (cdm)
1457 {
1458 cdm->makePartOfGroup(gd);
1459 }
1460 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1461 }
1462 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1463 {
1464 warn(root->fileName, root->startLine,
1465 "Found non-existing group '{}' for the command '{}', ignoring command",
1467 );
1468 }
1469 }
1470}
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:97
Grouping info.
Definition types.h:227
QCString groupname
name of the group
Definition types.h:257
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
static const char * getGroupPriName(GroupPri_t priority)
Definition types.h:240
GroupPri_t pri
priority of this definition
Definition types.h:258

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

Referenced by addClassToContext().

◆ addConceptToGroups()

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

Definition at line 1472 of file groupdef.cpp.

1473{
1474 for (const Grouping &g : root->groups)
1475 {
1477 if (gd && gd->addConcept(cd))
1478 {
1480 if (cdm)
1481 {
1482 cdm->makePartOfGroup(gd);
1483 }
1484 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1485 }
1486 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1487 {
1488 warn(root->fileName, root->startLine,
1489 "Found non-existing group '{}' for the command '{}', ignoring command",
1491 );
1492 }
1493 }
1494}
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, Entry::startLine, toConceptDefMutable(), and warn.

Referenced by addConceptToContext().

◆ addDirToGroups()

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

Definition at line 1544 of file groupdef.cpp.

1545{
1546 //printf("*** root->groups.size()=%d\n",root->groups.size());
1547 for (const Grouping &g : root->groups)
1548 {
1550 //printf("group '%s'\n",qPrint(g->groupname));
1551 if (gd)
1552 {
1553 gd->addDir(dd);
1554 dd->makePartOfGroup(gd);
1555 //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1556 }
1557 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1558 {
1559 warn(root->fileName, root->startLine,
1560 "Found non-existing group '{}' for the command '{}', ignoring command",
1562 );
1563 }
1564 }
1565}
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, Entry::startLine, and warn.

Referenced by findDirDocumentation().

◆ addExampleToGroups()

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

Definition at line 1727 of file groupdef.cpp.

1728{
1729 for (const Grouping &g : root->groups)
1730 {
1732 if (gd)
1733 {
1734 gd->addExample(eg);
1735 eg->makePartOfGroup(gd);
1736 //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1737 }
1738 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1739 {
1740 warn(root->fileName, root->startLine,
1741 "Found non-existing group '{}' for the command '{}', ignoring command",
1743 );
1744 }
1745 }
1746}
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, Entry::startLine, and warn.

◆ addGroupToGroups()

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

Definition at line 1567 of file groupdef.cpp.

1568{
1569 //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
1570 for (const Grouping &g : root->groups)
1571 {
1573 if (gd)
1574 {
1575 if (gd==subGroup)
1576 {
1577 warn(root->fileName,root->startLine,"Refusing to add group {} to itself",
1578 gd->name());
1579 }
1580 else if (subGroup->findGroup(gd))
1581 {
1582 warn(root->fileName,root->startLine,"Refusing to add group {} to group {}, since the latter is already a "
1583 "subgroup of the former", subGroup->name(),gd->name());
1584 }
1585 else if (!gd->findGroup(subGroup))
1586 {
1587 gd->addGroup(subGroup);
1588 subGroup->makePartOfGroup(gd);
1589 }
1590 }
1591 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1592 {
1593 warn(root->fileName, root->startLine,
1594 "Found non-existing group '{}' for the command '{}', ignoring command",
1596 );
1597 }
1598 }
1599}
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, 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 1602 of file groupdef.cpp.

1603{
1604 //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
1605 // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
1606
1607 // Search entry's group list for group with highest pri.
1609 GroupDef *fgd=nullptr;
1610 for (const Grouping &g : root->groups)
1611 {
1612 GroupDef *gd=nullptr;
1613 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1614 if (gd && g.pri >= pri)
1615 {
1616 if (fgd && gd!=fgd && g.pri==pri)
1617 {
1618 warn(root->fileName, root->startLine,
1619 "Member {} found in multiple {} groups! "
1620 "The member will be put in group {}, and not in group {}",
1621 md->name(), Grouping::getGroupPriName( pri ),
1622 gd->name(), fgd->name()
1623 );
1624 }
1625
1626 fgd = gd;
1627 pri = g.pri;
1628 }
1629 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1630 {
1631 warn(root->fileName, root->startLine,
1632 "Found non-existing group '{}' for the command '{}', ignoring command",
1634 );
1635 }
1636 }
1637 //printf("fgd=%p\n",fgd);
1638
1639 // put member into group defined by this entry?
1640 if (fgd)
1641 {
1642 GroupDef *mgd = md->getGroupDef();
1643 //printf("mgd=%p\n",mgd);
1644 bool insertit = FALSE;
1645 if (mgd==nullptr)
1646 {
1647 insertit = TRUE;
1648 }
1649 else if (mgd!=fgd)
1650 {
1651 bool moveit = FALSE;
1652
1653 // move member from one group to another if
1654 // - the new one has a higher priority
1655 // - the new entry has the same priority, but with docs where the old one had no docs
1656 if (md->getGroupPri()<pri)
1657 {
1658 moveit = TRUE;
1659 }
1660 else
1661 {
1662 if (md->getGroupPri()==pri)
1663 {
1664 if (!root->doc.isEmpty() && !md->getGroupHasDocs())
1665 {
1666 moveit = TRUE;
1667 }
1668 else if (!root->doc.isEmpty() && md->getGroupHasDocs())
1669 {
1671 "Member documentation for {} found several times in {} groups!\n"
1672 "{}:{}: The member will remain in group {}, and won't be put into group {}",
1673 md->name(), Grouping::getGroupPriName( pri ),
1674 root->fileName, root->startLine,
1675 mgd->name(), fgd->name()
1676 );
1677 }
1678 }
1679 }
1680
1681 if (moveit)
1682 {
1683 //printf("removeMember\n");
1684 mgd->removeMember(md);
1685 insertit = TRUE;
1686 }
1687 }
1688
1689 if (insertit)
1690 {
1691 //printf("insertMember found at %s line %d: %s: related %s\n",
1692 // qPrint(md->getDefFileName()),md->getDefLine(),
1693 // qPrint(md->name()),qPrint(root->relates));
1694 bool success = fgd->insertMember(md);
1695 if (success)
1696 {
1698 if (mdm)
1699 {
1700 //printf("insertMember successful\n");
1701 mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
1703 if (cdm)
1704 {
1705 cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
1706 }
1707 if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong())
1708 {
1709 for (const auto &emd : mdm->enumFieldList())
1710 {
1712 if (emdm && emdm->getGroupDef()==nullptr)
1713 {
1714 emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(),
1715 mdm->getGroupFileName(),mdm->getGroupStartLine(),
1716 mdm->getGroupHasDocs());
1717 }
1718 }
1719 }
1720 }
1721 }
1722 }
1723 }
1724}
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:230
@ GROUPING_LOWEST
Definition types.h:231

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, GroupDef::removeMember(), MemberDefMutable::setGroupDef(), ClassDefMutable::setGroupDefForAllMembers(), Entry::startLine, toClassDefMutable(), toMemberDefMutable(), TRUE, and warn.

Referenced by addDefineDoc(), addEnumDocs(), addGlobalFunction(), addInterfaceOrServiceToServiceOrSingleton(), addMemberDocs(), addMethodToClass(), addVariableToClass(), addVariableToFile(), buildFunctionList(), buildTypedefList(), findEnums(), and findMember().

◆ addModuleToGroups()

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

Definition at line 1496 of file groupdef.cpp.

1497{
1498 for (const Grouping &g : root->groups)
1499 {
1501 if (gd && gd->addModule(mod))
1502 {
1503 mod->makePartOfGroup(gd);
1504 //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle());
1505 }
1506 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1507 {
1508 warn(root->fileName, root->startLine,
1509 "Found non-existing group '{}' for the command '{}', ignoring command",
1511 );
1512 }
1513 }
1514}
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, Entry::startLine, and warn.

Referenced by ModuleManager::addDocs().

◆ addNamespaceToGroups()

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

Definition at line 1517 of file groupdef.cpp.

1518{
1519 //printf("root->groups.size()=%zu\n",root->groups.size());
1520 for (const Grouping &g : root->groups)
1521 {
1522 GroupDef *gd=nullptr;
1523 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1524 //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1525 if (gd && gd->addNamespace(nd))
1526 {
1528 if (ndm)
1529 {
1530 ndm->makePartOfGroup(gd);
1531 }
1532 //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1533 }
1534 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1535 {
1536 warn(root->fileName, root->startLine,
1537 "Found non-existing group '{}' for the command '{}', ignoring command",
1539 );
1540 }
1541 }
1542}
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, 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 175 of file groupdef.cpp.

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

Referenced by buildGroupListFiltered(), and GroupDef::overrideGroupGraph().

◆ toGroupDef() [1/2]

const GroupDef * toGroupDef ( const Definition * d)

Definition at line 2033 of file groupdef.cpp.

2034{
2035 if (d==nullptr) return nullptr;
2036 if (d && typeid(*d)==typeid(GroupDefImpl))
2037 {
2038 return static_cast<const GroupDef*>(d);
2039 }
2040 else
2041 {
2042 return nullptr;
2043 }
2044}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 2020 of file groupdef.cpp.

2021{
2022 if (d==nullptr) return nullptr;
2023 if (d && typeid(*d)==typeid(GroupDefImpl))
2024 {
2025 return static_cast<GroupDef*>(d);
2026 }
2027 else
2028 {
2029 return nullptr;
2030 }
2031}

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