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

1502{
1503 for (const Grouping &g : root->groups)
1504 {
1505 GroupDef *gd=nullptr;
1506 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1507 if (gd && gd->addClass(cd))
1508 {
1510 if (cdm)
1511 {
1512 cdm->makePartOfGroup(gd);
1513 }
1514 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1515 }
1516 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1517 {
1518 warn(root->fileName, root->startLine,
1519 "Found non-existing group '{}' for the command '{}', ignoring command",
1521 );
1522 }
1523 }
1524}
virtual void makePartOfGroup(GroupDef *gd)=0
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:113
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: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 1526 of file groupdef.cpp.

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

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

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

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

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

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

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

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

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

◆ toGroupDef() [1/2]

const GroupDef * toGroupDef ( const Definition * d)

Definition at line 2087 of file groupdef.cpp.

2088{
2089 if (d==nullptr) return nullptr;
2090 if (d && typeid(*d)==typeid(GroupDefImpl))
2091 {
2092 return static_cast<const GroupDef*>(d);
2093 }
2094 else
2095 {
2096 return nullptr;
2097 }
2098}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 2074 of file groupdef.cpp.

2075{
2076 if (d==nullptr) return nullptr;
2077 if (d && typeid(*d)==typeid(GroupDefImpl))
2078 {
2079 return static_cast<GroupDef*>(d);
2080 }
2081 else
2082 {
2083 return nullptr;
2084 }
2085}

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