Doxygen
groupdef.cpp 文件参考
#include <algorithm>
#include <vector>
#include <ctype.h>
#include "groupdef.h"
#include "classdef.h"
#include "filedef.h"
#include "classlist.h"
#include "outputlist.h"
#include "namespacedef.h"
#include "language.h"
#include "util.h"
#include "memberlist.h"
#include "message.h"
#include "membergroup.h"
#include "doxygen.h"
#include "pagedef.h"
#include "docparser.h"
#include "searchindex.h"
#include "dot.h"
#include "dotgroupcollaboration.h"
#include "vhdldocgen.h"
#include "layout.h"
#include "arguments.h"
#include "entry.h"
#include "membername.h"
#include "dirdef.h"
#include "config.h"
#include "definitionimpl.h"
#include "regex.h"
+ groupdef.cpp 的引用(Include)关系图:

浏览源代码.

class  GroupDefImpl
 

函数

GroupDefcreateGroupDef (const QCString &fileName, int line, const QCString &name, const QCString &title, const QCString &refFileName)
 
void addClassToGroups (const Entry *root, ClassDef *cd)
 
void addConceptToGroups (const Entry *root, ConceptDef *cd)
 
void addNamespaceToGroups (const Entry *root, NamespaceDef *nd)
 
void addDirToGroups (const Entry *root, DirDef *dd)
 
void addGroupToGroups (const Entry *root, GroupDef *subGroup)
 
void addMemberToGroups (const Entry *root, MemberDef *md)
 
void addExampleToGroups (const Entry *root, PageDef *eg)
 
template<class Vec >
static void groupClassesWithSameScope (Vec &vec)
 
GroupDeftoGroupDef (Definition *d)
 
const GroupDeftoGroupDef (const Definition *d)
 

函数说明

◆ addClassToGroups()

void addClassToGroups ( const Entry root,
ClassDef cd 
)

在文件 groupdef.cpp1322 行定义.

