Doxygen
Loading...
Searching...
No Matches
classdef.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2024 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16// own include
17#include "classdef.h"
18
19// standard includes
20#include <cstdio>
21#include <algorithm>
22
23// other includes
24#include "arguments.h"
25#include "classlist.h"
26#include "config.h"
27#include "debug.h"
28#include "defargs.h"
29#include "definitionimpl.h"
30#include "diagram.h"
31#include "docparser.h"
32#include "dot.h"
33#include "dotclassgraph.h"
34#include "dotrunner.h"
35#include "doxygen.h"
36#include "entry.h"
37#include "example.h"
38#include "filedef.h"
39#include "fileinfo.h"
40#include "groupdef.h"
41#include "htmlhelp.h"
42#include "language.h"
43#include "layout.h"
44#include "membergroup.h"
45#include "memberlist.h"
46#include "membername.h"
47#include "message.h"
48#include "moduledef.h"
49#include "namespacedef.h"
50#include "outputlist.h"
51#include "searchindex.h"
52#include "symbolresolver.h"
53#include "trace.h"
54#include "types.h"
55#include "util.h"
56#include "vhdldocgen.h"
57
58//-----------------------------------------------------------------------------
59
61 const ArgumentLists *actualParams,uint32_t *actualParamIndex)
62{
63 //bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
64 bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES);
65 //printf("qualifiedNameWithTemplateParameters() localName=%s\n",qPrint(cd->localName()));
66 DString scName;
67 const Definition *d=cd->getOuterScope();
68 if (d)
69 {
71 {
72 const ClassDef *ocd=toClassDef(d);
73 scName = ocd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex);
74 }
75 else if (!hideScopeNames)
76 {
77 scName = d->qualifiedName();
78 }
79 }
80
81 SrcLangExt lang = cd->getLanguage();
82 DString scopeSeparator = getLanguageSpecificSeparator(lang);
83 if (!scName.empty()) scName+=scopeSeparator;
84
85 bool isSpecialization = cd->localName().find('<')!=DString::npos;
86 DString clName = cd->className();
87 scName+=clName;
88 if (lang!=SrcLangExt::CSharp && !cd->templateArguments().empty())
89 {
90 if (actualParams && *actualParamIndex<actualParams->size())
91 {
92 const ArgumentList &al = actualParams->at(*actualParamIndex);
93 if (!isSpecialization)
94 {
95 scName+=tempArgListToString(al,lang);
96 }
97 (*actualParamIndex)++;
98 }
99 else
100 {
101 if (!isSpecialization)
102 {
103 scName+=tempArgListToString(cd->templateArguments(),lang);
104 }
105 }
106 }
107 //printf("qualifiedNameWithTemplateParameters: scope=%s qualifiedName=%s\n",qPrint(name()),qPrint(scName));
108 return scName;
109}
110
111static DString makeDisplayName(const ClassDef *cd,bool includeScope)
112{
113 //bool optimizeOutputForJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
114 SrcLangExt lang = cd->getLanguage();
115 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
116 DString n;
117 if (lang==SrcLangExt::VHDL)
118 {
120 }
121 else
122 {
123 if (cd->tagLessReference())
124 {
125 size_t idx=cd->name().rfind("::");
126 if (includeScope || idx==DString::npos)
127 {
128 n=cd->name();
129 }
130 else
131 {
132 n=cd->name().mid(idx+2);
133 }
134 }
135 else if (includeScope)
136 {
138 }
139 else
140 {
141 n=cd->className();
142 }
143 }
144 if (cd->isAnonymous())
145 {
147 }
149 if (sep!="::")
150 {
151 n=substitute(n,"::",sep);
152 }
153 if (cd->compoundType()==ClassDef::Protocol && n.endsWith("-p"))
154 {
155 n="<"+n.left(n.length()-2)+">";
156 }
157 return n;
158}
159
160//-----------------------------------------------------------------------------
161
163{
164 if (lang==SrcLangExt::Fortran)
165 {
166 switch (compType)
167 {
168 case ClassDef::Class: return "module";
169 case ClassDef::Struct: return "type";
170 case ClassDef::Union: return "union";
171 case ClassDef::Interface: return "interface";
172 case ClassDef::Protocol: return "protocol";
173 case ClassDef::Category: return "category";
174 case ClassDef::Exception: return "exception";
175 default: return "unknown";
176 }
177 }
178 else
179 {
180 switch (compType)
181 {
182 case ClassDef::Class: return isJavaEnum ? "enum" : "class";
183 case ClassDef::Struct: return "struct";
184 case ClassDef::Union: return "union";
185 case ClassDef::Interface: return lang==SrcLangExt::ObjC ? "class" : "interface";
186 case ClassDef::Protocol: return "protocol";
187 case ClassDef::Category: return "category";
188 case ClassDef::Exception: return "exception";
189 case ClassDef::Service: return "service";
190 case ClassDef::Singleton: return "singleton";
191 default: return "unknown";
192 }
193 }
194}
195
196//-----------------------------------------------------------------------------
197
198
199/** Implementation of the ClassDef interface */
200class ClassDefImpl final : public DefinitionMixin<ClassDefMutable>
201{
202 public:
203 ClassDefImpl(const DString &fileName,int startLine,size_t startColumn,
204 const DString &name,CompoundType ct,
205 const DString &ref=DString(),const DString &fName=DString(),
206 bool isSymbol=true,bool isJavaEnum=false);
207
208 DefType definitionType() const override { return TypeClass; }
209 std::unique_ptr<ClassDef> deepCopy(const DString &name) const override;
210 void moveTo(Definition *) override;
211 CodeSymbolType codeSymbolType() const override;
212 DString getOutputFileBase() const override;
213 DString getInstanceOutputFileBase() const override;
214 DString getSourceFileBase() const override;
215 DString getReference() const override;
216 bool isReference() const override;
217 bool isLocal() const override;
218 ClassLinkedRefMap getClasses() const override;
219 bool hasDocumentation() const override;
220 bool hasDetailedDescription() const override;
221 DString collaborationGraphFileName() const override;
222 DString inheritanceGraphFileName() const override;
223 DString displayName(bool includeScope=true) const override;
224 CompoundType compoundType() const override;
225 DString compoundTypeString() const override;
226 const BaseClassList &baseClasses() const override;
227 void updateBaseClasses(const BaseClassList &bcd) override;
228 const BaseClassList &subClasses() const override;
229 void updateSubClasses(const BaseClassList &bcd) override;
230 const MemberNameInfoLinkedMap &memberNameInfoLinkedMap() const override;
231 Protection protection() const override;
232 bool isLinkableInProject() const override;
233 bool isLinkable() const override;
234 bool isVisibleInHierarchy() const override;
235 bool visibleInParentsDeclList() const override;
236 const ArgumentList &templateArguments() const override;
237 FileDef *getFileDef() const override;
238 ModuleDef *getModuleDef() const override;
239 const MemberDef *getMemberByName(const DString &) const override;
240 int isBaseClass(const ClassDef *bcd,bool followInstances,const DString &templSpec) const override;
241 bool isSubClass(ClassDef *bcd,int level=0) const override;
242 bool isAccessibleMember(const MemberDef *md) const override;
243 const TemplateInstanceList &getTemplateInstances() const override;
244 const ClassDef *templateMaster() const override;
245 bool isTemplate() const override;
246 const IncludeInfo *includeInfo() const override;
247 const UsesClassList &usedImplementationClasses() const override;
248 const UsesClassList &usedByImplementationClasses() const override;
249 const ConstraintClassList &templateTypeConstraints() const override;
250 bool isTemplateArgument() const override;
251 const Definition *findInnerCompound(const DString &name) const override;
254 const ArgumentLists *actualParams=nullptr,uint32_t *actualParamIndex=nullptr) const override;
255 bool isAbstract() const override;
256 bool isObjectiveC() const override;
257 bool isFortran() const override;
258 bool isCSharp() const override;
259 bool isFinal() const override;
260 bool isSealed() const override;
261 bool isPublished() const override;
262 bool isExtension() const override;
263 bool isForwardDeclared() const override;
264 bool isInterface() const override;
265 ClassDef *categoryOf() const override;
266 DString className() const override;
267 MemberList *getMemberList(MemberListType lt) const override;
268 const MemberLists &getMemberLists() const override;
269 const MemberGroupList &getMemberGroups() const override;
270 const TemplateNameMap &getTemplateBaseClassNames() const override;
271 bool isUsedOnly() const override;
272 DString anchor() const override;
273 bool isEmbeddedInOuterScope() const override;
274 bool isSimple() const override;
275 const ClassDef *tagLessReference() const override;
276 const MemberDef *isSmartPointer() const override;
277 bool isJavaEnum() const override;
278 DString title() const override;
279 DString generatedFromFiles() const override;
280 const FileList &usedFiles() const override;
281 const ArgumentList &typeConstraints() const override;
282 const ExampleList &getExamples() const override;
283 bool hasExamples() const override;
284 DString getMemberListFileName() const override;
285 bool subGrouping() const override;
286 bool isSliceLocal() const override;
287 bool hasNonReferenceSuperClass() const override;
288 DString requiresClause() const override;
289 StringVector getQualifiers() const override;
290 bool containsOverload(const MemberDef *md) const override;
291 bool isImplicitTemplateInstance() const override;
292
293 ClassDef *insertTemplateInstance(const DString &fileName,int startLine,size_t startColumn,
294 const DString &templSpec,bool &freshInstance) override;
295 void insertBaseClass(ClassDef *,const DString &name,Protection p,Specifier s,const DString &t=DString()) override;
296 void insertSubClass(ClassDef *,Protection p,Specifier s,const DString &t=DString()) override;
297 void insertExplicitTemplateInstance(ClassDef *instance,const DString &spec) override;
298 void setIncludeFile(FileDef *fd,const DString &incName,bool local,bool force) override;
299 void insertMember(MemberDef *) override;
300 void insertUsedFile(const FileDef *) override;
301 bool addExample(const DString &anchor,const DString &name, const DString &file) override;
302 void mergeCategory(ClassDef *category) override;
303 void setFileDef(FileDef *fd) override;
304 void setModuleDef(ModuleDef *mod) override;
305 void setSubGrouping(bool enabled) override;
306 void setProtection(Protection p) override;
307 void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const DString &fileName,int startLine,bool hasDocs) override;
308 void addInnerCompound(Definition *d) override;
309 void addUsedClass(ClassDef *cd,const DString &accessName,Protection prot) override;
310 void addUsedByClass(ClassDef *cd,const DString &accessName,Protection prot) override;
311 void setIsStatic(bool b) override;
312 void setCompoundType(CompoundType t) override;
313 void setClassName(const DString &name) override;
314 void setClassSpecifier(TypeSpecifier spec) override;
315 void addQualifiers(const StringVector &qualifiers) override;
316 void setTemplateArguments(const ArgumentList &al) override;
317 void setTemplateBaseClassNames(const TemplateNameMap &templateNames) override;
318 void setTemplateMaster(const ClassDef *tm) override;
319 void setImplicitTemplateInstance(bool b) override;
320 void setTypeConstraints(const ArgumentList &al) override;
321 void addMemberToTemplateInstance(const MemberDef *md, const ArgumentList &templateArguments, const DString &templSpec) override;
322 void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const DString &templSpec) override;
323 void makeTemplateArgument(bool b=true) override;
324 void setCategoryOf(ClassDef *cd) override;
325 void setUsedOnly(bool b) override;
326 void setTagLessReference(const ClassDef *cd) override;
327 void setMetaData(const DString &md) override;
328 void findSectionsInDocumentation() override;
329 void addMembersToMemberGroup() override;
330 void addListReferences() override;
331 void addRequirementReferences() override;
332 void addTypeConstraints() override;
333 void computeAnchors() override;
334 void mergeMembers() override;
335 void sortMemberLists() override;
337 void writeDocumentation(OutputList &ol) const override;
338 void writeDocumentationForInnerClasses(OutputList &ol) const override;
339 void writeMemberPages(OutputList &ol) const override;
340 void writeMemberList(OutputList &ol) const override;
341 void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const override;
342 void writePageNavigation(OutputList &ol) const override;
343 void writeSummaryLinks(OutputList &ol) const override;
344 void reclassifyMember(MemberDefMutable *md,MemberType t) override;
345 void writeInlineDocumentation(OutputList &ol) const override;
346 void writeDeclarationLink(OutputList &ol,bool &found,
347 const DString &header,bool localNames) const override;
348 void removeMemberFromLists(MemberDef *md) override;
349 void setAnonymousEnumType() override;
350 void countMembers() override;
351 void sortAllMembersList() override;
352
354 const ClassDef *inheritedFrom,const DString &inheritId) const override;
355 void writeTagFile(TextStream &) const override;
356
357 int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override;
358 int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom,
359 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override;
360 void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses,
361 MemberListType lt,const DString &title,
362 const DString &subTitle=DString(),
363 bool showInline=false,const ClassDef *inheritedFrom=nullptr,
364 MemberListType lt2=MemberListType::Invalid(),bool invert=false,bool showAlways=false) const override;
365 void setRequiresClause(const DString &req) override;
366 void setPrimaryConstructorParams(const ArgumentList &list) override;
367
368 // inheritance graph related members
369 CLASS_GRAPH_t hasInheritanceGraph() const override;
370 void overrideInheritanceGraph(CLASS_GRAPH_t e) override;
371
372 // collaboration graph related members
373 bool hasCollaborationGraph() const override;
374 void overrideCollaborationGraph(bool e) override;
375 private:
376 int countInheritedByNodes() const;
377 int countInheritsNodes() const;
378 int countInheritanceNodes() const;
379 void addUsedInterfaceClasses(MemberDef *md,const DString &typeStr);
380 void showUsedFiles(OutputList &ol) const;
381
382 void writeDocumentationContents(OutputList &ol,const DString &pageTitle) const;
383 void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList);
384 void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief);
387 const ClassDef *inheritedFrom,bool invert,
388 bool showAlways) const;
389 void writeMemberDocumentation(OutputList &ol,MemberListType lt,const DString &title,bool showInline=false) const;
392 int indentLevel,const ClassDef *inheritedFrom,const DString &inheritId) const;
393 void writeBriefDescription(OutputList &ol,bool exampleFlag) const;
394 void writeDetailedDescription(OutputList &ol,const DString &pageType,bool exampleFlag,
395 const DString &title,const DString &anchor=DString()) const;
396 void writeIncludeFiles(OutputList &ol) const;
398 void writeInheritanceGraph(OutputList &ol) const;
399 void writeCollaborationGraph(OutputList &ol) const;
400 void writeMemberGroups(OutputList &ol,bool showInline=false) const;
401 void writeNestedClasses(OutputList &ol,const DString &title) const;
402 void writeInlineClasses(OutputList &ol) const;
403 void startMemberDeclarations(OutputList &ol) const;
404 void endMemberDeclarations(OutputList &ol) const;
405 void startMemberDocumentation(OutputList &ol) const;
406 void endMemberDocumentation(OutputList &ol) const;
407 void writeAuthorSection(OutputList &ol) const;
408 void writeMoreLink(OutputList &ol,const DString &anchor) const;
410
413 void addClassAttributes(OutputList &ol) const;
415 const ClassDef *inheritedFrom,bool invert,bool showAlways,
416 ClassDefSet &visitedClasses) const;
418 DString &title,DString &subtitle) const;
419 void addTypeConstraint(const DString &typeConstraint,const DString &type);
420 void writeTemplateSpec(OutputList &ol,const Definition *d,
421 const DString &type,SrcLangExt lang) const;
422 void mergeMembersFromBaseClasses(bool mergeVirtualBaseClass);
424 private:
425 /*! file name that forms the base for the output file containing the
426 * class documentation. For compatibility with Qt (e.g. links via tag
427 * files) this name cannot be derived from the class name directly.
428 */
430
431 /*! file name used for the list of all members */
433
434 /*! file name used for the collaboration diagram */
436
437 /*! file name used for the inheritance graph */
439
440 /*! Include information about the header file should be included
441 * in the documentation. 0 by default, set by setIncludeFile().
442 */
443 std::unique_ptr<IncludeInfo> m_incInfo;
444
445 /*! List of base class (or super-classes) from which this class derives
446 * directly.
447 */
449
450 /*! List of sub-classes that directly derive from this class
451 */
453
454 /*! Namespace this class is part of
455 * (this is the inner most namespace in case of nested namespaces)
456 */
457 //NamespaceDef *m_nspace = nullptr;
458
459 /*! File this class is defined in */
460 FileDef *m_fileDef = nullptr;
461
462 /*! Module this class is defined in */
464
465 /*! List of all members (including inherited members) */
467
468 /*! Template arguments of this class */
470
471 /*! Type constraints for template parameters */
473
474 /*! Files that were used for generating the class documentation. */
476
477 /*! Examples that use this class */
479
480 /*! Holds the kind of "class" this is. */
482
483 /*! The protection level in which this class was found.
484 * Typically Public, but for nested classes this can also be Protected
485 * or Private.
486 */
488
489 /*! The inner classes contained in this class. Will be 0 if there are
490 * no inner classes.
491 */
493
494 /* classes for the collaboration diagram */
497
499
500 /*! Template instances that exists of this class, the key in the
501 * dictionary is the template argument list.
502 */
504
506
507 /*! The class this class is an instance of. */
508 const ClassDef *m_templateMaster = nullptr;
509
510 /*! local class name which could be a typedef'ed alias name. */
512
513 /*! If this class is a Objective-C category, then this points to the
514 * class which is extended.
515 */
517
519
520 /* user defined member groups */
522
523 /*! Is this an abstract class? */
524 bool m_isAbstract = false;
525
526 /*! Is the class part of an unnamed namespace? */
527 bool m_isStatic = false;
528
529 /*! true if classes members are merged with those of the base classes. */
530 bool m_membersMerged = false;
531
532 /*! true if the class is defined in a source file rather than a header file. */
533 bool m_isLocal = false;
534
535 bool m_isTemplArg = false;
536
537 /*! Does this class group its user-grouped members
538 * as a sub-section of the normal (public/protected/..)
539 * groups?
540 */
541 bool m_subGrouping = false;
542
543 /** Reason of existence is a "use" relation */
544 bool m_usedOnly = false;
545
546 /** List of titles to use for the summary */
548
549 /** Is this a simple (non-nested) C structure? */
550 bool m_isSimple = false;
551
552 /** Does this class overloaded the -> operator? */
553 const MemberDef *m_arrowOperator = nullptr;
554
555 const ClassDef *m_tagLessRef = nullptr;
556
557 /** Does this class represent a Java style enum? */
558 bool m_isJavaEnum = false;
559
561
563
564 /** C++20 requires clause */
566
568
570 CLASS_GRAPH_t m_typeInheritanceGraph = CLASS_GRAPH_t::NO;
571
573
575};
576
577std::unique_ptr<ClassDef> createClassDef(
578 const DString &fileName,int startLine,size_t startColumn,
579 const DString &name,ClassDef::CompoundType ct,
580 const DString &ref,const DString &fName,
581 bool isSymbol,bool isJavaEnum)
582{
583 return std::make_unique<ClassDefImpl>(fileName,startLine,startColumn,name,ct,ref,fName,isSymbol,isJavaEnum);
584}
585//-----------------------------------------------------------------------------
586
587class ClassDefAliasImpl final : public DefinitionAliasMixin<ClassDef>
588{
589 public:
590 ClassDefAliasImpl(const Definition *newScope,const ClassDef *cd)
591 : DefinitionAliasMixin(newScope,cd) { init(); }
592 ~ClassDefAliasImpl() override { deinit(); }
594
595 DefType definitionType() const override { return TypeClass; }
596
597 const ClassDef *getCdAlias() const { return toClassDef(getAlias()); }
598 std::unique_ptr<ClassDef> deepCopy(const DString &name) const override {
600 }
601 void moveTo(Definition *) override {}
602
604 { return getCdAlias()->codeSymbolType(); }
605 DString getOutputFileBase() const override
606 { return getCdAlias()->getOutputFileBase(); }
609 DString getSourceFileBase() const override
610 { return getCdAlias()->getSourceFileBase(); }
611 DString getReference() const override
612 { return getCdAlias()->getReference(); }
613 bool isReference() const override
614 { return getCdAlias()->isReference(); }
615 bool isLocal() const override
616 { return getCdAlias()->isLocal(); }
618 { return getCdAlias()->getClasses(); }
619 bool hasDocumentation() const override
620 { return getCdAlias()->hasDocumentation(); }
621 bool hasDetailedDescription() const override
622 { return getCdAlias()->hasDetailedDescription(); }
627 DString displayName(bool includeScope=true) const override
628 { return makeDisplayName(this,includeScope); }
629 CompoundType compoundType() const override
630 { return getCdAlias()->compoundType(); }
632 { return getCdAlias()->compoundTypeString(); }
633 const BaseClassList &baseClasses() const override
634 { return getCdAlias()->baseClasses(); }
635 const BaseClassList &subClasses() const override
636 { return getCdAlias()->subClasses(); }
639 Protection protection() const override
640 { return getCdAlias()->protection(); }
641 bool isLinkableInProject() const override
642 { return getCdAlias()->isLinkableInProject(); }
643 bool isLinkable() const override
644 { return getCdAlias()->isLinkable(); }
645 bool isVisibleInHierarchy() const override
646 { return getCdAlias()->isVisibleInHierarchy(); }
647 bool visibleInParentsDeclList() const override
648 { return getCdAlias()->visibleInParentsDeclList(); }
649 const ArgumentList &templateArguments() const override
650 { return getCdAlias()->templateArguments(); }
651 FileDef *getFileDef() const override
652 { return getCdAlias()->getFileDef(); }
653 ModuleDef *getModuleDef() const override
654 { return getCdAlias()->getModuleDef(); }
655 const MemberDef *getMemberByName(const DString &s) const override
656 { return getCdAlias()->getMemberByName(s); }
657 int isBaseClass(const ClassDef *bcd,bool followInstances,const DString &templSpec) const override
658 { return getCdAlias()->isBaseClass(bcd,followInstances,templSpec); }
659 bool isSubClass(ClassDef *bcd,int level=0) const override
660 { return getCdAlias()->isSubClass(bcd,level); }
661 bool isAccessibleMember(const MemberDef *md) const override
662 { return getCdAlias()->isAccessibleMember(md); }
664 { return getCdAlias()->getTemplateInstances(); }
665 const ClassDef *templateMaster() const override
666 { return getCdAlias()->templateMaster(); }
667 bool isTemplate() const override
668 { return getCdAlias()->isTemplate(); }
669 const IncludeInfo *includeInfo() const override
670 { return getCdAlias()->includeInfo(); }
677 bool isTemplateArgument() const override
678 { return getCdAlias()->isTemplateArgument(); }
679 const Definition *findInnerCompound(const DString &name) const override
680 { return getCdAlias()->findInnerCompound(name); }
684 const ArgumentLists *actualParams=nullptr,uint32_t *actualParamIndex=nullptr) const override
685 { return makeQualifiedNameWithTemplateParameters(this,actualParams,actualParamIndex); }
686 bool isAbstract() const override
687 { return getCdAlias()->isAbstract(); }
688 bool isObjectiveC() const override
689 { return getCdAlias()->isObjectiveC(); }
690 bool isFortran() const override
691 { return getCdAlias()->isFortran(); }
692 bool isCSharp() const override
693 { return getCdAlias()->isCSharp(); }
694 bool isFinal() const override
695 { return getCdAlias()->isFinal(); }
696 bool isSealed() const override
697 { return getCdAlias()->isSealed(); }
698 bool isPublished() const override
699 { return getCdAlias()->isPublished(); }
700 bool isExtension() const override
701 { return getCdAlias()->isExtension(); }
702 bool isForwardDeclared() const override
703 { return getCdAlias()->isForwardDeclared(); }
704 bool isInterface() const override
705 { return getCdAlias()->isInterface(); }
706 ClassDef *categoryOf() const override
707 { return getCdAlias()->categoryOf(); }
708 DString className() const override
709 { return getCdAlias()->className(); }
711 { return getCdAlias()->getMemberList(lt); }
712 const MemberLists &getMemberLists() const override
713 { return getCdAlias()->getMemberLists(); }
714 const MemberGroupList &getMemberGroups() const override
715 { return getCdAlias()->getMemberGroups(); }
718 bool isUsedOnly() const override
719 { return getCdAlias()->isUsedOnly(); }
720 DString anchor() const override
721 { return getCdAlias()->anchor(); }
722 bool isEmbeddedInOuterScope() const override
723 { return getCdAlias()->isEmbeddedInOuterScope(); }
724 bool isSimple() const override
725 { return getCdAlias()->isSimple(); }
726 const ClassDef *tagLessReference() const override
727 { return getCdAlias()->tagLessReference(); }
728 const MemberDef *isSmartPointer() const override
729 { return getCdAlias()->isSmartPointer(); }
730 bool isJavaEnum() const override
731 { return getCdAlias()->isJavaEnum(); }
732 DString title() const override
733 { return getCdAlias()->title(); }
735 { return getCdAlias()->generatedFromFiles(); }
736 const FileList &usedFiles() const override
737 { return getCdAlias()->usedFiles(); }
738 const ArgumentList &typeConstraints() const override
739 { return getCdAlias()->typeConstraints(); }
740 const ExampleList &getExamples() const override
741 { return getCdAlias()->getExamples(); }
742 bool hasExamples() const override
743 { return getCdAlias()->hasExamples(); }
745 { return getCdAlias()->getMemberListFileName(); }
746 bool subGrouping() const override
747 { return getCdAlias()->subGrouping(); }
748 bool isSliceLocal() const override
749 { return getCdAlias()->isSliceLocal(); }
750 bool hasNonReferenceSuperClass() const override
752 DString requiresClause() const override
753 { return getCdAlias()->requiresClause(); }
755 { return getCdAlias()->getQualifiers(); }
756 bool containsOverload(const MemberDef *md) const override
757 { return getCdAlias()->containsOverload(md); }
758
759 int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override
760 { return getCdAlias()->countMembersIncludingGrouped(lt,inheritedFrom,additional); }
762 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override
763 { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); }
764
765 void writeDeclarationLink(OutputList &ol,bool &found,
766 const DString &header,bool localNames) const override
767 { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); }
768 bool isImplicitTemplateInstance() const override
770
771 void writeDocumentation(OutputList &ol) const override
775 void writeMemberPages(OutputList &ol) const override
776 { getCdAlias()->writeMemberPages(ol); }
777 void writeMemberList(OutputList &ol) const override
778 { getCdAlias()->writeMemberList(ol); }
779 void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const override
780 { getCdAlias()->writeQuickMemberLinks(ol,md); }
781 void writeSummaryLinks(OutputList &ol) const override
782 { getCdAlias()->writeSummaryLinks(ol); }
783 void writePageNavigation(OutputList &ol) const override
787 void writeTagFile(TextStream &ol) const override
788 { getCdAlias()->writeTagFile(ol); }
790 MemberListType lt,const DString &title,
791 const DString &subTitle=DString(),
792 bool showInline=false,const ClassDef *inheritedFrom=nullptr,
793 MemberListType lt2=MemberListType::Invalid(),bool invert=false,bool showAlways=false) const override
794 { getCdAlias()->writeMemberDeclarations(ol,visitedClasses,lt,title,subTitle,showInline,inheritedFrom,lt2,invert,showAlways); }
796 const ClassDef *inheritedFrom,const DString &inheritId) const override
797 { getCdAlias()->addGroupedInheritedMembers(ol,lt,inheritedFrom,inheritId); }
798
799 void updateBaseClasses(const BaseClassList &) override {}
800 void updateSubClasses(const BaseClassList &) override {}
801};
802
803std::unique_ptr<ClassDef> createClassDefAlias(const Definition *newScope,const ClassDef *cd)
804{
805 auto acd = std::make_unique<ClassDefAliasImpl>(newScope,cd);
806 //printf("cd name=%s localName=%s qualifiedName=%s qualifiedNameWith=%s displayName()=%s\n",
807 // qPrint(acd->name()),qPrint(acd->localName()),qPrint(acd->qualifiedName()),
808 // qPrint(acd->qualifiedNameWithTemplateParameters()),qPrint(acd->displayName()));
809 return acd;
810}
811
812//-----------------------------------------------------------------------------
813
814// constructs a new class definition
816 const DString &defFileName,int defLine,size_t defColumn,
817 const DString &nm,CompoundType ct,
818 const DString &lref,const DString &fName,
819 bool isSymbol,bool isJavaEnum)
820 : DefinitionMixin(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),nullptr,nullptr,isSymbol)
821{
822 AUTO_TRACE("name={}",name());
823 setReference(lref);
824 m_compType = ct;
827 if (!fName.empty())
828 {
830 }
831 else
832 {
833 m_fileName=compTypeString+name();
834 }
835 m_prot=Protection::Public;
836 //nspace=nullptr;
837 m_fileDef=nullptr;
838 m_moduleDef=nullptr;
839 m_subGrouping=Config_getBool(SUBGROUPING);
840 m_templateMaster =nullptr;
841 m_isAbstract = false;
842 m_isStatic = false;
843 m_isTemplArg = false;
844 m_membersMerged = false;
845 m_categoryOf = nullptr;
846 m_usedOnly = false;
847 m_isSimple = Config_getBool(INLINE_SIMPLE_STRUCTS);
848 m_arrowOperator = nullptr;
849 m_tagLessRef = nullptr;
851 //DString ns;
852 //extractNamespaceName(name,className,ns);
853 //printf("m_name=%s m_className=%s ns=%s\n",qPrint(m_name),qPrint(m_className),qPrint(ns));
854
855 // we cannot use getLanguage at this point, as setLanguage has not been called.
856 SrcLangExt lang = getLanguageFromFileName(defFileName);
857 if ((lang==SrcLangExt::Cpp || lang==SrcLangExt::ObjC) && EntryType::guessSection(defFileName).isSource())
858 {
859 m_isLocal=true;
860 }
861 else
862 {
863 m_isLocal=false;
864 }
865 m_hasCollaborationGraph = Config_getBool(COLLABORATION_GRAPH);
867 m_memberListFileName = convertNameToFile(compTypeString+name()+"-members");
870 if (lref.empty())
871 {
873 }
874 AUTO_TRACE_EXIT("m_fileName='{}'",m_fileName);
875}
876
877std::unique_ptr<ClassDef> ClassDefImpl::deepCopy(const DString &name) const
878{
879 AUTO_TRACE("name='{}'",name);
880 auto result = std::make_unique<ClassDefImpl>(
882 std::string(),std::string(),true,m_isJavaEnum);
883 result->setBriefDescription(briefDescription(),briefFile(),briefLine());
884 result->setDocumentation(documentation(),docFile(),docLine());
885 result->setInbodyDocumentation(inbodyDocumentation(),inbodyFile(),inbodyLine());
886 result->setBodySegment(getStartDefLine(),getStartBodyLine(),getEndBodyLine());
887 result->setBodyDef(getBodyDef());
888 result->setLanguage(getLanguage());
889
890 // copy other members
891 result->m_memberListFileName = m_memberListFileName;
892 result->m_collabFileName = m_collabFileName;
893 result->m_inheritFileName = m_inheritFileName;
894 if (m_incInfo)
895 {
896 result->m_incInfo = std::make_unique<IncludeInfo>();
897 *(result->m_incInfo) = *m_incInfo;
898 }
899 result->m_inherits = m_inherits;
900 result->m_inheritedBy = m_inheritedBy;
901 result->m_fileDef = m_fileDef;
902 result->m_moduleDef = m_moduleDef;
903 result->m_tempArgs = m_tempArgs;
904 result->m_typeConstraints = m_typeConstraints;
905 result->m_files = m_files;
906 result->m_examples = m_examples;
907 result->m_compType = m_compType;
908 result->m_prot = m_prot;
909 result->m_usesImplClassList = m_usesImplClassList;
910 result->m_usedByImplClassList = m_usedByImplClassList;
911 result->m_constraintClassList = m_constraintClassList;
912 result->m_templateInstances = m_templateInstances;
913 result->m_templBaseClassNames = m_templBaseClassNames;
914 result->m_templateMaster = m_templateMaster;
915 result->m_className = m_className;
916 result->m_categoryOf = m_categoryOf;
917 result->m_isAbstract = m_isAbstract;
918 result->m_isStatic = m_isStatic;
919 result->m_membersMerged = m_membersMerged;
920 result->m_isLocal = m_isLocal;
921 result->m_isTemplArg = m_isTemplArg;
922 result->m_subGrouping = m_subGrouping;
923 result->m_usedOnly = m_usedOnly;
924 result->m_vhdlSummaryTitles = m_vhdlSummaryTitles;
925 result->m_isSimple = m_isSimple;
926 result->m_arrowOperator = m_arrowOperator;
927 result->m_tagLessRef = m_tagLessRef;
928 result->m_isJavaEnum = m_isJavaEnum;
929 result->m_spec = m_spec;
930 result->m_metaData = m_metaData;
931 result->m_requiresClause = m_requiresClause;
932 result->m_qualifiers = m_qualifiers;
933 result->m_hasCollaborationGraph = m_hasCollaborationGraph;
934 result->m_typeInheritanceGraph = m_typeInheritanceGraph;
935
936 // set new file name
938 result->m_fileName = compTypeString+name;
939 result->m_memberListFileName = convertNameToFile(compTypeString+name+"-members");
940 result->m_collabFileName = convertNameToFile(result->m_fileName+"_coll_graph");
941 result->m_inheritFileName = convertNameToFile(result->m_fileName+"_inherit_graph");
942 result->m_fileName = convertNameToFile(result->m_fileName);
943
944 // deep copy nested classes
945 for (const auto &innerCd : m_innerClasses)
946 {
947 DString innerName = name+"::"+innerCd->localName();
948 if (Doxygen::classLinkedMap->find(innerName)==nullptr)
949 {
950 auto cd = Doxygen::classLinkedMap->add(innerName,innerCd->deepCopy(innerName));
951 result->addInnerCompound(cd);
953 if (cdm)
954 {
955 cdm->setOuterScope(result.get());
956 }
957 }
958 }
959
960 // copy all member list (and make deep copies of members)
961 for (auto &mni : m_allMemberNameInfoLinkedMap)
962 {
963 for (auto &mi : *mni)
964 {
965 const MemberDef *md=mi->memberDef();
966 auto newMd = md->deepCopy();
967 if (newMd)
968 {
969 AUTO_TRACE_ADD("Copying member {}",newMd->name());
970 auto mmd = toMemberDefMutable(newMd.get());
971 if (mmd)
972 {
973 mmd->moveTo(result.get());
974 }
975
976 result->internalInsertMember(newMd.get(),newMd->protection(),true);
977
978 // also add to the global list (which will own newMd)
979 MemberName *mn = Doxygen::memberNameLinkedMap->add(newMd->name());
980 mn->push_back(std::move(newMd));
981 }
982 }
983 }
984
985 return result;
986}
987
989{
990 //printf("%s::moveTo(%s)\n",qPrint(name()),qPrint(scope->name()));
991 setOuterScope(scope);
993 {
994 m_fileDef = toFileDef(scope);
995 }
996 else if (scope->definitionType()==Definition::TypeModule)
997 {
998 m_moduleDef = toModuleDef(scope);
999 }
1000}
1001
1006
1007DString ClassDefImpl::displayName(bool includeScope) const
1008{
1009 return makeDisplayName(this,includeScope);
1010}
1011
1012// inserts a base/super class in the inheritance list
1014 Specifier s,const DString &t)
1015{
1016 //printf("*** insert base class %s into %s\n",qPrint(cd->name()),qPrint(name()));
1017 m_inherits.emplace_back(cd,n,p,s,t);
1018 m_isSimple = false;
1019}
1020
1021// inserts a derived/sub class in the inherited-by list
1023 Specifier s,const DString &t)
1024{
1025 //printf("*** insert sub class %s into %s\n",qPrint(cd->name()),qPrint(name()));
1026 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
1027 if (!extractPrivate && cd->protection()==Protection::Private) return;
1028 m_inheritedBy.emplace_back(cd,DString(),p,s,t);
1029 m_isSimple = false;
1030}
1031
1033{
1034 for (auto &ml : m_memberLists)
1035 {
1036 if (!ml->listType().isDetailed())
1037 {
1039 }
1040 }
1041
1042 // add members inside sections to their groups
1043 for (const auto &mg : m_memberGroups)
1044 {
1045 if (mg->allMembersInSameSection() && m_subGrouping)
1046 {
1047 //printf("addToDeclarationSection(%s)\n",qPrint(mg->header()));
1048 mg->addToDeclarationSection();
1049 }
1050 }
1051}
1052
1053// adds new member definition to the class
1055 Protection prot,
1056 bool addToAllList
1057 )
1058{
1059 AUTO_TRACE("{} name={} isHidden={}",name(),md->name(),md->isHidden());
1060 if (md->isHidden()) return;
1061
1062 if (getLanguage()==SrcLangExt::VHDL)
1063 {
1065 m_vhdlSummaryTitles.insert(title.str());
1066 }
1067
1068 if (1 /*!isReference()*/) // changed to 1 for showing members of external
1069 // classes when HAVE_DOT and UML_LOOK are enabled.
1070 {
1071 bool isSimple=false;
1072
1073 /********************************************/
1074 /* insert member in the declaration section */
1075 /********************************************/
1076 if (md->isRelated() && protectionLevelVisible(prot))
1077 {
1078 addMemberToList(MemberListType::Related(),md,true);
1079 }
1080 else if (md->isFriend())
1081 {
1082 addMemberToList(MemberListType::Friends(),md,true);
1083 }
1084 else
1085 {
1086 switch (md->memberType())
1087 {
1088 case MemberType::Service: // UNO IDL
1089 addMemberToList(MemberListType::Services(),md,true);
1090 break;
1091 case MemberType::Interface: // UNO IDL
1092 addMemberToList(MemberListType::Interfaces(),md,true);
1093 break;
1094 case MemberType::Signal: // Qt specific
1095 addMemberToList(MemberListType::Signals(),md,true);
1096 break;
1097 case MemberType::DCOP: // KDE2 specific
1098 addMemberToList(MemberListType::DcopMethods(),md,true);
1099 break;
1100 case MemberType::Property:
1101 addMemberToList(MemberListType::Properties(),md,true);
1102 break;
1103 case MemberType::Event:
1104 addMemberToList(MemberListType::Events(),md,true);
1105 break;
1106 case MemberType::Slot: // Qt specific
1107 switch (prot)
1108 {
1109 case Protection::Protected:
1110 case Protection::Package: // slots in packages are not possible!
1111 addMemberToList(MemberListType::ProSlots(),md,true);
1112 break;
1113 case Protection::Public:
1114 addMemberToList(MemberListType::PubSlots(),md,true);
1115 break;
1116 case Protection::Private:
1117 addMemberToList(MemberListType::PriSlots(),md,true);
1118 break;
1119 }
1120 break;
1121 default: // any of the other members
1122 if (md->isStatic())
1123 {
1124 if (md->isVariable())
1125 {
1126 switch (prot)
1127 {
1128 case Protection::Protected:
1129 addMemberToList(MemberListType::ProStaticAttribs(),md,true);
1130 break;
1131 case Protection::Package:
1132 addMemberToList(MemberListType::PacStaticAttribs(),md,true);
1133 break;
1134 case Protection::Public:
1135 addMemberToList(MemberListType::PubStaticAttribs(),md,true);
1136 break;
1137 case Protection::Private:
1138 addMemberToList(MemberListType::PriStaticAttribs(),md,true);
1139 break;
1140 }
1141 }
1142 else // function
1143 {
1144 switch (prot)
1145 {
1146 case Protection::Protected:
1147 addMemberToList(MemberListType::ProStaticMethods(),md,true);
1148 break;
1149 case Protection::Package:
1150 addMemberToList(MemberListType::PacStaticMethods(),md,true);
1151 break;
1152 case Protection::Public:
1153 addMemberToList(MemberListType::PubStaticMethods(),md,true);
1154 break;
1155 case Protection::Private:
1156 addMemberToList(MemberListType::PriStaticMethods(),md,true);
1157 break;
1158 }
1159 }
1160 }
1161 else // not static
1162 {
1163 if (md->isVariable())
1164 {
1165 switch (prot)
1166 {
1167 case Protection::Protected:
1168 addMemberToList(MemberListType::ProAttribs(),md,true);
1169 break;
1170 case Protection::Package:
1171 addMemberToList(MemberListType::PacAttribs(),md,true);
1172 break;
1173 case Protection::Public:
1174 {
1175 addMemberToList(MemberListType::PubAttribs(),md,true);
1176 const int MAX_CELL_SIZE=60;
1177 size_t typeLen = removeAnonymousScopes(md->typeString()).length();
1178 isSimple = typeLen + md->name().length() + md->argsString().length() <= MAX_CELL_SIZE;
1179 }
1180 break;
1181 case Protection::Private:
1182 addMemberToList(MemberListType::PriAttribs(),md,true);
1183 break;
1184 }
1185 }
1186 else if (md->isTypedef() || md->isEnumerate() || md->isEnumValue())
1187 {
1188 switch (prot)
1189 {
1190 case Protection::Protected:
1191 addMemberToList(MemberListType::ProTypes(),md,true);
1192 break;
1193 case Protection::Package:
1194 addMemberToList(MemberListType::PacTypes(),md,true);
1195 break;
1196 case Protection::Public:
1197 addMemberToList(MemberListType::PubTypes(),md,true);
1198 isSimple=!md->isEnumerate() &&
1199 !md->isEnumValue() &&
1200 md->typeString().find(")(")==DString::npos; // func ptr typedef
1201 break;
1202 case Protection::Private:
1203 addMemberToList(MemberListType::PriTypes(),md,true);
1204 break;
1205 }
1206 }
1207 else // member function
1208 {
1209 switch (prot)
1210 {
1211 case Protection::Protected:
1212 addMemberToList(MemberListType::ProMethods(),md,true);
1213 break;
1214 case Protection::Package:
1215 addMemberToList(MemberListType::PacMethods(),md,true);
1216 break;
1217 case Protection::Public:
1218 addMemberToList(MemberListType::PubMethods(),md,true);
1219 break;
1220 case Protection::Private:
1221 addMemberToList(MemberListType::PriMethods(),md,true);
1222 break;
1223 }
1224 }
1225 }
1226 break;
1227 }
1228 }
1229 if (!isSimple) // not a simple field -> not a simple struct
1230 {
1231 m_isSimple = false;
1232 }
1233 //printf("adding %s simple=%d total_simple=%d\n",qPrint(md->qualifiedName()),isSimple,m_isSimple);
1234
1235 /*******************************************************/
1236 /* insert member in the detailed documentation section */
1237 /*******************************************************/
1238 if ((md->isRelated() && protectionLevelVisible(prot)) || md->isFriend())
1239 {
1240 addMemberToList(MemberListType::RelatedMembers(),md,false);
1241 }
1242 else if (md->isFunction() &&
1243 md->protection()==Protection::Private &&
1244 (md->virtualness()!=Specifier::Normal || md->isOverride() || md->isFinal()) &&
1245 Config_getBool(EXTRACT_PRIV_VIRTUAL))
1246 {
1247 addMemberToList(MemberListType::FunctionMembers(),md,false);
1248 }
1249 else
1250 {
1251 switch (md->memberType())
1252 {
1253 case MemberType::Service: // UNO IDL
1254 addMemberToList(MemberListType::ServiceMembers(),md,false);
1255 break;
1256 case MemberType::Interface: // UNO IDL
1257 addMemberToList(MemberListType::InterfaceMembers(),md,false);
1258 break;
1259 case MemberType::Property:
1260 addMemberToList(MemberListType::PropertyMembers(),md,false);
1261 break;
1262 case MemberType::Event:
1263 addMemberToList(MemberListType::EventMembers(),md,false);
1264 break;
1265 case MemberType::Signal: // fall through
1266 case MemberType::DCOP:
1267 addMemberToList(MemberListType::FunctionMembers(),md,false);
1268 break;
1269 case MemberType::Slot:
1270 if (protectionLevelVisible(prot))
1271 {
1272 addMemberToList(MemberListType::FunctionMembers(),md,false);
1273 }
1274 break;
1275 default: // any of the other members
1276 if (protectionLevelVisible(prot))
1277 {
1278 switch (md->memberType())
1279 {
1280 case MemberType::Typedef:
1281 addMemberToList(MemberListType::TypedefMembers(),md,false);
1282 break;
1283 case MemberType::Enumeration:
1284 addMemberToList(MemberListType::EnumMembers(),md,false);
1285 break;
1286 case MemberType::EnumValue:
1287 addMemberToList(MemberListType::EnumValMembers(),md,false);
1288 break;
1289 case MemberType::Function:
1290 if (md->isConstructor() || md->isDestructor())
1291 {
1292 m_memberLists.get(MemberListType::Constructors(),MemberListContainer::Class)->push_back(md);
1293 }
1294 else
1295 {
1296 addMemberToList(MemberListType::FunctionMembers(),md,false);
1297 }
1298 break;
1299 case MemberType::Variable:
1300 addMemberToList(MemberListType::VariableMembers(),md,false);
1301 break;
1302 case MemberType::Define:
1303 warn(md->getDefFileName(),md->getDefLine()-1,"A define ({}) cannot be made a member of {}",
1304 md->name(), this->name());
1305 break;
1306 default:
1307 err("Unexpected member type '{}' found!\n",md->memberTypeName());
1308 }
1309 }
1310 break;
1311 }
1312 }
1313
1314 /*************************************************/
1315 /* insert member in the appropriate member group */
1316 /*************************************************/
1317 // Note: this must be done AFTER inserting the member in the
1318 // regular groups
1319 //addMemberToGroup(md,groupId);
1320
1321 }
1322
1323 if (md->virtualness()==Specifier::Pure)
1324 {
1325 m_isAbstract=true;
1326 }
1327
1328 if (md->name()=="operator->")
1329 {
1330 m_arrowOperator=md;
1331 }
1332
1333 if (addToAllList &&
1334 !(Config_getBool(HIDE_FRIEND_COMPOUNDS) &&
1335 md->isFriend() &&
1336 (md->typeString()=="friend class" ||
1337 md->typeString()=="friend struct" ||
1338 md->typeString()=="friend union")))
1339 {
1340 //printf("=======> adding member %s to class %s\n",qPrint(md->name()),qPrint(name()));
1341
1343 mni->push_back(std::make_unique<MemberInfo>(md,prot,md->virtualness(),false,false));
1344 }
1345
1346 // if we already created template instances before inserting this member (i.e. due to a typedef or using statement)
1347 // then we also need to insert the member in the template instance.
1348 for (const auto &ti : getTemplateInstances())
1349 {
1350 AUTO_TRACE_ADD("member {} of class {} with template instance {}\n",md->name(),name(),ti.templSpec);
1351 ClassDefMutable *cdm = toClassDefMutable(ti.classDef);
1352 if (cdm)
1353 {
1354 cdm->addMemberToTemplateInstance(md,templateArguments(),ti.templSpec);
1355 }
1356 }
1357
1358}
1359
1361{
1362 internalInsertMember(md,md->protection(),true);
1363}
1364
1365// compute the anchors for all members
1367{
1368 for (auto &ml : m_memberLists)
1369 {
1370 if (!ml->listType().isDetailed())
1371 {
1372 ml->setAnchors();
1373 }
1374 }
1375
1376 for (const auto &mg : m_memberGroups)
1377 {
1378 mg->setAnchors();
1379 }
1380}
1381
1383{
1384 for (const auto &mg : m_memberGroups)
1385 {
1386 mg->distributeMemberGroupDocumentation();
1387 }
1388}
1389
1391{
1395 for (const auto &mg : m_memberGroups)
1396 {
1397 mg->findSectionsInDocumentation(this);
1398 }
1399 for (auto &ml : m_memberLists)
1400 {
1401 if (!ml->listType().isDetailed())
1402 {
1403 ml->findSectionsInDocumentation(this);
1404 }
1405 }
1406}
1407
1408
1409// add a file name to the used files set
1411{
1412 if (fd == nullptr) return;
1413
1414 if (std::find(m_files.begin(), m_files.end(), fd) == m_files.end()) m_files.push_back(fd);
1415
1416 for (const auto &ti : m_templateInstances)
1417 {
1418 if (ClassDefMutable *cdm = toClassDefMutable(ti.classDef)) cdm->insertUsedFile(fd);
1419 }
1420}
1421
1423{
1424 if (bcd.prot!=Protection::Public || bcd.virt!=Specifier::Normal)
1425 {
1426 ol.startTypewriter();
1427 ol.docify(" [");
1428 StringVector sl;
1429 if (bcd.prot==Protection::Protected) sl.emplace_back("protected");
1430 else if (bcd.prot==Protection::Private) sl.emplace_back("private");
1431 if (bcd.virt==Specifier::Virtual) sl.emplace_back("virtual");
1432 bool first=true;
1433 for (const auto &s : sl)
1434 {
1435 if (!first) ol.docify(", ");
1436 ol.docify(s);
1437 first=false;
1438 }
1439 ol.docify("]");
1440 ol.endTypewriter();
1441 }
1442}
1443
1445 const DString &includeName,bool local, bool force)
1446{
1447 //printf("ClassDefImpl::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force);
1448 if (!m_incInfo) m_incInfo = std::make_unique<IncludeInfo>();
1449 if ((!includeName.empty() && m_incInfo->includeName.empty()) ||
1450 (fd!=nullptr && m_incInfo->fileDef==nullptr)
1451 )
1452 {
1453 //printf("Setting file info\n");
1454 m_incInfo->fileDef = fd;
1455 m_incInfo->includeName = includeName;
1457 }
1458 if (force && !includeName.empty())
1459 {
1460 m_incInfo->includeName = includeName;
1462 }
1463}
1464
1465// TODO: fix this: a nested template class can have multiple outer templates
1466//ArgumentList *ClassDefImpl::outerTemplateArguments() const
1467//{
1468// int ti;
1469// ClassDef *pcd=nullptr;
1470// int pi=0;
1471// if (m_tempArgs) return m_tempArgs;
1472// // find the outer most class scope
1473// while ((ti=name().find("::",pi))!=-1 &&
1474// (pcd=getClass(name().left(ti)))==0
1475// ) pi=ti+2;
1476// if (pcd)
1477// {
1478// return pcd->templateArguments();
1479// }
1480// return nullptr;
1481//}
1482
1483static void searchTemplateSpecs(/*in*/ const Definition *d,
1484 /*out*/ ArgumentLists &result,
1485 /*out*/ DString &name,
1486 /*in*/ SrcLangExt lang)
1487{
1489 {
1490 if (d->getOuterScope())
1491 {
1492 searchTemplateSpecs(d->getOuterScope(),result,name,lang);
1493 }
1494 const ClassDef *cd=toClassDef(d);
1495 if (!name.empty()) name+="::";
1496 DString clName = d->localName();
1497 if (clName.endsWith("-p"))
1498 {
1499 clName = clName.left(clName.length()-2);
1500 }
1501 name+=clName;
1502 bool isSpecialization = d->localName().find('<')!=DString::npos;
1503 if (!cd->templateArguments().empty())
1504 {
1505 result.push_back(cd->templateArguments());
1506 if (!isSpecialization)
1507 {
1508 name+=tempArgListToString(cd->templateArguments(),lang);
1509 }
1510 }
1511 }
1512 else
1513 {
1514 name+=d->qualifiedName();
1515 }
1516}
1517
1519 const DString &type,SrcLangExt lang) const
1520{
1521 ArgumentLists specs;
1522 DString name;
1523 searchTemplateSpecs(d,specs,name,lang);
1524 if (!specs.empty()) // class has template scope specifiers
1525 {
1527 for (const ArgumentList &al : specs)
1528 {
1529 ol.docify("template<");
1530 auto it = al.begin();
1531 while (it!=al.end())
1532 {
1533 Argument a = *it;
1535 a.type, // text
1536 LinkifyTextOptions().setScope(d).setFileScope(getFileDef()).setSelf(this));
1537 if (!a.name.empty())
1538 {
1539 ol.docify(" ");
1540 ol.docify(a.name);
1541 }
1542 if (a.defval.length()!=0)
1543 {
1544 ol.docify(" = ");
1545 ol.docify(a.defval);
1546 }
1547 ++it;
1548 if (it!=al.end()) ol.docify(", ");
1549 }
1550 ol.docify(">");
1551 ol.lineBreak();
1552 }
1553 if (!m_requiresClause.empty())
1554 {
1555 ol.docify("requires ");
1557 m_requiresClause, // text
1558 LinkifyTextOptions().setScope(d).setFileScope(getFileDef()).setSelf(this));
1559 ol.lineBreak();
1560 }
1561 ol.docify(type.lower()+" "+name);
1563 }
1564}
1565
1566void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) const
1567{
1568 if (hasBriefDescription())
1569 {
1570 ol.startParagraph();
1571 ol.pushGeneratorState();
1573 ol.writeString(" - ");
1574 ol.popGeneratorState();
1576 briefLine(),
1577 this,
1578 nullptr,
1580 DocOptions()
1581 .setIndexWords(true)
1582 .setSingleLine(true));
1583 ol.pushGeneratorState();
1585 ol.writeString(" \n");
1587 ol.popGeneratorState();
1588
1589 if (hasDetailedDescription() || exampleFlag)
1590 {
1591 writeMoreLink(ol,anchor());
1592 }
1593
1594 ol.endParagraph();
1595 }
1596 ol.writeSynopsis();
1597}
1598
1600{
1601 bool repeatBrief = Config_getBool(REPEAT_BRIEF);
1602
1603 ol.startTextBlock();
1604
1605 if (getLanguage()==SrcLangExt::Cpp)
1606 {
1607 writeTemplateSpec(ol,this,compoundTypeString(),SrcLangExt::Cpp);
1608 }
1609
1610 // repeat brief description
1611 if (!briefDescription().empty() && repeatBrief)
1612 {
1614 briefLine(),
1615 this,
1616 nullptr,
1618 DocOptions());
1619 }
1620 if (!briefDescription().empty() && repeatBrief &&
1621 !documentation().empty())
1622 {
1623 ol.pushGeneratorState();
1625 ol.writeString("\n\n");
1626 ol.popGeneratorState();
1627 }
1628 // write documentation
1629 if (!documentation().empty())
1630 {
1631 ol.generateDoc(docFile(),
1632 docLine(),
1633 this,
1634 nullptr,
1635 documentation(),
1636 DocOptions()
1637 .setIndexWords(true));
1638 }
1639 // write type constraints
1641
1642 ol.generateDoc(
1643 docFile(),docLine(),
1644 this,
1645 nullptr, // memberDef
1647 DocOptions()
1648 .setIndexWords(true));
1649
1650 // write examples
1651 if (hasExamples())
1652 {
1653 ol.startExamples();
1654 ol.startDescForItem();
1656 ol.endDescForItem();
1657 ol.endExamples();
1658 }
1659 writeSourceDef(ol);
1661 ol.endTextBlock();
1662}
1663
1665{
1666 bool repeatBrief = Config_getBool(REPEAT_BRIEF);
1667 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1668 return ((!briefDescription().empty() && repeatBrief) ||
1670 (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) ||
1672}
1673
1674// write the detailed description for this class
1675void ClassDefImpl::writeDetailedDescription(OutputList &ol, const DString &/*pageType*/, bool exampleFlag,
1676 const DString &title,const DString &anchor) const
1677{
1678 if (hasDetailedDescription() || exampleFlag)
1679 {
1680 ol.pushGeneratorState();
1682 ol.writeRuler();
1683 ol.popGeneratorState();
1684
1685 ol.pushGeneratorState();
1687 ol.writeAnchor(DString(),anchor.empty() ? DString("details") : anchor);
1688 ol.popGeneratorState();
1689
1690 if (!anchor.empty())
1691 {
1692 ol.pushGeneratorState();
1696 ol.popGeneratorState();
1697 }
1698
1699 ol.startGroupHeader("details");
1700 ol.parseText(title);
1701 ol.endGroupHeader();
1702
1704 }
1705 else
1706 {
1707 //writeTemplateSpec(ol,this,pageType);
1708 }
1709}
1710
1712{
1713 DString result;
1714 SrcLangExt lang = getLanguage();
1715 size_t numFiles = m_files.size();
1716 if (lang==SrcLangExt::Fortran)
1717 {
1719 getLanguage()==SrcLangExt::ObjC && m_compType==Interface ? Class : m_compType,
1720 numFiles==1);
1721 }
1722 else if (isJavaEnum())
1723 {
1724 result = theTranslator->trEnumGeneratedFromFiles(numFiles==1);
1725 }
1726 else if (m_compType==Service)
1727 {
1728 result = theTranslator->trServiceGeneratedFromFiles(numFiles==1);
1729 }
1730 else if (m_compType==Singleton)
1731 {
1732 result = theTranslator->trSingletonGeneratedFromFiles(numFiles==1);
1733 }
1734 else
1735 {
1737 getLanguage()==SrcLangExt::ObjC && m_compType==Interface ? Class : m_compType,
1738 numFiles==1);
1739 }
1740 return result;
1741}
1742
1744{
1745 ol.pushGeneratorState();
1747
1748
1749 ol.writeRuler();
1750 ol.pushGeneratorState();
1752 ol.startParagraph();
1754 ol.endParagraph();
1755 ol.popGeneratorState();
1759
1760 bool first=true;
1761 for (const auto &fd : m_files)
1762 {
1763 if (first)
1764 {
1765 first=false;
1766 ol.startItemList();
1767 }
1768
1769 ol.startItemListItem();
1770 DString path=fd->getPath();
1771 if (Config_getBool(FULL_PATH_NAMES))
1772 {
1773 ol.docify(stripFromPath(path));
1774 }
1775
1776 DString fname = fd->name();
1777 if (!fd->getVersion().empty()) // append version if available
1778 {
1779 fname += " (" + fd->getVersion() + ")";
1780 }
1781
1782 // for HTML
1783 ol.pushGeneratorState();
1785 if (fd->generateSourceFile())
1786 {
1787 ol.writeObjectLink(DString(),fd->getSourceFileBase(),DString(),fname);
1788 }
1789 else if (fd->isLinkable())
1790 {
1791 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),DString(),fname);
1792 }
1793 else
1794 {
1795 ol.startBold();
1796 ol.docify(fname);
1797 ol.endBold();
1798 }
1799 ol.popGeneratorState();
1800
1801 // for other output formats
1802 ol.pushGeneratorState();
1804 if (fd->isLinkable())
1805 {
1806 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),DString(),fname);
1807 }
1808 else
1809 {
1810 ol.docify(fname);
1811 }
1812 ol.popGeneratorState();
1813
1814 ol.endItemListItem();
1815 }
1816 if (!first) ol.endItemList();
1817
1818 ol.popGeneratorState();
1819}
1820
1822{
1823 int count=0;
1824 for (const auto &ibcd : m_inheritedBy)
1825 {
1826 const ClassDef *icd=ibcd.classDef;
1827 if ( icd->isVisibleInHierarchy()) count++;
1828 }
1829 return count;
1830}
1831
1833{
1834 int count=0;
1835 for (const auto &ibcd : m_inherits)
1836 {
1837 const ClassDef *icd=ibcd.classDef;
1838 if ( icd->isVisibleInHierarchy()) count++;
1839 }
1840 return count;
1841}
1842
1847
1849{
1850 bool haveDot = Config_getBool(HAVE_DOT);
1851 auto classGraph = m_typeInheritanceGraph;
1852
1853 if (classGraph == CLASS_GRAPH_t::NO) return;
1854 // count direct inheritance relations
1855 int count=countInheritanceNodes();
1856
1857 bool renderDiagram = false;
1858 if (haveDot && (classGraph==CLASS_GRAPH_t::YES || classGraph==CLASS_GRAPH_t::GRAPH))
1859 // write class diagram using dot
1860 {
1861 DotClassGraph inheritanceGraph(this,GraphType::Inheritance);
1862 if (inheritanceGraph.isTooBig())
1863 {
1864 warn_uncond("Inheritance graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
1865 name(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
1866 }
1867 else if (!inheritanceGraph.isTrivial())
1868 {
1869 ol.pushGeneratorState();
1871 ol.startDotGraph();
1873 ol.endDotGraph(inheritanceGraph);
1874 ol.popGeneratorState();
1875 renderDiagram = true;
1876 }
1877 }
1878 else if ((classGraph==CLASS_GRAPH_t::YES || classGraph==CLASS_GRAPH_t::GRAPH || classGraph==CLASS_GRAPH_t::BUILTIN) && count>0)
1879 // write class diagram using built-in generator
1880 {
1881 ClassDiagram diagram(this); // create a diagram of this class.
1882 ol.startClassDiagram();
1887 renderDiagram = true;
1888 }
1889
1890 if (renderDiagram) // if we already show the inheritance relations graphically,
1891 // then hide the text version
1892 {
1894 }
1895
1896 count = countInheritsNodes();
1897 if (count>0)
1898 {
1899 auto replaceFunc = [this,&ol](size_t entryIndex)
1900 {
1901 for (size_t index=0; index<m_inherits.size() ; index++)
1902 {
1903 const BaseClassDef &bcd=m_inherits[index];
1904 const ClassDef *cd=bcd.classDef;
1905
1906 if (cd->isVisibleInHierarchy()) // filter on the class we want to show
1907 {
1908 if (index==entryIndex) // found the requested index
1909 {
1910 // use the class name but with the template arguments as given
1911 // in the inheritance relation
1913 cd->displayName(),bcd.templSpecifiers);
1914
1915 if (cd->isLinkable())
1916 {
1918 cd->getOutputFileBase(),
1919 cd->anchor(),
1920 displayName);
1921 }
1922 else
1923 {
1924 ol.docify(displayName);
1925 }
1926 return;
1927 }
1928 }
1929 }
1930 };
1931
1932 ol.startParagraph();
1933 writeMarkerList(ol,
1935 static_cast<size_t>(count),
1936 replaceFunc);
1937 ol.endParagraph();
1938 }
1939
1940 // write subclasses
1941 count = countInheritedByNodes();
1942 if (count>0)
1943 {
1944 auto replaceFunc = [this,&ol](size_t entryIndex)
1945 {
1946 for (size_t index=0; index<m_inheritedBy.size() ; index++)
1947 {
1948 const BaseClassDef &bcd=m_inheritedBy[index];
1949 const ClassDef *cd=bcd.classDef;
1950 if (cd->isVisibleInHierarchy()) // filter on the class we want to show
1951 {
1952 if (index==entryIndex) // found the requested index
1953 {
1954 if (cd->isLinkable())
1955 {
1958 }
1959 else
1960 {
1961 ol.docify(cd->displayName());
1962 }
1963 return;
1964 }
1965 }
1966 }
1967 };
1968
1969 ol.startParagraph();
1970 writeMarkerList(ol,
1972 static_cast<size_t>(count),
1973 replaceFunc);
1974 ol.endParagraph();
1975 }
1976
1977 if (renderDiagram)
1978 {
1979 ol.enableAll();
1980 }
1981}
1982
1984{
1985 if (Config_getBool(HAVE_DOT) && m_hasCollaborationGraph /*&& Config_getBool(COLLABORATION_GRAPH)*/)
1986 {
1987 DotClassGraph usageImplGraph(this,GraphType::Collaboration);
1988 if (usageImplGraph.isTooBig())
1989 {
1990 warn_uncond("Collaboration graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
1991 name(), usageImplGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
1992 }
1993 else if (!usageImplGraph.isTrivial())
1994 {
1995 ol.pushGeneratorState();
1997 ol.startDotGraph();
1999 ol.endDotGraph(usageImplGraph);
2000 ol.popGeneratorState();
2001 }
2002 }
2003}
2004
2005
2007{
2008 if (m_incInfo)
2009 {
2010 DString nm;
2011 StringVector paths = Config_getList(STRIP_FROM_PATH);
2012 if (!paths.empty() && m_incInfo->fileDef)
2013 {
2014 DString abs = m_incInfo->fileDef->absFilePath();
2015 DString potential;
2016 size_t length = 0;
2017 for (const auto &s : paths)
2018 {
2019 FileInfo info(s);
2020 if (info.exists())
2021 {
2022 DString prefix = info.absFilePath();
2023 if (prefix.at(prefix.length() - 1) != '/')
2024 {
2025 prefix += '/';
2026 }
2027
2028 if (prefix.length() > length &&
2029 dstricmp(abs.left(prefix.length()).data(), prefix.data()) == 0) // case insensitive compare
2030 {
2031 length = prefix.length();
2032 potential = abs.mid(prefix.length());
2033 }
2034 }
2035 }
2036
2037 if (length > 0)
2038 {
2039 nm = potential;
2040 }
2041 }
2042
2043 if (nm.empty())
2044 {
2045 nm = m_incInfo->includeName;
2046 }
2047
2048 ol.startParagraph();
2049 ol.docify(theTranslator->trDefinedIn()+" ");
2050 ol.startTypewriter();
2051 ol.docify("<");
2052 if (m_incInfo->fileDef)
2053 {
2054 ol.writeObjectLink(DString(),m_incInfo->fileDef->includeName(),DString(),nm);
2055 }
2056 else
2057 {
2058 ol.docify(nm);
2059 }
2060 ol.docify(">");
2061 ol.endTypewriter();
2062 ol.endParagraph();
2063 }
2064
2065 // Write a summary of the Slice definition including metadata.
2066 ol.startParagraph();
2067 ol.startTypewriter();
2068 if (!m_metaData.empty())
2069 {
2070 ol.docify(m_metaData);
2071 ol.lineBreak();
2072 }
2073 if (m_spec.isLocal())
2074 {
2075 ol.docify("local ");
2076 }
2077 if (m_spec.isInterface())
2078 {
2079 ol.docify("interface ");
2080 }
2081 else if (m_spec.isStruct())
2082 {
2083 ol.docify("struct ");
2084 }
2085 else if (m_spec.isException())
2086 {
2087 ol.docify("exception ");
2088 }
2089 else
2090 {
2091 ol.docify("class ");
2092 }
2093 ol.docify(stripScope(name()));
2094 if (!m_inherits.empty())
2095 {
2096 if (m_spec.isInterface() || m_spec.isException())
2097 {
2098 ol.docify(" extends ");
2099 bool first=true;
2100 for (const auto &ibcd : m_inherits)
2101 {
2102 if (!first) ol.docify(", ");
2103 ClassDef *icd = ibcd.classDef;
2104 ol.docify(icd->name());
2105 first=false;
2106 }
2107 }
2108 else
2109 {
2110 // Must be a class.
2111 bool implements = false;
2112 for (const auto &ibcd : m_inherits)
2113 {
2114 ClassDef *icd = ibcd.classDef;
2115 if (icd->isInterface())
2116 {
2117 implements = true;
2118 }
2119 else
2120 {
2121 ol.docify(" extends ");
2122 ol.docify(icd->name());
2123 }
2124 }
2125 if (implements)
2126 {
2127 ol.docify(" implements ");
2128 bool first = true;
2129 for (const auto &ibcd : m_inherits)
2130 {
2131 ClassDef *icd = ibcd.classDef;
2132 if (icd->isInterface())
2133 {
2134 if (!first) ol.docify(", ");
2135 first = false;
2136 ol.docify(icd->name());
2137 }
2138 }
2139 }
2140 }
2141 }
2142 ol.docify(" { ... }");
2143 ol.endTypewriter();
2144 ol.endParagraph();
2145}
2146
2148{
2149 if (m_incInfo /*&& Config_getBool(SHOW_HEADERFILE)*/)
2150 {
2151 SrcLangExt lang = getLanguage();
2152 DString nm=m_incInfo->includeName.empty() ?
2153 (m_incInfo->fileDef ?
2154 m_incInfo->fileDef->docName() : DString()
2155 ) :
2156 m_incInfo->includeName;
2157 if (!nm.empty())
2158 {
2159 ol.startParagraph();
2160 ol.startTypewriter();
2161 ol.docify(::includeStatement(lang,m_incInfo->kind));
2162 ol.docify(::includeOpen(lang,m_incInfo->kind));
2163 ol.pushGeneratorState();
2165 ol.docify(nm);
2168 if (m_incInfo->fileDef)
2169 {
2170 ol.writeObjectLink(DString(),m_incInfo->fileDef->includeName(),DString(),nm);
2171 }
2172 else
2173 {
2174 ol.docify(nm);
2175 }
2176 ol.popGeneratorState();
2177 ol.docify(::includeClose(lang,m_incInfo->kind));
2178 ol.endTypewriter();
2179 ol.endParagraph();
2180 }
2181 }
2182}
2183
2184void ClassDefImpl::writeMemberGroups(OutputList &ol,bool showInline) const
2185{
2186 // write user defined member groups
2187 for (const auto &mg : m_memberGroups)
2188 {
2189 if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section
2190 {
2191 mg->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,showInline);
2192 }
2193 else // add this group to the corresponding member section
2194 {
2195 //printf("addToDeclarationSection(%s)\n",qPrint(mg->header()));
2196 //mg->addToDeclarationSection();
2197 }
2198 }
2199}
2200
2202{
2203 // nested classes
2204 m_innerClasses.writeDeclaration(ol,nullptr,title,true);
2205}
2206
2211
2213{
2214 //printf("%s: ClassDefImpl::startMemberDocumentation()\n",qPrint(name()));
2215 if (Config_getBool(SEPARATE_MEMBER_PAGES))
2216 {
2219 }
2220}
2221
2223{
2224 //printf("%s: ClassDefImpl::endMemberDocumentation()\n",qPrint(name()));
2225 if (Config_getBool(SEPARATE_MEMBER_PAGES))
2226 {
2229 }
2230}
2231
2233{
2234 //printf("%s: ClassDefImpl::startMemberDeclarations()\n",qPrint(name()));
2236}
2237
2239{
2240 //printf("%s: ClassDefImpl::endMemberDeclarations()\n",qPrint(name()));
2241 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
2242 if (!inlineInheritedMembers && countAdditionalInheritedMembers()>0)
2243 {
2244 ol.startMemberHeader("inherited");
2246 ol.endMemberHeader();
2248 }
2249 ol.endMemberSections();
2250}
2251
2263
2264
2266{
2267 static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
2268 ol.pushGeneratorState();
2270 bool first=true;
2271 SrcLangExt lang = getLanguage();
2272
2273 if (lang!=SrcLangExt::VHDL)
2274 {
2275 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2276 {
2277 if (lde->kind()==LayoutDocEntry::ClassNestedClasses &&
2279 )
2280 {
2281 for (const auto &innerCd : m_innerClasses)
2282 {
2283 if (!innerCd->isAnonymous() &&
2284 !innerCd->isExtension() &&
2285 (innerCd->protection()!=Protection::Private || extractPrivate) &&
2286 innerCd->visibleInParentsDeclList()
2287 )
2288 {
2289 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection *>(lde.get());
2290 ol.writeSummaryLink(DString(),"nested-classes",ls->title(lang),first);
2291 first=false;
2292 break;
2293 }
2294 }
2295 }
2296 else if (lde->kind()==LayoutDocEntry::ClassAllMembersLink &&
2298 !Config_getBool(OPTIMIZE_OUTPUT_FOR_C)
2299 )
2300 {
2302 first=false;
2303 }
2304 else if (lde->kind()==LayoutDocEntry::MemberDecl)
2305 {
2306 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2307 if (lmd)
2308 {
2309 MemberList * ml = getMemberList(lmd->type);
2310 if (ml && ml->declVisible())
2311 {
2312 ol.writeSummaryLink(DString(),ml->listType().toLabel(),lmd->title(lang),first);
2313 first=false;
2314 }
2315 }
2316 }
2317 }
2318 }
2319 else // VDHL only
2320 {
2321 for (const auto &s : m_vhdlSummaryTitles)
2322 {
2323 ol.writeSummaryLink(DString(),convertToId(s),s,first);
2324 first=false;
2325 }
2326 }
2327 if (!first)
2328 {
2329 ol.writeString(" </div>\n");
2330 }
2331 ol.popGeneratorState();
2332}
2333
2338
2340{
2341 if (!isLinkableInProject() || isArtificial()) return;
2342 tagFile << " <compound kind=\"";
2343 if (isFortran() && (compoundTypeString() == "type"))
2344 tagFile << "struct";
2345 else
2346 tagFile << compoundTypeString();
2347 tagFile << "\"";
2348 if (isObjectiveC()) { tagFile << " objc=\"yes\""; }
2349 tagFile << ">\n";
2350 tagFile << " <name>" << convertToXML(name()) << "</name>\n";
2353 tagFile << " <filename>" << convertToXML(fn) << "</filename>\n";
2354 if (!anchor().empty())
2355 {
2356 tagFile << " <anchor>" << convertToXML(anchor()) << "</anchor>\n";
2357 }
2358 DString idStr = id();
2359 if (!idStr.empty())
2360 {
2361 tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n";
2362 }
2363 for (const Argument &a : m_tempArgs)
2364 {
2365 tagFile << " <templarg>" << convertToXML(a.type);
2366 if (!a.name.empty())
2367 {
2368 tagFile << " " << convertToXML(a.name);
2369 }
2370 tagFile << "</templarg>\n";
2371 }
2372 for (const auto &ibcd : m_inherits)
2373 {
2374 ClassDef *cd=ibcd.classDef;
2375 if (cd && cd->isLinkable())
2376 {
2377 tagFile << " <base";
2378 if (ibcd.prot==Protection::Protected)
2379 {
2380 tagFile << " protection=\"protected\"";
2381 }
2382 else if (ibcd.prot==Protection::Private)
2383 {
2384 tagFile << " protection=\"private\"";
2385 }
2386 if (ibcd.virt==Specifier::Virtual)
2387 {
2388 tagFile << " virtualness=\"virtual\"";
2389 }
2391 cd->displayName(),ibcd.templSpecifiers);
2392 tagFile << ">" << convertToXML(displayName) << "</base>\n";
2393 }
2394 }
2395 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2396 {
2397 switch (lde->kind())
2398 {
2399 case LayoutDocEntry::ClassNestedClasses:
2400 {
2401 for (const auto &innerCd : m_innerClasses)
2402 {
2403 if (innerCd->isLinkableInProject() && !innerCd->isImplicitTemplateInstance() &&
2404 protectionLevelVisible(innerCd->protection()) &&
2405 !innerCd->isEmbeddedInOuterScope()
2406 )
2407 {
2408 tagFile << " <class kind=\"" << innerCd->compoundTypeString() <<
2409 "\">" << convertToXML(innerCd->name()) << "</class>\n";
2410 }
2411 }
2412 }
2413 break;
2414 case LayoutDocEntry::MemberDecl:
2415 {
2416 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2417 if (lmd)
2418 {
2419 MemberList * ml = getMemberList(lmd->type);
2420 if (ml)
2421 {
2422 ml->writeTagFile(tagFile);
2423 }
2424 }
2425 }
2426 break;
2427 case LayoutDocEntry::MemberGroups:
2428 {
2429 for (const auto &mg : m_memberGroups)
2430 {
2431 mg->writeTagFile(tagFile);
2432 }
2433 }
2434 break;
2435 default:
2436 break;
2437 }
2438 }
2439 writeDocAnchorsToTagFile(tagFile);
2440 tagFile << " </compound>\n";
2441}
2442
2443/** Write class documentation inside another container (i.e\. a group) */
2445{
2446 bool isSimple = m_isSimple;
2447
2448 ol.addIndexItem(name(),DString());
2449 //printf("ClassDefImpl::writeInlineDocumentation(%s)\n",qPrint(name()));
2450
2451 // part 1: anchor and title
2452 DString s = compoundTypeString()+" "+name();
2453
2454 // part 1a
2455 ol.pushGeneratorState();
2457 { // only HTML only
2458 ol.writeAnchor(DString(),anchor());
2459 ol.startMemberDoc(DString(),DString(),anchor(),name(),1,1,false);
2460 ol.startMemberDocName(false);
2461 ol.parseText(s);
2462 ol.endMemberDocName();
2463 ol.endMemberDoc(false);
2464 ol.writeString("</div>");
2465 ol.startIndent();
2466 }
2467 ol.popGeneratorState();
2468
2469 // part 1b
2470 ol.pushGeneratorState();
2473 { // for LaTeX/RTF only
2475 }
2476 ol.popGeneratorState();
2477
2478 // part 1c
2479 ol.pushGeneratorState();
2481 {
2482 // for LaTeX/RTF/Man
2483 ol.startGroupHeader("",1);
2484 ol.parseText(s);
2485 ol.endGroupHeader(1);
2486 }
2487 ol.popGeneratorState();
2488
2489 SrcLangExt lang=getLanguage();
2490
2491 // part 2: the header and detailed description
2492 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2493 {
2494 switch (lde->kind())
2495 {
2496 case LayoutDocEntry::BriefDesc:
2497 {
2498 // since we already shown the brief description in the
2499 // declaration part of the container, so we use this to
2500 // show the details on top.
2502 }
2503 break;
2504 case LayoutDocEntry::ClassInheritanceGraph:
2506 break;
2507 case LayoutDocEntry::ClassCollaborationGraph:
2509 break;
2510 case LayoutDocEntry::MemberDeclStart:
2512 break;
2513 case LayoutDocEntry::MemberDecl:
2514 {
2515 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2516 if (lmd)
2517 {
2518 ClassDefSet visitedClasses;
2519 if (!isSimple) writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang),true);
2520 }
2521 }
2522 break;
2523 case LayoutDocEntry::MemberGroups:
2524 if (!isSimple) writeMemberGroups(ol,true);
2525 break;
2526 case LayoutDocEntry::MemberDeclEnd:
2528 break;
2529 case LayoutDocEntry::MemberDefStart:
2531 break;
2532 case LayoutDocEntry::MemberDef:
2533 {
2534 const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get());
2535 if (lmd)
2536 {
2537 if (isSimple)
2538 {
2540 }
2541 else
2542 {
2543 writeMemberDocumentation(ol,lmd->type,lmd->title(lang),true);
2544 }
2545 }
2546 }
2547 break;
2548 case LayoutDocEntry::MemberDefEnd:
2550 break;
2551 default:
2552 break;
2553 }
2554 }
2555
2556 // part 3: close the block
2557 ol.pushGeneratorState();
2559 { // HTML only
2560 ol.endIndent();
2561 }
2562 ol.popGeneratorState();
2563}
2564
2566{
2567 // TODO: clean up this mess by moving it to
2568 // the output generators...
2569 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2570 bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS);
2571 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
2572
2573 // HTML only
2574 ol.pushGeneratorState();
2576 ol.docify(" ");
2578 anchor.empty() ? DString("details") : anchor);
2580 ol.endTextLink();
2581 ol.popGeneratorState();
2582
2583 if (!anchor.empty())
2584 {
2585 ol.pushGeneratorState();
2586 // LaTeX + RTF
2590 if (!(usePDFLatex && pdfHyperlinks))
2591 {
2593 }
2594 if (!rtfHyperlinks)
2595 {
2597 }
2598 ol.docify(" ");
2601 ol.endTextLink();
2602 // RTF only
2604 ol.writeString("\\par");
2605 ol.popGeneratorState();
2606 }
2607}
2608
2610{
2611 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
2612 bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES);
2613 bool extractLocalClasses = Config_getBool(EXTRACT_LOCAL_CLASSES);
2614 bool linkable = isLinkable();
2615 return (!isAnonymous() && !isExtension() &&
2616 (protection()!=Protection::Private || extractPrivate) &&
2617 (linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses)))
2618 );
2619}
2620
2621void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const DString &header,bool localNames) const
2622{
2623 //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
2624 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
2625 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
2626 SrcLangExt lang = getLanguage();
2628 {
2629 if (!found) // first class
2630 {
2631 if (sliceOpt)
2632 {
2633 if (compoundType()==Interface)
2634 {
2635 ol.startMemberHeader("interfaces");
2636 }
2637 else if (compoundType()==Struct)
2638 {
2639 ol.startMemberHeader("structs");
2640 }
2641 else if (compoundType()==Exception)
2642 {
2643 ol.startMemberHeader("exceptions");
2644 }
2645 else // compoundType==Class
2646 {
2647 ol.startMemberHeader("nested-classes");
2648 }
2649 }
2650 else // non-Slice optimization: single header for class/struct/..
2651 {
2652 ol.startMemberHeader("nested-classes");
2653 }
2654 if (!header.empty())
2655 {
2656 ol.parseText(header);
2657 }
2658 else if (lang==SrcLangExt::VHDL)
2659 {
2661 }
2662 else
2663 {
2664 ol.parseText(lang==SrcLangExt::Fortran ?
2667 }
2668 ol.endMemberHeader();
2669 ol.startMemberList();
2670 found=true;
2671 }
2673 DString ctype = compoundTypeString();
2674 DString cname = displayName(!localNames);
2675 DString anc = anchor();
2676 if (anc.empty()) anc = cname; else anc.prepend(cname+"_");
2678
2679 if (lang!=SrcLangExt::VHDL) // for VHDL we swap the name and the type
2680 {
2681 if (isSliceLocal())
2682 {
2683 ol.writeString("local ");
2684 }
2685 ol.writeString(ctype);
2686 ol.writeString(" ");
2687 ol.insertMemberAlign();
2688 }
2689 if (isLinkable())
2690 {
2693 anchor(),
2694 cname
2695 );
2696 }
2697 else
2698 {
2699 ol.startBold();
2700 ol.docify(cname);
2701 ol.endBold();
2702 }
2703 if (lang==SrcLangExt::VHDL) // now write the type
2704 {
2705 ol.writeString(" ");
2706 ol.insertMemberAlign();
2708 }
2710
2711 // add the brief description if available
2712 if (!briefDescription().empty() && Config_getBool(BRIEF_MEMBER_DESC))
2713 {
2714 auto parser { createDocParser() };
2715 auto ast { validatingParseDoc(*parser.get(),
2716 briefFile(),
2717 briefLine(),
2718 this,
2719 nullptr,
2721 DocOptions()
2722 .setSingleLine(true))
2723 };
2724 if (!ast->empty())
2725 {
2727 ol.writeDoc(ast.get(),this,nullptr);
2728 if (isLinkableInProject())
2729 {
2730 writeMoreLink(ol,anchor());
2731 }
2733 }
2734 }
2736 }
2737}
2738
2740{
2741 StringVector sl;
2742 if (isFinal()) sl.emplace_back("final");
2743 if (isSealed()) sl.emplace_back("sealed");
2744 if (isAbstract()) sl.emplace_back("abstract");
2745 if (isExported()) sl.emplace_back("export");
2746 if (getLanguage()==SrcLangExt::IDL && isPublished()) sl.emplace_back("published");
2747
2748 for (const auto &sx : m_qualifiers)
2749 {
2750 bool alreadyAdded = std::find(sl.begin(), sl.end(), sx) != sl.end();
2751 if (!alreadyAdded)
2752 {
2753 sl.push_back(sx);
2754 }
2755 }
2756
2757 ol.pushGeneratorState();
2759 if (!sl.empty())
2760 {
2761 ol.startLabels();
2762 size_t i=0;
2763 for (const auto &s : sl)
2764 {
2765 i++;
2766 ol.writeLabel(s,i==sl.size());
2767 }
2768 ol.endLabels();
2769 }
2770 ol.popGeneratorState();
2771}
2772
2774{
2775 ol.startContents();
2776
2777 DString pageType = " ";
2778 pageType += compoundTypeString();
2779
2780 bool exampleFlag=hasExamples();
2781
2782 //---------------------------------------- start flexible part -------------------------------
2783
2784 SrcLangExt lang = getLanguage();
2785
2786 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2787 {
2788 switch (lde->kind())
2789 {
2790 case LayoutDocEntry::BriefDesc:
2791 writeBriefDescription(ol,exampleFlag);
2792 break;
2793 case LayoutDocEntry::ClassIncludes:
2794 if (lang==SrcLangExt::Slice)
2795 {
2797 }
2798 else
2799 {
2801 }
2802 break;
2803 case LayoutDocEntry::ClassInheritanceGraph:
2805 break;
2806 case LayoutDocEntry::ClassCollaborationGraph:
2808 break;
2809 case LayoutDocEntry::ClassAllMembersLink:
2810 //writeAllMembersLink(ol); // this is now part of the summary links
2811 break;
2812 case LayoutDocEntry::MemberDeclStart:
2814 break;
2815 case LayoutDocEntry::MemberGroups:
2817 break;
2818 case LayoutDocEntry::MemberDecl:
2819 {
2820 ClassDefSet visitedClasses;
2821 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2822 if (lmd)
2823 {
2824 writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang));
2825 }
2826 }
2827 break;
2828 case LayoutDocEntry::ClassNestedClasses:
2829 {
2830 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
2831 if (ls)
2832 {
2833 writeNestedClasses(ol,ls->title(lang));
2834 }
2835 }
2836 break;
2837 case LayoutDocEntry::MemberDeclEnd:
2839 break;
2840 case LayoutDocEntry::DetailedDesc:
2841 {
2842 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
2843 if (ls)
2844 {
2845 writeDetailedDescription(ol,pageType,exampleFlag,ls->title(lang));
2846 }
2847 }
2848 break;
2849 case LayoutDocEntry::MemberDefStart:
2851 break;
2852 case LayoutDocEntry::ClassInlineClasses:
2854 break;
2855 case LayoutDocEntry::MemberDef:
2856 {
2857 const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get());
2858 if (lmd)
2859 {
2860 writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
2861 }
2862 }
2863 break;
2864 case LayoutDocEntry::MemberDefEnd:
2866 break;
2867 case LayoutDocEntry::ClassUsedFiles:
2868 showUsedFiles(ol);
2869 break;
2870 case LayoutDocEntry::AuthorSection:
2872 break;
2873 case LayoutDocEntry::NamespaceNestedNamespaces:
2874 case LayoutDocEntry::NamespaceNestedConstantGroups:
2875 case LayoutDocEntry::NamespaceClasses:
2876 case LayoutDocEntry::NamespaceConcepts:
2877 case LayoutDocEntry::NamespaceInterfaces:
2878 case LayoutDocEntry::NamespaceStructs:
2879 case LayoutDocEntry::NamespaceExceptions:
2880 case LayoutDocEntry::NamespaceInlineClasses:
2881 case LayoutDocEntry::ConceptDefinition:
2882 case LayoutDocEntry::FileClasses:
2883 case LayoutDocEntry::FileConcepts:
2884 case LayoutDocEntry::FileInterfaces:
2885 case LayoutDocEntry::FileStructs:
2886 case LayoutDocEntry::FileExceptions:
2887 case LayoutDocEntry::FileNamespaces:
2888 case LayoutDocEntry::FileConstantGroups:
2889 case LayoutDocEntry::FileIncludes:
2890 case LayoutDocEntry::FileIncludeGraph:
2891 case LayoutDocEntry::FileIncludedByGraph:
2892 case LayoutDocEntry::FileSourceLink:
2893 case LayoutDocEntry::FileInlineClasses:
2894 case LayoutDocEntry::GroupClasses:
2895 case LayoutDocEntry::GroupConcepts:
2896 case LayoutDocEntry::GroupModules:
2897 case LayoutDocEntry::GroupInlineClasses:
2898 case LayoutDocEntry::GroupNamespaces:
2899 case LayoutDocEntry::GroupDirs:
2900 case LayoutDocEntry::GroupNestedGroups:
2901 case LayoutDocEntry::GroupFiles:
2902 case LayoutDocEntry::GroupGraph:
2903 case LayoutDocEntry::GroupPageDocs:
2904 case LayoutDocEntry::ModuleExports:
2905 case LayoutDocEntry::ModuleClasses:
2906 case LayoutDocEntry::ModuleConcepts:
2907 case LayoutDocEntry::ModuleUsedFiles:
2908 case LayoutDocEntry::DirSubDirs:
2909 case LayoutDocEntry::DirFiles:
2910 case LayoutDocEntry::DirGraph:
2911 err("Internal inconsistency: member '{}' should not be part of LayoutDocManager::Class entry list\n",lde->entryToString());
2912 break;
2913 }
2914 }
2915
2916 ol.endContents();
2917}
2918
2920{
2921 DString pageTitle;
2922 SrcLangExt lang = getLanguage();
2923
2924 auto getReferenceTitle = [this](std::function<DString()> translateFunc) -> DString
2925 {
2926 return Config_getBool(HIDE_COMPOUND_REFERENCE) ? displayName() : translateFunc();
2927 };
2928
2929 if (lang==SrcLangExt::Fortran)
2930 {
2931 pageTitle = getReferenceTitle([this](){
2933 });
2934 }
2935 else if (lang==SrcLangExt::Slice)
2936 {
2937 pageTitle = getReferenceTitle([this](){
2939 });
2940 }
2941 else if (lang==SrcLangExt::VHDL)
2942 {
2943 pageTitle = getReferenceTitle([this](){
2945 });
2946 }
2947 else if (lang==SrcLangExt::CSharp && !m_primaryConstructorParams.empty())
2948 {
2949 pageTitle = getReferenceTitle([this](){
2951 m_compType,
2952 !m_tempArgs.empty());
2953 });
2954 }
2955 else if (isJavaEnum())
2956 {
2957 pageTitle = getReferenceTitle([this](){
2959 });
2960 }
2961 else if (m_compType==Service)
2962 {
2963 pageTitle = getReferenceTitle([this](){
2965 });
2966 }
2967 else if (m_compType==Singleton)
2968 {
2969 pageTitle = getReferenceTitle([this](){
2971 });
2972 }
2973 else
2974 {
2975 pageTitle = getReferenceTitle([this](){
2977 m_compType == Interface && getLanguage()==SrcLangExt::ObjC ? Class : m_compType,
2978 !m_tempArgs.empty());
2979 });
2980 }
2981 return pageTitle;
2982}
2983
2984// write all documentation for this class
2986{
2987 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2988 //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
2989 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
2990 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
2991 DString pageTitle = title();
2992
2994 if (sliceOpt)
2995 {
2996 if (compoundType()==Interface)
2997 {
2999 }
3000 else if (compoundType()==Struct)
3001 {
3003 }
3004 else if (compoundType()==Exception)
3005 {
3007 }
3008 else
3009 {
3011 }
3012 }
3013 else
3014 {
3016 }
3017
3018 AUTO_TRACE("name='{}' getOutputFileBase='{}'",name(),getOutputFileBase());
3019 bool hasAllMembersLink=false;
3020 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
3021 {
3022 if (lde->kind()==LayoutDocEntry::ClassAllMembersLink)
3023 {
3024 hasAllMembersLink = true;
3025 break;
3026 }
3027 }
3028 DString memListFile;
3029 if (hasAllMembersLink && !m_allMemberNameInfoLinkedMap.empty() && !Config_getBool(OPTIMIZE_OUTPUT_FOR_C))
3030 {
3031 memListFile = getMemberListFileName();
3032 }
3033 startFile(ol,getOutputFileBase(),false,name(),pageTitle,hli,!generateTreeView,DString(),0,memListFile);
3034 if (!generateTreeView)
3035 {
3037 {
3039 }
3040 ol.endQuickIndices();
3041 }
3042
3043 startTitle(ol,getOutputFileBase(),this);
3044 ol.parseText(pageTitle);
3046 addGroupListToTitle(ol,this);
3048 writeDocumentationContents(ol,pageTitle);
3049
3050 endFileWithNavPath(ol,this);
3051
3052 if (Config_getBool(SEPARATE_MEMBER_PAGES))
3053 {
3054 writeMemberPages(ol);
3055 }
3056}
3057
3059{
3060 ///////////////////////////////////////////////////////////////////////////
3061 //// Member definitions on separate pages
3062 ///////////////////////////////////////////////////////////////////////////
3063
3064 ol.pushGeneratorState();
3066
3067 for (const auto &ml : m_memberLists)
3068 {
3069 if (ml->numDocMembers()>ml->numDocEnumValues() && ml->listType().isDetailed())
3070 {
3071 ml->writeDocumentationPage(ol,displayName(),this);
3072 }
3073 }
3074
3075 ol.popGeneratorState();
3076}
3077
3079{
3080 bool createSubDirs=Config_getBool(CREATE_SUBDIRS);
3081
3082 ol.writeString(" <div class=\"navtab\">\n");
3083 ol.writeString(" <table>\n");
3084
3085 for (auto &mni : m_allMemberNameInfoLinkedMap)
3086 {
3087 for (auto &mi : *mni)
3088 {
3089 const MemberDef *md=mi->memberDef();
3090 if (md->getClassDef()==this && md->isLinkable() && !md->isEnumValue())
3091 {
3092 if (md->isLinkableInProject())
3093 {
3094 if (md==currentMd) // selected item => highlight
3095 {
3096 ol.writeString(" <tr><td class=\"navtabHL\">");
3097 }
3098 else
3099 {
3100 ol.writeString(" <tr><td class=\"navtab\">");
3101 }
3102 ol.writeString("<span class=\"label\"><a ");
3103 ol.writeString("href=\"");
3104 if (createSubDirs) ol.writeString("../../");
3105 DString url = md->getOutputFileBase();
3107 ol.writeString(url+"#"+md->anchor());
3108 ol.writeString("\">");
3109 ol.writeString(convertToHtml(md->name()));
3110 ol.writeString("</a></span>");
3111 ol.writeString("</td></tr>\n");
3112 }
3113 }
3114 }
3115 }
3116
3117 ol.writeString(" </table>\n");
3118 ol.writeString(" </div>\n");
3119}
3120
3121
3122
3124{
3125 // write inner classes after the parent, so the tag files contain
3126 // the definition in proper order!
3127 for (const auto &innerCd : m_innerClasses)
3128 {
3129 if (
3130 innerCd->isLinkableInProject() && !innerCd->isImplicitTemplateInstance() &&
3131 protectionLevelVisible(innerCd->protection()) &&
3132 !innerCd->isEmbeddedInOuterScope()
3133 )
3134 {
3135 msg("Generating docs for nested compound {}...\n",innerCd->displayName());
3136 innerCd->writeDocumentation(ol);
3137 innerCd->writeMemberList(ol);
3138 }
3139 innerCd->writeDocumentationForInnerClasses(ol);
3140 }
3141}
3142
3143// write the list of all (inherited) members for this class
3145{
3146 bool cOpt = Config_getBool(OPTIMIZE_OUTPUT_FOR_C);
3147 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
3148 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
3149 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3150 if (m_allMemberNameInfoLinkedMap.empty() || cOpt) return;
3151 // only for HTML
3152 ol.pushGeneratorState();
3154
3156 if (sliceOpt)
3157 {
3158 if (compoundType()==Interface)
3159 {
3161 }
3162 else if (compoundType()==Struct)
3163 {
3165 }
3166 else if (compoundType()==Exception)
3167 {
3169 }
3170 else
3171 {
3173 }
3174 }
3175 else
3176 {
3178 }
3179
3180 DString memListFile = getMemberListFileName();
3181 startFile(ol,memListFile,false,memListFile,theTranslator->trMemberList(),hli,!generateTreeView,getOutputFileBase());
3182 if (!generateTreeView)
3183 {
3185 {
3187 }
3188 ol.endQuickIndices();
3189 }
3190 startTitle(ol,DString());
3192 endTitle(ol,DString(),DString());
3193 ol.startContents();
3194 ol.startParagraph();
3196 ol.docify(" ");
3199 ol.endParagraph();
3200
3201 //ol.startItemList();
3202
3203 bool first = true; // to prevent empty table
3204 int idx=0;
3205 for (auto &mni : m_allMemberNameInfoLinkedMap)
3206 {
3207 for (auto &mi : *mni)
3208 {
3209 const MemberDef *md=mi->memberDef();
3210 const ClassDef *cd=md->getClassDef();
3211 Protection prot = mi->prot();
3212 Specifier virt=md->virtualness();
3213
3214 //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n",
3215 // qPrint(name()),qPrint(md->name()),qPrint(cd->name()),md->protection(),mi->prot,prot,mi->inherited);
3216
3217 if (cd && !md->name().empty() && !md->isAnonymous())
3218 {
3219 bool memberWritten=false;
3220 if (cd->isLinkable() && md->isLinkable())
3221 // create a link to the documentation
3222 {
3223 DString name=mi->ambiguityResolutionScope()+md->name();
3224 //ol.writeListItem();
3225 if (first)
3226 {
3227 ol.writeString("<table class=\"directory\">\n");
3228 first = false;
3229 }
3230 ol.writeString(" <tr");
3231 if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\"");
3232 idx++;
3233 ol.writeString("><td class=\"entry\">");
3234 if (cd->isObjectiveC())
3235 {
3236 if (md->isObjCMethod())
3237 {
3238 if (md->isStatic())
3239 ol.writeString("+&#160;</td><td>");
3240 else
3241 ol.writeString("-&#160;</td><td>");
3242 }
3243 else
3244 ol.writeString("</td><td class=\"entry\">");
3245 }
3246 if (md->isObjCMethod())
3247 {
3249 md->getOutputFileBase(),
3250 md->anchor(),md->name());
3251 }
3252 else
3253 {
3254 //Definition *bd = md->getGroupDef();
3255 //if (bd==nullptr) bd=cd;
3257 md->getOutputFileBase(),
3258 md->anchor(),name);
3259
3260 if ( md->isFunction() || md->isSignal() || md->isSlot() ||
3261 (md->isFriend() && !md->argsString().empty()))
3262 ol.docify(md->argsString());
3263 else if (md->isEnumerate())
3265 else if (md->isEnumValue())
3267 else if (md->isTypedef())
3268 ol.docify(" typedef");
3269 else if (md->isFriend() && md->typeString()=="friend class")
3270 ol.docify(" class");
3271 //ol.writeString("\n");
3272 }
3273 ol.writeString("</td>");
3274 memberWritten=true;
3275 }
3276 else if (!cd->isArtificial() &&
3277 !Config_getBool(HIDE_UNDOC_MEMBERS) &&
3279 ) // no documentation,
3280 // generate link to the class instead.
3281 {
3282 //ol.writeListItem();
3283 if (first)
3284 {
3285 ol.writeString("<table class=\"directory\">\n");
3286 first = false;
3287 }
3288 ol.writeString(" <tr bgcolor=\"#f0f0f0\"");
3289 if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\"");
3290 idx++;
3291 ol.writeString("><td class=\"entry\">");
3292 if (cd->isObjectiveC())
3293 {
3294 if (md->isObjCMethod())
3295 {
3296 if (md->isStatic())
3297 ol.writeString("+&#160;</td><td class=\"entry\">");
3298 else
3299 ol.writeString("-&#160;</td><td class=\"entry\">");
3300 }
3301 else
3302 ol.writeString("</td><td class=\"entry\">");
3303 }
3304 ol.startBold();
3305 ol.docify(md->name());
3306 ol.endBold();
3307 if (!md->isObjCMethod())
3308 {
3309 if ( md->isFunction() || md->isSignal() || md->isSlot() )
3310 ol.docify(md->argsString());
3311 else if (md->isEnumerate())
3313 else if (md->isEnumValue())
3315 else if (md->isTypedef())
3316 ol.docify(" typedef");
3317 }
3318 ol.writeString(" (");
3320 if (cd->isLinkable())
3321 {
3322 ol.writeObjectLink(
3323 cd->getReference(),
3324 cd->getOutputFileBase(),
3325 cd->anchor(),
3326 cd->displayName());
3327 }
3328 else
3329 {
3330 ol.startBold();
3331 ol.docify(cd->displayName());
3332 ol.endBold();
3333 }
3334 ol.writeString(")");
3335 ol.writeString("</td>");
3336 memberWritten=true;
3337 }
3338 if (memberWritten)
3339 {
3340 ol.writeString("<td class=\"entry\">");
3342 cd->getOutputFileBase(),
3343 cd->anchor(),
3344 md->category() ?
3345 md->category()->displayName() :
3346 cd->displayName());
3347 ol.writeString("</td>");
3348 ol.writeString("<td class=\"entry\">");
3349 }
3350 SrcLangExt lang = md->getLanguage();
3351 if (
3352 (prot!=Protection::Public || (virt!=Specifier::Normal && getLanguage()!=SrcLangExt::ObjC) ||
3353 md->isFriend() || md->isRelated() || md->isExplicit() ||
3354 md->isMutable() || (md->isInline() && Config_getBool(INLINE_INFO)) ||
3355 md->isSignal() || md->isSlot() || md->isThreadLocal() ||
3356 (getLanguage()==SrcLangExt::IDL &&
3357 (md->isOptional() || md->isAttribute() || md->isUNOProperty())) ||
3358 md->isStatic() || lang==SrcLangExt::VHDL
3359 )
3360 && memberWritten)
3361 {
3362 StringVector sl;
3363 if (lang==SrcLangExt::VHDL)
3364 {
3365 sl.push_back(theTranslator->trVhdlType(md->getVhdlSpecifiers(),true).str()); //append vhdl type
3366 }
3367 else if (md->isFriend()) sl.emplace_back("friend");
3368 else if (md->isRelated()) sl.emplace_back("related");
3369 else
3370 {
3371 if (Config_getBool(INLINE_INFO) && md->isInline())
3372 sl.emplace_back("inline");
3373 if (md->isExplicit()) sl.emplace_back("explicit");
3374 if (md->isMutable()) sl.emplace_back("mutable");
3375 if (md->isThreadLocal()) sl.emplace_back("thread_local");
3376 if (prot==Protection::Protected) sl.emplace_back("protected");
3377 else if (prot==Protection::Private) sl.emplace_back("private");
3378 else if (prot==Protection::Package) sl.emplace_back("package");
3379 if (virt==Specifier::Virtual && getLanguage()!=SrcLangExt::ObjC)
3380 sl.emplace_back("virtual");
3381 else if (virt==Specifier::Pure) sl.emplace_back("pure virtual");
3382 if (md->isStatic()) sl.emplace_back("static");
3383 if (md->isSignal()) sl.emplace_back("signal");
3384 if (md->isSlot()) sl.emplace_back("slot");
3385// this is the extra member page
3386 if (md->isOptional()) sl.emplace_back("optional");
3387 if (md->isAttribute()) sl.emplace_back("attribute");
3388 if (md->isUNOProperty()) sl.emplace_back("property");
3389 if (md->isReadonly()) sl.emplace_back("readonly");
3390 if (md->isBound()) sl.emplace_back("bound");
3391 if (md->isRemovable()) sl.emplace_back("removable");
3392 if (md->isConstrained()) sl.emplace_back("constrained");
3393 if (md->isTransient()) sl.emplace_back("transient");
3394 if (md->isMaybeVoid()) sl.emplace_back("maybevoid");
3395 if (md->isMaybeDefault()) sl.emplace_back("maybedefault");
3396 if (md->isMaybeAmbiguous()) sl.emplace_back("maybeambiguous");
3397 }
3398 bool firstSpan=true;
3399 for (const auto &s : sl)
3400 {
3401 if (!firstSpan)
3402 {
3403 ol.writeString("</span><span class=\"mlabel\">");
3404 }
3405 else
3406 {
3407 ol.writeString("<span class=\"mlabel\">");
3408 firstSpan=false;
3409 }
3410 ol.docify(s);
3411 }
3412 if (!firstSpan) ol.writeString("</span>");
3413 }
3414 if (memberWritten)
3415 {
3416 ol.writeString("</td>");
3417 ol.writeString("</tr>\n");
3418 }
3419 }
3420 }
3421 }
3422 //ol.endItemList();
3423
3424 if (!first) ol.writeString("</table>");
3425
3426 endFile(ol);
3427 ol.popGeneratorState();
3428}
3429
3430// add a reference to an example
3431bool ClassDefImpl::addExample(const DString &anchor,const DString &nameStr, const DString &file)
3432{
3433 return m_examples.inSort(Example(anchor,nameStr,file));
3434}
3435
3436// returns true if this class is used in an example
3438{
3439 return !m_examples.empty();
3440}
3441
3442void ClassDefImpl::addTypeConstraint(const DString &typeConstraint,const DString &type)
3443{
3444 //printf("addTypeConstraint(%s,%s)\n",qPrint(type),qPrint(typeConstraint));
3445 bool hideUndocRelation = Config_getBool(HIDE_UNDOC_RELATIONS);
3446 if (typeConstraint.empty() || type.empty()) return;
3447 SymbolResolver resolver(getFileDef());
3448 ClassDefMutable *cd = resolver.resolveClassMutable(this,typeConstraint);
3449 if (cd==nullptr && !hideUndocRelation)
3450 {
3451 cd = toClassDefMutable(
3452 Doxygen::hiddenClassLinkedMap->add(typeConstraint,
3453 std::unique_ptr<ClassDef>(
3454 new ClassDefImpl(
3456 getDefColumn(),
3457 typeConstraint,
3458 ClassDef::Class))));
3459 if (cd)
3460 {
3461 cd->setUsedOnly(true);
3462 cd->setLanguage(getLanguage());
3463 //printf("Adding undocumented constraint '%s' to class %s on type %s\n",
3464 // qPrint(typeConstraint),qPrint(name()),qPrint(type));
3465 }
3466 }
3467 if (cd)
3468 {
3469 auto it = std::find_if(m_constraintClassList.begin(),
3471 [&cd](const auto &ccd) { return ccd.classDef==cd; });
3472
3473 if (it==m_constraintClassList.end())
3474 {
3475 m_constraintClassList.emplace_back(cd);
3476 it = m_constraintClassList.end()-1;
3477 }
3478 (*it).addAccessor(type);
3479 //printf("Adding constraint '%s' to class %s on type %s\n",
3480 // qPrint(typeConstraint),qPrint(name()),qPrint(type));
3481 }
3482}
3483
3484// Java Type Constrains: A<T extends C & I>
3486{
3487 for (const Argument &a : m_tempArgs)
3488 {
3489 if (!a.typeConstraint.empty())
3490 {
3491 DString typeConstraint;
3492 size_t i=0,p=0;
3493 while ((i=a.typeConstraint.find('&',p))!=DString::npos) // typeConstraint="A &I" for C<T extends A & I>
3494 {
3495 typeConstraint = a.typeConstraint.mid(p,i-p).stripWhiteSpace();
3496 addTypeConstraint(typeConstraint,a.type);
3497 p=i+1;
3498 }
3499 typeConstraint = a.typeConstraint.mid(p).stripWhiteSpace();
3500 addTypeConstraint(typeConstraint,a.type);
3501 }
3502 }
3503}
3504
3505// C# Type Constraints: D<T> where T : C, I
3510
3512{
3513 m_tempArgs = al;
3514}
3515
3516static bool hasNonReferenceSuperClassRec(const ClassDef *cd,int level)
3517{
3518 bool found=!cd->isReference() && cd->isLinkableInProject() && !cd->isHidden();
3519 if (found)
3520 {
3521 return true; // we're done if this class is not a reference
3522 }
3523 for (const auto &ibcd : cd->subClasses())
3524 {
3525 const ClassDef *bcd=ibcd.classDef;
3526 if (level>256)
3527 {
3528 err("Possible recursive class relation while inside {} and looking for base class {}\n",cd->name(),bcd->name());
3529 return false;
3530 }
3531 // recurse into the super class branch
3532 found = found || hasNonReferenceSuperClassRec(bcd,level+1);
3533 if (!found)
3534 {
3535 // look for template instances that might have non-reference super classes
3536 for (const auto &cil : bcd->getTemplateInstances())
3537 {
3538 // recurse into the template instance branch
3539 found = hasNonReferenceSuperClassRec(cil.classDef,level+1);
3540 if (found) break;
3541 }
3542 }
3543 else
3544 {
3545 break;
3546 }
3547 }
3548 return found;
3549}
3550
3551/*! Returns \c true iff this class or a class inheriting from this class
3552 * is \e not defined in an external tag file.
3553 */
3555{
3556 return hasNonReferenceSuperClassRec(this,0);
3557}
3558
3563
3565{
3566 m_requiresClause = req;
3567}
3568
3573
3574/*! a link to this class is possible within this project */
3576{
3577 bool extractLocal = Config_getBool(EXTRACT_LOCAL_CLASSES);
3578 bool extractStatic = Config_getBool(EXTRACT_STATIC);
3579 bool hideUndoc = Config_getBool(HIDE_UNDOC_CLASSES);
3581 {
3583 }
3584 else
3585 {
3586 //printf("%s::isLinkableInProject() conditions: artificial=%d hidden=%d anonymous=%d protection=%d local=%d docs=%d static=%d ref=%d\n",
3587 // qPrint(name()),
3588 // !isArtificial(),
3589 // !isHidden(),
3590 // !isAnonymous(),
3591 // protectionLevelVisible(m_prot),
3592 // !m_isLocal || extractLocal,
3593 // hasDocumentation() || m_tempArgs.hasTemplateDocumentation() || !hideUndoc,
3594 // !m_isStatic || extractStatic,
3595 // !isReference());
3596 return
3597 !isArtificial() && !isHidden() && /* not hidden */
3598 !isAnonymous() && /* not anonymous */
3599 protectionLevelVisible(m_prot) && /* private/internal */
3600 (!m_isLocal || extractLocal) && /* local */
3601 (hasDocumentation() || m_tempArgs.hasTemplateDocumentation() || !hideUndoc) && /* documented */
3602 (!m_isStatic || extractStatic) && /* static */
3603 !isReference(); /* not an external reference */
3604 }
3605}
3606
3608{
3610 {
3611 return m_templateMaster->isLinkable();
3612 }
3613 else
3614 {
3615 return isReference() || isLinkableInProject();
3616 }
3617}
3618
3619
3620/*! the class is visible in a class diagram, or class hierarchy */
3622{
3623 bool allExternals = Config_getBool(ALLEXTERNALS);
3624 bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES);
3625 bool extractStatic = Config_getBool(EXTRACT_STATIC);
3626
3627 //printf("%s: isArtificial=%d isAnonymous=%d protectionLevelVisible=%d hasDocumentation=%d templateInstance=%d static=%d\n",
3628 // qPrint(name()),
3629 // (allExternals && !isArtificial()) || hasNonReferenceSuperClass(),
3630 // !isAnonymous(),
3631 // protectionLevelVisible(m_prot),
3632 // (hasDocumentation() || !hideUndocClasses || (m_templateMaster && m_templateMaster->hasDocumentation()) || isReference()),
3633 // !m_implicitTemplateInstance || !m_inherits.empty() || !m_inheritedBy.empty(),
3634 // !m_isStatic || extractStatic);
3635
3636 return // show all classes or a subclass is visible
3637 ((allExternals && !isArtificial()) || hasNonReferenceSuperClass()) &&
3638 // and not an anonymous compound
3639 !isAnonymous() &&
3640 // and not privately inherited
3642 // documented or shown anyway or documentation is external
3643 (hasDocumentation() ||
3644 !hideUndocClasses ||
3646 isReference()
3647 ) &&
3648 // if this is an implicit template instance then it most be part of the inheritance hierarchy
3649 (!m_implicitTemplateInstance || !m_inherits.empty() || !m_inheritedBy.empty()) &&
3650 // is not part of an unnamed namespace or shown anyway
3651 (!m_isStatic || extractStatic);
3652}
3653
3658
3659//----------------------------------------------------------------------
3660// recursive function:
3661// returns the distance to the base class definition 'bcd' represents an (in)direct base
3662// class of class definition 'cd' or nullptr if it does not.
3663
3664int ClassDefImpl::isBaseClass(const ClassDef *bcd, bool followInstances,const DString &templSpec) const
3665{
3666 int distance=0;
3667 //printf("isBaseClass(cd=%s) looking for %s templSpec=%s\n",qPrint(name()),qPrint(bcd->name()),qPrint(templSpec));
3668 for (const auto &bclass : baseClasses())
3669 {
3670 const ClassDef *ccd = bclass.classDef;
3671 if (!followInstances && ccd->templateMaster())
3672 {
3673 ccd=ccd->templateMaster();
3674 }
3675 if (ccd==bcd && (templSpec.empty() || templSpec==bclass.templSpecifiers))
3676 {
3677 distance=1;
3678 break; // no shorter path possible
3679 }
3680 else
3681 {
3682 int d = ccd->isBaseClass(bcd,followInstances,templSpec);
3683 if (d>256)
3684 {
3685 err("Possible recursive class relation while inside {} and looking for base class {}\n",name(),bcd->name());
3686 return 0;
3687 }
3688 else if (d>0) // path found
3689 {
3690 if (distance==0 || d+1<distance) // update if no path found yet or shorter path found
3691 {
3692 distance=d+1;
3693 }
3694 }
3695 }
3696 }
3697 return distance;
3698}
3699
3700//----------------------------------------------------------------------
3701
3702bool ClassDefImpl::isSubClass(ClassDef *cd,int level) const
3703{
3704 bool found=false;
3705 if (level>256)
3706 {
3707 err("Possible recursive class relation while inside {} and looking for derived class {}\n",name(),cd->name());
3708 return false;
3709 }
3710 for (const auto &iscd : subClasses())
3711 {
3712 ClassDef *ccd=iscd.classDef;
3713 found = (ccd==cd) || ccd->isSubClass(cd,level+1);
3714 if (found) break;
3715 }
3716 return found;
3717}
3718
3719//----------------------------------------------------------------------------
3720
3721static bool isStandardFunc(const MemberDef *md)
3722{
3723 return md->name()=="operator=" || // assignment operator
3724 md->isConstructor() || // constructor
3725 md->isDestructor(); // destructor
3726}
3727
3728void ClassDefImpl::mergeMembersFromBaseClasses(bool mergeVirtualBaseClass)
3729{
3730 SrcLangExt lang = getLanguage();
3732 size_t sepLen = sep.length();
3733 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
3734 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
3735
3736 auto insertMember = [&](const ClassDef *cd,MemberDef *md,Protection prot)
3737 {
3738 if (inlineInheritedMembers && !isStandardFunc(md))
3739 {
3740 //printf(" %s::insertMember(%s)\n",qPrint(name()),qPrint(srcMd->name()));
3741 internalInsertMember(md,prot,false);
3742 if (!cd->isLinkable()) // if the base is not linkable then move the member to this class
3743 {
3745 mdm->moveTo(this);
3746 mdm->setExplicitInherited(true);
3747 }
3748 }
3749 };
3750
3751 //printf(" mergeMembers for %s mergeVirtualBaseClass=%d\n",qPrint(name()),mergeVirtualBaseClass);
3752 // the merge the base members with this class' members
3753 for (const auto &bcd : baseClasses())
3754 {
3755 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
3756 if (bClass)
3757 {
3758 const MemberNameInfoLinkedMap &srcMnd = bClass->memberNameInfoLinkedMap();
3760
3761 for (auto &srcMni : srcMnd)
3762 {
3763 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
3764 if (dstMni)
3765 // a member with that name is already in the class.
3766 // the member may hide or reimplement the one in the sub class
3767 // or there may be another path to the base class that is already
3768 // visited via another branch in the class hierarchy.
3769 {
3770 //printf(" %s hides member name %s\n",qPrint(bClass->name()),qPrint(srcMni->memberName()));
3771 for (auto &srcMi : *srcMni)
3772 {
3773 MemberDef *srcMd = srcMi->memberDef();
3774 bool found=false;
3775 bool ambiguous=false;
3776 bool hidden=false;
3777 const ClassDef *srcCd = srcMd->getClassDef();
3778 for (auto &dstMi : *dstMni)
3779 {
3780 const MemberDef *dstMd = dstMi->memberDef();
3781 if (srcMd!=dstMd) // different members
3782 {
3783 const ClassDef *dstCd = dstMd->getClassDef();
3784 //printf(" Is %s a base class of %s?\n",qPrint(srcCd->name()),qPrint(dstCd->name()));
3785 if (srcCd==dstCd || dstCd->isBaseClass(srcCd,true))
3786 // member is in the same or a base class
3787 {
3788 const ArgumentList &srcAl = srcMd->argumentList();
3789 const ArgumentList &dstAl = dstMd->argumentList();
3790 found=matchArguments2(
3791 srcMd->getOuterScope(),srcMd->getFileDef(),srcMd->typeString(),&srcAl,
3792 dstMd->getOuterScope(),dstMd->getFileDef(),dstMd->typeString(),&dstAl,
3793 true,lang
3794 );
3795 //printf(" Yes, matching (%s<->%s): %d\n",
3796 // qPrint(argListToString(srcMd->argumentList())),
3797 // qPrint(argListToString(dstMd->argumentList())),
3798 // found);
3799 hidden = hidden || !found;
3800 }
3801 else // member is in a non base class => multiple inheritance
3802 // using the same base class.
3803 {
3804 //printf(" $$ Existing member %s %s add scope %s\n",
3805 // qPrint(dstMi->ambiguityResolutionScope()),
3806 // qPrint(dstMd->name()),
3807 // qPrint(dstMi->scopePath().left(dstMi->scopePath().find("::")+2)));
3808
3809 size_t scopeSepPos = dstMi->scopePath().find(sep);
3810 DString scope = dstMi->scopePath().left(scopeSepPos!=DString::npos ? scopeSepPos+sepLen : 0);
3811 if (scope!=dstMi->ambiguityResolutionScope().left(scope.length()))
3812 {
3813 dstMi->setAmbiguityResolutionScope(scope+dstMi->ambiguityResolutionScope());
3814 }
3815 ambiguous=true;
3816 }
3817 }
3818 else // same members
3819 {
3820 // do not add if base class is virtual or
3821 // if scope paths are equal or
3822 // if base class is an interface (and thus implicitly virtual).
3823 //printf(" same member found srcMi->virt=%d dstMi->virt=%d\n",srcMi->virt(),dstMi->virt());
3824 if ((srcMi->virt()!=Specifier::Normal && dstMi->virt()!=Specifier::Normal) ||
3825 bClass->name()+sep+srcMi->scopePath() == dstMi->scopePath() ||
3827 )
3828 {
3829 found=true;
3830 }
3831 else // member can be reached via multiple paths in the
3832 // inheritance tree
3833 {
3834 //printf(" $$ Existing member %s %s add scope %s\n",
3835 // qPrint(dstMi->ambiguityResolutionScope()),
3836 // qPrint(dstMd->name()),
3837 // qPrint(dstMi->scopePath().left(dstMi->scopePath().find("::")+2)));
3838
3839 size_t scopeSepPos = dstMi->scopePath().find(sep);
3840 DString scope = dstMi->scopePath().left(scopeSepPos!=DString::npos ? scopeSepPos+sepLen : 0);
3841 if (scope!=dstMi->ambiguityResolutionScope().left(scope.length()))
3842 {
3843 dstMi->setAmbiguityResolutionScope(dstMi->ambiguityResolutionScope()+scope);
3844 }
3845 ambiguous=true;
3846 }
3847 }
3848 if (found) break;
3849 }
3850 //printf(" member %s::%s hidden %d ambiguous %d srcMi->ambigClass=%p found=%d\n",
3851 // qPrint(srcCd->name()),qPrint(srcMd->name()),hidden,ambiguous,
3852 // (void*)srcMi->ambigClass(),found);
3853
3854 // TODO: fix the case where a member is hidden by inheritance
3855 // of a member with the same name but with another prototype,
3856 // while there is more than one path to the member in the
3857 // base class due to multiple inheritance. In this case
3858 // it seems that the member is not reachable by prefixing a
3859 // scope name either (according to my compiler). Currently,
3860 // this case is shown anyway.
3861 if (!found && srcMd->protection()!=Protection::Private && !srcMd->isFriend() &&
3862 srcMi->virtualBaseClass()==mergeVirtualBaseClass && lang!=SrcLangExt::Python)
3863 {
3864 Protection prot = srcMd->protection();
3865 if (bcd.prot==Protection::Protected && prot==Protection::Public)
3866 {
3867 prot = bcd.prot;
3868 }
3869 else if (bcd.prot==Protection::Private)
3870 {
3871 prot = bcd.prot;
3872 }
3873
3874 insertMember(bClass,srcMd,prot);
3875
3876 Specifier virt=srcMi->virt();
3877 if (virt==Specifier::Normal && bcd.virt!=Specifier::Normal) virt=bcd.virt;
3878 bool virtualBaseClass = bcd.virt!=Specifier::Normal;
3879
3880 auto newMi = std::make_unique<MemberInfo>(srcMd,prot,virt,true,virtualBaseClass);
3881 newMi->setScopePath(bClass->name()+sep+srcMi->scopePath());
3882 if (ambiguous)
3883 {
3884 //printf("$$ New member %s %s add scope %s::\n",
3885 // qPrint(srcMi->ambiguityResolutionScope),
3886 // qPrint(srcMd->name()),
3887 // qPrint(bClass->name()));
3888
3889 DString scope=bClass->name()+sep;
3890 if (scope!=srcMi->ambiguityResolutionScope().left(scope.length()))
3891 {
3892 newMi->setAmbiguityResolutionScope(scope+srcMi->ambiguityResolutionScope());
3893 }
3894 }
3895 if (hidden)
3896 {
3897 if (srcMi->ambigClass()==nullptr)
3898 {
3899 newMi->setAmbigClass(bClass);
3900 newMi->setAmbiguityResolutionScope(bClass->name()+sep);
3901 }
3902 else
3903 {
3904 newMi->setAmbigClass(srcMi->ambigClass());
3905 newMi->setAmbiguityResolutionScope(srcMi->ambigClass()->name()+sep);
3906 }
3907 }
3908 dstMni->push_back(std::move(newMi));
3909 }
3910 }
3911 }
3912 else // base class has a member that is not in the sub class => copy
3913 {
3914 //printf(" %s adds member name %s\n",qPrint(bClass->name()),qPrint(srcMni->memberName()));
3915 // create a deep copy of the list (only the MemberInfo's will be
3916 // copied, not the actual MemberDef's)
3917 MemberNameInfo *newMni = dstMnd.add(srcMni->memberName());
3918
3919 // copy the member(s) from the base to the sub class
3920 for (auto &mi : *srcMni)
3921 {
3922 if (mi->virtualBaseClass()==mergeVirtualBaseClass && !mi->memberDef()->isFriend()) // don't inherit friends
3923 {
3924 Protection prot = mi->prot();
3925 if (bcd.prot==Protection::Protected)
3926 {
3927 if (prot==Protection::Public) prot=Protection::Protected;
3928 }
3929 else if (bcd.prot==Protection::Private)
3930 {
3931 prot=Protection::Private;
3932 }
3933 Specifier virt=mi->virt();
3934 bool virtualBaseClass = bcd.virt!=Specifier::Normal || mi->virtualBaseClass();
3935 if (virt==Specifier::Normal && bcd.virt!=Specifier::Normal) virt=bcd.virt;
3936 //printf(" %s::%s: [mi.prot=%d, bcd.prot=%d => prot=%d], [mi.virt=%d, bcd.virt=%d => virt=%d] virtualBase=%d\n",
3937 // qPrint(name()),qPrint(mi->memberDef()->name()),
3938 // mi->prot(),bcd.prot,prot,
3939 // mi->virt(),bcd.virt,virt,
3940 // virtualBaseClass
3941 // );
3942
3943 if (prot!=Protection::Private || extractPrivate)
3944 {
3945 insertMember(bClass,mi->memberDef(),prot);
3946
3947 //printf("Adding!\n");
3948 std::unique_ptr<MemberInfo> newMi = std::make_unique<MemberInfo>(mi->memberDef(),prot,virt,true,virtualBaseClass);
3949 newMi->setScopePath(bClass->name()+sep+mi->scopePath());
3950 newMi->setAmbigClass(mi->ambigClass());
3951 newMi->setAmbiguityResolutionScope(mi->ambiguityResolutionScope());
3952 newMni->push_back(std::move(newMi));
3953 }
3954 }
3955 }
3956 }
3957 }
3958 }
3959 }
3960}
3961
3962// See issue11260, referring to a variable in a base class will make doxygen
3963// add it as a member to the derived class, but this is not correct for non-private variables
3964// so we correct this here, now we know the inheritance hierarchy
3966{
3967 //printf("hideDerivedVariableInPython()\n");
3968 if (bClass)
3969 {
3970 const MemberNameInfoLinkedMap &srcMnd = bClass->memberNameInfoLinkedMap();
3972
3973 // recurse up the inheritance hierarchy
3974 for (const auto &bcd : bClass->baseClasses())
3975 {
3977 }
3978
3979 for (auto &srcMni : srcMnd) // for each member in a base class
3980 {
3981 //printf(" candidate(%s)\n",qPrint(srcMni->memberName()));
3982 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
3983 if (dstMni) // that is also in this class
3984 {
3986 //printf("%s member in %s and %s\n",qPrint(name()),qPrint(bClass->name()),qPrint(name()));
3987 for (it=dstMni->begin();it!=dstMni->end();)
3988 {
3989 MemberDefMutable *dstMd = toMemberDefMutable((*it)->memberDef());
3990 if (dstMd && dstMd->isVariable() && !dstMd->name().startsWith("__"))
3991 {
3992 //printf(" hiding member %s\n",qPrint(dstMd->name()));
3993 // hide a member variable if it is already defined in a base class, unless
3994 // it is a __private variable
3995 removeMemberFromLists(dstMd);
3996 it = dstMni->erase(it);
3997 }
3998 else
3999 {
4000 ++it;
4001 }
4002 }
4003 if (dstMni->empty()) // if the list has become empty, remove the entry from the dictionary
4004 {
4005 dstMnd.del(srcMni->memberName());
4006 }
4007 }
4008 }
4009 }
4010}
4011
4012/*!
4013 * recursively merges the 'all members' lists of a class base
4014 * with that of this class. Must only be called for classes without
4015 * subclasses!
4016 */
4018{
4019 if (m_membersMerged) return;
4020 if (getLanguage()==SrcLangExt::Python)
4021 {
4022 for (const auto &bcd : baseClasses())
4023 {
4024 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
4026 }
4027 }
4028
4029 //printf("> %s::mergeMembers()\n",qPrint(name()));
4030
4031 m_membersMerged=true;
4032
4033 // first merge the members of the base class recursively
4034 for (const auto &bcd : baseClasses())
4035 {
4036 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
4037 if (bClass)
4038 {
4039 // merge the members in the base class of this inheritance branch first
4040 bClass->mergeMembers();
4041 }
4042 }
4043
4044 // first merge the member that are not inherited via a virtual base class
4045 // (as this can end up reimplemented via multiple paths, see #10717 for examples)
4047 // then process the member that are inherited via a virtual base class to add the
4048 // ones that are not reimplemented via any path
4050
4051 //printf("< %s::mergeMembers()\n",qPrint(name()));
4052}
4053
4054//----------------------------------------------------------------------------
4055
4056/*! Merges the members of a Objective-C category into this class.
4057 */
4059{
4060 AUTO_TRACE();
4061 ClassDefMutable *category = toClassDefMutable(cat);
4062 if (category)
4063 {
4064 bool extractLocalMethods = Config_getBool(EXTRACT_LOCAL_METHODS);
4065 bool makePrivate = category->isLocal();
4066 // in case extract local methods is not enabled we don't add the methods
4067 // of the category in case it is defined in the .m file.
4068 if (makePrivate && !extractLocalMethods) return;
4069 bool isExtension = category->isExtension();
4070
4071 category->setCategoryOf(this);
4072 if (isExtension)
4073 {
4074 category->setArtificial(true);
4075
4076 // copy base classes/protocols from extension
4077 for (const auto &bcd : category->baseClasses())
4078 {
4079 insertBaseClass(bcd.classDef,bcd.usedName,bcd.prot,bcd.virt,bcd.templSpecifiers);
4080 // correct bcd.classDef so that they do no longer derive from
4081 // category, but from this class!
4082 BaseClassList scl = bcd.classDef->subClasses();
4083 for (auto &scd : scl)
4084 {
4085 if (scd.classDef==category)
4086 {
4087 scd.classDef=this;
4088 }
4089 }
4090 bcd.classDef->updateSubClasses(scl);
4091 }
4092 }
4093 // make methods private for categories defined in the .m file
4094 //printf("%s::mergeCategory makePrivate=%d\n",qPrint(name()),makePrivate);
4095
4096 const MemberNameInfoLinkedMap &srcMnd = category->memberNameInfoLinkedMap();
4098
4099 for (auto &srcMni : srcMnd)
4100 {
4101 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
4102 if (dstMni) // method is already defined in the class
4103 {
4104 AUTO_TRACE_ADD("Existing member {}",srcMni->memberName());
4105 const auto &dstMi = dstMni->front();
4106 const auto &srcMi = srcMni->front();
4107 if (srcMi && dstMi)
4108 {
4109 MemberDefMutable *smdm = toMemberDefMutable(srcMi->memberDef());
4110 MemberDefMutable *dmdm = toMemberDefMutable(dstMi->memberDef());
4111 if (smdm && dmdm)
4112 {
4114 dmdm->setCategory(category);
4115 dmdm->setCategoryRelation(smdm);
4116 smdm->setCategoryRelation(dmdm);
4117 }
4118 }
4119 }
4120 else // new method name
4121 {
4122 AUTO_TRACE_ADD("New member {}",srcMni->memberName());
4123 // create a deep copy of the list
4124 MemberNameInfo *newMni = dstMnd.add(srcMni->memberName());
4125
4126 // copy the member(s) from the category to this class
4127 for (auto &mi : *srcMni)
4128 {
4129 //printf("Adding '%s'\n",qPrint(mi->memberDef->name()));
4130 Protection prot = mi->prot();
4131 //if (makePrivate) prot = Private;
4132 auto newMd = mi->memberDef()->deepCopy();
4133 if (newMd)
4134 {
4135 auto mmd = toMemberDefMutable(newMd.get());
4136 AUTO_TRACE_ADD("Copying member {}",mmd->name());
4137 if (mmd)
4138 {
4139 mmd->moveTo(this);
4140 }
4141
4142 auto newMi=std::make_unique<MemberInfo>(newMd.get(),prot,mi->virt(),mi->inherited(),mi->virtualBaseClass());
4143 newMi->setScopePath(mi->scopePath());
4144 newMi->setAmbigClass(mi->ambigClass());
4145 newMi->setAmbiguityResolutionScope(mi->ambiguityResolutionScope());
4146 newMni->push_back(std::move(newMi));
4147
4148 // also add the newly created member to the global members list
4149
4150 DString name = newMd->name();
4152
4153 if (mmd)
4154 {
4155 mmd->setCategory(category);
4156 mmd->setCategoryRelation(mi->memberDef());
4157 }
4158 auto miMmd = toMemberDefMutable(mi->memberDef());
4159 if (miMmd) miMmd->setCategoryRelation(newMd.get());
4160
4161 if (mmd && (makePrivate || isExtension))
4162 {
4163 mmd->makeImplementationDetail();
4164 }
4165 internalInsertMember(newMd.get(),prot,false);
4166 mn->push_back(std::move(newMd));
4167 }
4168 }
4169 }
4170 }
4171 }
4172}
4173
4174//----------------------------------------------------------------------------
4175
4177 Protection prot)
4178{
4179 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
4180 bool umlLook = Config_getBool(UML_LOOK);
4181 if (prot==Protection::Private && !extractPrivate) return;
4182 //printf("%s::addUsedClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName);
4183
4184 auto it = std::find_if(m_usesImplClassList.begin(),
4185 m_usesImplClassList.end(),
4186 [&cd](const auto &ucd) { return ucd.classDef==cd; });
4187 if (it==m_usesImplClassList.end())
4188 {
4189 m_usesImplClassList.emplace_back(cd);
4190 //printf("Adding used class %s to class %s via accessor %s\n",
4191 // qPrint(cd->name()),qPrint(name()),accessName);
4192 it = m_usesImplClassList.end()-1;
4193 }
4194 DString acc = accessName;
4195 if (umlLook)
4196 {
4197 switch(prot)
4198 {
4199 case Protection::Public: acc.prepend("+"); break;
4200 case Protection::Private: acc.prepend("-"); break;
4201 case Protection::Protected: acc.prepend("#"); break;
4202 case Protection::Package: acc.prepend("~"); break;
4203 }
4204 }
4205 (*it).addAccessor(acc);
4206}
4207
4209 Protection prot)
4210{
4211 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
4212 bool umlLook = Config_getBool(UML_LOOK);
4213 if (prot==Protection::Private && !extractPrivate) return;
4214 //printf("%s::addUsedByClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName);
4215 //
4216 auto it = std::find_if(m_usedByImplClassList.begin(),
4218 [&cd](const auto &ucd) { return ucd.classDef==cd; });
4219 if (it==m_usedByImplClassList.end())
4220 {
4221 m_usedByImplClassList.emplace_back(cd);
4222 //printf("Adding used by class %s to class %s\n",
4223 // qPrint(cd->name()),qPrint(name()));
4224 it = m_usedByImplClassList.end()-1;
4225 }
4226 DString acc = accessName;
4227 if (umlLook)
4228 {
4229 switch(prot)
4230 {
4231 case Protection::Public: acc.prepend("+"); break;
4232 case Protection::Private: acc.prepend("-"); break;
4233 case Protection::Protected: acc.prepend("#"); break;
4234 case Protection::Package: acc.prepend("~"); break;
4235 }
4236 }
4237 (*it).addAccessor(acc);
4238}
4239
4240
4245
4247{
4248 bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
4249 bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS);
4251 {
4252 Definition *scope=nullptr;
4253 if (inlineGroupedClasses && !partOfGroups().empty())
4254 {
4255 // point to the group that embeds this class
4256 return partOfGroups().front()->getOutputFileBase();
4257 }
4258 else if (inlineSimpleClasses && m_isSimple && !partOfGroups().empty())
4259 {
4260 // point to simple struct inside a group
4261 return partOfGroups().front()->getOutputFileBase();
4262 }
4263 else if (inlineSimpleClasses && m_isSimple && (scope=getOuterScope()))
4264 {
4265 if (scope==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) // simple struct embedded in file
4266 {
4267 return getFileDef()->getOutputFileBase();
4268 }
4269 else if (scope->isLinkableInProject()) // simple struct embedded in other container (namespace/group/class)
4270 {
4271 return getOuterScope()->getOutputFileBase();
4272 }
4273 }
4274 }
4275 AUTO_TRACE("name='{}' m_templateMaster={} m_implicitTemplateInstance={}",name(),(void*)m_templateMaster,m_implicitTemplateInstance);
4277 {
4278 // point to the template of which this class is an instance
4279 return m_templateMaster->getOutputFileBase();
4280 }
4281 return m_fileName;
4282}
4283
4288
4290{
4292 {
4294 }
4295 else
4296 {
4298 }
4299}
4300
4301void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const DString &fileName,int startLine,bool hasDocs)
4302{
4303 gd->addClass(this);
4304 //printf("ClassDefImpl::setGroupDefForAllMembers(%s)\n",qPrint(gd->name()));
4305 for (auto &mni : m_allMemberNameInfoLinkedMap)
4306 {
4307 for (auto &mi : *mni)
4308 {
4309 MemberDefMutable *md = toMemberDefMutable(mi->memberDef());
4310 if (md)
4311 {
4312 md->setGroupDef(gd,pri,fileName,startLine,hasDocs);
4313 gd->insertMember(md,true);
4314 ClassDefMutable *innerClass = toClassDefMutable(const_cast<ClassDef*>(md->getClassDefOfAnonymousType()));
4315 if (innerClass) innerClass->setGroupDefForAllMembers(gd,pri,fileName,startLine,hasDocs);
4316 }
4317 }
4318 }
4319}
4320
4322{
4323 //printf("**** %s::addInnerCompound(%s)\n",qPrint(name()),qPrint(d->name()));
4324 if (d->definitionType()==Definition::TypeClass) // only classes can be
4325 // nested in classes.
4326 {
4328 }
4329}
4330
4332{
4333 return m_innerClasses.find(name);
4334}
4335
4337 int startLine, size_t startColumn, const DString &templSpec,bool &freshInstance)
4338{
4339 freshInstance = false;
4340 auto it = std::find_if(m_templateInstances.begin(),
4341 m_templateInstances.end(),
4342 [&templSpec](const auto &ti) { return templSpec==ti.templSpec; });
4343 ClassDefMutable *templateClass=nullptr;
4344 if (it!=m_templateInstances.end())
4345 {
4346 templateClass = toClassDefMutable((*it).classDef);
4347 }
4348 if (templateClass==nullptr)
4349 {
4350 DString tcname = removeRedundantWhiteSpace(name()+templSpec);
4351 AUTO_TRACE("New template instance class name='{}' templSpec='{}' inside '{}' hidden={}",
4352 name(),templSpec,name(),isHidden());
4353
4354 ClassDef *foundCd = Doxygen::classLinkedMap->find(tcname);
4355 if (foundCd)
4356 {
4357 return foundCd;
4358 }
4359 templateClass =
4361 Doxygen::classLinkedMap->add(tcname,
4362 std::unique_ptr<ClassDef>(
4363 new ClassDefImpl(fileName,startLine,startColumn,tcname,ClassDef::Class))));
4364 if (templateClass)
4365 {
4366 templateClass->setTemplateMaster(this);
4367 ArgumentList tal = *stringToArgumentList(getLanguage(),templSpec);
4368 templateClass->setTemplateArguments(tal);
4369 templateClass->setOuterScope(getOuterScope());
4370 templateClass->setHidden(isHidden());
4371 templateClass->setArtificial(isArtificial());
4372 templateClass->setImplicitTemplateInstance(true);
4373 m_templateInstances.emplace_back(templSpec,templateClass);
4374
4375 // also add nested classes
4376 for (const auto &innerCd : m_innerClasses)
4377 {
4378 DString innerName = tcname+"::"+innerCd->localName();
4379 ClassDefMutable *innerClass =
4381 Doxygen::classLinkedMap->add(innerName,
4382 std::unique_ptr<ClassDef>(
4383 new ClassDefImpl(fileName,startLine,startColumn,innerName,ClassDef::Class))));
4384 if (innerClass)
4385 {
4386 templateClass->addInnerCompound(innerClass);
4387 innerClass->setOuterScope(templateClass);
4388 innerClass->setHidden(isHidden());
4389 innerClass->setArtificial(true);
4390 innerClass->setImplicitTemplateInstance(true);
4391 }
4392 }
4393 freshInstance=true;
4394 }
4395 }
4396 return templateClass;
4397}
4398
4400{
4401 AUTO_TRACE("this={} cd={} templSpec={}",name(),templateClass->name(),templSpec);
4402 m_templateInstances.emplace_back(templSpec,templateClass);
4403}
4404
4406{
4407 m_templBaseClassNames = templateNames;
4408}
4409
4414
4417 const DString &templSpec)
4418{
4419 AUTO_TRACE("this={} md={}",name(),md->name());
4420 auto actualArguments_p = stringToArgumentList(getLanguage(),templSpec);
4421 auto imd = md->createTemplateInstanceMember(templateArguments,actualArguments_p);
4422 auto mmd = toMemberDefMutable(imd.get());
4423 mmd->setMemberClass(this);
4424 mmd->setTemplateMaster(md);
4425 mmd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
4426 mmd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
4427 mmd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
4428 mmd->setMemberSpecifiers(md->getMemberSpecifiers());
4429 mmd->setMemberGroupId(md->getMemberGroupId());
4430 mmd->setArtificial(true);
4431 insertMember(imd.get());
4432 //printf("Adding member=%s %s%s to class %s templSpec %s\n",
4433 // imd->typeString(),qPrint(imd->name()),imd->argsString(),
4434 // qPrint(imd->getClassDef()->name()),templSpec);
4435 // insert imd in the list of all members
4436 //printf("Adding member=%s class=%s\n",qPrint(imd->name()),qPrint(name()));
4437 MemberName *mn = Doxygen::memberNameLinkedMap->add(imd->name());
4438 mn->push_back(std::move(imd));
4439}
4440
4442{
4443 AUTO_TRACE("this={} cd={} templSpec={}",name(),cd->name(),templSpec);
4444 //printf("%s::addMembersToTemplateInstance(%s,%s)\n",qPrint(name()),qPrint(cd->name()),templSpec);
4445 for (const auto &mni : cd->memberNameInfoLinkedMap())
4446 {
4447 for (const auto &mi : *mni)
4448 {
4449 const MemberDef *md = mi->memberDef();
4450 if (m_allMemberNameInfoLinkedMap.find(md->name())==nullptr) // only insert the member if not hidden by one with the same name (#11541)
4451 {
4453 }
4454 }
4455 }
4456 // also instantiate members for nested classes
4457 for (const auto &innerCd : cd->getClasses())
4458 {
4459 ClassDefMutable *ncd = toClassDefMutable(m_innerClasses.find(innerCd->localName()));
4460 if (ncd)
4461 {
4462 ncd->addMembersToTemplateInstance(innerCd,cd->templateArguments(),templSpec);
4463 }
4464 }
4465}
4466
4468{
4470 {
4472 }
4473 else
4474 {
4476 }
4477}
4478
4480{
4482 {
4483 return m_templateMaster->isReference();
4484 }
4485 else
4486 {
4488 }
4489}
4490
4492{
4493 ArgumentLists result;
4495 while (d && d->definitionType()==Definition::TypeClass)
4496 {
4497 result.insert(result.begin(),toClassDef(d)->templateArguments());
4498 d = d->getOuterScope();
4499 }
4500 if (!templateArguments().empty())
4501 {
4502 result.push_back(templateArguments());
4503 }
4504 return result;
4505}
4506
4508 const ArgumentLists *actualParams,uint32_t *actualParamIndex) const
4509{
4510 return makeQualifiedNameWithTemplateParameters(this,actualParams,actualParamIndex);
4511}
4512
4514{
4516 auto lang = getLanguage();
4517 if (lang==SrcLangExt::CSharp)
4518 {
4520 }
4521 return name;
4522}
4523
4525{
4526 m_className = name;
4527}
4528
4530{
4531 if (!isLinkableInProject()) return;
4532 SrcLangExt lang = getLanguage();
4534 qualifiedName(),
4537 displayName(),
4538 DString(),
4539 this
4540 );
4541 for (const auto &mg : m_memberGroups)
4542 {
4543 mg->addListReferences(this);
4544 }
4545 for (auto &ml : m_memberLists)
4546 {
4547 if (ml->listType().isDetailed())
4548 {
4549 ml->addListReferences(this);
4550 }
4551 }
4552}
4553
4555{
4556 if (!isLinkableInProject()) return;
4558 for (const auto &mg : m_memberGroups)
4559 {
4560 mg->addRequirementReferences(this);
4561 }
4562 for (auto &ml : m_memberLists)
4563 {
4564 if (ml->listType().isDetailed())
4565 {
4566 ml->addRequirementReferences(this);
4567 }
4568 }
4569}
4570
4572{
4573 const MemberDef *xmd = nullptr;
4575 if (mni)
4576 {
4577 const int maxInheritanceDepth = 100000;
4578 int mdist=maxInheritanceDepth;
4579 for (auto &mi : *mni)
4580 {
4581 const ClassDef *mcd=mi->memberDef()->getClassDef();
4582 int m=minClassDistance(this,mcd);
4583 //printf("found member in %s linkable=%d m=%d\n",
4584 // qPrint(mcd->name()),mcd->isLinkable(),m);
4585 if (m<mdist)
4586 {
4587 mdist=m;
4588 xmd=mi->memberDef();
4589 }
4590 }
4591 }
4592 //printf("getMemberByName(%s)=%p\n",qPrint(name),xmd);
4593 return xmd;
4594}
4595
4597{
4598 return md->getClassDef() && isBaseClass(md->getClassDef(),true,DString());
4599}
4600
4602{
4603 for (auto &ml : m_memberLists)
4604 {
4605 if (ml->listType()==lt)
4606 {
4607 return ml.get();
4608 }
4609 }
4610 return nullptr;
4611}
4612
4614{
4615 AUTO_TRACE("{} md={} lt={} isBrief={}",name(),md->name(),lt,isBrief);
4616 bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
4617 bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
4618 const auto &ml = m_memberLists.get(lt,MemberListContainer::Class);
4619 ml->setNeedsSorting((isBrief && sortBriefDocs) || (!isBrief && sortMemberDocs));
4620 ml->push_back(md);
4621
4622 // for members in the declaration lists we set the section, needed for member grouping
4623 if (!ml->listType().isDetailed())
4624 {
4626 if (mdm)
4627 {
4628 mdm->setSectionList(this,ml.get());
4629 }
4630 }
4631}
4632
4634{
4635 for (auto &ml : m_memberLists)
4636 {
4637 if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(false); }
4638 }
4639 if (Config_getBool(SORT_BRIEF_DOCS))
4640 {
4641 std::stable_sort(m_innerClasses.begin(),
4643 [](const auto &c1,const auto &c2)
4644 {
4645 return Config_getBool(SORT_BY_SCOPE_NAME) ?
4646 dstricmp_sort(c1->name(), c2->name() )<0 :
4647 dstricmp_sort(c1->className(), c2->className())<0 ;
4648 });
4649 }
4650}
4651
4653 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const
4654{
4655 //printf("%s: countMemberDeclarations for %s and %s\n",qPrint(name()),lt.to_string(),lt2.to_string());
4656 int count=0;
4657 MemberList * ml = getMemberList(lt);
4658 MemberList * ml2 = getMemberList(lt2);
4659 if (getLanguage()!=SrcLangExt::VHDL) // use specific declarations function
4660 {
4661 if (ml)
4662 {
4663 count+=ml->numDecMembers(inheritedFrom);
4664 //printf("-> ml=%d\n",ml->numDecMembers());
4665 }
4666 if (ml2)
4667 {
4668 count+=ml2->numDecMembers(inheritedFrom);
4669 //printf("-> ml2=%d\n",ml2->numDecMembers());
4670 }
4671 // also include grouped members that have their own section in the class (see bug 722759)
4672 if (inheritedFrom)
4673 {
4674 for (const auto &mg : m_memberGroups)
4675 {
4676 count+=mg->countGroupedInheritedMembers(lt);
4677 if (!lt2.isInvalid()) count+=mg->countGroupedInheritedMembers(lt2);
4678 }
4679 }
4680 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
4681 if (!inlineInheritedMembers) // show inherited members as separate lists
4682 {
4683 count+=countInheritedDecMembers(lt,inheritedFrom,invert,showAlways,visitedClasses);
4684 }
4685 }
4686 //printf("-> %d\n",count);
4687 return count;
4688}
4689
4691{
4692 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4693 {
4694 if (lde->kind()==LayoutDocEntry::MemberDecl)
4695 {
4696 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4697 if (lmd)
4698 {
4699 MemberList * ml = getMemberList(lmd->type);
4700 if (ml)
4701 {
4703 }
4704 }
4705 }
4706 else if (lde->kind()==LayoutDocEntry::MemberGroups)
4707 {
4708 for (const auto &mg : m_memberGroups)
4709 {
4710 mg->setAnonymousEnumType();
4711 }
4712 }
4713 }
4714}
4715
4717{
4718 for (auto &ml : m_memberLists)
4719 {
4720 ml->countDecMembers();
4721 ml->countDocMembers();
4722 }
4723 for (const auto &mg : m_memberGroups)
4724 {
4725 mg->countDecMembers();
4726 mg->countDocMembers();
4727 }
4728}
4729
4731 const ClassDef *inheritedFrom,bool invert,bool showAlways,
4732 ClassDefSet &visitedClasses) const
4733{
4734 int inhCount = 0;
4735 int count = countMembersIncludingGrouped(lt,inheritedFrom,false);
4736 bool process = count>0;
4737 //printf("%s: countInheritedDecMembers: lt=%s process=%d count=%d invert=%d\n",
4738 // qPrint(name()),lt.to_string(),process,count,invert);
4739 if ((process^invert) || showAlways)
4740 {
4741 for (const auto &ibcd : m_inherits)
4742 {
4743 ClassDefMutable *icd = toClassDefMutable(ibcd.classDef);
4746 if (icd && icd->isLinkable())
4747 {
4748 convertProtectionLevel(lt,ibcd.prot,&lt1,&lt2);
4749 //printf("%s: convert %s->(%s,%s) prot=%d\n",
4750 // qPrint(icd->name()),lt.to_string(),lt1.to_string(),lt2.to_string(),ibcd.prot);
4751 if (visitedClasses.find(icd)==visitedClasses.end())
4752 {
4753 visitedClasses.insert(icd); // guard for multiple virtual inheritance
4754 if (!lt1.isInvalid())
4755 {
4756 inhCount+=icd->countMemberDeclarations(lt1,inheritedFrom,lt2,false,true,visitedClasses);
4757 }
4758 }
4759 }
4760 }
4761 }
4762 //printf("%s: count=%d\n",qPrint(name()),inhCount);
4763 return inhCount;
4764}
4765
4767 DString &title,DString &subtitle) const
4768{
4769 SrcLangExt lang = getLanguage();
4770 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4771 {
4772 if (lde->kind()==LayoutDocEntry::MemberDecl)
4773 {
4774 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4775 if (lmd && lmd->type==type)
4776 {
4777 title = lmd->title(lang);
4778 subtitle = lmd->subtitle(lang);
4779 return;
4780 }
4781 }
4782 }
4783 title="";
4784 subtitle="";
4785}
4786
4788{
4789 int totalCount=0;
4790 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4791 {
4792 if (lde->kind()==LayoutDocEntry::MemberDecl)
4793 {
4794 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4795 if (lmd && lmd->type!=MemberListType::Friends()) // friendship is not inherited
4796 {
4797 ClassDefSet visited;
4798 totalCount+=countInheritedDecMembers(lmd->type,this,true,false,visited);
4799 }
4800 }
4801 }
4802 //printf("countAdditionalInheritedMembers()=%d\n",totalCount);
4803 return totalCount;
4804}
4805
4807{
4808 //printf("**** writeAdditionalInheritedMembers()\n");
4809 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4810 {
4811 if (lde->kind()==LayoutDocEntry::MemberDecl)
4812 {
4813 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4814 if (lmd && lmd->type!=MemberListType::Friends())
4815 {
4816 ClassDefSet visited;
4817 writeInheritedMemberDeclarations(ol,visited,lmd->type,MemberListType::Invalid(),lmd->title(getLanguage()),this,true,false);
4818 }
4819 }
4820 }
4821}
4822
4824 const ClassDef *inheritedFrom,bool additional) const
4825{
4826 int count=0;
4827 MemberList *ml = getMemberList(lt);
4828 if (ml)
4829 {
4830 count=ml->countInheritableMembers(inheritedFrom);
4831 }
4832 //printf("%s:countMembersIncludingGrouped: count=%d\n",qPrint(name()),count);
4833 for (const auto &mg : m_memberGroups)
4834 {
4835 bool hasOwnSection = !mg->allMembersInSameSection() ||
4836 !m_subGrouping; // group is in its own section
4837 if ((additional && hasOwnSection) || (!additional && !hasOwnSection))
4838 {
4839 count+=mg->countGroupedInheritedMembers(lt);
4840 }
4841 }
4842 //printf("%s:countMembersIncludingGrouped(lt=%s,%s)=%d\n",
4843 // qPrint(name()),qPrint(lt.to_string()),ml?qPrint(ml->listType().to_string()):"<none>",count);
4844 return count;
4845}
4846
4847
4850 const ClassDef *inheritedFrom,bool invert,bool showAlways) const
4851{
4852 int count = countMembersIncludingGrouped(lt,inheritedFrom,false);
4853 bool process = count>0;
4854 //printf("%s: writeInheritedMemberDec: lt=%s process=%d invert=%d always=%d\n",
4855 // qPrint(name()),qPrint(lt.to_string()),process,invert,showAlways);
4856 if ((process^invert) || showAlways)
4857 {
4858 for (const auto &ibcd : m_inherits)
4859 {
4860 ClassDefMutable *icd=toClassDefMutable(ibcd.classDef);
4861 if (icd && icd->isLinkable())
4862 {
4865 convertProtectionLevel(lt,ibcd.prot,&lt1,&lt3);
4866 if (lt2.isInvalid() && !lt3.isInvalid())
4867 {
4868 lt2=lt3;
4869 }
4870 //printf("%s:convert %s->(%s,%s) prot=%d\n",qPrint(icd->name()),qPrint(lt.to_string()),
4871 // qPrint(lt1.to_string()),qPrint(lt2.to_string()),ibcd.prot);
4872 if (visitedClasses.find(icd)==visitedClasses.end())
4873 {
4874 visitedClasses.insert(icd); // guard for multiple virtual inheritance
4875 if (!lt1.isInvalid())
4876 {
4877 //printf("--> writeMemberDeclarations for type %s\n",qPrint(lt1.to_string()));
4878 icd->writeMemberDeclarations(ol,visitedClasses,lt1,
4879 title,DString(),false,inheritedFrom,lt2,false,true);
4880 }
4881 }
4882 else
4883 {
4884 //printf("%s: class already visited!\n",qPrint(icd->name()));
4885 }
4886 }
4887 }
4888 }
4889}
4890
4892 MemberListType lt,const DString &title,
4893 const DString &subTitle,bool showInline,const ClassDef *inheritedFrom,MemberListType lt2,
4894 bool invert,bool showAlways) const
4895{
4896 //printf("%s: ClassDefImpl::writeMemberDeclarations lt=%s lt2=%s\n",qPrint(name()),qPrint(lt.to_string()),qPrint(lt2.to_string()));
4897 MemberList * ml = getMemberList(lt);
4898 MemberList * ml2 = getMemberList(lt2);
4899 if (getLanguage()==SrcLangExt::VHDL) // use specific declarations function
4900 {
4901 static const ClassDef *cdef;
4902 if (cdef!=this)
4903 { // only one inline link
4905 cdef=this;
4906 }
4907 if (ml)
4908 {
4909 VhdlDocGen::writeVhdlDeclarations(ml,ol,nullptr,this,nullptr,nullptr,nullptr);
4910 }
4911 }
4912 else
4913 {
4914 //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",qPrint(name()),qPrint(title),(void*)ml,(void*)ml2);
4915 DString tt = title, st = subTitle;
4916 if (ml)
4917 {
4918 //printf(" writeDeclarations ml type=%s count=%d\n",qPrint(lt.to_string()),ml->numDecMembers(inheritedFrom));
4919 ml->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,tt,st,false,showInline,inheritedFrom,lt,true);
4920 tt.clear();
4921 st.clear();
4922 }
4923 if (ml2)
4924 {
4925 //printf(" writeDeclarations ml2 type=%s count=%d\n",qPrint(lt2.to_string()),ml2->numDecMembers(inheritedFrom));
4926 ml2->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,tt,st,false,showInline,inheritedFrom,lt,ml==nullptr);
4927 }
4928 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
4929 if (!inlineInheritedMembers) // show inherited members as separate lists
4930 {
4931 writeInheritedMemberDeclarations(ol,visitedClasses,lt,lt2,title,
4932 inheritedFrom ? inheritedFrom : this,
4933 invert,showAlways);
4934 }
4935 }
4936}
4937
4939 const ClassDef *inheritedFrom,const DString &inheritId) const
4940{
4941 //printf("** %s::addGroupedInheritedMembers() inheritId=%s\n",qPrint(name()),qPrint(inheritId));
4942 for (const auto &mg : m_memberGroups)
4943 {
4944 if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section
4945 {
4946 mg->addGroupedInheritedMembers(ol,this,lt,inheritedFrom,inheritId);
4947 }
4948 }
4949}
4950
4952{
4953 //printf("%s: ClassDefImpl::writeMemberDocumentation()\n",qPrint(name()));
4954 MemberList * ml = getMemberList(lt);
4955 if (ml) ml->writeDocumentation(ol,displayName(),this,title,ml->listType().toLabel(),false,showInline);
4956}
4957
4959{
4960 //printf("%s: ClassDefImpl::writeSimpleMemberDocumentation()\n",qPrint(name()));
4961 MemberList * ml = getMemberList(lt);
4962 if (ml) ml->writeSimpleDocumentation(ol,this);
4963}
4964
4966 MemberListType lt,bool inGroup,
4967 int indentLevel,const ClassDef *inheritedFrom,const DString &inheritId) const
4968{
4969 //printf("%s: ClassDefImpl::writePlainMemberDeclaration()\n",qPrint(name()));
4970 MemberList * ml = getMemberList(lt);
4971 if (ml)
4972 {
4973 ml->writePlainDeclarations(ol,inGroup,this,nullptr,nullptr,nullptr,nullptr,indentLevel,inheritedFrom,inheritId);
4974 }
4975}
4976
4978{
4979 return m_isLocal;
4980}
4981
4986
4991
4993{
4994 return m_inherits;
4995}
4996
4998{
4999 m_inherits = bcd;
5000}
5001
5003{
5004 return m_inheritedBy;
5005}
5006
5008{
5009 m_inheritedBy = bcd;
5010}
5011
5016
5018{
5019 std::stable_sort(m_allMemberNameInfoLinkedMap.begin(),
5021 [](const auto &m1,const auto &m2)
5022 {
5023 return dstricmp_sort(m1->memberName(),m2->memberName())<0;
5024 });
5025}
5026
5028{
5029 return m_prot;
5030}
5031
5033{
5034 return m_tempArgs;
5035}
5036
5038{
5039 return m_fileDef;
5040}
5041
5043{
5044 return m_moduleDef;
5045}
5046
5051
5053{
5054 return m_templateMaster;
5055}
5056
5061
5066
5068{
5069 return !m_tempArgs.empty();
5070}
5071
5073{
5074 return m_incInfo.get();
5075}
5076
5081
5086
5091
5093{
5094 return m_isTemplArg;
5095}
5096
5098{
5099 return m_isAbstract || m_spec.isAbstract();
5100}
5101
5103{
5104 return m_spec.isFinal();
5105}
5106
5108{
5109 return m_spec.isSealed();
5110}
5111
5113{
5114 return m_spec.isPublished();
5115}
5116
5118{
5119 return m_spec.isForwardDecl();
5120}
5121
5123{
5124 return m_spec.isInterface();
5125}
5126
5128{
5129 return getLanguage()==SrcLangExt::ObjC;
5130}
5131
5133{
5134 return getLanguage()==SrcLangExt::Fortran;
5135}
5136
5138{
5139 return getLanguage()==SrcLangExt::CSharp;
5140}
5141
5143{
5144 return m_categoryOf;
5145}
5146
5148{
5149 return m_memberLists;
5150}
5151
5153{
5154 return m_memberGroups;
5155}
5156
5158{
5159 m_fileDef = fd;
5160}
5161
5163{
5164 m_moduleDef = mod;
5165}
5166
5168{
5169 m_subGrouping = enabled;
5170}
5171
5173{
5174 m_prot=p;
5175 if (getLanguage()==SrcLangExt::VHDL && VhdlDocGen::convert(p)==VhdlDocGen::ARCHITECTURECLASS)
5176 {
5177 m_className = name();
5178 }
5179}
5180
5182{
5183 m_isStatic=b;
5184}
5185
5190
5192{
5193 ASSERT(tm!=this);
5195}
5196
5198{
5199 m_isTemplArg = b;
5200}
5201
5203{
5204 m_categoryOf = cd;
5205}
5206
5208{
5209 m_usedOnly = b;
5210}
5211
5213{
5214 return m_usedOnly;
5215}
5216
5218{
5219 return m_isSimple;
5220}
5221
5223{
5224 return m_arrowOperator;
5225}
5226
5228{
5229 md->setMemberType(t);
5230 for (auto &ml : m_memberLists)
5231 {
5232 ml->remove(md);
5233 }
5234 insertMember(md);
5235}
5236
5238{
5239 DString anc;
5241 {
5243 {
5244 // point to the template of which this class is an instance
5246 }
5247 else
5248 {
5249 anc = m_fileName;
5250 }
5251 }
5252 return anc;
5253}
5254
5256{
5257 bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
5258 bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS);
5259
5260 Definition *container = getOuterScope();
5261
5262 bool containerLinkable =
5263 container &&
5264 (
5265 (container==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) || // global class in documented file
5266 container->isLinkableInProject() // class in documented scope
5267 );
5268
5269 if (isAnonymous())
5270 {
5271 return false; // don't inline an anonymous class
5272 }
5273
5274 // inline because of INLINE_GROUPED_CLASSES=YES ?
5275 bool b1 = (inlineGroupedClasses && !partOfGroups().empty()); // a grouped class
5276 // inline because of INLINE_SIMPLE_STRUCTS=YES ?
5277 bool b2 = (inlineSimpleClasses && m_isSimple && // a simple class
5278 (containerLinkable || // in a documented container
5279 !partOfGroups().empty() // or part of a group
5280 )
5281 );
5282 //printf("%s::isEmbeddedInOuterScope(): inlineGroupedClasses=%d "
5283 // "inlineSimpleClasses=%d partOfGroups()=%d m_isSimple=%d "
5284 // "getOuterScope()=%s b1=%d b2=%d\n",
5285 // qPrint(name()),inlineGroupedClasses,inlineSimpleClasses,
5286 // !partOfGroups().empty(),m_isSimple,getOuterScope()?qPrint(getOuterScope()->name()):"<none>",b1,b2);
5287 return b1 || b2; // either reason will do
5288}
5289
5291{
5292 return m_tagLessRef;
5293}
5294
5296{
5297 m_tagLessRef = cd;
5298}
5299
5301{
5302 for (auto &ml : m_memberLists)
5303 {
5304 ml->remove(md);
5305 }
5306}
5307
5309{
5310 return m_isJavaEnum;
5311}
5312
5314{
5315 m_spec = spec;
5316}
5317
5319{
5320 for (const auto &sx : qualifiers)
5321 {
5322 bool alreadyAdded = std::find(m_qualifiers.begin(), m_qualifiers.end(), sx) != m_qualifiers.end();
5323 if (!alreadyAdded)
5324 {
5325 m_qualifiers.push_back(sx);
5326 }
5327 }
5328}
5329
5334
5336{
5337 AUTO_TRACE("name={}",md->name());
5338 const auto &mni = m_allMemberNameInfoLinkedMap.find(md->name());
5339 if (mni)
5340 {
5341 for (const auto &mi : *mni)
5342 {
5343 const MemberDef *classMd = mi->memberDef();
5344 const ArgumentList &classAl = classMd->argumentList();
5345 const ArgumentList &al = md->argumentList();
5346 bool found = matchArguments2(
5347 classMd->getOuterScope(),classMd->getFileDef(),classMd->typeString(),&classAl,
5348 md->getOuterScope(),md->getFileDef(),md->typeString(),&al,
5349 true,getLanguage()
5350 );
5351 if (found)
5352 {
5353 AUTO_TRACE_EXIT("true");
5354 return true;
5355 }
5356 }
5357 }
5358 AUTO_TRACE_EXIT("false");
5359 return false;
5360}
5361
5363{
5364 DString n = name();
5365 size_t si = n.find('(');
5366 size_t ei = n.find(')');
5367 bool b = si!=DString::npos && ei!=DString::npos && ei>si && n.mid(si+1,ei-si-1).stripWhiteSpace().empty();
5368 return b;
5369}
5370
5372{
5373 return m_files;
5374}
5375
5377{
5378 return m_typeConstraints;
5379}
5380
5382{
5383 return m_examples;
5384}
5385
5387{
5388 return m_subGrouping;
5389}
5390
5392{
5393 return m_spec.isLocal();
5394}
5395
5397{
5398 m_metaData = md;
5399}
5400
5405
5410
5412{
5414}
5415
5417{
5419}
5420
5422{
5423 switch (compoundType())
5424 {
5425 case Class: return CodeSymbolType::Class; break;
5426 case Struct: return CodeSymbolType::Struct; break;
5427 case Union: return CodeSymbolType::Union; break;
5428 case Interface: return CodeSymbolType::Interface; break;
5429 case Protocol: return CodeSymbolType::Protocol; break;
5430 case Category: return CodeSymbolType::Category; break;
5431 case Exception: return CodeSymbolType::Exception; break;
5432 case Service: return CodeSymbolType::Service; break;
5433 case Singleton: return CodeSymbolType::Singleton; break;
5434 }
5435 return CodeSymbolType::Class;
5436}
5437
5442
5447
5448
5449// --- Cast functions
5450//
5452{
5453 if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
5454 {
5455 return static_cast<ClassDef*>(d);
5456 }
5457 else
5458 {
5459 return nullptr;
5460 }
5461}
5462
5464{
5465 Definition *d = toDefinition(md);
5466 if (d && typeid(*d)==typeid(ClassDefImpl))
5467 {
5468 return static_cast<ClassDef*>(d);
5469 }
5470 else
5471 {
5472 return nullptr;
5473 }
5474}
5475
5477{
5478 if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
5479 {
5480 return static_cast<const ClassDef*>(d);
5481 }
5482 else
5483 {
5484 return nullptr;
5485 }
5486}
5487
5489{
5490 if (d && typeid(*d)==typeid(ClassDefImpl))
5491 {
5492 return static_cast<ClassDefMutable*>(d);
5493 }
5494 else
5495 {
5496 return nullptr;
5497 }
5498}
5499
5500// --- Helpers
5501
5502/*! Get a class definition given its name.
5503 * Returns nullptr if the class is not found.
5504 */
5506{
5507 if (n.empty()) return nullptr;
5508 return Doxygen::classLinkedMap->find(n);
5509}
5510
5512{
5513 for (const auto &bcd : bcl)
5514 {
5515 const ClassDef *cd=bcd.classDef;
5516 if (cd->isVisibleInHierarchy()) return true;
5517 if (classHasVisibleRoot(cd->baseClasses())) return true;
5518 }
5519 return false;
5520}
5521
5523{
5524 BaseClassList bcl;
5525
5526 if (cd->getLanguage()==SrcLangExt::VHDL) // reverse baseClass/subClass relation
5527 {
5528 if (cd->baseClasses().empty()) return false;
5529 bcl=cd->baseClasses();
5530 }
5531 else
5532 {
5533 if (cd->subClasses().empty()) return false;
5534 bcl=cd->subClasses();
5535 }
5536
5537 for (const auto &bcd : bcl)
5538 {
5539 if (bcd.classDef->isVisibleInHierarchy())
5540 {
5541 return true;
5542 }
5543 }
5544 return false;
5545}
5546
5548{
5549 bool allExternals = Config_getBool(ALLEXTERNALS);
5550 return (allExternals && cd->isLinkable()) || cd->isLinkableInProject();
5551}
5552
5553//----------------------------------------------------------------------
5554// recursive function that returns the number of branches in the
5555// inheritance tree that the base class 'bcd' is below the class 'cd'
5556
5557int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level)
5558{
5559 const int maxInheritanceDepth = 100000;
5560 if (bcd->categoryOf()) // use class that is being extended in case of
5561 // an Objective-C category
5562 {
5563 bcd=bcd->categoryOf();
5564 }
5565 if (cd==bcd) return level;
5566 if (level==256)
5567 {
5568 warn_uncond("class {} seem to have a recursive inheritance relation!\n",cd->name());
5569 return -1;
5570 }
5571 int m=maxInheritanceDepth;
5572 for (const auto &bcdi : cd->baseClasses())
5573 {
5574 int mc=minClassDistance(bcdi.classDef,bcd,level+1);
5575 if (mc<m) m=mc;
5576 if (m<0) break;
5577 }
5578 return m;
5579}
5580
5582{
5583 if (bcd->categoryOf()) // use class that is being extended in case of
5584 // an Objective-C category
5585 {
5586 bcd=bcd->categoryOf();
5587 }
5588 if (cd==bcd)
5589 {
5590 goto exit;
5591 }
5592 if (level==256)
5593 {
5594 err("Internal inconsistency: found class {} seem to have a recursive "
5595 "inheritance relation! Please send a bug report to doxygen@gmail.com\n",cd->name());
5596 }
5597 else if (prot!=Protection::Private)
5598 {
5599 for (const auto &bcdi : cd->baseClasses())
5600 {
5601 Protection baseProt = classInheritedProtectionLevel(bcdi.classDef,bcd,bcdi.prot,level+1);
5602 if (baseProt==Protection::Private) prot=Protection::Private;
5603 else if (baseProt==Protection::Protected) prot=Protection::Protected;
5604 }
5605 }
5606exit:
5607 //printf("classInheritedProtectionLevel(%s,%s)=%d\n",qPrint(cd->name()),qPrint(bcd->name()),prot);
5608 return prot;
5609}
5610
5611
constexpr auto prefix
Definition anchor.cpp:47
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString defval
Definition arguments.h:47
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
This class represents an function or template argument list.
Definition arguments.h:66
bool empty() const
Definition arguments.h:100
bool hasTemplateDocumentation() const
Definition arguments.cpp:34
bool isSimple() const override
Definition classdef.cpp:724
bool isFortran() const override
Returns true if this class is implemented in Fortran.
Definition classdef.cpp:690
DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const override
Definition classdef.cpp:683
void writeTagFile(TextStream &ol) const override
Definition classdef.cpp:787
int countMemberDeclarations(MemberListType lt, const ClassDef *inheritedFrom, MemberListType lt2, bool invert, bool showAlways, ClassDefSet &visitedClasses) const override
Definition classdef.cpp:761
DString displayName(bool includeScope=true) const override
Definition classdef.cpp:627
bool isSubClass(ClassDef *bcd, int level=0) const override
Returns true iff bcd is a direct or indirect sub class of this class.
Definition classdef.cpp:659
const UsesClassList & usedByImplementationClasses() const override
Definition classdef.cpp:673
bool hasDetailedDescription() const override
returns true if this class has a non-empty detailed description
Definition classdef.cpp:621
void writePageNavigation(OutputList &ol) const override
Definition classdef.cpp:783
DString title() const override
Definition classdef.cpp:732
ModuleDef * getModuleDef() const override
Returns the C++20 module in which this compound's definition can be found.
Definition classdef.cpp:653
DString getReference() const override
Definition classdef.cpp:611
int isBaseClass(const ClassDef *bcd, bool followInstances, const DString &templSpec) const override
Returns true iff bcd is a direct or indirect base class of this class.
Definition classdef.cpp:657
void writeDocumentation(OutputList &ol) const override
Definition classdef.cpp:771
DString getMemberListFileName() const override
Definition classdef.cpp:744
const UsesClassList & usedImplementationClasses() const override
Definition classdef.cpp:671
const MemberDef * getMemberByName(const DString &s) const override
Returns the member with the given name.
Definition classdef.cpp:655
DString anchor() const override
Definition classdef.cpp:720
StringVector getQualifiers() const override
Definition classdef.cpp:754
void writeSummaryLinks(OutputList &ol) const override
Definition classdef.cpp:781
bool isVisibleInHierarchy() const override
the class is visible in a class diagram, or class hierarchy
Definition classdef.cpp:645
bool isPublished() const override
Returns true if this class is marked as published.
Definition classdef.cpp:698
const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const override
Returns a dictionary of all members.
Definition classdef.cpp:637
bool isImplicitTemplateInstance() const override
Definition classdef.cpp:768
const FileList & usedFiles() const override
Definition classdef.cpp:736
CodeSymbolType codeSymbolType() const override
Definition classdef.cpp:603
bool isFinal() const override
Returns true if this class is marked as final.
Definition classdef.cpp:694
void addGroupedInheritedMembers(OutputList &ol, MemberListType lt, const ClassDef *inheritedFrom, const DString &inheritId) const override
Definition classdef.cpp:795
void writeMemberDeclarations(OutputList &ol, ClassDefSet &visitedClasses, MemberListType lt, const DString &title, const DString &subTitle=DString(), bool showInline=false, const ClassDef *inheritedFrom=nullptr, MemberListType lt2=MemberListType::Invalid(), bool invert=false, bool showAlways=false) const override
Definition classdef.cpp:789
const ExampleList & getExamples() const override
Definition classdef.cpp:740
DString getSourceFileBase() const override
Definition classdef.cpp:609
void moveTo(Definition *) override
Definition classdef.cpp:601
bool isReference() const override
Definition classdef.cpp:613
bool isTemplateArgument() const override
Definition classdef.cpp:677
void updateSubClasses(const BaseClassList &) override
Update the list of sub classes to the one passed.
Definition classdef.cpp:800
bool isForwardDeclared() const override
Returns true if this class represents a forward declaration of a template class.
Definition classdef.cpp:702
const ArgumentList & typeConstraints() const override
Definition classdef.cpp:738
std::unique_ptr< ClassDef > deepCopy(const DString &name) const override
Definition classdef.cpp:598
const IncludeInfo * includeInfo() const override
Definition classdef.cpp:669
DString getOutputFileBase() const override
Definition classdef.cpp:605
bool isAccessibleMember(const MemberDef *md) const override
returns true iff md is a member of this class or of the the public/protected members of a base class
Definition classdef.cpp:661
void writeMemberPages(OutputList &ol) const override
Definition classdef.cpp:775
DString getInstanceOutputFileBase() const override
Definition classdef.cpp:607
DString requiresClause() const override
Definition classdef.cpp:752
ClassDefAliasImpl(const Definition *newScope, const ClassDef *cd)
Definition classdef.cpp:590
void writeQuickMemberLinks(OutputList &ol, const MemberDef *md) const override
Definition classdef.cpp:779
void updateBaseClasses(const BaseClassList &) override
Update the list of base classes to the one passed.
Definition classdef.cpp:799
bool containsOverload(const MemberDef *md) const override
Definition classdef.cpp:756
bool subGrouping() const override
Definition classdef.cpp:746
const ArgumentList & templateArguments() const override
Returns the template arguments of this class.
Definition classdef.cpp:649
Protection protection() const override
Return the protection level (Public,Protected,Private) in which this compound was found.
Definition classdef.cpp:639
bool isCSharp() const override
Returns true if this class is implemented in C#.
Definition classdef.cpp:692
const MemberGroupList & getMemberGroups() const override
Returns the member groups defined for this class.
Definition classdef.cpp:714
bool isEmbeddedInOuterScope() const override
Definition classdef.cpp:722
DString compoundTypeString() const override
Returns the type of compound as a string.
Definition classdef.cpp:631
int countMembersIncludingGrouped(MemberListType lt, const ClassDef *inheritedFrom, bool additional) const override
Definition classdef.cpp:759
bool isSealed() const override
Returns true if this class is marked as sealed.
Definition classdef.cpp:696
bool hasDocumentation() const override
Definition classdef.cpp:619
FileDef * getFileDef() const override
Returns the file in which this compound's definition can be found.
Definition classdef.cpp:651
ArgumentLists getTemplateParameterLists() const override
Returns the template parameter lists that form the template declaration of this class.
Definition classdef.cpp:681
bool hasNonReferenceSuperClass() const override
Definition classdef.cpp:750
void writeDeclarationLink(OutputList &ol, bool &found, const DString &header, bool localNames) const override
Definition classdef.cpp:765
DString className() const override
Returns the name of the class including outer classes, but not including namespaces.
Definition classdef.cpp:708
void writeInlineDocumentation(OutputList &ol) const override
Definition classdef.cpp:785
const BaseClassList & subClasses() const override
Returns the list of sub classes that directly derive from this class.
Definition classdef.cpp:635
DString generatedFromFiles() const override
Definition classdef.cpp:734
bool isJavaEnum() const override
Definition classdef.cpp:730
~ClassDefAliasImpl() override
Definition classdef.cpp:592
const TemplateInstanceList & getTemplateInstances() const override
Returns a sorted dictionary with all template instances found for this template class.
Definition classdef.cpp:663
bool isLinkableInProject() const override
Definition classdef.cpp:641
bool isLocal() const override
Returns true if this is a local class definition, see EXTRACT_LOCAL_CLASSES.
Definition classdef.cpp:615
void writeDocumentationForInnerClasses(OutputList &ol) const override
Definition classdef.cpp:773
const MemberLists & getMemberLists() const override
Returns the list containing the list of members sorted per type.
Definition classdef.cpp:712
MemberList * getMemberList(MemberListType lt) const override
Returns the members in the list identified by lt.
Definition classdef.cpp:710
ClassDef * categoryOf() const override
Returns the class of which this is a category (Objective-C only).
Definition classdef.cpp:706
const ClassDef * getCdAlias() const
Definition classdef.cpp:597
CompoundType compoundType() const override
Returns the type of compound this is, i.e. class/struct/union/...
Definition classdef.cpp:629
const TemplateNameMap & getTemplateBaseClassNames() const override
Definition classdef.cpp:716
DefType definitionType() const override
Definition classdef.cpp:595
bool isLinkable() const override
Definition classdef.cpp:643
const BaseClassList & baseClasses() const override
Returns the list of base classes from which this class directly inherits.
Definition classdef.cpp:633
const ClassDef * tagLessReference() const override
Definition classdef.cpp:726
DString collaborationGraphFileName() const override
returns the file name to use for the collaboration graph
Definition classdef.cpp:623
bool isExtension() const override
Returns true if this class represents an Objective-C 2.0 extension (nameless category).
Definition classdef.cpp:700
ClassLinkedRefMap getClasses() const override
returns the classes nested into this class
Definition classdef.cpp:617
const ConstraintClassList & templateTypeConstraints() const override
Definition classdef.cpp:675
bool isInterface() const override
Returns true if this class represents an interface.
Definition classdef.cpp:704
const Definition * findInnerCompound(const DString &name) const override
Definition classdef.cpp:679
bool isAbstract() const override
Returns true if there is at least one pure virtual member in this class.
Definition classdef.cpp:686
bool hasExamples() const override
Definition classdef.cpp:742
bool visibleInParentsDeclList() const override
show this class in the declaration section of its parent?
Definition classdef.cpp:647
const ClassDef * templateMaster() const override
Returns the template master of which this class is an instance.
Definition classdef.cpp:665
bool isTemplate() const override
Returns true if this class is a template.
Definition classdef.cpp:667
bool isSliceLocal() const override
Definition classdef.cpp:748
bool isUsedOnly() const override
Definition classdef.cpp:718
DString inheritanceGraphFileName() const override
returns the file name to use for the inheritance graph
Definition classdef.cpp:625
const MemberDef * isSmartPointer() const override
Definition classdef.cpp:728
bool isObjectiveC() const override
Returns true if this class is implemented in Objective-C.
Definition classdef.cpp:688
void writeMemberList(OutputList &ol) const override
Definition classdef.cpp:777
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual DString requiresClause() const =0
virtual int countMemberDeclarations(MemberListType lt, const ClassDef *inheritedFrom, MemberListType lt2, bool invert, bool showAlways, ClassDefSet &visitedClasses) const =0
virtual bool isSliceLocal() const =0
virtual ModuleDef * getModuleDef() const =0
Returns the C++20 module in which this compound's definition can be found.
virtual bool isAbstract() const =0
Returns true if there is at least one pure virtual member in this class.
virtual void writeDeclarationLink(OutputList &ol, bool &found, const DString &header, bool localNames) const =0
virtual const MemberDef * getMemberByName(const DString &) const =0
Returns the member with the given name.
virtual bool isFinal() const =0
Returns true if this class is marked as final.
virtual bool visibleInParentsDeclList() const =0
show this class in the declaration section of its parent?
virtual DString getInstanceOutputFileBase() const =0
virtual bool subGrouping() const =0
virtual void writeSummaryLinks(OutputList &ol) const =0
virtual bool hasDetailedDescription() const =0
returns true if this class has a non-empty detailed description
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual DString getMemberListFileName() const =0
virtual void writeMemberPages(OutputList &ol) const =0
virtual bool isFortran() const =0
Returns true if this class is implemented in Fortran.
virtual void writeDocumentation(OutputList &ol) const =0
virtual const MemberLists & getMemberLists() const =0
Returns the list containing the list of members sorted per type.
virtual void writeMemberList(OutputList &ol) const =0
virtual bool isVisibleInHierarchy() const =0
the class is visible in a class diagram, or class hierarchy
virtual bool isTemplate() const =0
Returns true if this class is a template.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual DString inheritanceGraphFileName() const =0
returns the file name to use for the inheritance graph
virtual int isBaseClass(const ClassDef *bcd, bool followInstances, const DString &templSpec=DString()) const =0
Returns true iff bcd is a direct or indirect base class of this class.
virtual bool isSealed() const =0
Returns true if this class is marked as sealed.
virtual const TemplateInstanceList & getTemplateInstances() const =0
Returns a sorted dictionary with all template instances found for this template class.
virtual ArgumentLists getTemplateParameterLists() const =0
Returns the template parameter lists that form the template declaration of this class.
virtual const UsesClassList & usedImplementationClasses() const =0
virtual bool isObjectiveC() const =0
Returns true if this class is implemented in Objective-C.
virtual bool hasExamples() const =0
virtual StringVector getQualifiers() const =0
virtual void writeMemberDeclarations(OutputList &ol, ClassDefSet &visitedClasses, MemberListType lt, const DString &title, const DString &subTitle=DString(), bool showInline=false, const ClassDef *inheritedFrom=nullptr, MemberListType lt2=MemberListType::Invalid(), bool invert=false, bool showAlways=false) const =0
virtual bool isLocal() const =0
Returns true if this is a local class definition, see EXTRACT_LOCAL_CLASSES.
virtual void writeQuickMemberLinks(OutputList &ol, const MemberDef *md) const =0
virtual bool isSimple() const =0
virtual DString className() const =0
Returns the name of the class including outer classes, but not including namespaces.
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
virtual const ClassDef * tagLessReference() const =0
virtual DString compoundTypeString() const =0
Returns the type of compound as a string.
virtual MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual void writePageNavigation(OutputList &ol) const =0
virtual ClassDef * categoryOf() const =0
Returns the class of which this is a category (Objective-C only).
virtual const MemberDef * isSmartPointer() const =0
virtual bool isExtension() const =0
Returns true if this class represents an Objective-C 2.0 extension (nameless category).
virtual bool hasNonReferenceSuperClass() const =0
virtual bool isCSharp() const =0
Returns true if this class is implemented in C#.
virtual bool isForwardDeclared() const =0
Returns true if this class represents a forward declaration of a template class.
virtual DString collaborationGraphFileName() const =0
returns the file name to use for the collaboration graph
virtual const ExampleList & getExamples() const =0
virtual bool isJavaEnum() const =0
virtual bool isSubClass(ClassDef *bcd, int level=0) const =0
Returns true iff bcd is a direct or indirect sub class of this class.
virtual bool isTemplateArgument() const =0
virtual int countMembersIncludingGrouped(MemberListType lt, const ClassDef *inheritedFrom, bool additional) const =0
virtual const ArgumentList & typeConstraints() const =0
virtual bool isAccessibleMember(const MemberDef *md) const =0
returns true iff md is a member of this class or of the the public/protected members of a base class
virtual const TemplateNameMap & getTemplateBaseClassNames() const =0
virtual bool isPublished() const =0
Returns true if this class is marked as published.
virtual const FileList & usedFiles() const =0
virtual DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const =0
virtual bool isEmbeddedInOuterScope() const =0
virtual const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const =0
Returns a dictionary of all members.
virtual DString generatedFromFiles() const =0
virtual const ConstraintClassList & templateTypeConstraints() const =0
virtual void addGroupedInheritedMembers(OutputList &ol, MemberListType lt, const ClassDef *inheritedFrom, const DString &inheritId) const =0
virtual bool isImplicitTemplateInstance() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Returns the member groups defined for this class.
virtual const UsesClassList & usedByImplementationClasses() const =0
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
CompoundType
The various compound types.
Definition classdef.h:105
@ Singleton
Definition classdef.h:113
@ Interface
Definition classdef.h:108
@ Exception
Definition classdef.h:111
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e. class/struct/union/...
virtual bool containsOverload(const MemberDef *md) const =0
virtual ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual bool isInterface() const =0
Returns true if this class represents an interface.
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
virtual const IncludeInfo * includeInfo() const =0
virtual void writeInlineDocumentation(OutputList &ol) const =0
virtual void writeTagFile(TextStream &) const =0
virtual DString title() const =0
virtual void writeDocumentationForInnerClasses(OutputList &ol) const =0
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual bool isUsedOnly() const =0
Implementation of the ClassDef interface.
Definition classdef.cpp:201
bool isSubClass(ClassDef *bcd, int level=0) const override
Returns true iff bcd is a direct or indirect sub class of this class.
DString className() const override
Returns the name of the class including outer classes, but not including namespaces.
TemplateInstanceList m_templateInstances
Definition classdef.cpp:503
void writeIncludeFilesForSlice(OutputList &ol) const
void overrideInheritanceGraph(CLASS_GRAPH_t e) override
ClassLinkedRefMap getClasses() const override
returns the classes nested into this class
const Definition * findInnerCompound(const DString &name) const override
ArgumentList m_typeConstraints
Definition classdef.cpp:472
void writePageNavigation(OutputList &ol) const override
DString getMemberListFileName() const override
void addMembersToMemberGroup() override
bool subGrouping() const override
void distributeMemberGroupDocumentation() override
void addMemberToList(MemberListType lt, MemberDef *md, bool isBrief)
void addTypeConstraint(const DString &typeConstraint, const DString &type)
bool isObjectiveC() const override
Returns true if this class is implemented in Objective-C.
StringSet m_vhdlSummaryTitles
List of titles to use for the summary.
Definition classdef.cpp:547
ExampleList m_examples
Definition classdef.cpp:478
void setImplicitTemplateInstance(bool b) override
const MemberDef * getMemberByName(const DString &) const override
Returns the member with the given name.
void insertUsedFile(const FileDef *) override
void addGroupedInheritedMembers(OutputList &ol, MemberListType lt, const ClassDef *inheritedFrom, const DString &inheritId) const override
DString title() const override
const MemberDef * m_arrowOperator
Does this class overloaded the -> operator?
Definition classdef.cpp:553
void addClassAttributes(OutputList &ol) const
void updateSubClasses(const BaseClassList &bcd) override
Update the list of sub classes to the one passed.
void writeDeclarationLink(OutputList &ol, bool &found, const DString &header, bool localNames) const override
MemberGroupList m_memberGroups
Definition classdef.cpp:521
TypeSpecifier m_spec
Definition classdef.cpp:560
DString m_fileName
Definition classdef.cpp:429
ClassDef * m_categoryOf
Definition classdef.cpp:516
FileDef * getFileDef() const override
Returns the file in which this compound's definition can be found.
DString getReference() const override
bool isTemplateArgument() const override
void writeInheritanceGraph(OutputList &ol) const
const ClassDef * m_tagLessRef
Definition classdef.cpp:555
void setAnonymousEnumType() override
void setTagLessReference(const ClassDef *cd) override
Protection m_prot
Definition classdef.cpp:487
bool isLinkableInProject() const override
void addUsedInterfaceClasses(MemberDef *md, const DString &typeStr)
BaseClassList m_inheritedBy
Definition classdef.cpp:452
void getTitleForMemberListType(MemberListType type, DString &title, DString &subtitle) const
FileList m_files
Definition classdef.cpp:475
const TemplateInstanceList & getTemplateInstances() const override
Returns a sorted dictionary with all template instances found for this template class.
MemberLists m_memberLists
Definition classdef.cpp:518
DString getSourceFileBase() const override
const UsesClassList & usedByImplementationClasses() const override
ArgumentLists getTemplateParameterLists() const override
Returns the template parameter lists that form the template declaration of this class.
void writeMemberList(OutputList &ol) const override
void writeBriefDescription(OutputList &ol, bool exampleFlag) const
void writeInlineClasses(OutputList &ol) const
void moveTo(Definition *) override
Definition classdef.cpp:988
const ExampleList & getExamples() const override
UsesClassList m_usesImplClassList
Definition classdef.cpp:495
void insertExplicitTemplateInstance(ClassDef *instance, const DString &spec) override
void insertBaseClass(ClassDef *, const DString &name, Protection p, Specifier s, const DString &t=DString()) override
void addListReferences() override
const ArgumentList & templateArguments() const override
Returns the template arguments of this class.
void writeDetailedDocumentationBody(OutputList &ol) const
void setClassName(const DString &name) override
const ClassDef * m_templateMaster
Definition classdef.cpp:508
void writeTagFile(TextStream &) const override
void endMemberDeclarations(OutputList &ol) const
bool m_membersMerged
Definition classdef.cpp:530
const MemberGroupList & getMemberGroups() const override
Returns the member groups defined for this class.
void sortMemberLists() override
const FileList & usedFiles() const override
void writeNestedClasses(OutputList &ol, const DString &title) const
DString getOutputFileBase() const override
void setTemplateArguments(const ArgumentList &al) override
void mergeCategory(ClassDef *category) override
void countMembers() override
void writeInheritedMemberDeclarations(OutputList &ol, ClassDefSet &visitedClasses, MemberListType lt, MemberListType lt2, const DString &title, const ClassDef *inheritedFrom, bool invert, bool showAlways) const
std::unique_ptr< ClassDef > deepCopy(const DString &name) const override
Definition classdef.cpp:877
void addMemberToTemplateInstance(const MemberDef *md, const ArgumentList &templateArguments, const DString &templSpec) override
void setClassSpecifier(TypeSpecifier spec) override
void reclassifyMember(MemberDefMutable *md, MemberType t) override
int countAdditionalInheritedMembers() const
DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const override
bool isFinal() const override
Returns true if this class is marked as final.
void writeMoreLink(OutputList &ol, const DString &anchor) const
void writeDocumentationForInnerClasses(OutputList &ol) const override
bool isUsedOnly() const override
void setRequiresClause(const DString &req) override
void writePlainMemberDeclaration(OutputList &ol, MemberListType lt, bool inGroup, int indentLevel, const ClassDef *inheritedFrom, const DString &inheritId) const
int isBaseClass(const ClassDef *bcd, bool followInstances, const DString &templSpec) const override
Returns true iff bcd is a direct or indirect base class of this class.
void addQualifiers(const StringVector &qualifiers) override
void setTypeConstraints(const ArgumentList &al) override
bool isInterface() const override
Returns true if this class represents an interface.
void writeSimpleMemberDocumentation(OutputList &ol, MemberListType lt) const
int countMemberDeclarations(MemberListType lt, const ClassDef *inheritedFrom, MemberListType lt2, bool invert, bool showAlways, ClassDefSet &visitedClasses) const override
void writeInlineDocumentation(OutputList &ol) const override
Write class documentation inside another container (i.e. a group).
int countMembersIncludingGrouped(MemberListType lt, const ClassDef *inheritedFrom, bool additional) const override
DString getInstanceOutputFileBase() const override
bool isLocal() const override
Returns true if this is a local class definition, see EXTRACT_LOCAL_CLASSES.
const BaseClassList & baseClasses() const override
Returns the list of base classes from which this class directly inherits.
void writeCollaborationGraph(OutputList &ol) const
void writeTemplateSpec(OutputList &ol, const Definition *d, const DString &type, SrcLangExt lang) const
void setIncludeFile(FileDef *fd, const DString &incName, bool local, bool force) override
void writeAuthorSection(OutputList &ol) const
TemplateNameMap m_templBaseClassNames
Definition classdef.cpp:505
const ConstraintClassList & templateTypeConstraints() const override
const UsesClassList & usedImplementationClasses() const override
ClassDefImpl(const DString &fileName, int startLine, size_t startColumn, const DString &name, CompoundType ct, const DString &ref=DString(), const DString &fName=DString(), bool isSymbol=true, bool isJavaEnum=false)
Definition classdef.cpp:815
std::unique_ptr< IncludeInfo > m_incInfo
Definition classdef.cpp:443
ClassDef * categoryOf() const override
Returns the class of which this is a category (Objective-C only).
bool isReference() const override
bool isPublished() const override
Returns true if this class is marked as published.
bool m_isJavaEnum
Does this class represent a Java style enum?
Definition classdef.cpp:558
bool isFortran() const override
Returns true if this class is implemented in Fortran.
BaseClassList m_inherits
Definition classdef.cpp:448
void writeMemberPages(OutputList &ol) const override
MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap
Definition classdef.cpp:466
DString collaborationGraphFileName() const override
returns the file name to use for the collaboration graph
void endMemberDocumentation(OutputList &ol) const
DString inheritanceGraphFileName() const override
returns the file name to use for the inheritance graph
void writeDocumentation(OutputList &ol) const override
void setModuleDef(ModuleDef *mod) override
DString m_metaData
Definition classdef.cpp:562
const BaseClassList & subClasses() const override
Returns the list of sub classes that directly derive from this class.
bool isSimple() const override
ModuleDef * m_moduleDef
Definition classdef.cpp:463
void hideDerivedVariablesInPython(ClassDefMutable *cls)
bool hasCollaborationGraph() const override
void writeQuickMemberLinks(OutputList &ol, const MemberDef *md) const override
void insertSubClass(ClassDef *, Protection p, Specifier s, const DString &t=DString()) override
bool containsOverload(const MemberDef *md) const override
DString generatedFromFiles() const override
bool isJavaEnum() const override
void setMetaData(const DString &md) override
void setCompoundType(CompoundType t) override
void insertMember(MemberDef *) override
int countInheritedDecMembers(MemberListType lt, const ClassDef *inheritedFrom, bool invert, bool showAlways, ClassDefSet &visitedClasses) const
DString m_inheritFileName
Definition classdef.cpp:438
bool m_isSimple
Is this a simple (non-nested) C structure?
Definition classdef.cpp:550
const ClassDef * tagLessReference() const override
bool isForwardDeclared() const override
Returns true if this class represents a forward declaration of a template class.
CLASS_GRAPH_t m_typeInheritanceGraph
Definition classdef.cpp:570
DString requiresClause() const override
int countInheritanceNodes() const
void setTemplateBaseClassNames(const TemplateNameMap &templateNames) override
void findSectionsInDocumentation() override
bool isTemplate() const override
Returns true if this class is a template.
int countInheritsNodes() const
void mergeMembersFromBaseClasses(bool mergeVirtualBaseClass)
DString m_memberListFileName
Definition classdef.cpp:432
const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const override
Returns a dictionary of all members.
bool m_isAbstract
Definition classdef.cpp:524
StringVector m_qualifiers
Definition classdef.cpp:567
ClassDef * insertTemplateInstance(const DString &fileName, int startLine, size_t startColumn, const DString &templSpec, bool &freshInstance) override
DString m_className
Definition classdef.cpp:511
ArgumentList m_primaryConstructorParams
Definition classdef.cpp:574
FileDef * m_fileDef
Definition classdef.cpp:460
const ClassDef * templateMaster() const override
Returns the template master of which this class is an instance.
const TemplateNameMap & getTemplateBaseClassNames() const override
ClassDef::CompoundType m_compType
Definition classdef.cpp:481
bool m_hasCollaborationGraph
Definition classdef.cpp:569
bool isExtension() const override
Returns true if this class represents an Objective-C 2.0 extension (nameless category).
bool isAbstract() const override
Returns true if there is at least one pure virtual member in this class.
const IncludeInfo * includeInfo() const override
void writeMemberDeclarations(OutputList &ol, ClassDefSet &visitedClasses, MemberListType lt, const DString &title, const DString &subTitle=DString(), bool showInline=false, const ClassDef *inheritedFrom=nullptr, MemberListType lt2=MemberListType::Invalid(), bool invert=false, bool showAlways=false) const override
void setCategoryOf(ClassDef *cd) override
void addTypeConstraints() override
bool visibleInParentsDeclList() const override
show this class in the declaration section of its parent?
const MemberLists & getMemberLists() const override
Returns the list containing the list of members sorted per type.
void overrideCollaborationGraph(bool e) override
bool isSealed() const override
Returns true if this class is marked as sealed.
ClassLinkedRefMap m_innerClasses
Definition classdef.cpp:492
UsesClassList m_usedByImplClassList
Definition classdef.cpp:496
bool isSliceLocal() const override
DString anchor() const override
ConstraintClassList m_constraintClassList
Definition classdef.cpp:498
void setIsStatic(bool b) override
int countInheritedByNodes() const
void setFileDef(FileDef *fd) override
void addUsedByClass(ClassDef *cd, const DString &accessName, Protection prot) override
bool m_isTemplArg
Definition classdef.cpp:535
DefType definitionType() const override
Definition classdef.cpp:208
CodeSymbolType codeSymbolType() const override
void writeDocumentationContents(OutputList &ol, const DString &pageTitle) const
bool m_usedOnly
Reason of existence is a "use" relation.
Definition classdef.cpp:544
bool isCSharp() const override
Returns true if this class is implemented in C#.
void computeAnchors() override
DString m_requiresClause
C++20 requires clause.
Definition classdef.cpp:565
void writeIncludeFiles(OutputList &ol) const
void addRequirementReferences() override
void addInnerCompound(Definition *d) override
void setSubGrouping(bool enabled) override
void mergeMembers() override
void writeSummaryLinks(OutputList &ol) const override
void setGroupDefForAllMembers(GroupDef *g, Grouping::GroupPri_t pri, const DString &fileName, int startLine, bool hasDocs) override
void writeAdditionalInheritedMembers(OutputList &ol) const
void addUsedClass(ClassDef *cd, const DString &accessName, Protection prot) override
void removeMemberFromLists(MemberDef *md) override
bool isVisibleInHierarchy() const override
void addMembersToTemplateInstance(const ClassDef *cd, const ArgumentList &templateArguments, const DString &templSpec) override
bool isLinkable() const override
bool m_implicitTemplateInstance
Definition classdef.cpp:572
bool hasDocumentation() const override
ModuleDef * getModuleDef() const override
Returns the C++20 module in which this compound's definition can be found.
ArgumentList m_tempArgs
Definition classdef.cpp:469
void internalInsertMember(MemberDef *md, Protection prot, bool addToAllList)
void startMemberDeclarations(OutputList &ol) const
bool m_subGrouping
Definition classdef.cpp:541
bool hasExamples() const override
StringVector getQualifiers() const override
const MemberDef * isSmartPointer() const override
void updateBaseClasses(const BaseClassList &bcd) override
Update the list of base classes to the one passed.
CLASS_GRAPH_t hasInheritanceGraph() const override
DString compoundTypeString() const override
Returns the type of compound as a string.
void writeMemberDocumentation(OutputList &ol, MemberListType lt, const DString &title, bool showInline=false) const
MemberList * getMemberList(MemberListType lt) const override
Returns the members in the list identified by lt.
void setUsedOnly(bool b) override
Protection protection() const override
Return the protection level (Public,Protected,Private) in which this compound was found.
const ArgumentList & typeConstraints() const override
DString displayName(bool includeScope=true) const override
void showUsedFiles(OutputList &ol) const
bool addExample(const DString &anchor, const DString &name, const DString &file) override
bool isEmbeddedInOuterScope() const override
void sortAllMembersList() override
void writeMemberGroups(OutputList &ol, bool showInline=false) const
CompoundType compoundType() const override
Returns the type of compound this is, i.e. class/struct/union/...
void makeTemplateArgument(bool b=true) override
void writeDetailedDescription(OutputList &ol, const DString &pageType, bool exampleFlag, const DString &title, const DString &anchor=DString()) const
bool isAccessibleMember(const MemberDef *md) const override
returns true iff md is a member of this class or of the the public/protected members of a base class
bool isImplicitTemplateInstance() const override
bool hasNonReferenceSuperClass() const override
void setTemplateMaster(const ClassDef *tm) override
DString m_collabFileName
Definition classdef.cpp:435
void setPrimaryConstructorParams(const ArgumentList &list) override
void startMemberDocumentation(OutputList &ol) const
void setProtection(Protection p) override
bool hasDetailedDescription() const override
returns true if this class has a non-empty detailed description
virtual void addMemberToTemplateInstance(const MemberDef *md, const ArgumentList &templateArguments, const DString &templSpec)=0
virtual void setTemplateArguments(const ArgumentList &al)=0
virtual void setGroupDefForAllMembers(GroupDef *g, Grouping::GroupPri_t pri, const DString &fileName, int startLine, bool hasDocs)=0
virtual void setTemplateMaster(const ClassDef *tm)=0
virtual void setImplicitTemplateInstance(bool b)=0
virtual void setUsedOnly(bool b)=0
virtual void setCategoryOf(ClassDef *cd)=0
virtual void mergeMembers()=0
virtual void addMembersToTemplateInstance(const ClassDef *cd, const ArgumentList &templateArguments, const DString &templSpec)=0
Class representing a built-in class diagram.
Definition diagram.h:29
bool declVisible(const ClassDef::CompoundType *filter=nullptr) const
Definition classlist.cpp:27
void writeDocumentation(OutputList &ol, const Definition *container=nullptr) const
Definition classlist.cpp:72
void writeDeclaration(OutputList &ol, const ClassDef::CompoundType *filter, const DString &header, bool localNames) const
Definition classlist.cpp:51
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
void clear()
Definition dstring.h:214
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
DString lower() const
Definition dstring.h:326
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
DString & prepend(const char *s)
Definition dstring.h:515
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
DString left(size_t len) const
Definition dstring.h:306
const std::string & str() const
Definition dstring.h:645
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
bool startsWith(const char *s) const
Definition dstring.h:600
bool endsWith(const char *s) const
Definition dstring.h:617
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
const DString & name() const override
const Definition * getAlias() const
const Definition * getScope() const
DefinitionAliasMixin(const Definition *scope, const Definition *alias)
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DString briefDescription(bool abbreviate=false) const =0
virtual DString inbodyFile() const =0
virtual DString briefFile() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int docLine() const =0
virtual DString getDefFileName() const =0
virtual DString documentation() const =0
virtual bool isLinkable() const =0
virtual DString inbodyDocumentation() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual const DString & localName() const =0
virtual int inbodyLine() const =0
virtual int briefLine() const =0
virtual bool hasDocumentation() const =0
virtual bool isLinkableInProject() const =0
virtual bool isAnonymous() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual DString qualifiedName() const =0
virtual bool isHidden() const =0
virtual DString anchor() const =0
virtual DString getReference() const =0
virtual bool isArtificial() const =0
virtual CodeSymbolType codeSymbolType() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual DString getSourceFileBase() const =0
virtual bool isReference() const =0
virtual const Definition * findInnerCompound(const DString &name) const =0
virtual DString getOutputFileBase() const =0
bool isReference() const override
DString docFile() const override
void writeSourceDef(OutputList &ol) const override
DString qualifiedName() const override
void writeNavigationPath(OutputList &ol) const override
bool hasBriefDescription() const override
DString briefFile() const override
bool hasRequirementRefs() const override
DString briefDescription(bool abbreviate=false) const override
const DString & name() const override
DString inbodyFile() const override
void setOuterScope(Definition *def) override
DString getReference() const override
void writeRequirementRefs(OutputList &ol) const override
const RefItemVector & xrefListItems() const override
size_t getDefColumn() const override
Definition * getOuterScope() const override
const DString & localName() const override
void setReference(const DString &r) override
DString getDefFileName() const override
DString documentation() const override
const GroupList & partOfGroups() const override
DefinitionMixin(const DString &defFileName, int defLine, size_t defColumn, const DString &name, const char *b=nullptr, const char *d=nullptr, bool isSymbol=true)
const FileDef * getBodyDef() const override
DString inbodyDocumentation() const override
int getStartBodyLine() const override
DString getSourceFileBase() const override
void writeDocAnchorsToTagFile(TextStream &fs) const override
bool hasDocumentation() const override
SrcLangExt getLanguage() const override
virtual void setHidden(bool b)=0
virtual void addInnerCompound(Definition *d)=0
virtual void setLanguage(SrcLangExt lang)=0
virtual void setOuterScope(Definition *d)=0
virtual void setArtificial(bool b)=0
Representation of a class inheritance or dependency graph.
bool isTooBig() const
bool isTrivial() const
int numNodes() const
static bool suppressDocWarnings
Definition doxygen.h:123
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:88
static NamespaceDefMutable * globalScope
Definition doxygen.h:114
static ClassLinkedMap * hiddenClassLinkedMap
Definition doxygen.h:89
static bool generatingXmlOutput
Definition doxygen.h:127
static MemberNameLinkedMap * memberNameLinkedMap
Definition doxygen.h:104
static EntryType guessSection(const DString &name)
Definition types.cpp:22
bool inSort(const Example &ex)
Definition example.h:39
A model of a file symbol.
Definition filedef.h:97
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
bool exists() const
Definition fileinfo.cpp:34
std::string absFilePath() const
Definition fileinfo.cpp:105
A model of a group of symbols.
Definition groupdef.h:48
virtual bool addClass(ClassDef *def)=0
virtual bool insertMember(MemberDef *def, bool docOnly=false)=0
Class representing the data associated with a #include statement.
Definition filedef.h:72
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1437
iterator begin()
Definition linkedmap.h:201
bool del(const DString &key)
Definition linkedmap.h:183
bool empty() const
Definition linkedmap.h:209
iterator end()
Definition linkedmap.h:202
T * add(const char *k, Args &&... args)
Definition linkedmap.h:90
const T * find(const std::string &key) const
Definition linkedmap.h:47
bool add(const char *k, T *obj)
Definition linkedmap.h:284
iterator end()
Definition linkedmap.h:367
const T * find(const std::string &key) const
Definition linkedmap.h:243
iterator begin()
Definition linkedmap.h:366
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual bool isSignal() const =0
virtual bool isDestructor() const =0
virtual bool isExplicit() const =0
virtual bool isObjCMethod() const =0
virtual bool isMaybeVoid() const =0
virtual bool isConstructor() const =0
virtual bool isFriend() const =0
virtual DString argsString() const =0
virtual bool isRelated() const =0
virtual const ClassDef * getClassDef() const =0
virtual bool isOverride() const =0
virtual bool isTypedef() const =0
virtual ClassDef * category() const =0
virtual bool isSlot() const =0
virtual void moveTo(Definition *)=0
virtual const FileDef * getFileDef() const =0
virtual bool isInline() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isMaybeAmbiguous() const =0
virtual VhdlSpecifier getVhdlSpecifiers() const =0
virtual bool isFunction() const =0
virtual bool isAttribute() const =0
virtual int getMemberGroupId() const =0
virtual bool isStatic() const =0
virtual bool isMaybeDefault() const =0
virtual bool isRemovable() const =0
virtual bool isConstrained() const =0
virtual bool isReadonly() const =0
virtual bool isBound() const =0
virtual bool isThreadLocal() const =0
virtual std::unique_ptr< MemberDef > createTemplateInstanceMember(const ArgumentList &formalArgs, const std::unique_ptr< ArgumentList > &actualArgs) const =0
virtual const ClassDef * getClassDefOfAnonymousType() const =0
virtual bool isTransient() const =0
virtual Protection protection() const =0
virtual TypeSpecifier getMemberSpecifiers() const =0
virtual bool isOptional() const =0
virtual bool isEnumerate() const =0
virtual MemberType memberType() const =0
virtual std::unique_ptr< MemberDef > deepCopy() const =0
virtual bool isVariable() const =0
virtual DString typeString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual bool isUNOProperty() const =0
virtual bool isFinal() const =0
virtual DString memberTypeName() const =0
virtual bool isMutable() const =0
virtual bool isEnumValue() const =0
virtual void setMemberType(MemberType t)=0
virtual void setSectionList(const Definition *container, const MemberList *sl)=0
virtual void setCategory(ClassDef *)=0
virtual void setExplicitInherited(bool b)=0
virtual void setCategoryRelation(const MemberDef *)=0
virtual void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const DString &fileName, int startLine, bool hasDocs, MemberDef *member=nullptr)=0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:126
void writeTagFile(TextStream &, bool useQualifiedName=false, bool showNamespaceMembers=true)
void setAnonymousEnumType()
int countInheritableMembers(const ClassDef *inheritedFrom) const
void writeSimpleDocumentation(OutputList &ol, const Definition *container) const
void writeDeclarations(OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, const DString &title, const DString &subtitle, bool showEnumValues=false, bool showInline=false, const ClassDef *inheritedFrom=nullptr, MemberListType lt=MemberListType::PubMethods(), bool showSectionTitle=true) const
Writes the list of members to the output.
void writeDocumentation(OutputList &ol, const DString &scopeName, const Definition *container, const DString &title, const DString &anchor, bool showEnumValues=false, bool showInline=false) const
MemberListType listType() const
Definition memberlist.h:131
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 DString &inheritId) const
int numDecMembers(const ClassDef *inheritedFrom) const
Definition memberlist.h:134
bool declVisible() const
Wrapper class for the MemberListType type.
Definition types.h:346
constexpr const char * toLabel() const noexcept
Definition types.h:402
constexpr bool isInvalid() const noexcept
Definition types.h:372
static constexpr MemberListType Invalid() noexcept
Definition types.h:371
const std::unique_ptr< MemberList > & get(MemberListType lt, MemberListContainer con)
Definition memberlist.h:192
void push_back(Ptr &&p)
Definition membername.h:52
bool empty() const
Definition membername.h:133
void push_back(Ptr &&p)
Definition membername.h:139
iterator begin()
Definition membername.h:129
iterator end()
Definition membername.h:130
typename Vec::iterator iterator
Definition membername.h:123
iterator erase(iterator pos)
Definition membername.h:140
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:311
void writeDoc(const IDocNodeAST *ast, const Definition *ctx, const MemberDef *md, int sectionLevel=-1)
Definition outputlist.h:379
void endIndent()
Definition outputlist.h:580
void startMemberDeclaration()
Definition outputlist.h:565
void parseText(const DString &textStr)
void startMemberDocName(bool align)
Definition outputlist.h:676
void startClassDiagram()
Definition outputlist.h:590
void startItemList()
Definition outputlist.h:425
void disable(OutputType o)
void startParagraph(const DString &classDef=DString())
Definition outputlist.h:403
void writeObjectLink(const DString &ref, const DString &file, const DString &anchor, const DString &name)
Definition outputlist.h:435
void endMemberDocName()
Definition outputlist.h:678
void endMemberDoc(bool hasArgs)
Definition outputlist.h:531
void addIndexItem(const DString &s1, const DString &s2)
Definition outputlist.h:586
void writeRuler()
Definition outputlist.h:517
void enable(OutputType o)
void endContents()
Definition outputlist.h:616
void endMemberDescription()
Definition outputlist.h:563
void endTextBlock(bool paraBreak=false)
Definition outputlist.h:668
void endMemberDeclaration(const DString &anchor, const DString &inheritId)
Definition outputlist.h:567
void docify(const DString &s)
Definition outputlist.h:433
void startMemberHeader(const DString &anchor, int typ=2)
Definition outputlist.h:465
void endCompoundTemplateParams()
Definition outputlist.h:499
void lineBreak(const DString &style=DString())
Definition outputlist.h:555
void startMemberDoc(const DString &clName, const DString &memName, const DString &anchor, const DString &title, int memCount, int memTotal, bool showInline)
Definition outputlist.h:527
void writeAnchor(const DString &fileName, const DString &name)
Definition outputlist.h:519
void insertMemberAlign(bool templ=false)
Definition outputlist.h:513
void startIndent()
Definition outputlist.h:578
void writeString(const DString &text)
Definition outputlist.h:407
void endDescForItem()
Definition outputlist.h:545
void endExamples()
Definition outputlist.h:576
void endParagraph()
Definition outputlist.h:405
void startExamples()
Definition outputlist.h:574
void startMemberSections()
Definition outputlist.h:457
void startMemberList()
Definition outputlist.h:477
void endTextLink()
Definition outputlist.h:440
void startItemListItem()
Definition outputlist.h:453
void endItemListItem()
Definition outputlist.h:455
void startBold()
Definition outputlist.h:557
void endMemberItem(OutputGenerator::MemberItemType type)
Definition outputlist.h:491
void writeSynopsis()
Definition outputlist.h:588
void endClassDiagram(const ClassDiagram &d, const DString &f, const DString &n)
Definition outputlist.h:592
void startTypewriter()
Definition outputlist.h:445
void pushGeneratorState()
void writeSummaryLink(const DString &file, const DString &anchor, const DString &title, bool first)
Definition outputlist.h:610
void startDescForItem()
Definition outputlist.h:543
void disableAllBut(OutputType o)
void startTextBlock(bool dense=false)
Definition outputlist.h:666
void popGeneratorState()
void startTextLink(const DString &file, const DString &anchor)
Definition outputlist.h:438
void endBold()
Definition outputlist.h:559
void endGroupHeader(int extraLevels=0)
Definition outputlist.h:451
void writeLabel(const DString &l, bool isLast)
Definition outputlist.h:736
void endLabels()
Definition outputlist.h:738
void startMemberItem(const DString &anchor, OutputGenerator::MemberItemType type, const DString &id=DString())
Definition outputlist.h:489
void endQuickIndices()
Definition outputlist.h:600
void startMemberDescription(const DString &anchor, const DString &inheritId=DString(), bool typ=false)
Definition outputlist.h:561
void writePageOutline()
Definition outputlist.h:612
void endDotGraph(DotClassGraph &g)
Definition outputlist.h:646
void generateDoc(const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &docStr, const DocOptions &options)
void endItemList()
Definition outputlist.h:427
void startDotGraph()
Definition outputlist.h:644
void startLabels()
Definition outputlist.h:734
void startContents()
Definition outputlist.h:614
void startCompoundTemplateParams()
Definition outputlist.h:497
void startGroupHeader(const DString &id=DString(), int extraLevels=0)
Definition outputlist.h:449
void enableAll()
void endMemberHeader()
Definition outputlist.h:467
void endTypewriter()
Definition outputlist.h:447
void endMemberSections()
Definition outputlist.h:459
static RequirementManager & instance()
void addRequirementRefsForSymbol(const Definition *symbol)
ClassDefMutable * resolveClassMutable(const Definition *scope, const DString &name, bool mayBeUnlinkable=false, bool mayBeHidden=false)
Wrapper around resolveClass that returns a mutable interface to the class object or a nullptr if the ...
Implements TextGeneratorIntf for an OutputDocInterface stream.
Definition outputlist.h:786
Text streaming class that buffers data.
Definition textstream.h:36
virtual DString trCompoundReference(const DString &clName, ClassDef::CompoundType compType, bool isTemplate)=0
virtual DString trIncludingInheritedMembers()=0
virtual DString trServiceGeneratedFromFiles(bool single)=0
virtual DString trMemberList()=0
virtual DString trAdditionalInheritedMembers()=0
virtual DString trCompoundReferenceSlice(const DString &clName, ClassDef::CompoundType compType, bool isLocal)=0
virtual DString trAuthor(bool first_capital, bool singular)=0
virtual DString trServiceReference(const DString &sName)=0
virtual DString trClassDiagram(const DString &clName)=0
virtual DString trCustomReference(const DString &name)=0
virtual DString trCompoundType(ClassDef::CompoundType compType, SrcLangExt lang)=0
virtual DString trCollaborationDiagram(const DString &clName)=0
virtual DString trCompounds()=0
virtual DString trInheritedByList(int numEntries)=0
virtual DString trMore()=0
virtual DString trEnumName()=0
virtual DString trDefinedIn()=0
virtual DString trVhdlType(VhdlSpecifier type, bool single)=0
virtual DString trThisIsTheListOfAllMembers()=0
virtual DString trEnumGeneratedFromFiles(bool single)=0
virtual DString trSingletonReference(const DString &sName)=0
virtual DString trDataTypes()=0
virtual DString trGeneratedFromFiles(ClassDef::CompoundType compType, bool single)=0
virtual DString trListOfAllMembers()=0
virtual DString trEnumValue()=0
virtual DString trInheritsList(int numEntries)=0
virtual DString trGeneratedAutomatically(const DString &s)=0
virtual DString trGeneratedFromFilesFortran(ClassDef::CompoundType compType, bool single)=0
virtual DString trCompoundReferenceFortran(const DString &clName, ClassDef::CompoundType compType, bool isTemplate)=0
virtual DString trEnumReference(const DString &name)=0
virtual DString trSingletonGeneratedFromFiles(bool single)=0
Wrapper class for a number of boolean properties.
Definition types.h:694
@ ARCHITECTURECLASS
Definition vhdldocgen.h:74
static DString getClassTitle(const ClassDef *)
static DString getProtectionName(int prot)
static void writeInlineClassLink(const ClassDef *, OutputList &ol)
static DString getClassName(const ClassDef *)
static void writeVhdlDeclarations(const MemberList *, OutputList &, const GroupDef *, const ClassDef *, const FileDef *, const NamespaceDef *, const ModuleDef *)
static VhdlClasses convert(Protection prot)
Definition vhdldocgen.h:77
static DString makeQualifiedNameWithTemplateParameters(const ClassDef *cd, const ArgumentLists *actualParams, uint32_t *actualParamIndex)
Definition classdef.cpp:60
static DString getCompoundTypeString(SrcLangExt lang, ClassDef::CompoundType compType, bool isJavaEnum)
Definition classdef.cpp:162
ClassDefMutable * toClassDefMutable(Definition *d)
ClassDef * getClass(const DString &n)
static DString makeDisplayName(const ClassDef *cd, bool includeScope)
Definition classdef.cpp:111
static bool hasNonReferenceSuperClassRec(const ClassDef *cd, int level)
int minClassDistance(const ClassDef *cd, const ClassDef *bcd, int level)
static void searchTemplateSpecs(const Definition *d, ArgumentLists &result, DString &name, SrcLangExt lang)
static bool isStandardFunc(const MemberDef *md)
std::unique_ptr< ClassDef > createClassDefAlias(const Definition *newScope, const ClassDef *cd)
Definition classdef.cpp:803
static void writeInheritanceSpecifier(OutputList &ol, const BaseClassDef &bcd)
bool classHasVisibleRoot(const BaseClassList &bcl)
std::unique_ptr< ClassDef > createClassDef(const DString &fileName, int startLine, size_t startColumn, const DString &name, ClassDef::CompoundType ct, const DString &ref, const DString &fName, bool isSymbol, bool isJavaEnum)
Factory method to create a new ClassDef object.
Definition classdef.cpp:577
bool classVisibleInIndex(const ClassDef *cd)
ClassDef * toClassDef(Definition *d)
Protection classInheritedProtectionLevel(const ClassDef *cd, const ClassDef *bcd, Protection prot, int level)
bool classHasVisibleChildren(const ClassDef *cd)
std::vector< BaseClassDef > BaseClassList
Definition classdef.h:77
std::unordered_set< const ClassDef * > ClassDefSet
Definition classdef.h:91
std::map< std::string, int > TemplateNameMap
Definition classdef.h:89
std::vector< TemplateInstanceDef > TemplateInstanceList
Definition classdef.h:87
#define Config_getInt(name)
Definition config.h:34
#define Config_getList(name)
Definition config.h:38
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
#define Config_getEnum(name)
Definition config.h:35
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
std::set< std::string > StringSet
Definition containers.h:31
std::vector< std::string > StringVector
Definition containers.h:33
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const DString &argsString, DString *extraTypeChars=nullptr)
Definition defargs.l:821
Definition * toDefinition(DefinitionMutable *dm)
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:54
#define AUTO_TRACE(...)
Definition docnode.cpp:53
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:55
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
void docFindSections(const DString &input, const Definition *d, const DString &fileName)
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
@ Collaboration
Definition dotgraph.h:31
@ Inheritance
Definition dotgraph.h:31
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
int dstricmp(const char *s1, const char *s2)
Definition dstring.cpp:444
DString includeClose(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:82
DString includeOpen(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:69
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:1973
DString includeStatement(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:52
@ IncludeLocal
Definition filedef.h:47
@ IncludeSystem
Definition filedef.h:46
void endTitle(OutputList &ol, const DString &fileName, const DString &name)
Definition index.cpp:398
void endFileWithNavPath(OutputList &ol, const DefinitionMutable *d, bool showPageNavigation)
Definition index.cpp:452
void endFile(OutputList &ol, bool skipNavIndex, bool skipEndContents, const DString &navPath)
Definition index.cpp:431
void startTitle(OutputList &ol, const DString &fileName, const DefinitionMutable *def)
Definition index.cpp:388
void startFile(OutputList &ol, const DString &name, bool isSource, const DString &manName, const DString &title, HighlightedItem hli, bool additionalIndices, const DString &altSidebarName, int hierarchyLevel, const DString &allMembersFile)
Definition index.cpp:405
HighlightedItem
Definition index.h:58
@ InterfaceVisible
Definition index.h:88
@ ExceptionVisible
Definition index.h:90
Translator * theTranslator
Definition language.cpp:76
void linkifyText(const TextGeneratorIntf &out, const DString &text, const LinkifyTextOptions &options)
MemberDefMutable * toMemberDefMutable(Definition *d)
void combineDeclarationAndDefinition(MemberDefMutable *mdec, MemberDefMutable *mdef)
#define warn_uncond(fmt,...)
Definition message.h:122
#define warn(file, line, fmt,...)
Definition message.h:97
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
#define ASSERT(x)
Definition message.h:142
ModuleDef * toModuleDef(Definition *d)
void addRefItem(const RefItemVector &sli, const DString &key, const DString &prefix, const DString &name, const DString &title, const DString &args, const Definition *scope)
Definition reflist.h:134
Web server based search engine.
Class that contains information about an inheritance relation.
Definition classdef.h:51
ClassDef * classDef
Class definition that this relation inherits from.
Definition classdef.h:56
Specifier virt
Virtualness of the inheritance relation: Normal, or Virtual.
Definition classdef.h:71
Protection prot
Protection level of the inheritance relation: Public, Protected, or Private.
Definition classdef.h:66
DString templSpecifiers
Template arguments used for the base class.
Definition classdef.h:74
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
Data associated with an example.
Definition example.h:29
GroupPri_t
Grouping priority.
Definition types.h:230
Represents of a member declaration list with configurable title and subtitle.
Definition layout.h:111
DString subtitle(SrcLangExt lang) const
Definition layout.cpp:1793
MemberListType type
Definition layout.h:117
DString title(SrcLangExt lang) const
Definition layout.cpp:1788
Represents of a member definition list with configurable title.
Definition layout.h:131
MemberListType type
Definition layout.h:136
DString title(SrcLangExt lang) const
Definition layout.cpp:1800
Definition layout.h:101
DString title(SrcLangExt lang) const
Definition layout.cpp:1781
This file contains a number of basic enums and types.
CodeSymbolType
Definition types.h:481
MemberType
Definition types.h:569
Protection
Definition types.h:32
SrcLangExt
Definition types.h:207
Specifier
Definition types.h:80
DString stripExtension(const DString &fName)
Definition util.cpp:3955
bool protectionLevelVisible(Protection prot)
Definition util.cpp:4671
void writeTypeConstraints(OutputList &ol, const Definition *d, const ArgumentList &al)
Definition util.cpp:4283
DString convertToId(const DString &s)
Definition util.cpp:3202
DString insertTemplateSpecifierInScope(const DString &scope, const DString &templ)
Definition util.cpp:3076
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:426
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2863
DString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
Definition util.cpp:903
void addGroupListToTitle(OutputList &ol, const Definition *d)
Definition util.cpp:3921
DString stripScope(const DString &name)
Definition util.cpp:3109
void createSubDirs(const Dir &d)
Definition util.cpp:2969
DString convertToHtml(const DString &s, bool keepEntities)
Definition util.cpp:3291
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4168
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcReturnType, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstReturnType, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang)
Definition util.cpp:1589
void addHtmlExtensionIfMissing(DString &fName)
Definition util.cpp:3931
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
Definition util.cpp:3232
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
Definition util.cpp:859
void convertProtectionLevel(MemberListType inListType, Protection inProt, MemberListType *outListType1, MemberListType *outListType2)
Computes for a given list type inListType, which are the the corresponding list type(s) in the base c...
Definition util.cpp:4904
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition util.cpp:4629
DString demangleCSharpGenericName(const DString &name, const DString &templArgs)
Definition util.cpp:5328
DString removeAnonymousScopes(const DString &str)
Definition util.cpp:98
void writeMarkerList(OutputList &ol, const std::string &markerText, size_t numMarkers, std::function< void(size_t)> replaceFunc)
Definition util.cpp:753
DString stripFromPath(const DString &path)
Definition util.cpp:219
DString inlineTemplateArgListToDoc(const ArgumentList &al)
Definition util.cpp:832
void writeExamples(OutputList &ol, const ExampleList &list)
Definition util.cpp:804
A bunch of utility functions.