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

1438{
1439 for (const Grouping &g : root->groups)
1440 {
1441 GroupDef *gd=nullptr;
1442 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1443 if (gd && gd->addClass(cd))
1444 {
1446 if (cdm)
1447 {
1448 cdm->makePartOfGroup(gd);
1449 }
1450 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1451 }
1452 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1453 {
1454 warn(root->fileName, root->startLine,
1455 "Found non-existing group '{}' for the command '{}', ignoring command",
1457 );
1458 }
1459 }
1460}
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 1462 of file groupdef.cpp.

1463{
1464 for (const Grouping &g : root->groups)
1465 {
1467 if (gd && gd->addConcept(cd))
1468 {
1470 if (cdm)
1471 {
1472 cdm->makePartOfGroup(gd);
1473 }
1474 //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1475 }
1476 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1477 {
1478 warn(root->fileName, root->startLine,
1479 "Found non-existing group '{}' for the command '{}', ignoring command",
1481 );
1482 }
1483 }
1484}
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 1534 of file groupdef.cpp.

1535{
1536 //printf("*** root->groups.size()=%d\n",root->groups.size());
1537 for (const Grouping &g : root->groups)
1538 {
1540 //printf("group '%s'\n",qPrint(g->groupname));
1541 if (gd)
1542 {
1543 gd->addDir(dd);
1544 dd->makePartOfGroup(gd);
1545 //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1546 }
1547 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1548 {
1549 warn(root->fileName, root->startLine,
1550 "Found non-existing group '{}' for the command '{}', ignoring command",
1552 );
1553 }
1554 }
1555}
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 1717 of file groupdef.cpp.

1718{
1719 for (const Grouping &g : root->groups)
1720 {
1722 if (gd)
1723 {
1724 gd->addExample(eg);
1725 eg->makePartOfGroup(gd);
1726 //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1727 }
1728 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1729 {
1730 warn(root->fileName, root->startLine,
1731 "Found non-existing group '{}' for the command '{}', ignoring command",
1733 );
1734 }
1735 }
1736}
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 1557 of file groupdef.cpp.

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

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

1487{
1488 for (const Grouping &g : root->groups)
1489 {
1491 if (gd && gd->addModule(mod))
1492 {
1493 mod->makePartOfGroup(gd);
1494 //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle());
1495 }
1496 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1497 {
1498 warn(root->fileName, root->startLine,
1499 "Found non-existing group '{}' for the command '{}', ignoring command",
1501 );
1502 }
1503 }
1504}
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 1507 of file groupdef.cpp.

1508{
1509 //printf("root->groups.size()=%zu\n",root->groups.size());
1510 for (const Grouping &g : root->groups)
1511 {
1512 GroupDef *gd=nullptr;
1513 if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname);
1514 //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1515 if (gd && gd->addNamespace(nd))
1516 {
1518 if (ndm)
1519 {
1520 ndm->makePartOfGroup(gd);
1521 }
1522 //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1523 }
1524 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
1525 {
1526 warn(root->fileName, root->startLine,
1527 "Found non-existing group '{}' for the command '{}', ignoring command",
1529 );
1530 }
1531 }
1532}
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 2002 of file groupdef.cpp.

2003{
2004 if (d==nullptr) return nullptr;
2005 if (d && typeid(*d)==typeid(GroupDefImpl))
2006 {
2007 return static_cast<const GroupDef*>(d);
2008 }
2009 else
2010 {
2011 return nullptr;
2012 }
2013}

◆ toGroupDef() [2/2]

GroupDef * toGroupDef ( Definition * d)

Definition at line 1989 of file groupdef.cpp.

1990{
1991 if (d==nullptr) return nullptr;
1992 if (d && typeid(*d)==typeid(GroupDefImpl))
1993 {
1994 return static_cast<GroupDef*>(d);
1995 }
1996 else
1997 {
1998 return nullptr;
1999 }
2000}

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