1323 {
1324  for (const Grouping &g : root->groups)
1325  {
1327  if (gd && gd->addClass(cd))
1328  {
1330  if (cdm)
1331  {
1332  cdm->makePartOfGroup(gd);
1333  }
1334  //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1335  }
1336  }
1337 }

引用了 GroupDef::addClass(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup() , 以及 toClassDefMutable().

被这些函数引用 addClassToContext().

◆ addConceptToGroups()

void addConceptToGroups ( const Entry root,
ConceptDef cd 
)

在文件 groupdef.cpp1339 行定义.

1340 {
1341  for (const Grouping &g : root->groups)
1342  {
1344  if (gd && gd->addConcept(cd))
1345  {
1347  if (cdm)
1348  {
1349  cdm->makePartOfGroup(gd);
1350  }
1351  //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
1352  }
1353  }
1354 }

引用了 GroupDef::addConcept(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup() , 以及 toConceptDefMutable().

被这些函数引用 addConceptToContext().

◆ addDirToGroups()

void addDirToGroups ( const Entry root,
DirDef dd 
)

在文件 groupdef.cpp1376 行定义.

1377 {
1378  //printf("*** root->groups.size()=%d\n",root->groups.size());
1379  for (const Grouping &g : root->groups)
1380  {
1382  //printf("group '%s'\n",qPrint(g->groupname));
1383  if (gd)
1384  {
1385  gd->addDir(dd);
1386  dd->makePartOfGroup(gd);
1387  //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
1388  }
1389  }
1390 }

引用了 GroupDef::addDir(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups , 以及 DefinitionMutable::makePartOfGroup().

被这些函数引用 findDirDocumentation().

◆ addExampleToGroups()

void addExampleToGroups ( const Entry root,
PageDef eg 
)

在文件 groupdef.cpp1540 行定义.

1541 {
1542  for (const Grouping &g : root->groups)
1543  {
1545  if (gd)
1546  {
1547  gd->addExample(eg);
1548  eg->makePartOfGroup(gd);
1549  //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
1550  }
1551  }
1552 }

引用了 GroupDef::addExample(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups , 以及 DefinitionMutable::makePartOfGroup().

◆ addGroupToGroups()

void addGroupToGroups ( const Entry root,
GroupDef subGroup 
)

在文件 groupdef.cpp1392 行定义.

1393 {
1394  //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
1395  for (const Grouping &g : root->groups)
1396  {
1398  if (gd)
1399  {
1400  if (gd==subGroup)
1401  {
1402  warn(root->fileName,root->startLine,"Refusing to add group %s to itself",
1403  qPrint(gd->name()));
1404  }
1405  else if (subGroup->findGroup(gd))
1406  {
1407  warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a "
1408  "subgroup of the former\n", qPrint(subGroup->name()),qPrint(gd->name()));
1409  }
1410  else if (!gd->findGroup(subGroup))
1411  {
1412  gd->addGroup(subGroup);
1413  subGroup->makePartOfGroup(gd);
1414  }
1415  }
1416  }
1417 }

引用了 GroupDef::addGroup(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), GroupDef::findGroup(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup(), Definition::name(), qPrint(), Entry::startLine , 以及 warn().

被这些函数引用 organizeSubGroupsFiltered().

◆ addMemberToGroups()

void addMemberToGroups ( const Entry root,
MemberDef md 
)

Add a member to the group with the highest priority

在文件 groupdef.cpp1420 行定义.

1421 {
1422  //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
1423  // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
1424 
1425  // Search entry's group list for group with highest pri.
1427  GroupDef *fgd=0;
1428  for (const Grouping &g : root->groups)
1429  {
1430  GroupDef *gd=0;
1431  if (!g.groupname.isEmpty() &&
1433  g.pri >= pri)
1434  {
1435  if (fgd && gd!=fgd && g.pri==pri)
1436  {
1437  warn(root->fileName, root->startLine,
1438  "Member %s found in multiple %s groups! "
1439  "The member will be put in group %s, and not in group %s",
1440  qPrint(md->name()), Grouping::getGroupPriName( pri ),
1441  qPrint(gd->name()), qPrint(fgd->name())
1442  );
1443  }
1444 
1445  fgd = gd;
1446  pri = g.pri;
1447  }
1448  }
1449  //printf("fgd=%p\n",fgd);
1450 
1451  // put member into group defined by this entry?
1452  if (fgd)
1453  {
1454  GroupDef *mgd = const_cast<GroupDef*>(md->getGroupDef());
1455  //printf("mgd=%p\n",mgd);
1456  bool insertit = FALSE;
1457  if (mgd==0)
1458  {
1459  insertit = TRUE;
1460  }
1461  else if (mgd!=fgd)
1462  {
1463  bool moveit = FALSE;
1464 
1465  // move member from one group to another if
1466  // - the new one has a higher priority
1467  // - the new entry has the same priority, but with docs where the old one had no docs
1468  if (md->getGroupPri()<pri)
1469  {
1470  moveit = TRUE;
1471  }
1472  else
1473  {
1474  if (md->getGroupPri()==pri)
1475  {
1476  if (!root->doc.isEmpty() && !md->getGroupHasDocs())
1477  {
1478  moveit = TRUE;
1479  }
1480  else if (!root->doc.isEmpty() && md->getGroupHasDocs())
1481  {
1483  "Member documentation for %s found several times in %s groups!\n"
1484  "%s:%d: The member will remain in group %s, and won't be put into group %s",
1485  qPrint(md->name()), Grouping::getGroupPriName( pri ),
1486  qPrint(root->fileName), root->startLine,
1487  qPrint(mgd->name()),
1488  qPrint(fgd->name())
1489  );
1490  }
1491  }
1492  }
1493 
1494  if (moveit)
1495  {
1496  //printf("removeMember\n");
1497  mgd->removeMember(md);
1498  insertit = TRUE;
1499  }
1500  }
1501 
1502  if (insertit)
1503  {
1504  //printf("insertMember found at %s line %d: %s: related %s\n",
1505  // qPrint(md->getDefFileName()),md->getDefLine(),
1506  // qPrint(md->name()),qPrint(root->relates));
1507  bool success = fgd->insertMember(md);
1508  if (success)
1509  {
1511  if (mdm)
1512  {
1513  //printf("insertMember successful\n");
1514  mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
1516  if (cdm)
1517  {
1518  cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
1519  }
1520  if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong())
1521  {
1522  for (const auto &emd : mdm->enumFieldList())
1523  {
1524  MemberDefMutable *emdm = toMemberDefMutable(emd);
1525  if (emdm && emdm->getGroupDef()==0)
1526  {
1527  emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(),
1528  mdm->getGroupFileName(),mdm->getGroupStartLine(),
1529  mdm->getGroupHasDocs());
1530  }
1531  }
1532  }
1533  }
1534  }
1535  }
1536  }
1537 }

引用了 Entry::doc, MemberDef::enumFieldList(), FALSE, Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberDef::getClassDefOfAnonymousType(), MemberDef::getGroupDef(), MemberDef::getGroupFileName(), MemberDef::getGroupHasDocs(), MemberDef::getGroupPri(), Grouping::getGroupPriName(), MemberDef::getGroupStartLine(), Grouping::GROUPING_LOWEST, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, GroupDef::insertMember(), QCString::isEmpty(), MemberDef::isEnumerate(), MemberDef::isStrong(), QCString::length(), Definition::name(), Grouping::pri, qPrint(), GroupDef::removeMember(), MemberDefMutable::setGroupDef(), ClassDefMutable::setGroupDefForAllMembers(), Entry::startLine, toClassDefMutable(), toMemberDefMutable(), TRUE , 以及 warn().

被这些函数引用 addEnumDocs(), addMemberDocs(), addVariableToClass(), addVariableToFile(), findDefineDocumentation(), findEnums() , 以及 findMember().

◆ addNamespaceToGroups()

void addNamespaceToGroups ( const Entry root,
NamespaceDef nd 
)

在文件 groupdef.cpp1357 行定义.

1358 {
1359  //printf("root->groups.size()=%zu\n",root->groups.size());
1360  for (const Grouping &g : root->groups)
1361  {
1363  //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
1364  if (gd && gd->addNamespace(nd))
1365  {
1367  if (ndm)
1368  {
1369  ndm->makePartOfGroup(gd);
1370  }
1371  //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
1372  }
1373  }
1374 }

引用了 GroupDef::addNamespace(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, DefinitionMutable::makePartOfGroup() , 以及 toNamespaceDefMutable().

被这些函数引用 buildNamespaceList().

◆ createGroupDef()

GroupDef* createGroupDef ( const QCString fileName,
int  line,
const QCString name,
const QCString title,
const QCString refFileName 
)

在文件 groupdef.cpp162 行定义.

164 {
165  return new GroupDefImpl(fileName,line,name,title,refFileName);
166 }

被这些函数引用 buildGroupListFiltered().

◆ groupClassesWithSameScope()

template<class Vec >
static void groupClassesWithSameScope ( Vec &  vec)
static

在文件 groupdef.cpp1597 行定义.

1598 {
1599  bool done=false;
1600  while (!done) // for each iteration
1601  {
1602  done=true;
1603  for (size_t i=0; i<vec.size(); i++) // go through all items
1604  {
1605  std::string qni = vec[i]->name().str();
1606  size_t posi = qni.rfind("::");
1607  if (posi!=std::string::npos)
1608  {
1609  std::string scope = qni.substr(0,posi);
1610  auto it = std::find_if( vec.begin(), vec.end(),
1611  [&](typename Vec::Ptr &cd)
1612  { return cd->name().str()==scope; });
1613  if (it!=vec.end())
1614  {
1615  size_t idx = std::distance(vec.begin(),it);
1616  if (i<idx) // parent scope located after child scope
1617  {
1618  // to avoid reordering elements with the same parent
1619  // we skip to the last one with the same scope
1620  size_t k = idx;
1621  while (k<vec.size() && vec[k]->name().str().substr(0,posi)==scope)
1622  {
1623  idx = k;
1624  k++;
1625  }
1626  // swap the items such that i is inserted after idx
1627  for (size_t j=i; j<idx; j++)
1628  {
1629  std::swap(vec[j],vec[j+1]);
1630  }
1631  done=false;
1632  }
1633  else if (idx<i && vec[i-1]->name().str().substr(0,posi)!=scope)
1634  {
1635  // parent scope is found before the item, and the item
1636  // has some other item with a different scope in front of it
1637  // move idx to the end of range with the same scope
1638  while (idx<i && vec[idx]->name().str().substr(0,posi)==scope)
1639  {
1640  idx++;
1641  }
1642  // swap the items such that i is just after idx
1643  for (size_t j=idx; j<i; j++)
1644  {
1645  std::swap(vec[j],vec[j+1]);
1646  }
1647  done=false;
1648  }
1649  }
1650  }
1651  }
1652  }
1653 }

被这些函数引用 GroupDefImpl::sortMemberLists().

◆ toGroupDef() [1/2]

const GroupDef* toGroupDef ( const Definition d)

在文件 groupdef.cpp1779 行定义.

1780 {
1781  if (d==0) return 0;
1782  if (d && typeid(*d)==typeid(GroupDefImpl))
1783  {
1784  return static_cast<const GroupDef*>(d);
1785  }
1786  else
1787  {
1788  return 0;
1789  }
1790 }

◆ toGroupDef() [2/2]

ConceptDefMutable
Definition: conceptdef.h:42
Grouping::getGroupPriName
static const char * getGroupPriName(GroupPri_t priority)
Definition: types.h:78
GroupDef::insertMember
virtual bool insertMember(const MemberDef *def, bool docOnly=FALSE)=0
ClassDefMutable
Definition: classdef.h:384
toMemberDefMutable
MemberDefMutable * toMemberDefMutable(Definition *d)
Definition: memberdef.cpp:6125
Entry::startLine
int startLine
start line of entry in the source
Definition: entry.h:291
Grouping::pri
GroupPri_t pri
priority of this definition
Definition: types.h:96
MemberDef::getGroupPri
virtual Grouping::GroupPri_t getGroupPri() const =0
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
MemberDef::getGroupFileName
virtual QCString getGroupFileName() const =0
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
MemberDef::getClassDefOfAnonymousType
virtual ClassDef * getClassDefOfAnonymousType() const =0
GroupDef::addNamespace
virtual bool addNamespace(const NamespaceDef *def)=0
Grouping
Grouping info
Definition: types.h:64
Grouping::GROUPING_LOWEST
@ GROUPING_LOWEST
Definition: types.h:69
GroupDef::addClass
virtual bool addClass(const ClassDef *def)=0
MemberDefMutable
Definition: memberdef.h:296
warn
void warn(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:151
Entry::doc
QCString doc
documentation block (partly parsed)
Definition: entry.h:267
GroupDef::addConcept
virtual bool addConcept(const ConceptDef *def)=0
GroupDef::addDir
virtual void addDir(DirDef *dd)=0
GroupDef
A model of a group of symbols.
Definition: groupdef.h:49
toNamespaceDefMutable
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)
Definition: namespacedef.cpp:1579
ClassDefMutable::setGroupDefForAllMembers
virtual void setGroupDefForAllMembers(GroupDef *g, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs)=0
DefinitionMutable::makePartOfGroup
virtual void makePartOfGroup(const GroupDef *gd)=0
MemberDef::enumFieldList
virtual const MemberVector & enumFieldList() const =0
GroupDefImpl
Definition: groupdef.cpp:52
MemberDef::getGroupHasDocs
virtual bool getGroupHasDocs() const =0
GroupDef::removeMember
virtual void removeMember(MemberDef *md)=0
Definition::name
virtual QCString name() const =0
Doxygen::groupLinkedMap
static GroupLinkedMap * groupLinkedMap
Definition: doxygen.h:96
GroupDef::addGroup
virtual void addGroup(const GroupDef *def)=0
Grouping::GroupPri_t
GroupPri_t
Grouping priority
Definition: types.h:67
MemberDefMutable::setGroupDef
virtual void setGroupDef(const GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=0)=0
TRUE
#define TRUE
Definition: qcstring.h:36
LinkedMap::find
const T * find(const std::string &key) const
Find an object given the key.
Definition: linkedmap.h:60
GroupDef::addExample
virtual void addExample(const PageDef *def)=0
MemberDef::isStrong
virtual bool isStrong() const =0
Entry::fileName
QCString fileName
file this entry was extracted from
Definition: entry.h:290
Grouping::groupname
QCString groupname
name of the group
Definition: types.h:95
MemberDef::isEnumerate
virtual bool isEnumerate() const =0
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
NamespaceDefMutable
Definition: namespacedef.h:106
MemberDef::getGroupStartLine
virtual int getGroupStartLine() const =0
GroupDef::findGroup
virtual bool findGroup(const GroupDef *def) const =0
toClassDefMutable
ClassDefMutable * toClassDefMutable(Definition *d)
Definition: classdef.cpp:4944
toConceptDefMutable
ConceptDefMutable * toConceptDefMutable(Definition *d)
Definition: conceptdef.cpp:713
Entry::groups
std::vector< Grouping > groups
list of groups this entry belongs to
Definition: entry.h:288
MemberDef::getGroupDef
virtual const GroupDef * getGroupDef() const =0
FALSE
#define FALSE
Definition: qcstring.h:33