Doxygen
Loading...
Searching...
No Matches
membergroup.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#include "membergroup.h"
19#include "memberlist.h"
20#include "outputlist.h"
21#include "util.h"
22#include "classdef.h"
23#include "namespacedef.h"
24#include "filedef.h"
25#include "language.h"
26#include "groupdef.h"
27#include "doxygen.h"
28#include "docparser.h"
29#include "entry.h"
30#include "md5.h"
31
33 const QCString &d,const QCString &docFile,int docLine,
36 memberList(std::make_unique<MemberList>(MemberListType::MemberGroup(),con)),
38{
39 //printf("New member group id=%d header=%s desc=%s\n",id,hdr,d);
40 memberList->setNeedsSorting(Config_getBool(SORT_BRIEF_DOCS)); // detailed sections are already sorted elsewhere.
41 //printf("Member group docs='%s'\n",qPrint(doc));
42}
43
45{
46 //printf("MemberGroup::insertMember(%s) inSameSection=%d md->getSectionList()=%s\n",qPrint(md->name()),
47 // inSameSection,qPrint(md->getSectionList(m_container)->listType().to_string()));
48
49 MemberDef *firstMd = memberList->empty() ? nullptr : memberList->front();
50 if (inSameSection && firstMd &&
52 {
53 //printf("inSameSection=FALSE\n");
55 }
56 else if (inDeclSection==nullptr)
57 {
58 inDeclSection = const_cast<MemberList*>(md->getSectionList(m_container));
59 //printf("inDeclSection=%p type=%d\n",inDeclSection,inDeclSection->listType());
60 }
61 memberList->push_back(md);
62
63 // copy the group of the first member in the memberGroup
64 GroupDef *gd = nullptr;
65 if (firstMd && !firstMd->isAlias() && (gd=firstMd->getGroupDef()))
66 {
67 MemberDefMutable *mdm = toMemberDefMutable(md);
68 if (mdm)
69 {
70 mdm->setGroupDef(gd, firstMd->getGroupPri(),
71 firstMd->getGroupFileName(),
72 firstMd->getGroupStartLine(),
73 firstMd->getGroupHasDocs());
74 }
75 gd->insertMember(md);
76 }
77}
78
79
81{
82 memberList->setAnchors();
83}
84
86 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
87 bool showInline) const
88{
89 //printf("MemberGroup::writeDeclarations() %s\n",qPrint(grpHeader));
90 QCString ldoc = doc;
91 memberList->writeDeclarations(ol,cd,nd,fd,gd,mod,grpHeader,ldoc,FALSE,showInline);
92}
93
95 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
96 int indentLevel,const ClassDef *inheritedFrom,const QCString &inheritId
97 ) const
98{
99 //printf("MemberGroup::writePlainDeclarations() memberList->count()=%d\n",memberList->count());
100 memberList->writePlainDeclarations(ol,inGroup,cd,nd,fd,gd,mod,indentLevel,inheritedFrom,inheritId);
101}
102
104 const Definition *container,bool showEnumValues,bool showInline) const
105{
106 //printf("MemberGroup::writeDocumentation() %s\n",qPrint(grpHeader));
107 memberList->writeDocumentation(ol,scopeName,container,QCString(),showEnumValues,showInline);
108}
109
111 const DefinitionMutable *container) const
112{
113 memberList->writeDocumentationPage(ol,scopeName,container);
114}
115
117{
118 memberList->setAnonymousEnumType();
119}
120
123 const ClassDef *inheritedFrom,const QCString &inheritId) const
124{
125 //printf("** addGroupedInheritedMembers()\n");
126 for (const auto &md : *memberList)
127 {
128 //printf("matching %d == %d\n",lt,md->getSectionList()->listType());
129 const MemberList *ml = md->getSectionList(m_container);
130 if (ml && lt==ml->listType())
131 {
132 MemberList mml(lt,MemberListContainer::Class);
133 mml.push_back(md);
134 mml.countDecMembers();
135 mml.writePlainDeclarations(ol,false,cd,nullptr,nullptr,nullptr,nullptr,0,inheritedFrom,inheritId);
136 }
137 }
138}
139
141{
142 //printf("** countGroupedInheritedMembers()\n");
143 int count=0;
144 for (const auto &md : *memberList)
145 {
146 //printf("matching %d == %d\n",lt,md->getSectionList()->listType());
147 const MemberList *ml = md->getSectionList(m_container);
148 if (ml && lt==ml->listType())
149 {
150 count++;
151 }
152 }
153 return count;
154}
155
156
157/*! Add this group as a subsection of the declaration section, instead
158 * of rendering it in its own section
159 */
161{
162 if (inDeclSection)
163 {
164 //printf("Adding group %p to list %p (type=%d) memberList=%p\n",this,
165 // inDeclSection,inDeclSection->listType(),memberList);
166 inDeclSection->addMemberGroup(this);
167 }
168}
169
171{
172 memberList->countDecMembers();
173}
174
176{
177 memberList->countDocMembers();
178}
179
181{
182 return m_container;
183}
184
186{
187 // return the container for the first member.
188 // Note this can be different from container() in case
189 // the member is rendered as part of a file but the members
190 // are actually of a namespace.
191 const Definition *ctx = nullptr;
192 if (memberList && !memberList->empty())
193 {
194 const MemberDef *md = memberList->front();
195 ctx = md->getClassDef();
196 if (ctx==nullptr) ctx = md->getNamespaceDef();
197 if (ctx==nullptr) ctx = md->getFileDef();
198 }
199 return ctx==nullptr ? m_container : ctx;
200}
201
202int MemberGroup::countInheritableMembers(const ClassDef *inheritedFrom) const
203{
204 return memberList->countInheritableMembers(inheritedFrom);
205}
206
207
209{
210 //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",qPrint(grpHeader));
211 const MemberDef *md = nullptr;
212 for (const auto &smd : *memberList)
213 {
214 //printf("checking md=%s\n",qPrint(md->name()));
215 // find the first member of the group with documentation
216 if (!smd->documentation().isEmpty() ||
217 !smd->briefDescription().isEmpty() ||
218 !smd->inbodyDocumentation().isEmpty()
219 )
220 {
221 //printf("found it!\n");
222 md = smd;
223 break;
224 }
225 }
226 if (md) // distribute docs of md to other members of the list
227 {
228 //printf("Member %s has documentation!\n",qPrint(md->name()));
229 for (const auto &iomd : *memberList)
230 {
231 MemberDefMutable *omd = toMemberDefMutable(iomd);
232 if (omd && md!=omd && omd->documentation().isEmpty() &&
233 omd->briefDescription().isEmpty() &&
235 )
236 {
237 //printf("Copying documentation to member %s\n",qPrint(omd->name()));
239 omd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
241 }
242 }
243 }
244}
245
246
248{
249 return memberList->numDecMembers();
250}
251
253{
254 return memberList->numDecEnumValues();
255}
256
258{
259 return memberList->numDocMembers();
260}
261
263{
264 return memberList->numDocEnumValues();
265}
266
268{
269 memberList->addListReferences(def);
270}
271
273{
275 memberList->findSectionsInDocumentation(d);
276}
277
279{
280 m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend());
281}
282
283void MemberGroup::writeTagFile(TextStream &tagFile,bool qualifiedName)
284{
285 memberList->writeTagFile(tagFile,qualifiedName);
286}
287
288//--------------------------------------------------------------------------
289
291{
292 m_sli.insert(m_sli.end(), sli.cbegin(), sli.cend());
293}
A abstract class representing of a compound symbol.
Definition classdef.h:104
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual QCString docFile() const =0
virtual int docLine() const =0
virtual int inbodyLine() const =0
virtual int briefLine() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString documentation() const =0
virtual bool isAlias() const =0
virtual QCString briefFile() const =0
virtual QCString inbodyDocumentation() const =0
virtual QCString inbodyFile() const =0
virtual void setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace=TRUE)=0
virtual void setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)=0
virtual void setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)=0
A model of a file symbol.
Definition filedef.h:99
A model of a group of symbols.
Definition groupdef.h:52
virtual bool insertMember(MemberDef *def, bool docOnly=FALSE)=0
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual bool getGroupHasDocs() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual int getGroupStartLine() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual Grouping::GroupPri_t getGroupPri() const =0
virtual const MemberList * getSectionList(const Definition *container) const =0
virtual QCString getGroupFileName() const =0
virtual void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=nullptr)=0
bool inSameSection
Definition membergroup.h:99
MemberGroup(const Definition *container, int id, const QCString &header, const QCString &docs, const QCString &docFile, int docLine, MemberListContainer con)
void addToDeclarationSection()
int numDecMembers() const
const Definition * container() const
int numDecEnumValues() const
void findSectionsInDocumentation(const Definition *d)
void addGroupedInheritedMembers(OutputList &ol, const ClassDef *cd, MemberListType lt, const ClassDef *inheritedFrom, const QCString &inheritId) const
void setAnchors()
void writeDeclarations(OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, bool showInline=FALSE) const
int countInheritableMembers(const ClassDef *inheritedFrom) const
const Definition * memberContainer() const
void writeDocumentation(OutputList &ol, const QCString &scopeName, const Definition *container, bool showEnumValues, bool showInline) const
void writeDocumentationPage(OutputList &ol, const QCString &scopeName, const DefinitionMutable *container) const
int numDocMembers() const
void setRefItems(const RefItemVector &sli)
void distributeMemberGroupDocumentation()
void countDecMembers()
void addListReferences(Definition *d)
void writeTagFile(TextStream &, bool qualifiedName=false)
int countGroupedInheritedMembers(MemberListType lt)
void countDocMembers()
int numDocEnumValues() const
void writePlainDeclarations(OutputList &ol, bool inGroup, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, int indentLevel, const ClassDef *inheritedFrom, const QCString &inheritId) const
QCString docFile() const
Definition membergroup.h:88
int docLine() const
Definition membergroup.h:89
QCString doc
Definition membergroup.h:98
void insertMember(MemberDef *md)
QCString m_docFile
void setAnonymousEnumType()
const Definition * m_container
Definition membergroup.h:92
RefItemVector m_xrefListItems
std::unique_ptr< MemberList > memberList
Definition membergroup.h:93
MemberList * inDeclSection
Definition membergroup.h:94
QCString grpHeader
Definition membergroup.h:96
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:108
void countDecMembers()
void writePlainDeclarations(OutputList &ol, bool inGroup, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, int indentLevel, const ClassDef *inheritedFrom, const QCString &inheritId) const
MemberListType listType() const
Definition memberlist.h:113
Wrapper class for the MemberListType type.
Definition types.h:184
void push_back(const T &value)
Definition memberlist.h:47
An abstract interface of a namespace symbol.
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:314
This is an alternative implementation of QCString.
Definition qcstring.h:101
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
Text streaming class that buffers data.
Definition textstream.h:36
#define Config_getBool(name)
Definition config.h:33
void docFindSections(const QCString &input, const Definition *d, const QCString &fileName)
MemberDefMutable * toMemberDefMutable(Definition *d)
#define FALSE
Definition qcstring.h:34
std::vector< RefItem * > RefItemVector
Definition reflist.h:133
RefItemVector m_sli
void setRefItems(const RefItemVector &sli)
MemberListContainer
Definition types.h:310
A bunch of utility functions.