Doxygen
Loading...
Searching...
No Matches
groupdef.h File Reference

#include <src/groupdef.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< GroupDef > createGroupDef (const DString &fileName, int line, const DString &name, const DString &title, const DString &refFileName=DString())
GroupDef * toGroupDef (Definition *d)
const GroupDef * toGroupDef (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 1567 of file groupdef.cpp.

1568{
1569 for (const Grouping &g : root->groups)
1570 {
1571 GroupDef *gd=nullptr;
1573 if (gd && gd->addClass(cd))
1574 {
1576 if (cdm)
1577 {
1578 cdm->makePartOfGroup(gd);
1579 }
1580 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1581 }
1582 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1583 {
1584 warn(root->fileName, root->startLine,
1585 "Found non-existing group '{}' for the command '{}', ignoring command",
1587 );
1588 }
1589 }
1590}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
virtual void makePartOfGroup(GroupDef *gd)=0
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:107
DString fileName
file this entry was extracted from
Definition entry.h:232
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:230
int startLine
start line of entry in the source
Definition entry.h:233
A model of a group of symbols.
Definition groupdef.h:48
virtual bool addClass(ClassDef *def)=0
const T * find(const std::string &key) const
Definition linkedmap.h:47
ClassDefMutable * toClassDefMutable(Definition *d)
#define warn(file, line, fmt,...)
Definition message.h:97
Grouping info.
Definition types.h:227
DString 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(), DString::empty(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Grouping::pri, Entry::startLine, toClassDefMutable(), and warn.

Referenced by addClassToContext().

◆ addConceptToGroups()

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

Definition at line 1592 of file groupdef.cpp.

1593{
1594 for (const Grouping &g : root->groups)
1595 {
1597 if (gd && gd->addConcept(cd))
1598 {
1600 if (cdm)
1601 {
1602 cdm->makePartOfGroup(gd);
1603 }
1604 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1605 }
1606 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1607 {
1608 warn(root->fileName, root->startLine,
1609 "Found non-existing group '{}' for the command '{}', ignoring command",
1611 );
1612 }
1613 }
1614}
virtual bool addConcept(ConceptDef *def)=0
ConceptDefMutable * toConceptDefMutable(Definition *d)

References GroupDef::addConcept(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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 1664 of file groupdef.cpp.

1665{
1666 //printf("*** root->groups.size()=%d\n",root->groups.size());
1667 for (const Grouping &g : root->groups)
1668 {
1670 //printf("group '%s'\n",qPrint(g->groupname));
1671 if (gd)
1672 {
1673 gd->addDir(dd);
1674 dd->makePartOfGroup(gd);
1675 //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1676 }
1677 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1678 {
1679 warn(root->fileName, root->startLine,
1680 "Found non-existing group '{}' for the command '{}', ignoring command",
1682 );
1683 }
1684 }
1685}
virtual void addDir(DirDef *dd)=0

References GroupDef::addDir(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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 1847 of file groupdef.cpp.

1848{
1849 for (const Grouping &g : root->groups)
1850 {
1852 if (gd)
1853 {
1854 gd->addExample(eg);
1855 eg->makePartOfGroup(gd);
1856 //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1857 }
1858 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1859 {
1860 warn(root->fileName, root->startLine,
1861 "Found non-existing group '{}' for the command '{}', ignoring command",
1863 );
1864 }
1865 }
1866}
virtual void addExample(PageDef *def)=0

References GroupDef::addExample(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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 1687 of file groupdef.cpp.

1688{
1689 //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
1690 for (const Grouping &g : root->groups)
1691 {
1693 if (gd)
1694 {
1695 if (gd==subGroup)
1696 {
1697 warn(root->fileName,root->startLine,"Refusing to add group {} to itself",
1698 gd->name());
1699 }
1700 else if (subGroup->findGroup(gd))
1701 {
1702 warn(root->fileName,root->startLine,"Refusing to add group {} to group {}, since the latter is already a "
1703 "subgroup of the former", subGroup->name(),gd->name());
1704 }
1705 else if (!gd->findGroup(subGroup))
1706 {
1707 gd->addGroup(subGroup);
1708 subGroup->makePartOfGroup(gd);
1709 }
1710 }
1711 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1712 {
1713 warn(root->fileName, root->startLine,
1714 "Found non-existing group '{}' for the command '{}', ignoring command",
1716 );
1717 }
1718 }
1719}
virtual const DString & name() const =0
virtual void addGroup(GroupDef *def)=0
virtual bool findGroup(const GroupDef *def) const =0

References GroupDef::addGroup(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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 1722 of file groupdef.cpp.

1723{
1724 //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
1725 // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
1726
1727 // Search entry's group list for group with highest pri.
1729 GroupDef *fgd=nullptr;
1730 for (const Grouping &g : root->groups)
1731 {
1732 GroupDef *gd=nullptr;
1734 if (gd && g.pri >= pri)
1735 {
1736 if (fgd && gd!=fgd && g.pri==pri)
1737 {
1738 warn(root->fileName, root->startLine,
1739 "Member {} found in multiple {} groups! "
1740 "The member will be put in group {}, and not in group {}",
1741 md->name(), Grouping::getGroupPriName( pri ),
1742 gd->name(), fgd->name()
1743 );
1744 }
1745
1746 fgd = gd;
1747 pri = g.pri;
1748 }
1749 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1750 {
1751 warn(root->fileName, root->startLine,
1752 "Found non-existing group '{}' for the command '{}', ignoring command",
1754 );
1755 }
1756 }
1757 //printf("fgd=%p\n",fgd);
1758
1759 // put member into group defined by this entry?
1760 if (fgd)
1761 {
1762 GroupDef *mgd = md->getGroupDef();
1763 //printf("mgd=%p\n",mgd);
1764 bool insertit = false;
1765 if (mgd==nullptr)
1766 {
1767 insertit = true;
1768 }
1769 else if (mgd!=fgd)
1770 {
1771 bool moveit = false;
1772
1773 // move member from one group to another if
1774 // - the new one has a higher priority
1775 // - the new entry has the same priority, but with docs where the old one had no docs
1776 if (md->getGroupPri()<pri)
1777 {
1778 moveit = true;
1779 }
1780 else
1781 {
1782 if (md->getGroupPri()==pri)
1783 {
1784 if (!root->doc.empty() && !md->getGroupHasDocs())
1785 {
1786 moveit = true;
1787 }
1788 else if (!root->doc.empty() && md->getGroupHasDocs())
1789 {
1791 "Member documentation for {} found several times in {} groups!\n"
1792 "{}:{}: The member will remain in group {}, and won't be put into group {}",
1793 md->name(), Grouping::getGroupPriName( pri ),
1794 root->fileName, root->startLine,
1795 mgd->name(), fgd->name()
1796 );
1797 }
1798 }
1799 }
1800
1801 if (moveit)
1802 {
1803 //printf("removeMember\n");
1804 mgd->removeMember(md);
1805 insertit = true;
1806 }
1807 }
1808
1809 if (insertit)
1810 {
1811 //printf("insertMember found at %s line %d: %s: related %s\n",
1812 // qPrint(md->getDefFileName()),md->getDefLine(),
1813 // qPrint(md->name()),qPrint(root->relates));
1814 bool success = fgd->insertMember(md);
1815 if (success)
1816 {
1818 if (mdm)
1819 {
1820 //printf("insertMember successful\n");
1821 mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.empty());
1823 if (cdm)
1824 {
1825 cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
1826 }
1827 if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong())
1828 {
1829 for (const auto &emd : mdm->enumFieldList())
1830 {
1832 if (emdm && emdm->getGroupDef()==nullptr)
1833 {
1834 emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(),
1835 mdm->getGroupFileName(),mdm->getGroupStartLine(),
1836 mdm->getGroupHasDocs());
1837 }
1838 }
1839 }
1840 }
1841 }
1842 }
1843 }
1844}
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual void setGroupDefForAllMembers(GroupDef *g, Grouping::GroupPri_t pri, const DString &fileName, int startLine, bool hasDocs)=0
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
DString doc
documentation block (partly parsed)
Definition entry.h:208
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 Grouping::GroupPri_t getGroupPri() const =0
virtual const ClassDef * getClassDefOfAnonymousType() const =0
virtual bool isEnumerate() const =0
virtual DString getGroupFileName() const =0
virtual bool isStrong() const =0
virtual void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const DString &fileName, int startLine, bool hasDocs, MemberDef *member=nullptr)=0
MemberDefMutable * toMemberDefMutable(Definition *d)
GroupPri_t
Grouping priority.
Definition types.h:230
@ GROUPING_LOWEST
Definition types.h:231

References Entry::doc, DString::empty(), MemberDef::enumFieldList(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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(), MemberDef::isEnumerate(), MemberDef::isStrong(), DString::length(), Definition::name(), Grouping::pri, GroupDef::removeMember(), MemberDefMutable::setGroupDef(), ClassDefMutable::setGroupDefForAllMembers(), Entry::startLine, toClassDefMutable(), toMemberDefMutable(), 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 1616 of file groupdef.cpp.

1617{
1618 for (const Grouping &g : root->groups)
1619 {
1621 if (gd && gd->addModule(mod))
1622 {
1623 mod->makePartOfGroup(gd);
1624 //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle());
1625 }
1626 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1627 {
1628 warn(root->fileName, root->startLine,
1629 "Found non-existing group '{}' for the command '{}', ignoring command",
1631 );
1632 }
1633 }
1634}
virtual bool addModule(ModuleDef *def)=0

References GroupDef::addModule(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), 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 1637 of file groupdef.cpp.

1638{
1639 //printf("root->groups.size()=%zu\n",root->groups.size());
1640 for (const Grouping &g : root->groups)
1641 {
1642 GroupDef *gd=nullptr;
1644 //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1645 if (gd && gd->addNamespace(nd))
1646 {
1648 if (ndm)
1649 {
1650 ndm->makePartOfGroup(gd);
1651 }
1652 //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1653 }
1654 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1655 {
1656 warn(root->fileName, root->startLine,
1657 "Found non-existing group '{}' for the command '{}', ignoring command",
1659 );
1660 }
1661 }
1662}
virtual bool addNamespace(NamespaceDef *def)=0
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)

References GroupDef::addNamespace(), DString::empty(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, 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 DString & fileName,
int line,
const DString & name,
const DString & title,
const DString & refFileName = DString() )

Definition at line 184 of file groupdef.cpp.

186{
187 return std::make_unique<GroupDefImpl>(fileName,line,name,title,refFileName);
188}

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

◆ toGroupDef() [1/2]

const GroupDef * toGroupDef ( const Definition * d)

Definition at line 2163 of file groupdef.cpp.

2164{
2165 if (d==nullptr) return nullptr;
2166 if (d && typeid(*d)==typeid(GroupDefImpl))
2167 {
2168 return static_cast<const GroupDef*>(d);
2169 }
2170 else
2171 {
2172 return nullptr;
2173 }
2174}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 2150 of file groupdef.cpp.

2151{
2152 if (d==nullptr) return nullptr;
2153 if (d && typeid(*d)==typeid(GroupDefImpl))
2154 {
2155 return static_cast<GroupDef*>(d);
2156 }
2157 else
2158 {
2159 return nullptr;
2160 }
2161}

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