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

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

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

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

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

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

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

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

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

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

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 2072 of file groupdef.cpp.

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

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