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

1498{
1499 for (const Grouping &g : root->groups)
1500 {
1501 GroupDef *gd=nullptr;
1502 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1503 if (gd && gd->addClass(cd))
1504 {
1506 if (cdm)
1507 {
1508 cdm->makePartOfGroup(gd);
1509 }
1510 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1511 }
1512 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1513 {
1514 warn(root->fileName, root->startLine,
1515 "Found non-existing group '{}' for the command '{}', ignoring command",
1517 );
1518 }
1519 }
1520}
virtual void makePartOfGroup(GroupDef *gd)=0
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:113
QCString fileName
file this entry was extracted from
Definition entry.h:224
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:222
int startLine
start line of entry in the source
Definition entry.h:225
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:163
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
static constexpr const char * getGroupPriName(GroupPri_t priority) noexcept
Definition types.h:240
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
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 1522 of file groupdef.cpp.

1523{
1524 for (const Grouping &g : root->groups)
1525 {
1527 if (gd && gd->addConcept(cd))
1528 {
1530 if (cdm)
1531 {
1532 cdm->makePartOfGroup(gd);
1533 }
1534 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1535 }
1536 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1537 {
1538 warn(root->fileName, root->startLine,
1539 "Found non-existing group '{}' for the command '{}', ignoring command",
1541 );
1542 }
1543 }
1544}
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 1594 of file groupdef.cpp.

1595{
1596 //printf("*** root->groups.size()=%d\n",root->groups.size());
1597 for (const Grouping &g : root->groups)
1598 {
1600 //printf("group '%s'\n",qPrint(g->groupname));
1601 if (gd)
1602 {
1603 gd->addDir(dd);
1604 dd->makePartOfGroup(gd);
1605 //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1606 }
1607 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1608 {
1609 warn(root->fileName, root->startLine,
1610 "Found non-existing group '{}' for the command '{}', ignoring command",
1612 );
1613 }
1614 }
1615}
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 1777 of file groupdef.cpp.

1778{
1779 for (const Grouping &g : root->groups)
1780 {
1782 if (gd)
1783 {
1784 gd->addExample(eg);
1785 eg->makePartOfGroup(gd);
1786 //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1787 }
1788 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1789 {
1790 warn(root->fileName, root->startLine,
1791 "Found non-existing group '{}' for the command '{}', ignoring command",
1793 );
1794 }
1795 }
1796}
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 1617 of file groupdef.cpp.

1618{
1619 //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
1620 for (const Grouping &g : root->groups)
1621 {
1623 if (gd)
1624 {
1625 if (gd==subGroup)
1626 {
1627 warn(root->fileName,root->startLine,"Refusing to add group {} to itself",
1628 gd->name());
1629 }
1630 else if (subGroup->findGroup(gd))
1631 {
1632 warn(root->fileName,root->startLine,"Refusing to add group {} to group {}, since the latter is already a "
1633 "subgroup of the former", subGroup->name(),gd->name());
1634 }
1635 else if (!gd->findGroup(subGroup))
1636 {
1637 gd->addGroup(subGroup);
1638 subGroup->makePartOfGroup(gd);
1639 }
1640 }
1641 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1642 {
1643 warn(root->fileName, root->startLine,
1644 "Found non-existing group '{}' for the command '{}', ignoring command",
1646 );
1647 }
1648 }
1649}
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 1652 of file groupdef.cpp.

1653{
1654 //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
1655 // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
1656
1657 // Search entry's group list for group with highest pri.
1659 GroupDef *fgd=nullptr;
1660 for (const Grouping &g : root->groups)
1661 {
1662 GroupDef *gd=nullptr;
1663 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1664 if (gd && g.pri >= pri)
1665 {
1666 if (fgd && gd!=fgd && g.pri==pri)
1667 {
1668 warn(root->fileName, root->startLine,
1669 "Member {} found in multiple {} groups! "
1670 "The member will be put in group {}, and not in group {}",
1671 md->name(), Grouping::getGroupPriName( pri ),
1672 gd->name(), fgd->name()
1673 );
1674 }
1675
1676 fgd = gd;
1677 pri = g.pri;
1678 }
1679 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1680 {
1681 warn(root->fileName, root->startLine,
1682 "Found non-existing group '{}' for the command '{}', ignoring command",
1684 );
1685 }
1686 }
1687 //printf("fgd=%p\n",fgd);
1688
1689 // put member into group defined by this entry?
1690 if (fgd)
1691 {
1692 GroupDef *mgd = md->getGroupDef();
1693 //printf("mgd=%p\n",mgd);
1694 bool insertit = FALSE;
1695 if (mgd==nullptr)
1696 {
1697 insertit = TRUE;
1698 }
1699 else if (mgd!=fgd)
1700 {
1701 bool moveit = FALSE;
1702
1703 // move member from one group to another if
1704 // - the new one has a higher priority
1705 // - the new entry has the same priority, but with docs where the old one had no docs
1706 if (md->getGroupPri()<pri)
1707 {
1708 moveit = TRUE;
1709 }
1710 else
1711 {
1712 if (md->getGroupPri()==pri)
1713 {
1714 if (!root->doc.isEmpty() && !md->getGroupHasDocs())
1715 {
1716 moveit = TRUE;
1717 }
1718 else if (!root->doc.isEmpty() && md->getGroupHasDocs())
1719 {
1721 "Member documentation for {} found several times in {} groups!\n"
1722 "{}:{}: The member will remain in group {}, and won't be put into group {}",
1723 md->name(), Grouping::getGroupPriName( pri ),
1724 root->fileName, root->startLine,
1725 mgd->name(), fgd->name()
1726 );
1727 }
1728 }
1729 }
1730
1731 if (moveit)
1732 {
1733 //printf("removeMember\n");
1734 mgd->removeMember(md);
1735 insertit = TRUE;
1736 }
1737 }
1738
1739 if (insertit)
1740 {
1741 //printf("insertMember found at %s line %d: %s: related %s\n",
1742 // qPrint(md->getDefFileName()),md->getDefLine(),
1743 // qPrint(md->name()),qPrint(root->relates));
1744 bool success = fgd->insertMember(md);
1745 if (success)
1746 {
1748 if (mdm)
1749 {
1750 //printf("insertMember successful\n");
1751 mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
1753 if (cdm)
1754 {
1755 cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
1756 }
1757 if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong())
1758 {
1759 for (const auto &emd : mdm->enumFieldList())
1760 {
1762 if (emdm && emdm->getGroupDef()==nullptr)
1763 {
1764 emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(),
1765 mdm->getGroupFileName(),mdm->getGroupStartLine(),
1766 mdm->getGroupHasDocs());
1767 }
1768 }
1769 }
1770 }
1771 }
1772 }
1773 }
1774}
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:201
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:166
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 1546 of file groupdef.cpp.

1547{
1548 for (const Grouping &g : root->groups)
1549 {
1551 if (gd && gd->addModule(mod))
1552 {
1553 mod->makePartOfGroup(gd);
1554 //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle());
1555 }
1556 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1557 {
1558 warn(root->fileName, root->startLine,
1559 "Found non-existing group '{}' for the command '{}', ignoring command",
1561 );
1562 }
1563 }
1564}
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 1567 of file groupdef.cpp.

1568{
1569 //printf("root->groups.size()=%zu\n",root->groups.size());
1570 for (const Grouping &g : root->groups)
1571 {
1572 GroupDef *gd=nullptr;
1573 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1574 //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1575 if (gd && gd->addNamespace(nd))
1576 {
1578 if (ndm)
1579 {
1580 ndm->makePartOfGroup(gd);
1581 }
1582 //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1583 }
1584 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1585 {
1586 warn(root->fileName, root->startLine,
1587 "Found non-existing group '{}' for the command '{}', ignoring command",
1589 );
1590 }
1591 }
1592}
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 178 of file groupdef.cpp.

180{
181 return std::make_unique<GroupDefImpl>(fileName,line,name,title,refFileName);
182}

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

◆ toGroupDef() [1/2]

const GroupDef * toGroupDef ( const Definition * d)

Definition at line 2093 of file groupdef.cpp.

2094{
2095 if (d==nullptr) return nullptr;
2096 if (d && typeid(*d)==typeid(GroupDefImpl))
2097 {
2098 return static_cast<const GroupDef*>(d);
2099 }
2100 else
2101 {
2102 return nullptr;
2103 }
2104}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 2080 of file groupdef.cpp.

2081{
2082 if (d==nullptr) return nullptr;
2083 if (d && typeid(*d)==typeid(GroupDefImpl))
2084 {
2085 return static_cast<GroupDef*>(d);
2086 }
2087 else
2088 {
2089 return nullptr;
2090 }
2091}

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