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->taglessParent())
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 *taglessParent() const override;
276 bool hasNamedVariable() const override;
277 const MemberDef *isSmartPointer() const override;
278 bool isJavaEnum() const override;
279 DString title() const override;
280 DString generatedFromFiles() const override;
281 const FileList &usedFiles() const override;
282 const ArgumentList &typeConstraints() const override;
283 const ExampleList &getExamples() const override;
284 bool hasExamples() const override;
285 DString getMemberListFileName() const override;
286 bool subGrouping() const override;
287 bool isSliceLocal() const override;
288 bool hasNonReferenceSuperClass() const override;
289 DString requiresClause() const override;
290 StringVector getQualifiers() const override;
291 bool containsOverload(const MemberDef *md) const override;
292 bool isImplicitTemplateInstance() const override;
293
294 ClassDef *insertTemplateInstance(const DString &fileName,int startLine,size_t startColumn,
295 const DString &templSpec,bool &freshInstance) override;
296 void insertBaseClass(ClassDef *,const DString &name,Protection p,Specifier s,const DString &t=DString()) override;
297 void insertSubClass(ClassDef *,Protection p,Specifier s,const DString &t=DString()) override;
298 void insertExplicitTemplateInstance(ClassDef *instance,const DString &spec) override;
299 void setIncludeFile(FileDef *fd,const DString &incName,bool local,bool force) override;
300 void insertMember(MemberDef *) override;
301 void insertUsedFile(const FileDef *) override;
302 bool addExample(const DString &anchor,const DString &name, const DString &file) override;
303 void mergeCategory(ClassDef *category) override;
304 void setFileDef(FileDef *fd) override;
305 void setModuleDef(ModuleDef *mod) override;
306 void setSubGrouping(bool enabled) override;
307 void setProtection(Protection p) override;
308 void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const DString &fileName,int startLine,bool hasDocs) override;
309 void addInnerCompound(Definition *d) override;
310 void addUsedClass(ClassDef *cd,const DString &accessName,Protection prot) override;
311 void addUsedByClass(ClassDef *cd,const DString &accessName,Protection prot) override;
312 void setIsStatic(bool b) override;
313 void setCompoundType(CompoundType t) override;
314 void setClassName(const DString &name) override;
315 void setClassSpecifier(TypeSpecifier spec) override;
316 void addQualifiers(const StringVector &qualifiers) override;
317 void setTemplateArguments(const ArgumentList &al) override;
318 void setTemplateBaseClassNames(const TemplateNameMap &templateNames) override;
319 void setTemplateMaster(const ClassDef *tm) override;
320 void setImplicitTemplateInstance(bool b) override;
321 void setTypeConstraints(const ArgumentList &al) override;
322 void addMemberToTemplateInstance(const MemberDef *md, const ArgumentList &templateArguments, const DString &templSpec) override;
323 void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const DString &templSpec) override;
324 void makeTemplateArgument(bool b=true) override;
325 void setCategoryOf(ClassDef *cd) override;
326 void setUsedOnly(bool b) override;
327 void setTaglessParent(const ClassDef *cd) override;
328 void setHasNamedVariable(bool b) override;
329 void setMetaData(const DString &md) override;
330 void findSectionsInDocumentation() override;
331 void addMembersToMemberGroup() override;
332 void addListReferences() override;
333 void addRequirementReferences() override;
334 void addTypeConstraints() override;
335 void computeAnchors() override;
336 void mergeMembers() override;
337 void sortMemberLists() override;
339 void writeDocumentation(OutputList &ol) const override;
340 void writeDocumentationForInnerClasses(OutputList &ol) const override;
341 void writeMemberPages(OutputList &ol) const override;
342 void writeMemberList(OutputList &ol) const override;
343 void writeDeclaration(OutputList &ol,bool inGroup,int indentLevel,
344 const ClassDef *inheritedFrom,const DString &inheritId) const override;
345 void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const override;
346 void writePageNavigation(OutputList &ol) const override;
347 void writeSummaryLinks(OutputList &ol) const override;
348 void reclassifyMember(MemberDefMutable *md,MemberType t) override;
349 void writeInlineDocumentation(OutputList &ol) const override;
350 void writeDeclarationLink(OutputList &ol,bool &found,
351 const DString &header,bool localNames) const override;
352 void removeMemberFromLists(MemberDef *md) override;
353 void setAnonymousEnumType() override;
354 void countMembers() override;
355 void sortAllMembersList() override;
356
358 const ClassDef *inheritedFrom,const DString &inheritId) const override;
359 void writeTagFile(TextStream &) const override;
360
361 int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override;
362 int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom,
363 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override;
364 void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses,
365 MemberListType lt,const DString &title,
366 const DString &subTitle=DString(),
367 bool showInline=false,const ClassDef *inheritedFrom=nullptr,
368 MemberListType lt2=MemberListType::Invalid(),bool invert=false,bool showAlways=false) const override;
369 void setRequiresClause(const DString &req) override;
370 void setPrimaryConstructorParams(const ArgumentList &list) override;
371
372 // inheritance graph related members
373 CLASS_GRAPH_t hasInheritanceGraph() const override;
374 void overrideInheritanceGraph(CLASS_GRAPH_t e) override;
375
376 // collaboration graph related members
377 bool hasCollaborationGraph() const override;
378 void overrideCollaborationGraph(bool e) override;
379 private:
380 int countInheritedByNodes() const;
381 int countInheritsNodes() const;
382 int countInheritanceNodes() const;
383 void addUsedInterfaceClasses(MemberDef *md,const DString &typeStr);
384 void showUsedFiles(OutputList &ol) const;
385
386 void writeDocumentationContents(OutputList &ol,const DString &pageTitle) const;
387 void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList);
388 void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief);
391 const ClassDef *inheritedFrom,bool invert,
392 bool showAlways) const;
393 void writeMemberDocumentation(OutputList &ol,MemberListType lt,const DString &title,bool showInline=false) const;
396 int indentLevel,const ClassDef *inheritedFrom,const DString &inheritId) const;
397 void writeBriefDescription(OutputList &ol,bool exampleFlag) const;
398 void writeDetailedDescription(OutputList &ol,const DString &pageType,bool exampleFlag,
399 const DString &title,const DString &anchor=DString()) const;
400 void writeIncludeFiles(OutputList &ol) const;
402 void writeInheritanceGraph(OutputList &ol) const;
403 void writeCollaborationGraph(OutputList &ol) const;
404 void writeMemberGroups(OutputList &ol,bool showInline=false) const;
405 void writeNestedClasses(OutputList &ol,const DString &title) const;
406 void writeInlineClasses(OutputList &ol) const;
407 void startMemberDeclarations(OutputList &ol) const;
408 void endMemberDeclarations(OutputList &ol) const;
409 void startMemberDocumentation(OutputList &ol) const;
410 void endMemberDocumentation(OutputList &ol) const;
411 void writeAuthorSection(OutputList &ol) const;
412 void writeMoreLink(OutputList &ol,const DString &anchor) const;
414
417 void addClassAttributes(OutputList &ol) const;
419 const ClassDef *inheritedFrom,bool invert,bool showAlways,
420 ClassDefSet &visitedClasses) const;
422 DString &title,DString &subtitle) const;
423 void addTypeConstraint(const DString &typeConstraint,const DString &type);
424 void writeTemplateSpec(OutputList &ol,const Definition *d,
425 const DString &type,SrcLangExt lang) const;
426 void mergeMembersFromBaseClasses(bool mergeVirtualBaseClass);
428 private:
429 /*! file name that forms the base for the output file containing the
430 * class documentation. For compatibility with Qt (e.g. links via tag
431 * files) this name cannot be derived from the class name directly.
432 */
434
435 /*! file name used for the list of all members */
437
438 /*! file name used for the collaboration diagram */
440
441 /*! file name used for the inheritance graph */
443
444 /*! Include information about the header file should be included
445 * in the documentation. 0 by default, set by setIncludeFile().
446 */
447 std::unique_ptr<IncludeInfo> m_incInfo;
448
449 /*! List of base class (or super-classes) from which this class derives
450 * directly.
451 */
453
454 /*! List of sub-classes that directly derive from this class
455 */
457
458 /*! Namespace this class is part of
459 * (this is the inner most namespace in case of nested namespaces)
460 */
461 //NamespaceDef *m_nspace = nullptr;
462
463 /*! File this class is defined in */
464 FileDef *m_fileDef = nullptr;
465
466 /*! Module this class is defined in */
468
469 /*! List of all members (including inherited members) */
471
472 /*! Template arguments of this class */
474
475 /*! Type constraints for template parameters */
477
478 /*! Files that were used for generating the class documentation. */
480
481 /*! Examples that use this class */
483
484 /*! Holds the kind of "class" this is. */
486
487 /*! The protection level in which this class was found.
488 * Typically Public, but for nested classes this can also be Protected
489 * or Private.
490 */
492
493 /*! The inner classes contained in this class. Will be 0 if there are
494 * no inner classes.
495 */
497
498 /* classes for the collaboration diagram */
501
503
504 /*! Template instances that exists of this class, the key in the
505 * dictionary is the template argument list.
506 */
508
510
511 /*! The class this class is an instance of. */
512 const ClassDef *m_templateMaster = nullptr;
513
514 /*! local class name which could be a typedef'ed alias name. */
516
517 /*! If this class is a Objective-C category, then this points to the
518 * class which is extended.
519 */
521
523
524 /* user defined member groups */
526
527 /*! Is this an abstract class? */
528 bool m_isAbstract = false;
529
530 /*! Is the class part of an unnamed namespace? */
531 bool m_isStatic = false;
532
533 /*! true if classes members are merged with those of the base classes. */
534 bool m_membersMerged = false;
535
536 /*! true if the class is defined in a source file rather than a header file. */
537 bool m_isLocal = false;
538
539 bool m_isTemplArg = false;
540
541 /*! Does this class group its user-grouped members
542 * as a sub-section of the normal (public/protected/..)
543 * groups?
544 */
545 bool m_subGrouping = false;
546
547 /** Reason of existence is a "use" relation */
548 bool m_usedOnly = false;
549
550 /** List of titles to use for the summary */
552
553 /** Is this a simple (non-nested) C structure? */
554 bool m_isSimple = false;
555
556 /** Does this class overloaded the -> operator? */
557 const MemberDef *m_arrowOperator = nullptr;
558
559 const ClassDef *m_taglessParent = nullptr;
560 bool m_hasNamedVariable = false;
561
562 /** Does this class represent a Java style enum? */
563 bool m_isJavaEnum = false;
564
566
568
569 /** C++20 requires clause */
571
573
575 CLASS_GRAPH_t m_typeInheritanceGraph = CLASS_GRAPH_t::NO;
576
578
580};
581
582std::unique_ptr<ClassDef> createClassDef(
583 const DString &fileName,int startLine,size_t startColumn,
584 const DString &name,ClassDef::CompoundType ct,
585 const DString &ref,const DString &fName,
586 bool isSymbol,bool isJavaEnum)
587{
588 return std::make_unique<ClassDefImpl>(fileName,startLine,startColumn,name,ct,ref,fName,isSymbol,isJavaEnum);
589}
590//-----------------------------------------------------------------------------
591
592class ClassDefAliasImpl final : public DefinitionAliasMixin<ClassDef>
593{
594 public:
595 ClassDefAliasImpl(const Definition *newScope,const ClassDef *cd)
596 : DefinitionAliasMixin(newScope,cd) { init(); }
597 ~ClassDefAliasImpl() override { deinit(); }
599
600 DefType definitionType() const override { return TypeClass; }
601
602 const ClassDef *getCdAlias() const { return toClassDef(getAlias()); }
603 std::unique_ptr<ClassDef> deepCopy(const DString &name) const override {
605 }
606 void moveTo(Definition *) override {}
607
609 { return getCdAlias()->codeSymbolType(); }
610 DString getOutputFileBase() const override
611 { return getCdAlias()->getOutputFileBase(); }
614 DString getSourceFileBase() const override
615 { return getCdAlias()->getSourceFileBase(); }
616 DString getReference() const override
617 { return getCdAlias()->getReference(); }
618 bool isReference() const override
619 { return getCdAlias()->isReference(); }
620 bool isLocal() const override
621 { return getCdAlias()->isLocal(); }
623 { return getCdAlias()->getClasses(); }
624 bool hasDocumentation() const override
625 { return getCdAlias()->hasDocumentation(); }
626 bool hasDetailedDescription() const override
627 { return getCdAlias()->hasDetailedDescription(); }
632 DString displayName(bool includeScope=true) const override
633 { return makeDisplayName(this,includeScope); }
634 CompoundType compoundType() const override
635 { return getCdAlias()->compoundType(); }
637 { return getCdAlias()->compoundTypeString(); }
638 const BaseClassList &baseClasses() const override
639 { return getCdAlias()->baseClasses(); }
640 const BaseClassList &subClasses() const override
641 { return getCdAlias()->subClasses(); }
644 Protection protection() const override
645 { return getCdAlias()->protection(); }
646 bool isLinkableInProject() const override
647 { return getCdAlias()->isLinkableInProject(); }
648 bool isLinkable() const override
649 { return getCdAlias()->isLinkable(); }
650 bool isVisibleInHierarchy() const override
651 { return getCdAlias()->isVisibleInHierarchy(); }
652 bool visibleInParentsDeclList() const override
653 { return getCdAlias()->visibleInParentsDeclList(); }
654 const ArgumentList &templateArguments() const override
655 { return getCdAlias()->templateArguments(); }
656 FileDef *getFileDef() const override
657 { return getCdAlias()->getFileDef(); }
658 ModuleDef *getModuleDef() const override
659 { return getCdAlias()->getModuleDef(); }
660 const MemberDef *getMemberByName(const DString &s) const override
661 { return getCdAlias()->getMemberByName(s); }
662 int isBaseClass(const ClassDef *bcd,bool followInstances,const DString &templSpec) const override
663 { return getCdAlias()->isBaseClass(bcd,followInstances,templSpec); }
664 bool isSubClass(ClassDef *bcd,int level=0) const override
665 { return getCdAlias()->isSubClass(bcd,level); }
666 bool isAccessibleMember(const MemberDef *md) const override
667 { return getCdAlias()->isAccessibleMember(md); }
669 { return getCdAlias()->getTemplateInstances(); }
670 const ClassDef *templateMaster() const override
671 { return getCdAlias()->templateMaster(); }
672 bool isTemplate() const override
673 { return getCdAlias()->isTemplate(); }
674 const IncludeInfo *includeInfo() const override
675 { return getCdAlias()->includeInfo(); }
682 bool isTemplateArgument() const override
683 { return getCdAlias()->isTemplateArgument(); }
684 const Definition *findInnerCompound(const DString &name) const override
685 { return getCdAlias()->findInnerCompound(name); }
689 const ArgumentLists *actualParams=nullptr,uint32_t *actualParamIndex=nullptr) const override
690 { return makeQualifiedNameWithTemplateParameters(this,actualParams,actualParamIndex); }
691 bool isAbstract() const override
692 { return getCdAlias()->isAbstract(); }
693 bool isObjectiveC() const override
694 { return getCdAlias()->isObjectiveC(); }
695 bool isFortran() const override
696 { return getCdAlias()->isFortran(); }
697 bool isCSharp() const override
698 { return getCdAlias()->isCSharp(); }
699 bool isFinal() const override
700 { return getCdAlias()->isFinal(); }
701 bool isSealed() const override
702 { return getCdAlias()->isSealed(); }
703 bool isPublished() const override
704 { return getCdAlias()->isPublished(); }
705 bool isExtension() const override
706 { return getCdAlias()->isExtension(); }
707 bool isForwardDeclared() const override
708 { return getCdAlias()->isForwardDeclared(); }
709 bool isInterface() const override
710 { return getCdAlias()->isInterface(); }
711 ClassDef *categoryOf() const override
712 { return getCdAlias()->categoryOf(); }
713 DString className() const override
714 { return getCdAlias()->className(); }
716 { return getCdAlias()->getMemberList(lt); }
717 const MemberLists &getMemberLists() const override
718 { return getCdAlias()->getMemberLists(); }
719 const MemberGroupList &getMemberGroups() const override
720 { return getCdAlias()->getMemberGroups(); }
723 bool isUsedOnly() const override
724 { return getCdAlias()->isUsedOnly(); }
725 DString anchor() const override
726 { return getCdAlias()->anchor(); }
727 bool isEmbeddedInOuterScope() const override
728 { return getCdAlias()->isEmbeddedInOuterScope(); }
729 bool isSimple() const override
730 { return getCdAlias()->isSimple(); }
731 const ClassDef *taglessParent() const override
732 { return getCdAlias()->taglessParent(); }
733 bool hasNamedVariable() const override
734 { return getCdAlias()->hasNamedVariable(); }
735 const MemberDef *isSmartPointer() const override
736 { return getCdAlias()->isSmartPointer(); }
737 bool isJavaEnum() const override
738 { return getCdAlias()->isJavaEnum(); }
739 DString title() const override
740 { return getCdAlias()->title(); }
742 { return getCdAlias()->generatedFromFiles(); }
743 const FileList &usedFiles() const override
744 { return getCdAlias()->usedFiles(); }
745 const ArgumentList &typeConstraints() const override
746 { return getCdAlias()->typeConstraints(); }
747 const ExampleList &getExamples() const override
748 { return getCdAlias()->getExamples(); }
749 bool hasExamples() const override
750 { return getCdAlias()->hasExamples(); }
752 { return getCdAlias()->getMemberListFileName(); }
753 bool subGrouping() const override
754 { return getCdAlias()->subGrouping(); }
755 bool isSliceLocal() const override
756 { return getCdAlias()->isSliceLocal(); }
757 bool hasNonReferenceSuperClass() const override
759 DString requiresClause() const override
760 { return getCdAlias()->requiresClause(); }
762 { return getCdAlias()->getQualifiers(); }
763 bool containsOverload(const MemberDef *md) const override
764 { return getCdAlias()->containsOverload(md); }
765
766 int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override
767 { return getCdAlias()->countMembersIncludingGrouped(lt,inheritedFrom,additional); }
769 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override
770 { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); }
771
772 void writeDeclarationLink(OutputList &ol,bool &found,
773 const DString &header,bool localNames) const override
774 { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); }
775 bool isImplicitTemplateInstance() const override
777
778 void writeDocumentation(OutputList &ol) const override
782 void writeMemberPages(OutputList &ol) const override
783 { getCdAlias()->writeMemberPages(ol); }
784 void writeMemberList(OutputList &ol) const override
785 { getCdAlias()->writeMemberList(ol); }
786 void writeDeclaration(OutputList &ol,bool inGroup,
787 int indentLevel, const ClassDef *inheritedFrom,const DString &inheritId) const override
788 { getCdAlias()->writeDeclaration(ol,inGroup,indentLevel,inheritedFrom,inheritId); }
789 void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const override
790 { getCdAlias()->writeQuickMemberLinks(ol,md); }
791 void writeSummaryLinks(OutputList &ol) const override
792 { getCdAlias()->writeSummaryLinks(ol); }
793 void writePageNavigation(OutputList &ol) const override
797 void writeTagFile(TextStream &ol) const override
798 { getCdAlias()->writeTagFile(ol); }
800 MemberListType lt,const DString &title,
801 const DString &subTitle=DString(),
802 bool showInline=false,const ClassDef *inheritedFrom=nullptr,
803 MemberListType lt2=MemberListType::Invalid(),bool invert=false,bool showAlways=false) const override
804 { getCdAlias()->writeMemberDeclarations(ol,visitedClasses,lt,title,subTitle,showInline,inheritedFrom,lt2,invert,showAlways); }
806 const ClassDef *inheritedFrom,const DString &inheritId) const override
807 { getCdAlias()->addGroupedInheritedMembers(ol,lt,inheritedFrom,inheritId); }
808
809 void updateBaseClasses(const BaseClassList &) override {}
810 void updateSubClasses(const BaseClassList &) override {}
811};
812
813std::unique_ptr<ClassDef> createClassDefAlias(const Definition *newScope,const ClassDef *cd)
814{
815 auto acd = std::make_unique<ClassDefAliasImpl>(newScope,cd);
816 //printf("cd name=%s localName=%s qualifiedName=%s qualifiedNameWith=%s displayName()=%s\n",
817 // qPrint(acd->name()),qPrint(acd->localName()),qPrint(acd->qualifiedName()),
818 // qPrint(acd->qualifiedNameWithTemplateParameters()),qPrint(acd->displayName()));
819 return acd;
820}
821
822//-----------------------------------------------------------------------------
823
824// constructs a new class definition
826 const DString &defFileName,int defLine,size_t defColumn,
827 const DString &nm,CompoundType ct,
828 const DString &lref,const DString &fName,
829 bool isSymbol,bool isJavaEnum)
830 : DefinitionMixin(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),nullptr,nullptr,isSymbol)
831{
832 AUTO_TRACE("name={}",name());
833 setReference(lref);
834 m_compType = ct;
837 if (!fName.empty())
838 {
840 }
841 else
842 {
843 m_fileName=compTypeString+name();
844 }
845 m_prot=Protection::Public;
846 //nspace=nullptr;
847 m_fileDef=nullptr;
848 m_moduleDef=nullptr;
849 m_subGrouping=Config_getBool(SUBGROUPING);
850 m_templateMaster =nullptr;
851 m_isAbstract = false;
852 m_isStatic = false;
853 m_isTemplArg = false;
854 m_membersMerged = false;
855 m_categoryOf = nullptr;
856 m_usedOnly = false;
857 m_isSimple = Config_getBool(INLINE_SIMPLE_STRUCTS);
858 m_arrowOperator = nullptr;
859 m_taglessParent = nullptr;
860 m_hasNamedVariable = false;
862 //DString ns;
863 //extractNamespaceName(name,className,ns);
864 //printf("m_name=%s m_className=%s ns=%s\n",qPrint(m_name),qPrint(m_className),qPrint(ns));
865
866 // we cannot use getLanguage at this point, as setLanguage has not been called.
867 SrcLangExt lang = getLanguageFromFileName(defFileName);
868 if ((lang==SrcLangExt::Cpp || lang==SrcLangExt::ObjC) && EntryType::guessSection(defFileName).isSource())
869 {
870 m_isLocal=true;
871 }
872 else
873 {
874 m_isLocal=false;
875 }
876 m_hasCollaborationGraph = Config_getBool(COLLABORATION_GRAPH);
878 m_memberListFileName = convertNameToFile(compTypeString+name()+"-members");
881 if (lref.empty())
882 {
884 }
885 AUTO_TRACE_EXIT("m_fileName='{}'",m_fileName);
886}
887
888std::unique_ptr<ClassDef> ClassDefImpl::deepCopy(const DString &name) const
889{
890 AUTO_TRACE("name='{}'",name);
891 auto result = std::make_unique<ClassDefImpl>(
893 std::string(),std::string(),true,m_isJavaEnum);
894 result->setBriefDescription(briefDescription(),briefFile(),briefLine());
895 result->setDocumentation(documentation(),docFile(),docLine());
896 result->setInbodyDocumentation(inbodyDocumentation(),inbodyFile(),inbodyLine());
897 result->setBodySegment(getStartDefLine(),getStartBodyLine(),getEndBodyLine());
898 result->setBodyDef(getBodyDef());
899 result->setLanguage(getLanguage());
900
901 // copy other members
902 result->m_memberListFileName = m_memberListFileName;
903 result->m_collabFileName = m_collabFileName;
904 result->m_inheritFileName = m_inheritFileName;
905 if (m_incInfo)
906 {
907 result->m_incInfo = std::make_unique<IncludeInfo>();
908 *(result->m_incInfo) = *m_incInfo;
909 }
910 result->m_inherits = m_inherits;
911 result->m_inheritedBy = m_inheritedBy;
912 result->m_fileDef = m_fileDef;
913 result->m_moduleDef = m_moduleDef;
914 result->m_tempArgs = m_tempArgs;
915 result->m_typeConstraints = m_typeConstraints;
916 result->m_files = m_files;
917 result->m_examples = m_examples;
918 result->m_compType = m_compType;
919 result->m_prot = m_prot;
920 result->m_usesImplClassList = m_usesImplClassList;
921 result->m_usedByImplClassList = m_usedByImplClassList;
922 result->m_constraintClassList = m_constraintClassList;
923 result->m_templateInstances = m_templateInstances;
924 result->m_templBaseClassNames = m_templBaseClassNames;
925 result->m_templateMaster = m_templateMaster;
926 result->m_className = m_className;
927 result->m_categoryOf = m_categoryOf;
928 result->m_isAbstract = m_isAbstract;
929 result->m_isStatic = m_isStatic;
930 result->m_membersMerged = m_membersMerged;
931 result->m_isLocal = m_isLocal;
932 result->m_isTemplArg = m_isTemplArg;
933 result->m_subGrouping = m_subGrouping;
934 result->m_usedOnly = m_usedOnly;
935 result->m_vhdlSummaryTitles = m_vhdlSummaryTitles;
936 result->m_isSimple = m_isSimple;
937 result->m_arrowOperator = m_arrowOperator;
938 result->m_taglessParent = m_taglessParent;
939 result->m_hasNamedVariable = m_hasNamedVariable;
940 result->m_isJavaEnum = m_isJavaEnum;
941 result->m_spec = m_spec;
942 result->m_metaData = m_metaData;
943 result->m_requiresClause = m_requiresClause;
944 result->m_qualifiers = m_qualifiers;
945 result->m_hasCollaborationGraph = m_hasCollaborationGraph;
946 result->m_typeInheritanceGraph = m_typeInheritanceGraph;
947
948 // set new file name
950 result->m_fileName = compTypeString+name;
951 result->m_memberListFileName = convertNameToFile(compTypeString+name+"-members");
952 result->m_collabFileName = convertNameToFile(result->m_fileName+"_coll_graph");
953 result->m_inheritFileName = convertNameToFile(result->m_fileName+"_inherit_graph");
954 result->m_fileName = convertNameToFile(result->m_fileName);
955
956 // deep copy nested classes
957 for (const auto &innerCd : m_innerClasses)
958 {
959 DString innerName = name+"::"+innerCd->localName();
960 if (Doxygen::classLinkedMap->find(innerName)==nullptr)
961 {
962 auto cd = Doxygen::classLinkedMap->add(innerName,innerCd->deepCopy(innerName));
963 result->addInnerCompound(cd);
965 if (cdm)
966 {
967 cdm->setOuterScope(result.get());
968 }
969 }
970 }
971
972 // copy all member list (and make deep copies of members)
973 for (auto &mni : m_allMemberNameInfoLinkedMap)
974 {
975 for (auto &mi : *mni)
976 {
977 const MemberDef *md=mi->memberDef();
978 auto newMd = md->deepCopy();
979 if (newMd)
980 {
981 AUTO_TRACE_ADD("Copying member {}",newMd->name());
982 auto mmd = toMemberDefMutable(newMd.get());
983 if (mmd)
984 {
985 mmd->moveTo(result.get());
986 }
987
988 result->internalInsertMember(newMd.get(),newMd->protection(),true);
989
990 // also add to the global list (which will own newMd)
991 MemberName *mn = Doxygen::memberNameLinkedMap->add(newMd->name());
992 mn->push_back(std::move(newMd));
993 }
994 }
995 }
996
997 return result;
998}
999
1001{
1002 //printf("%s::moveTo(%s)\n",qPrint(name()),qPrint(scope->name()));
1003 setOuterScope(scope);
1005 {
1006 m_fileDef = toFileDef(scope);
1007 }
1008 else if (scope->definitionType()==Definition::TypeModule)
1009 {
1010 m_moduleDef = toModuleDef(scope);
1011 }
1012}
1013
1018
1019DString ClassDefImpl::displayName(bool includeScope) const
1020{
1021 return makeDisplayName(this,includeScope);
1022}
1023
1024// inserts a base/super class in the inheritance list
1026 Specifier s,const DString &t)
1027{
1028 //printf("*** insert base class %s into %s\n",qPrint(cd->name()),qPrint(name()));
1029 m_inherits.emplace_back(cd,n,p,s,t);
1030 m_isSimple = false;
1031}
1032
1033// inserts a derived/sub class in the inherited-by list
1035 Specifier s,const DString &t)
1036{
1037 //printf("*** insert sub class %s into %s\n",qPrint(cd->name()),qPrint(name()));
1038 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
1039 if (!extractPrivate && cd->protection()==Protection::Private) return;
1040 m_inheritedBy.emplace_back(cd,DString(),p,s,t);
1041 m_isSimple = false;
1042}
1043
1045{
1046 for (auto &ml : m_memberLists)
1047 {
1048 if (!ml->listType().isDetailed())
1049 {
1051 }
1052 }
1053
1054 // add members inside sections to their groups
1055 for (const auto &mg : m_memberGroups)
1056 {
1057 if (mg->allMembersInSameSection() && m_subGrouping)
1058 {
1059 //printf("addToDeclarationSection(%s)\n",qPrint(mg->header()));
1060 mg->addToDeclarationSection();
1061 }
1062 }
1063}
1064
1065// adds new member definition to the class
1067 Protection prot,
1068 bool addToAllList
1069 )
1070{
1071 AUTO_TRACE("{} name={} isHidden={}",name(),md->name(),md->isHidden());
1072 if (md->isHidden()) return;
1073
1074 if (getLanguage()==SrcLangExt::VHDL)
1075 {
1077 m_vhdlSummaryTitles.insert(title.str());
1078 }
1079
1080 if (1 /*!isReference()*/) // changed to 1 for showing members of external
1081 // classes when HAVE_DOT and UML_LOOK are enabled.
1082 {
1083 bool isSimple=false;
1084
1085 /********************************************/
1086 /* insert member in the declaration section */
1087 /********************************************/
1088 if (md->isRelated() && protectionLevelVisible(prot))
1089 {
1090 addMemberToList(MemberListType::Related(),md,true);
1091 }
1092 else if (md->isFriend())
1093 {
1094 addMemberToList(MemberListType::Friends(),md,true);
1095 }
1096 else
1097 {
1098 switch (md->memberType())
1099 {
1100 case MemberType::Service: // UNO IDL
1101 addMemberToList(MemberListType::Services(),md,true);
1102 break;
1103 case MemberType::Interface: // UNO IDL
1104 addMemberToList(MemberListType::Interfaces(),md,true);
1105 break;
1106 case MemberType::Signal: // Qt specific
1107 addMemberToList(MemberListType::Signals(),md,true);
1108 break;
1109 case MemberType::DCOP: // KDE2 specific
1110 addMemberToList(MemberListType::DcopMethods(),md,true);
1111 break;
1112 case MemberType::Property:
1113 addMemberToList(MemberListType::Properties(),md,true);
1114 break;
1115 case MemberType::Event:
1116 addMemberToList(MemberListType::Events(),md,true);
1117 break;
1118 case MemberType::Slot: // Qt specific
1119 switch (prot)
1120 {
1121 case Protection::Protected:
1122 case Protection::Package: // slots in packages are not possible!
1123 addMemberToList(MemberListType::ProSlots(),md,true);
1124 break;
1125 case Protection::Public:
1126 addMemberToList(MemberListType::PubSlots(),md,true);
1127 break;
1128 case Protection::Private:
1129 addMemberToList(MemberListType::PriSlots(),md,true);
1130 break;
1131 }
1132 break;
1133 default: // any of the other members
1134 if (md->isStatic())
1135 {
1136 if (md->isVariable())
1137 {
1138 switch (prot)
1139 {
1140 case Protection::Protected:
1141 addMemberToList(MemberListType::ProStaticAttribs(),md,true);
1142 break;
1143 case Protection::Package:
1144 addMemberToList(MemberListType::PacStaticAttribs(),md,true);
1145 break;
1146 case Protection::Public:
1147 addMemberToList(MemberListType::PubStaticAttribs(),md,true);
1148 break;
1149 case Protection::Private:
1150 addMemberToList(MemberListType::PriStaticAttribs(),md,true);
1151 break;
1152 }
1153 }
1154 else // function
1155 {
1156 switch (prot)
1157 {
1158 case Protection::Protected:
1159 addMemberToList(MemberListType::ProStaticMethods(),md,true);
1160 break;
1161 case Protection::Package:
1162 addMemberToList(MemberListType::PacStaticMethods(),md,true);
1163 break;
1164 case Protection::Public:
1165 addMemberToList(MemberListType::PubStaticMethods(),md,true);
1166 break;
1167 case Protection::Private:
1168 addMemberToList(MemberListType::PriStaticMethods(),md,true);
1169 break;
1170 }
1171 }
1172 }
1173 else // not static
1174 {
1175 if (md->isVariable())
1176 {
1177 switch (prot)
1178 {
1179 case Protection::Protected:
1180 addMemberToList(MemberListType::ProAttribs(),md,true);
1181 break;
1182 case Protection::Package:
1183 addMemberToList(MemberListType::PacAttribs(),md,true);
1184 break;
1185 case Protection::Public:
1186 {
1187 if (md->anonymousMemberForDeclaration()==nullptr) // not a split member that has a separate declaration member
1188 {
1189 addMemberToList(MemberListType::PubAttribs(),md,true);
1190 const int MAX_CELL_SIZE=60;
1191 size_t typeLen = removeAnonymousScopes(md->typeString()).length();
1192 isSimple = typeLen + md->name().length() + md->argsString().length() <= MAX_CELL_SIZE;
1193 }
1194 }
1195 break;
1196 case Protection::Private:
1197 addMemberToList(MemberListType::PriAttribs(),md,true);
1198 break;
1199 }
1200 }
1201 else if (md->isTypedef() || md->isEnumerate() || md->isEnumValue())
1202 {
1203 switch (prot)
1204 {
1205 case Protection::Protected:
1206 addMemberToList(MemberListType::ProTypes(),md,true);
1207 break;
1208 case Protection::Package:
1209 addMemberToList(MemberListType::PacTypes(),md,true);
1210 break;
1211 case Protection::Public:
1212 addMemberToList(MemberListType::PubTypes(),md,true);
1213 isSimple=!md->isEnumerate() &&
1214 !md->isEnumValue() &&
1215 md->typeString().find(")(")==DString::npos; // func ptr typedef
1216 break;
1217 case Protection::Private:
1218 addMemberToList(MemberListType::PriTypes(),md,true);
1219 break;
1220 }
1221 }
1222 else // member function
1223 {
1224 switch (prot)
1225 {
1226 case Protection::Protected:
1227 addMemberToList(MemberListType::ProMethods(),md,true);
1228 break;
1229 case Protection::Package:
1230 addMemberToList(MemberListType::PacMethods(),md,true);
1231 break;
1232 case Protection::Public:
1233 addMemberToList(MemberListType::PubMethods(),md,true);
1234 break;
1235 case Protection::Private:
1236 addMemberToList(MemberListType::PriMethods(),md,true);
1237 break;
1238 }
1239 }
1240 }
1241 break;
1242 }
1243 }
1244 if (!isSimple) // not a simple field -> not a simple struct
1245 {
1246 m_isSimple = false;
1247 }
1248 //printf("adding %s simple=%d total_simple=%d\n",qPrint(md->qualifiedName()),isSimple,m_isSimple);
1249 if ((!md->isEnumerate() && md->isAnonymous()) || // non-enum anonymous member (e.g. nameless member associated with anonymous struct/union)
1250 md->anonymousMemberForDetails()!=nullptr)
1251 {
1252 return; // The member is split in two, one for the declaration and one for the details.
1253 // Skip this member if it has an associated member for the details,
1254 // which implies this is the member for the declaration part only.
1255 }
1256
1257 /*******************************************************/
1258 /* insert member in the detailed documentation section */
1259 /*******************************************************/
1260 if ((md->isRelated() && protectionLevelVisible(prot)) || md->isFriend())
1261 {
1262 addMemberToList(MemberListType::RelatedMembers(),md,false);
1263 }
1264 else if (md->isFunction() &&
1265 md->protection()==Protection::Private &&
1266 (md->virtualness()!=Specifier::Normal || md->isOverride() || md->isFinal()) &&
1267 Config_getBool(EXTRACT_PRIV_VIRTUAL))
1268 {
1269 addMemberToList(MemberListType::FunctionMembers(),md,false);
1270 }
1271 else
1272 {
1273 switch (md->memberType())
1274 {
1275 case MemberType::Service: // UNO IDL
1276 addMemberToList(MemberListType::ServiceMembers(),md,false);
1277 break;
1278 case MemberType::Interface: // UNO IDL
1279 addMemberToList(MemberListType::InterfaceMembers(),md,false);
1280 break;
1281 case MemberType::Property:
1282 addMemberToList(MemberListType::PropertyMembers(),md,false);
1283 break;
1284 case MemberType::Event:
1285 addMemberToList(MemberListType::EventMembers(),md,false);
1286 break;
1287 case MemberType::Signal: // fall through
1288 case MemberType::DCOP:
1289 addMemberToList(MemberListType::FunctionMembers(),md,false);
1290 break;
1291 case MemberType::Slot:
1292 if (protectionLevelVisible(prot))
1293 {
1294 addMemberToList(MemberListType::FunctionMembers(),md,false);
1295 }
1296 break;
1297 default: // any of the other members
1298 if (protectionLevelVisible(prot))
1299 {
1300 switch (md->memberType())
1301 {
1302 case MemberType::Typedef:
1303 addMemberToList(MemberListType::TypedefMembers(),md,false);
1304 break;
1305 case MemberType::Enumeration:
1306 addMemberToList(MemberListType::EnumMembers(),md,false);
1307 break;
1308 case MemberType::EnumValue:
1309 addMemberToList(MemberListType::EnumValMembers(),md,false);
1310 break;
1311 case MemberType::Function:
1312 if (md->isConstructor() || md->isDestructor())
1313 {
1314 m_memberLists.get(MemberListType::Constructors(),MemberListContainer::Class)->push_back(md);
1315 }
1316 else
1317 {
1318 addMemberToList(MemberListType::FunctionMembers(),md,false);
1319 }
1320 break;
1321 case MemberType::Variable:
1322 addMemberToList(MemberListType::VariableMembers(),md,false);
1323 break;
1324 case MemberType::Define:
1325 warn(md->getDefFileName(),md->getDefLine()-1,"A define ({}) cannot be made a member of {}",
1326 md->name(), this->name());
1327 break;
1328 default:
1329 err("Unexpected member type '{}' found!\n",md->memberTypeName());
1330 }
1331 }
1332 break;
1333 }
1334 }
1335
1336 /*************************************************/
1337 /* insert member in the appropriate member group */
1338 /*************************************************/
1339 // Note: this must be done AFTER inserting the member in the
1340 // regular groups
1341 //addMemberToGroup(md,groupId);
1342
1343 }
1344
1345 if (md->virtualness()==Specifier::Pure)
1346 {
1347 m_isAbstract=true;
1348 }
1349
1350 if (md->name()=="operator->")
1351 {
1352 m_arrowOperator=md;
1353 }
1354
1355 if (addToAllList && !(Config_getBool(HIDE_FRIEND_COMPOUNDS) && md->isFriend() && isTypeAClassFriend(md->typeString())))
1356 {
1357 //printf("=======> adding member %s to class %s\n",qPrint(md->name()),qPrint(name()));
1358
1360 mni->push_back(std::make_unique<MemberInfo>(md,prot,md->virtualness(),false,false));
1361 }
1362
1363 // if we already created template instances before inserting this member (i.e. due to a typedef or using statement)
1364 // then we also need to insert the member in the template instance.
1365 for (const auto &ti : getTemplateInstances())
1366 {
1367 AUTO_TRACE_ADD("member {} of class {} with template instance {}\n",md->name(),name(),ti.templSpec);
1368 ClassDefMutable *cdm = toClassDefMutable(ti.classDef);
1369 if (cdm)
1370 {
1371 cdm->addMemberToTemplateInstance(md,templateArguments(),ti.templSpec);
1372 }
1373 }
1374
1375}
1376
1378{
1379 internalInsertMember(md,md->protection(),true);
1380}
1381
1382// compute the anchors for all members
1384{
1385 for (auto &ml : m_memberLists)
1386 {
1387 if (!ml->listType().isDetailed())
1388 {
1389 ml->setAnchors();
1390 }
1391 }
1392
1393 for (const auto &mg : m_memberGroups)
1394 {
1395 mg->setAnchors();
1396 }
1397}
1398
1400{
1401 for (const auto &mg : m_memberGroups)
1402 {
1403 mg->distributeMemberGroupDocumentation();
1404 }
1405}
1406
1408{
1412 for (const auto &mg : m_memberGroups)
1413 {
1414 mg->findSectionsInDocumentation(this);
1415 }
1416 for (auto &ml : m_memberLists)
1417 {
1418 if (!ml->listType().isDetailed())
1419 {
1420 ml->findSectionsInDocumentation(this);
1421 }
1422 }
1423}
1424
1425
1426// add a file name to the used files set
1428{
1429 if (fd == nullptr) return;
1430
1431 if (std::find(m_files.begin(), m_files.end(), fd) == m_files.end()) m_files.push_back(fd);
1432
1433 for (const auto &ti : m_templateInstances)
1434 {
1435 if (ClassDefMutable *cdm = toClassDefMutable(ti.classDef)) cdm->insertUsedFile(fd);
1436 }
1437}
1438
1440{
1441 if (bcd.prot!=Protection::Public || bcd.virt!=Specifier::Normal)
1442 {
1443 ol.startTypewriter();
1444 ol.docify(" [");
1445 StringVector sl;
1446 if (bcd.prot==Protection::Protected) sl.emplace_back("protected");
1447 else if (bcd.prot==Protection::Private) sl.emplace_back("private");
1448 if (bcd.virt==Specifier::Virtual) sl.emplace_back("virtual");
1449 bool first=true;
1450 for (const auto &s : sl)
1451 {
1452 if (!first) ol.docify(", ");
1453 ol.docify(s);
1454 first=false;
1455 }
1456 ol.docify("]");
1457 ol.endTypewriter();
1458 }
1459}
1460
1462 const DString &includeName,bool local, bool force)
1463{
1464 //printf("ClassDefImpl::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force);
1465 if (!m_incInfo) m_incInfo = std::make_unique<IncludeInfo>();
1466 if ((!includeName.empty() && m_incInfo->includeName.empty()) ||
1467 (fd!=nullptr && m_incInfo->fileDef==nullptr)
1468 )
1469 {
1470 //printf("Setting file info\n");
1471 m_incInfo->fileDef = fd;
1472 m_incInfo->includeName = includeName;
1474 }
1475 if (force && !includeName.empty())
1476 {
1477 m_incInfo->includeName = includeName;
1479 }
1480}
1481
1482// TODO: fix this: a nested template class can have multiple outer templates
1483//ArgumentList *ClassDefImpl::outerTemplateArguments() const
1484//{
1485// int ti;
1486// ClassDef *pcd=nullptr;
1487// int pi=0;
1488// if (m_tempArgs) return m_tempArgs;
1489// // find the outer most class scope
1490// while ((ti=name().find("::",pi))!=-1 &&
1491// (pcd=getClass(name().left(ti)))==0
1492// ) pi=ti+2;
1493// if (pcd)
1494// {
1495// return pcd->templateArguments();
1496// }
1497// return nullptr;
1498//}
1499
1500static void searchTemplateSpecs(/*in*/ const Definition *d,
1501 /*out*/ ArgumentLists &result,
1502 /*out*/ DString &name,
1503 /*in*/ SrcLangExt lang)
1504{
1506 {
1507 if (d->getOuterScope())
1508 {
1509 searchTemplateSpecs(d->getOuterScope(),result,name,lang);
1510 }
1511 const ClassDef *cd=toClassDef(d);
1512 if (!name.empty()) name+="::";
1513 DString clName = d->localName();
1514 if (clName.endsWith("-p"))
1515 {
1516 clName = clName.left(clName.length()-2);
1517 }
1518 name+=clName;
1519 bool isSpecialization = d->localName().find('<')!=DString::npos;
1520 if (!cd->templateArguments().empty())
1521 {
1522 result.push_back(cd->templateArguments());
1523 if (!isSpecialization)
1524 {
1525 name+=tempArgListToString(cd->templateArguments(),lang);
1526 }
1527 }
1528 }
1529 else
1530 {
1531 name+=d->qualifiedName();
1532 }
1533}
1534
1536 const DString &type,SrcLangExt lang) const
1537{
1538 ArgumentLists specs;
1539 DString name;
1540 searchTemplateSpecs(d,specs,name,lang);
1541 if (!specs.empty()) // class has template scope specifiers
1542 {
1544 for (const ArgumentList &al : specs)
1545 {
1546 ol.docify("template<");
1547 auto it = al.begin();
1548 while (it!=al.end())
1549 {
1550 Argument a = *it;
1552 a.type, // text
1553 LinkifyTextOptions().setScope(d).setFileScope(getFileDef()).setSelf(this));
1554 if (!a.name.empty())
1555 {
1556 ol.docify(" ");
1557 ol.docify(a.name);
1558 }
1559 if (a.defval.length()!=0)
1560 {
1561 ol.docify(" = ");
1562 ol.docify(a.defval);
1563 }
1564 ++it;
1565 if (it!=al.end()) ol.docify(", ");
1566 }
1567 ol.docify(">");
1568 ol.lineBreak();
1569 }
1570 if (!m_requiresClause.empty())
1571 {
1572 ol.docify("requires ");
1574 m_requiresClause, // text
1575 LinkifyTextOptions().setScope(d).setFileScope(getFileDef()).setSelf(this));
1576 ol.lineBreak();
1577 }
1578 ol.docify(type.lower()+" "+name);
1580 }
1581}
1582
1583void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) const
1584{
1585 if (hasBriefDescription())
1586 {
1587 ol.startParagraph();
1588 ol.pushGeneratorState();
1590 ol.writeString(" - ");
1591 ol.popGeneratorState();
1593 briefLine(),
1594 this,
1595 nullptr,
1597 DocOptions()
1598 .setIndexWords(true)
1599 .setSingleLine(true));
1600 ol.pushGeneratorState();
1602 ol.writeString(" \n");
1604 ol.popGeneratorState();
1605
1606 if (hasDetailedDescription() || exampleFlag)
1607 {
1608 writeMoreLink(ol,anchor());
1609 }
1610
1611 ol.endParagraph();
1612 }
1613 ol.writeSynopsis();
1614}
1615
1617{
1618 bool repeatBrief = Config_getBool(REPEAT_BRIEF);
1619
1620 ol.startTextBlock();
1621
1622 if (getLanguage()==SrcLangExt::Cpp)
1623 {
1624 writeTemplateSpec(ol,this,compoundTypeString(),SrcLangExt::Cpp);
1625 }
1626
1627 // repeat brief description
1628 if (!briefDescription().empty() && repeatBrief)
1629 {
1631 briefLine(),
1632 this,
1633 nullptr,
1635 DocOptions());
1636 }
1637 if (!briefDescription().empty() && repeatBrief &&
1638 !documentation().empty())
1639 {
1640 ol.pushGeneratorState();
1642 ol.writeString("\n\n");
1643 ol.popGeneratorState();
1644 }
1645 // write documentation
1646 if (!documentation().empty())
1647 {
1648 ol.generateDoc(docFile(),
1649 docLine(),
1650 this,
1651 nullptr,
1652 documentation(),
1653 DocOptions()
1654 .setIndexWords(true));
1655 }
1656 // write type constraints
1658
1659 ol.generateDoc(
1660 docFile(),docLine(),
1661 this,
1662 nullptr, // memberDef
1664 DocOptions()
1665 .setIndexWords(true));
1666
1667 // write examples
1668 if (hasExamples())
1669 {
1670 ol.startExamples();
1671 ol.startDescForItem();
1673 ol.endDescForItem();
1674 ol.endExamples();
1675 }
1676 writeSourceDef(ol);
1678 ol.endTextBlock();
1679}
1680
1682{
1683 bool repeatBrief = Config_getBool(REPEAT_BRIEF);
1684 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1685 return ((!briefDescription().empty() && repeatBrief) ||
1687 (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) ||
1689}
1690
1691// write the detailed description for this class
1692void ClassDefImpl::writeDetailedDescription(OutputList &ol, const DString &/*pageType*/, bool exampleFlag,
1693 const DString &title,const DString &anchor) const
1694{
1695 if (hasDetailedDescription() || exampleFlag)
1696 {
1697 ol.pushGeneratorState();
1699 ol.writeRuler();
1700 ol.popGeneratorState();
1701
1702 ol.pushGeneratorState();
1704 ol.writeAnchor(DString(),anchor.empty() ? DString("details") : anchor);
1705 ol.popGeneratorState();
1706
1707 if (!anchor.empty())
1708 {
1709 ol.pushGeneratorState();
1713 ol.popGeneratorState();
1714 }
1715
1716 ol.startGroupHeader("details");
1717 ol.parseText(title);
1718 ol.endGroupHeader();
1719
1721 }
1722 else
1723 {
1724 //writeTemplateSpec(ol,this,pageType);
1725 }
1726}
1727
1729{
1730 DString result;
1731 SrcLangExt lang = getLanguage();
1732 size_t numFiles = m_files.size();
1733 if (lang==SrcLangExt::Fortran)
1734 {
1736 getLanguage()==SrcLangExt::ObjC && m_compType==Interface ? Class : m_compType,
1737 numFiles==1);
1738 }
1739 else if (isJavaEnum())
1740 {
1741 result = theTranslator->trEnumGeneratedFromFiles(numFiles==1);
1742 }
1743 else if (m_compType==Service)
1744 {
1745 result = theTranslator->trServiceGeneratedFromFiles(numFiles==1);
1746 }
1747 else if (m_compType==Singleton)
1748 {
1749 result = theTranslator->trSingletonGeneratedFromFiles(numFiles==1);
1750 }
1751 else
1752 {
1754 getLanguage()==SrcLangExt::ObjC && m_compType==Interface ? Class : m_compType,
1755 numFiles==1);
1756 }
1757 return result;
1758}
1759
1761{
1762 ol.pushGeneratorState();
1764
1765
1766 ol.writeRuler();
1767 ol.pushGeneratorState();
1769 ol.startParagraph();
1771 ol.endParagraph();
1772 ol.popGeneratorState();
1776
1777 bool first=true;
1778 for (const auto &fd : m_files)
1779 {
1780 if (first)
1781 {
1782 first=false;
1783 ol.startItemList();
1784 }
1785
1786 ol.startItemListItem();
1787 DString path=fd->getPath();
1788 if (Config_getBool(FULL_PATH_NAMES))
1789 {
1790 ol.docify(stripFromPath(path));
1791 }
1792
1793 DString fname = fd->name();
1794 if (!fd->getVersion().empty()) // append version if available
1795 {
1796 fname += " (" + fd->getVersion() + ")";
1797 }
1798
1799 // for HTML
1800 ol.pushGeneratorState();
1802 if (fd->generateSourceFile())
1803 {
1804 ol.writeObjectLink(DString(),fd->getSourceFileBase(),DString(),fname);
1805 }
1806 else if (fd->isLinkable())
1807 {
1808 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),DString(),fname);
1809 }
1810 else
1811 {
1812 ol.startBold();
1813 ol.docify(fname);
1814 ol.endBold();
1815 }
1816 ol.popGeneratorState();
1817
1818 // for other output formats
1819 ol.pushGeneratorState();
1821 if (fd->isLinkable())
1822 {
1823 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),DString(),fname);
1824 }
1825 else
1826 {
1827 ol.docify(fname);
1828 }
1829 ol.popGeneratorState();
1830
1831 ol.endItemListItem();
1832 }
1833 if (!first) ol.endItemList();
1834
1835 ol.popGeneratorState();
1836}
1837
1839{
1840 int count=0;
1841 for (const auto &ibcd : m_inheritedBy)
1842 {
1843 const ClassDef *icd=ibcd.classDef;
1844 if ( icd->isVisibleInHierarchy()) count++;
1845 }
1846 return count;
1847}
1848
1850{
1851 int count=0;
1852 for (const auto &ibcd : m_inherits)
1853 {
1854 const ClassDef *icd=ibcd.classDef;
1855 if ( icd->isVisibleInHierarchy()) count++;
1856 }
1857 return count;
1858}
1859
1864
1866{
1867 bool haveDot = Config_getBool(HAVE_DOT);
1868 auto classGraph = m_typeInheritanceGraph;
1869
1870 if (classGraph == CLASS_GRAPH_t::NO) return;
1871 // count direct inheritance relations
1872 int count=countInheritanceNodes();
1873
1874 bool renderDiagram = false;
1875 if (haveDot && (classGraph==CLASS_GRAPH_t::YES || classGraph==CLASS_GRAPH_t::GRAPH))
1876 // write class diagram using dot
1877 {
1878 DotClassGraph inheritanceGraph(this,GraphType::Inheritance);
1879 if (inheritanceGraph.isTooBig())
1880 {
1881 warn_uncond("Inheritance graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
1882 name(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
1883 }
1884 else if (!inheritanceGraph.isTrivial())
1885 {
1886 ol.pushGeneratorState();
1888 ol.startDotGraph();
1890 ol.endDotGraph(inheritanceGraph);
1891 ol.popGeneratorState();
1892 renderDiagram = true;
1893 }
1894 }
1895 else if ((classGraph==CLASS_GRAPH_t::YES || classGraph==CLASS_GRAPH_t::GRAPH || classGraph==CLASS_GRAPH_t::BUILTIN) && count>0)
1896 // write class diagram using built-in generator
1897 {
1898 ClassDiagram diagram(this); // create a diagram of this class.
1899 ol.startClassDiagram();
1904 renderDiagram = true;
1905 }
1906
1907 if (renderDiagram) // if we already show the inheritance relations graphically,
1908 // then hide the text version
1909 {
1911 }
1912
1913 count = countInheritsNodes();
1914 if (count>0)
1915 {
1916 auto replaceFunc = [this,&ol](size_t entryIndex)
1917 {
1918 for (size_t index=0; index<m_inherits.size() ; index++)
1919 {
1920 const BaseClassDef &bcd=m_inherits[index];
1921 const ClassDef *cd=bcd.classDef;
1922
1923 if (cd->isVisibleInHierarchy()) // filter on the class we want to show
1924 {
1925 if (index==entryIndex) // found the requested index
1926 {
1927 // use the class name but with the template arguments as given
1928 // in the inheritance relation
1930 cd->displayName(),bcd.templSpecifiers);
1931
1932 if (cd->isLinkable())
1933 {
1935 cd->getOutputFileBase(),
1936 cd->anchor(),
1937 displayName);
1938 }
1939 else
1940 {
1941 ol.docify(displayName);
1942 }
1943 return;
1944 }
1945 }
1946 }
1947 };
1948
1949 ol.startParagraph();
1950 writeMarkerList(ol,
1952 static_cast<size_t>(count),
1953 replaceFunc);
1954 ol.endParagraph();
1955 }
1956
1957 // write subclasses
1958 count = countInheritedByNodes();
1959 if (count>0)
1960 {
1961 auto replaceFunc = [this,&ol](size_t entryIndex)
1962 {
1963 for (size_t index=0; index<m_inheritedBy.size() ; index++)
1964 {
1965 const BaseClassDef &bcd=m_inheritedBy[index];
1966 const ClassDef *cd=bcd.classDef;
1967 if (cd->isVisibleInHierarchy()) // filter on the class we want to show
1968 {
1969 if (index==entryIndex) // found the requested index
1970 {
1971 if (cd->isLinkable())
1972 {
1975 }
1976 else
1977 {
1978 ol.docify(cd->displayName());
1979 }
1980 return;
1981 }
1982 }
1983 }
1984 };
1985
1986 ol.startParagraph();
1987 writeMarkerList(ol,
1989 static_cast<size_t>(count),
1990 replaceFunc);
1991 ol.endParagraph();
1992 }
1993
1994 if (renderDiagram)
1995 {
1996 ol.enableAll();
1997 }
1998}
1999
2001{
2002 if (Config_getBool(HAVE_DOT) && m_hasCollaborationGraph /*&& Config_getBool(COLLABORATION_GRAPH)*/)
2003 {
2004 DotClassGraph usageImplGraph(this,GraphType::Collaboration);
2005 if (usageImplGraph.isTooBig())
2006 {
2007 warn_uncond("Collaboration graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
2008 name(), usageImplGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
2009 }
2010 else if (!usageImplGraph.isTrivial())
2011 {
2012 ol.pushGeneratorState();
2014 ol.startDotGraph();
2016 ol.endDotGraph(usageImplGraph);
2017 ol.popGeneratorState();
2018 }
2019 }
2020}
2021
2022
2024{
2025 if (m_incInfo)
2026 {
2027 DString nm;
2028 StringVector paths = Config_getList(STRIP_FROM_PATH);
2029 if (!paths.empty() && m_incInfo->fileDef)
2030 {
2031 DString abs = m_incInfo->fileDef->absFilePath();
2032 DString potential;
2033 size_t length = 0;
2034 for (const auto &s : paths)
2035 {
2036 FileInfo info(s);
2037 if (info.exists())
2038 {
2039 DString prefix = info.absFilePath();
2040 if (prefix.at(prefix.length() - 1) != '/')
2041 {
2042 prefix += '/';
2043 }
2044
2045 if (prefix.length() > length &&
2046 dstricmp(abs.left(prefix.length()).data(), prefix.data()) == 0) // case insensitive compare
2047 {
2048 length = prefix.length();
2049 potential = abs.mid(prefix.length());
2050 }
2051 }
2052 }
2053
2054 if (length > 0)
2055 {
2056 nm = potential;
2057 }
2058 }
2059
2060 if (nm.empty())
2061 {
2062 nm = m_incInfo->includeName;
2063 }
2064
2065 ol.startParagraph();
2066 ol.docify(theTranslator->trDefinedIn()+" ");
2067 ol.startTypewriter();
2068 ol.docify("<");
2069 if (m_incInfo->fileDef)
2070 {
2071 ol.writeObjectLink(DString(),m_incInfo->fileDef->includeName(),DString(),nm);
2072 }
2073 else
2074 {
2075 ol.docify(nm);
2076 }
2077 ol.docify(">");
2078 ol.endTypewriter();
2079 ol.endParagraph();
2080 }
2081
2082 // Write a summary of the Slice definition including metadata.
2083 ol.startParagraph();
2084 ol.startTypewriter();
2085 if (!m_metaData.empty())
2086 {
2087 ol.docify(m_metaData);
2088 ol.lineBreak();
2089 }
2090 if (m_spec.isLocal())
2091 {
2092 ol.docify("local ");
2093 }
2094 if (m_spec.isInterface())
2095 {
2096 ol.docify("interface ");
2097 }
2098 else if (m_spec.isStruct())
2099 {
2100 ol.docify("struct ");
2101 }
2102 else if (m_spec.isException())
2103 {
2104 ol.docify("exception ");
2105 }
2106 else
2107 {
2108 ol.docify("class ");
2109 }
2110 ol.docify(stripScope(name()));
2111 if (!m_inherits.empty())
2112 {
2113 if (m_spec.isInterface() || m_spec.isException())
2114 {
2115 ol.docify(" extends ");
2116 bool first=true;
2117 for (const auto &ibcd : m_inherits)
2118 {
2119 if (!first) ol.docify(", ");
2120 ClassDef *icd = ibcd.classDef;
2121 ol.docify(icd->name());
2122 first=false;
2123 }
2124 }
2125 else
2126 {
2127 // Must be a class.
2128 bool implements = false;
2129 for (const auto &ibcd : m_inherits)
2130 {
2131 ClassDef *icd = ibcd.classDef;
2132 if (icd->isInterface())
2133 {
2134 implements = true;
2135 }
2136 else
2137 {
2138 ol.docify(" extends ");
2139 ol.docify(icd->name());
2140 }
2141 }
2142 if (implements)
2143 {
2144 ol.docify(" implements ");
2145 bool first = true;
2146 for (const auto &ibcd : m_inherits)
2147 {
2148 ClassDef *icd = ibcd.classDef;
2149 if (icd->isInterface())
2150 {
2151 if (!first) ol.docify(", ");
2152 first = false;
2153 ol.docify(icd->name());
2154 }
2155 }
2156 }
2157 }
2158 }
2159 ol.docify(" { ... }");
2160 ol.endTypewriter();
2161 ol.endParagraph();
2162}
2163
2165{
2166 if (m_incInfo /*&& Config_getBool(SHOW_HEADERFILE)*/)
2167 {
2168 SrcLangExt lang = getLanguage();
2169 DString nm=m_incInfo->includeName.empty() ?
2170 (m_incInfo->fileDef ?
2171 m_incInfo->fileDef->docName() : DString()
2172 ) :
2173 m_incInfo->includeName;
2174 if (!nm.empty())
2175 {
2176 ol.startParagraph();
2177 ol.startTypewriter();
2178 ol.docify(::includeStatement(lang,m_incInfo->kind));
2179 ol.docify(::includeOpen(lang,m_incInfo->kind));
2180 ol.pushGeneratorState();
2182 ol.docify(nm);
2185 if (m_incInfo->fileDef)
2186 {
2187 ol.writeObjectLink(DString(),m_incInfo->fileDef->includeName(),DString(),nm);
2188 }
2189 else
2190 {
2191 ol.docify(nm);
2192 }
2193 ol.popGeneratorState();
2194 ol.docify(::includeClose(lang,m_incInfo->kind));
2195 ol.endTypewriter();
2196 ol.endParagraph();
2197 }
2198 }
2199}
2200
2201void ClassDefImpl::writeMemberGroups(OutputList &ol,bool showInline) const
2202{
2203 // write user defined member groups
2204 for (const auto &mg : m_memberGroups)
2205 {
2206 if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section
2207 {
2208 mg->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,showInline);
2209 }
2210 else // add this group to the corresponding member section
2211 {
2212 //printf("addToDeclarationSection(%s)\n",qPrint(mg->header()));
2213 //mg->addToDeclarationSection();
2214 }
2215 }
2216}
2217
2219{
2220 // nested classes
2221 m_innerClasses.writeDeclaration(ol,nullptr,title,true);
2222}
2223
2228
2230{
2231 //printf("%s: ClassDefImpl::startMemberDocumentation()\n",qPrint(name()));
2232 if (Config_getBool(SEPARATE_MEMBER_PAGES))
2233 {
2236 }
2237}
2238
2240{
2241 //printf("%s: ClassDefImpl::endMemberDocumentation()\n",qPrint(name()));
2242 if (Config_getBool(SEPARATE_MEMBER_PAGES))
2243 {
2246 }
2247}
2248
2250{
2251 //printf("%s: ClassDefImpl::startMemberDeclarations()\n",qPrint(name()));
2253}
2254
2256{
2257 //printf("%s: ClassDefImpl::endMemberDeclarations()\n",qPrint(name()));
2258 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
2259 if (!inlineInheritedMembers && countAdditionalInheritedMembers()>0)
2260 {
2261 ol.startMemberHeader("inherited");
2263 ol.endMemberHeader();
2265 }
2266 ol.endMemberSections();
2267}
2268
2280
2281
2283{
2284 static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
2285 ol.pushGeneratorState();
2287 bool first=true;
2288 SrcLangExt lang = getLanguage();
2289
2290 if (lang!=SrcLangExt::VHDL)
2291 {
2292 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2293 {
2294 if (lde->kind()==LayoutDocEntry::ClassNestedClasses &&
2296 )
2297 {
2298 for (const auto &innerCd : m_innerClasses)
2299 {
2300 if (!innerCd->isAnonymous() &&
2301 !innerCd->isExtension() &&
2302 (innerCd->protection()!=Protection::Private || extractPrivate) &&
2303 innerCd->visibleInParentsDeclList()
2304 )
2305 {
2306 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection *>(lde.get());
2307 ol.writeSummaryLink(DString(),"nested-classes",ls->title(lang),first);
2308 first=false;
2309 break;
2310 }
2311 }
2312 }
2313 else if (lde->kind()==LayoutDocEntry::ClassAllMembersLink &&
2315 !Config_getBool(OPTIMIZE_OUTPUT_FOR_C)
2316 )
2317 {
2319 first=false;
2320 }
2321 else if (lde->kind()==LayoutDocEntry::MemberDecl)
2322 {
2323 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2324 if (lmd)
2325 {
2326 MemberList * ml = getMemberList(lmd->type);
2327 if (ml && ml->declVisible())
2328 {
2329 ol.writeSummaryLink(DString(),ml->listType().toLabel(),lmd->title(lang),first);
2330 first=false;
2331 }
2332 }
2333 }
2334 }
2335 }
2336 else // VDHL only
2337 {
2338 for (const auto &s : m_vhdlSummaryTitles)
2339 {
2340 ol.writeSummaryLink(DString(),convertToId(s),s,first);
2341 first=false;
2342 }
2343 }
2344 if (!first)
2345 {
2346 ol.writeString(" </div>\n");
2347 }
2348 ol.popGeneratorState();
2349}
2350
2355
2357{
2358 if (!isLinkableInProject() || isArtificial()) return;
2359 tagFile << " <compound kind=\"";
2360 if (isFortran() && (compoundTypeString() == "type"))
2361 tagFile << "struct";
2362 else
2363 tagFile << compoundTypeString();
2364 tagFile << "\"";
2365 if (isObjectiveC()) { tagFile << " objc=\"yes\""; }
2366 tagFile << ">\n";
2367 tagFile << " <name>" << convertToXML(name()) << "</name>\n";
2370 tagFile << " <filename>" << convertToXML(fn) << "</filename>\n";
2371 if (!anchor().empty())
2372 {
2373 tagFile << " <anchor>" << convertToXML(anchor()) << "</anchor>\n";
2374 }
2375 DString idStr = id();
2376 if (!idStr.empty())
2377 {
2378 tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n";
2379 }
2380 for (const Argument &a : m_tempArgs)
2381 {
2382 tagFile << " <templarg>" << convertToXML(a.type);
2383 if (!a.name.empty())
2384 {
2385 tagFile << " " << convertToXML(a.name);
2386 }
2387 tagFile << "</templarg>\n";
2388 }
2389 for (const auto &ibcd : m_inherits)
2390 {
2391 ClassDef *cd=ibcd.classDef;
2392 if (cd && cd->isLinkable())
2393 {
2394 tagFile << " <base";
2395 if (ibcd.prot==Protection::Protected)
2396 {
2397 tagFile << " protection=\"protected\"";
2398 }
2399 else if (ibcd.prot==Protection::Private)
2400 {
2401 tagFile << " protection=\"private\"";
2402 }
2403 if (ibcd.virt==Specifier::Virtual)
2404 {
2405 tagFile << " virtualness=\"virtual\"";
2406 }
2408 cd->displayName(),ibcd.templSpecifiers);
2409 tagFile << ">" << convertToXML(displayName) << "</base>\n";
2410 }
2411 }
2412 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2413 {
2414 switch (lde->kind())
2415 {
2416 case LayoutDocEntry::ClassNestedClasses:
2417 {
2418 for (const auto &innerCd : m_innerClasses)
2419 {
2420 if (innerCd->isLinkableInProject() && !innerCd->isImplicitTemplateInstance() &&
2421 protectionLevelVisible(innerCd->protection()) &&
2422 !innerCd->isEmbeddedInOuterScope()
2423 )
2424 {
2425 tagFile << " <class kind=\"" << innerCd->compoundTypeString() <<
2426 "\">" << convertToXML(innerCd->name()) << "</class>\n";
2427 }
2428 }
2429 }
2430 break;
2431 case LayoutDocEntry::MemberDecl:
2432 {
2433 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2434 if (lmd)
2435 {
2436 MemberList * ml = getMemberList(lmd->type);
2437 if (ml)
2438 {
2439 ml->writeTagFile(tagFile);
2440 }
2441 }
2442 }
2443 break;
2444 case LayoutDocEntry::MemberGroups:
2445 {
2446 for (const auto &mg : m_memberGroups)
2447 {
2448 mg->writeTagFile(tagFile);
2449 }
2450 }
2451 break;
2452 default:
2453 break;
2454 }
2455 }
2456 writeDocAnchorsToTagFile(tagFile);
2457 tagFile << " </compound>\n";
2458}
2459
2460/** Write class documentation inside another container (i.e\. a group) */
2462{
2463 bool isSimple = m_isSimple;
2464
2465 ol.addIndexItem(name(),DString());
2466 //printf("ClassDefImpl::writeInlineDocumentation(%s)\n",qPrint(name()));
2467
2468 // part 1: anchor and title
2469 DString s = compoundTypeString()+" "+name();
2470
2471 // part 1a
2472 ol.pushGeneratorState();
2474 { // only HTML only
2475 ol.writeAnchor(DString(),anchor());
2476 ol.startMemberDoc(DString(),DString(),anchor(),name(),1,1,false);
2477 ol.startMemberDocName(false);
2478 ol.parseText(s);
2479 ol.endMemberDocName();
2480 ol.endMemberDoc(false);
2481 ol.writeString("</div>");
2482 ol.startIndent();
2483 }
2484 ol.popGeneratorState();
2485
2486 // part 1b
2487 ol.pushGeneratorState();
2490 { // for LaTeX/RTF only
2492 }
2493 ol.popGeneratorState();
2494
2495 // part 1c
2496 ol.pushGeneratorState();
2498 {
2499 // for LaTeX/RTF/Man
2500 ol.startGroupHeader("",1);
2501 ol.parseText(s);
2502 ol.endGroupHeader(1);
2503 }
2504 ol.popGeneratorState();
2505
2506 SrcLangExt lang=getLanguage();
2507
2508 // part 2: the header and detailed description
2509 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2510 {
2511 switch (lde->kind())
2512 {
2513 case LayoutDocEntry::BriefDesc:
2514 {
2515 // since we already shown the brief description in the
2516 // declaration part of the container, so we use this to
2517 // show the details on top.
2519 }
2520 break;
2521 case LayoutDocEntry::ClassInheritanceGraph:
2523 break;
2524 case LayoutDocEntry::ClassCollaborationGraph:
2526 break;
2527 case LayoutDocEntry::MemberDeclStart:
2529 break;
2530 case LayoutDocEntry::MemberDecl:
2531 {
2532 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2533 if (lmd)
2534 {
2535 ClassDefSet visitedClasses;
2536 if (!isSimple) writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang),true);
2537 }
2538 }
2539 break;
2540 case LayoutDocEntry::MemberGroups:
2541 if (!isSimple) writeMemberGroups(ol,true);
2542 break;
2543 case LayoutDocEntry::MemberDeclEnd:
2545 break;
2546 case LayoutDocEntry::MemberDefStart:
2548 break;
2549 case LayoutDocEntry::MemberDef:
2550 {
2551 const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get());
2552 if (lmd)
2553 {
2554 if (isSimple)
2555 {
2557 }
2558 else
2559 {
2560 writeMemberDocumentation(ol,lmd->type,lmd->title(lang),true);
2561 }
2562 }
2563 }
2564 break;
2565 case LayoutDocEntry::MemberDefEnd:
2567 break;
2568 default:
2569 break;
2570 }
2571 }
2572
2573 // part 3: close the block
2574 ol.pushGeneratorState();
2576 { // HTML only
2577 ol.endIndent();
2578 }
2579 ol.popGeneratorState();
2580}
2581
2583{
2584 // TODO: clean up this mess by moving it to
2585 // the output generators...
2586 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2587 bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS);
2588 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
2589
2590 // HTML only
2591 ol.pushGeneratorState();
2593 ol.docify(" ");
2595 anchor.empty() ? DString("details") : anchor);
2597 ol.endTextLink();
2598 ol.popGeneratorState();
2599
2600 if (!anchor.empty())
2601 {
2602 ol.pushGeneratorState();
2603 // LaTeX + RTF
2607 if (!(usePDFLatex && pdfHyperlinks))
2608 {
2610 }
2611 if (!rtfHyperlinks)
2612 {
2614 }
2615 ol.docify(" ");
2618 ol.endTextLink();
2619 // RTF only
2621 ol.writeString("\\par");
2622 ol.popGeneratorState();
2623 }
2624}
2625
2627{
2628 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
2629 bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES);
2630 bool extractLocalClasses = Config_getBool(EXTRACT_LOCAL_CLASSES);
2631 bool linkable = isLinkable();
2632 return (!isAnonymous() && !isExtension() &&
2633 (protection()!=Protection::Private || extractPrivate) &&
2634 (linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses)))
2635 );
2636}
2637
2638void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const DString &header,bool localNames) const
2639{
2640 //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
2641 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
2642 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
2643 SrcLangExt lang = getLanguage();
2645 {
2646 if (!found) // first class
2647 {
2648 if (sliceOpt)
2649 {
2650 if (compoundType()==Interface)
2651 {
2652 ol.startMemberHeader("interfaces");
2653 }
2654 else if (compoundType()==Struct)
2655 {
2656 ol.startMemberHeader("structs");
2657 }
2658 else if (compoundType()==Exception)
2659 {
2660 ol.startMemberHeader("exceptions");
2661 }
2662 else // compoundType==Class
2663 {
2664 ol.startMemberHeader("nested-classes");
2665 }
2666 }
2667 else // non-Slice optimization: single header for class/struct/..
2668 {
2669 ol.startMemberHeader("nested-classes");
2670 }
2671 if (!header.empty())
2672 {
2673 ol.parseText(header);
2674 }
2675 else if (lang==SrcLangExt::VHDL)
2676 {
2678 }
2679 else
2680 {
2681 ol.parseText(lang==SrcLangExt::Fortran ?
2684 }
2685 ol.endMemberHeader();
2686 ol.startMemberList();
2687 found=true;
2688 }
2690 DString ctype = compoundTypeString();
2691 DString cname = displayName(!localNames);
2692 DString anc = anchor();
2693 if (anc.empty()) anc = cname; else anc.prepend(cname+"_");
2695
2696 if (lang!=SrcLangExt::VHDL) // for VHDL we swap the name and the type
2697 {
2698 if (isSliceLocal())
2699 {
2700 ol.writeString("local ");
2701 }
2702 ol.writeString(ctype);
2703 ol.writeString(" ");
2704 ol.insertMemberAlign();
2705 }
2706 if (isLinkable())
2707 {
2710 anchor(),
2711 cname
2712 );
2713 }
2714 else
2715 {
2716 ol.startBold();
2717 ol.docify(cname);
2718 ol.endBold();
2719 }
2720 if (lang==SrcLangExt::VHDL) // now write the type
2721 {
2722 ol.writeString(" ");
2723 ol.insertMemberAlign();
2725 }
2727
2728 // add the brief description if available
2729 if (!briefDescription().empty() && Config_getBool(BRIEF_MEMBER_DESC))
2730 {
2731 auto parser { createDocParser() };
2732 auto ast { validatingParseDoc(*parser.get(),
2733 briefFile(),
2734 briefLine(),
2735 this,
2736 nullptr,
2738 DocOptions()
2739 .setSingleLine(true))
2740 };
2741 if (!ast->empty())
2742 {
2744 ol.writeDoc(ast.get(),this,nullptr);
2745 if (isLinkableInProject())
2746 {
2747 writeMoreLink(ol,anchor());
2748 }
2750 }
2751 }
2753 }
2754}
2755
2757{
2758 StringVector sl;
2759 if (isFinal()) sl.emplace_back("final");
2760 if (isSealed()) sl.emplace_back("sealed");
2761 if (isAbstract()) sl.emplace_back("abstract");
2762 if (isExported()) sl.emplace_back("export");
2763 if (getLanguage()==SrcLangExt::IDL && isPublished()) sl.emplace_back("published");
2764
2765 for (const auto &sx : m_qualifiers)
2766 {
2767 bool alreadyAdded = std::find(sl.begin(), sl.end(), sx) != sl.end();
2768 if (!alreadyAdded)
2769 {
2770 sl.push_back(sx);
2771 }
2772 }
2773
2774 ol.pushGeneratorState();
2776 if (!sl.empty())
2777 {
2778 ol.startLabels();
2779 size_t i=0;
2780 for (const auto &s : sl)
2781 {
2782 i++;
2783 ol.writeLabel(s,i==sl.size());
2784 }
2785 ol.endLabels();
2786 }
2787 ol.popGeneratorState();
2788}
2789
2791{
2792 ol.startContents();
2793
2794 DString pageType = " ";
2795 pageType += compoundTypeString();
2796
2797 bool exampleFlag=hasExamples();
2798
2799 //---------------------------------------- start flexible part -------------------------------
2800
2801 SrcLangExt lang = getLanguage();
2802
2803 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
2804 {
2805 switch (lde->kind())
2806 {
2807 case LayoutDocEntry::BriefDesc:
2808 writeBriefDescription(ol,exampleFlag);
2809 break;
2810 case LayoutDocEntry::Includes:
2811 if (lang==SrcLangExt::Slice)
2812 {
2814 }
2815 else
2816 {
2818 }
2819 break;
2820 case LayoutDocEntry::ClassInheritanceGraph:
2822 break;
2823 case LayoutDocEntry::ClassCollaborationGraph:
2825 break;
2826 case LayoutDocEntry::ClassAllMembersLink:
2827 //writeAllMembersLink(ol); // this is now part of the summary links
2828 break;
2829 case LayoutDocEntry::MemberDeclStart:
2831 break;
2832 case LayoutDocEntry::MemberGroups:
2834 break;
2835 case LayoutDocEntry::MemberDecl:
2836 {
2837 ClassDefSet visitedClasses;
2838 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
2839 if (lmd)
2840 {
2841 writeMemberDeclarations(ol,visitedClasses,lmd->type,lmd->title(lang),lmd->subtitle(lang));
2842 }
2843 }
2844 break;
2845 case LayoutDocEntry::ClassNestedClasses:
2846 {
2847 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
2848 if (ls)
2849 {
2850 writeNestedClasses(ol,ls->title(lang));
2851 }
2852 }
2853 break;
2854 case LayoutDocEntry::MemberDeclEnd:
2856 break;
2857 case LayoutDocEntry::DetailedDesc:
2858 {
2859 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
2860 if (ls)
2861 {
2862 writeDetailedDescription(ol,pageType,exampleFlag,ls->title(lang));
2863 }
2864 }
2865 break;
2866 case LayoutDocEntry::MemberDefStart:
2868 break;
2869 case LayoutDocEntry::ClassInlineClasses:
2871 break;
2872 case LayoutDocEntry::MemberDef:
2873 {
2874 const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get());
2875 if (lmd)
2876 {
2877 writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
2878 }
2879 }
2880 break;
2881 case LayoutDocEntry::MemberDefEnd:
2883 break;
2884 case LayoutDocEntry::ClassUsedFiles:
2885 showUsedFiles(ol);
2886 break;
2887 case LayoutDocEntry::AuthorSection:
2889 break;
2890 case LayoutDocEntry::NamespaceNestedNamespaces:
2891 case LayoutDocEntry::NamespaceNestedConstantGroups:
2892 case LayoutDocEntry::NamespaceClasses:
2893 case LayoutDocEntry::NamespaceConcepts:
2894 case LayoutDocEntry::NamespaceInterfaces:
2895 case LayoutDocEntry::NamespaceStructs:
2896 case LayoutDocEntry::NamespaceExceptions:
2897 case LayoutDocEntry::NamespaceInlineClasses:
2898 case LayoutDocEntry::ConceptDefinition:
2899 case LayoutDocEntry::FileClasses:
2900 case LayoutDocEntry::FileConcepts:
2901 case LayoutDocEntry::FileInterfaces:
2902 case LayoutDocEntry::FileStructs:
2903 case LayoutDocEntry::FileExceptions:
2904 case LayoutDocEntry::FileNamespaces:
2905 case LayoutDocEntry::FileConstantGroups:
2906 case LayoutDocEntry::FileIncludeGraph:
2907 case LayoutDocEntry::FileIncludedByGraph:
2908 case LayoutDocEntry::FileSourceLink:
2909 case LayoutDocEntry::FileInlineClasses:
2910 case LayoutDocEntry::GroupClasses:
2911 case LayoutDocEntry::GroupConcepts:
2912 case LayoutDocEntry::GroupModules:
2913 case LayoutDocEntry::GroupInlineClasses:
2914 case LayoutDocEntry::GroupNamespaces:
2915 case LayoutDocEntry::GroupDirs:
2916 case LayoutDocEntry::GroupNestedGroups:
2917 case LayoutDocEntry::GroupFiles:
2918 case LayoutDocEntry::GroupGraph:
2919 case LayoutDocEntry::GroupPageDocs:
2920 case LayoutDocEntry::ModuleExports:
2921 case LayoutDocEntry::ModuleClasses:
2922 case LayoutDocEntry::ModuleConcepts:
2923 case LayoutDocEntry::ModuleUsedFiles:
2924 case LayoutDocEntry::DirSubDirs:
2925 case LayoutDocEntry::DirFiles:
2926 case LayoutDocEntry::DirGraph:
2927 err("Internal inconsistency: member '{}' should not be part of LayoutDocManager::Class entry list\n",lde->entryToString());
2928 break;
2929 }
2930 }
2931
2932 ol.endContents();
2933}
2934
2936{
2937 DString pageTitle;
2938 SrcLangExt lang = getLanguage();
2939
2940 auto getReferenceTitle = [this](std::function<DString()> translateFunc) -> DString
2941 {
2942 return Config_getBool(HIDE_COMPOUND_REFERENCE) ? displayName() : translateFunc();
2943 };
2944
2945 if (lang==SrcLangExt::Fortran)
2946 {
2947 pageTitle = getReferenceTitle([this](){
2949 });
2950 }
2951 else if (lang==SrcLangExt::Slice)
2952 {
2953 pageTitle = getReferenceTitle([this](){
2955 });
2956 }
2957 else if (lang==SrcLangExt::VHDL)
2958 {
2959 pageTitle = getReferenceTitle([this](){
2961 });
2962 }
2963 else if (lang==SrcLangExt::CSharp && !m_primaryConstructorParams.empty())
2964 {
2965 pageTitle = getReferenceTitle([this](){
2967 m_compType,
2968 !m_tempArgs.empty());
2969 });
2970 }
2971 else if (isJavaEnum())
2972 {
2973 pageTitle = getReferenceTitle([this](){
2975 });
2976 }
2977 else if (m_compType==Service)
2978 {
2979 pageTitle = getReferenceTitle([this](){
2981 });
2982 }
2983 else if (m_compType==Singleton)
2984 {
2985 pageTitle = getReferenceTitle([this](){
2987 });
2988 }
2989 else
2990 {
2991 pageTitle = getReferenceTitle([this](){
2993 m_compType == Interface && getLanguage()==SrcLangExt::ObjC ? Class : m_compType,
2994 !m_tempArgs.empty());
2995 });
2996 }
2997 return pageTitle;
2998}
2999
3000// write all documentation for this class
3002{
3003 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3004 //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
3005 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
3006 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
3007 DString pageTitle = title();
3008
3010 if (sliceOpt)
3011 {
3012 if (compoundType()==Interface)
3013 {
3015 }
3016 else if (compoundType()==Struct)
3017 {
3019 }
3020 else if (compoundType()==Exception)
3021 {
3023 }
3024 else
3025 {
3027 }
3028 }
3029 else
3030 {
3032 }
3033
3034 AUTO_TRACE("name='{}' getOutputFileBase='{}'",name(),getOutputFileBase());
3035 bool hasAllMembersLink=false;
3036 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
3037 {
3038 if (lde->kind()==LayoutDocEntry::ClassAllMembersLink)
3039 {
3040 hasAllMembersLink = true;
3041 break;
3042 }
3043 }
3044 DString memListFile;
3045 if (hasAllMembersLink && !m_allMemberNameInfoLinkedMap.empty() && !Config_getBool(OPTIMIZE_OUTPUT_FOR_C))
3046 {
3047 memListFile = getMemberListFileName();
3048 }
3049 startFile(ol,getOutputFileBase(),false,name(),pageTitle,hli,!generateTreeView,DString(),0,memListFile);
3050 if (!generateTreeView)
3051 {
3053 {
3055 }
3056 ol.endQuickIndices();
3057 }
3058
3059 startTitle(ol,getOutputFileBase(),this);
3060 ol.parseText(pageTitle);
3062 addGroupListToTitle(ol,this);
3064 writeDocumentationContents(ol,pageTitle);
3065
3066 endFileWithNavPath(ol,this);
3067
3068 if (Config_getBool(SEPARATE_MEMBER_PAGES))
3069 {
3070 writeMemberPages(ol);
3071 }
3072}
3073
3075{
3076 ///////////////////////////////////////////////////////////////////////////
3077 //// Member definitions on separate pages
3078 ///////////////////////////////////////////////////////////////////////////
3079
3080 ol.pushGeneratorState();
3082
3083 for (const auto &ml : m_memberLists)
3084 {
3085 if (ml->numDocMembers()>ml->numDocEnumValues() && ml->listType().isDetailed())
3086 {
3087 ml->writeDocumentationPage(ol,displayName(),this);
3088 }
3089 }
3090
3091 ol.popGeneratorState();
3092}
3093
3095{
3096 bool createSubDirs=Config_getBool(CREATE_SUBDIRS);
3097
3098 ol.writeString(" <div class=\"navtab\">\n");
3099 ol.writeString(" <table>\n");
3100
3101 for (auto &mni : m_allMemberNameInfoLinkedMap)
3102 {
3103 for (auto &mi : *mni)
3104 {
3105 const MemberDef *md=mi->memberDef();
3106 if (md->getClassDef()==this && md->isLinkable() && !md->isEnumValue())
3107 {
3108 if (md->isLinkableInProject())
3109 {
3110 if (md==currentMd) // selected item => highlight
3111 {
3112 ol.writeString(" <tr><td class=\"navtabHL\">");
3113 }
3114 else
3115 {
3116 ol.writeString(" <tr><td class=\"navtab\">");
3117 }
3118 ol.writeString("<span class=\"label\"><a ");
3119 ol.writeString("href=\"");
3120 if (createSubDirs) ol.writeString("../../");
3121 DString url = md->getOutputFileBase();
3123 ol.writeString(url+"#"+md->anchor());
3124 ol.writeString("\">");
3125 ol.writeString(convertToHtml(md->name()));
3126 ol.writeString("</a></span>");
3127 ol.writeString("</td></tr>\n");
3128 }
3129 }
3130 }
3131 }
3132
3133 ol.writeString(" </table>\n");
3134 ol.writeString(" </div>\n");
3135}
3136
3137
3138
3140{
3141 // write inner classes after the parent, so the tag files contain
3142 // the definition in proper order!
3143 for (const auto &innerCd : m_innerClasses)
3144 {
3145 if (
3146 innerCd->isLinkableInProject() && !innerCd->isImplicitTemplateInstance() &&
3147 protectionLevelVisible(innerCd->protection()) &&
3148 !innerCd->isEmbeddedInOuterScope()
3149 )
3150 {
3151 msg("Generating docs for nested compound {}...\n",innerCd->displayName());
3152 innerCd->writeDocumentation(ol);
3153 innerCd->writeMemberList(ol);
3154 }
3155 innerCd->writeDocumentationForInnerClasses(ol);
3156 }
3157}
3158
3159// write the list of all (inherited) members for this class
3161{
3162 bool cOpt = Config_getBool(OPTIMIZE_OUTPUT_FOR_C);
3163 //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
3164 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
3165 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3166 if (m_allMemberNameInfoLinkedMap.empty() || cOpt) return;
3167 // only for HTML
3168 ol.pushGeneratorState();
3170
3172 if (sliceOpt)
3173 {
3174 if (compoundType()==Interface)
3175 {
3177 }
3178 else if (compoundType()==Struct)
3179 {
3181 }
3182 else if (compoundType()==Exception)
3183 {
3185 }
3186 else
3187 {
3189 }
3190 }
3191 else
3192 {
3194 }
3195
3196 DString memListFile = getMemberListFileName();
3197 startFile(ol,memListFile,false,memListFile,theTranslator->trMemberList(),hli,!generateTreeView,getOutputFileBase());
3198 if (!generateTreeView)
3199 {
3201 {
3203 }
3204 ol.endQuickIndices();
3205 }
3206 startTitle(ol,DString());
3208 endTitle(ol,DString(),DString());
3209 ol.startContents();
3210 ol.startParagraph();
3212 ol.docify(" ");
3215 ol.endParagraph();
3216
3217 //ol.startItemList();
3218
3219 bool first = true; // to prevent empty table
3220 int idx=0;
3221 for (auto &mni : m_allMemberNameInfoLinkedMap)
3222 {
3223 for (auto &mi : *mni)
3224 {
3225 const MemberDef *md=mi->memberDef();
3226 const ClassDef *cd=md->getClassDef();
3227 Protection prot = mi->prot();
3228 Specifier virt=md->virtualness();
3229
3230 //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n",
3231 // qPrint(name()),qPrint(md->name()),qPrint(cd->name()),md->protection(),mi->prot,prot,mi->inherited);
3232
3233 if (cd && !md->name().empty() && !md->isAnonymous())
3234 {
3235 bool memberWritten=false;
3236 if (cd->isLinkable() && md->isLinkable())
3237 // create a link to the documentation
3238 {
3239 DString name=mi->ambiguityResolutionScope()+md->name();
3240 //ol.writeListItem();
3241 if (first)
3242 {
3243 ol.writeString("<table class=\"directory\">\n");
3244 first = false;
3245 }
3246 ol.writeString(" <tr");
3247 if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\"");
3248 idx++;
3249 ol.writeString("><td class=\"entry\">");
3250 if (cd->isObjectiveC())
3251 {
3252 if (md->isObjCMethod())
3253 {
3254 if (md->isStatic())
3255 ol.writeString("+&#160;</td><td>");
3256 else
3257 ol.writeString("-&#160;</td><td>");
3258 }
3259 else
3260 ol.writeString("</td><td class=\"entry\">");
3261 }
3262 if (md->isObjCMethod())
3263 {
3265 md->getOutputFileBase(),
3266 md->anchor(),md->name());
3267 }
3268 else
3269 {
3270 //Definition *bd = md->getGroupDef();
3271 //if (bd==nullptr) bd=cd;
3273 md->getOutputFileBase(),
3274 md->anchor(),name);
3275
3276 if ( md->isFunction() || md->isSignal() || md->isSlot() ||
3277 (md->isFriend() && !md->argsString().empty()))
3278 ol.docify(md->argsString());
3279 else if (md->isEnumerate())
3281 else if (md->isEnumValue())
3283 else if (md->isTypedef())
3284 ol.docify(" typedef");
3285 else if (md->isFriend() && md->typeString()=="friend class")
3286 ol.docify(" class");
3287 else if (md->isFriend() && md->typeString()=="friend struct")
3288 ol.docify(" struct");
3289 else if (md->isFriend() && md->typeString()=="friend union")
3290 ol.docify(" union");
3291 //ol.writeString("\n");
3292 }
3293 ol.writeString("</td>");
3294 memberWritten=true;
3295 }
3296 else if (!cd->isArtificial() &&
3297 !Config_getBool(HIDE_UNDOC_MEMBERS) &&
3299 ) // no documentation,
3300 // generate link to the class instead.
3301 {
3302 //ol.writeListItem();
3303 if (first)
3304 {
3305 ol.writeString("<table class=\"directory\">\n");
3306 first = false;
3307 }
3308 ol.writeString(" <tr bgcolor=\"#f0f0f0\"");
3309 if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\"");
3310 idx++;
3311 ol.writeString("><td class=\"entry\">");
3312 if (cd->isObjectiveC())
3313 {
3314 if (md->isObjCMethod())
3315 {
3316 if (md->isStatic())
3317 ol.writeString("+&#160;</td><td class=\"entry\">");
3318 else
3319 ol.writeString("-&#160;</td><td class=\"entry\">");
3320 }
3321 else
3322 ol.writeString("</td><td class=\"entry\">");
3323 }
3324 ol.startBold();
3325 ol.docify(md->name());
3326 ol.endBold();
3327 if (!md->isObjCMethod())
3328 {
3329 if ( md->isFunction() || md->isSignal() || md->isSlot() )
3330 ol.docify(md->argsString());
3331 else if (md->isEnumerate())
3333 else if (md->isEnumValue())
3335 else if (md->isTypedef())
3336 ol.docify(" typedef");
3337 }
3338 ol.writeString(" (");
3340 if (cd->isLinkable())
3341 {
3342 ol.writeObjectLink(
3343 cd->getReference(),
3344 cd->getOutputFileBase(),
3345 cd->anchor(),
3346 cd->displayName());
3347 }
3348 else
3349 {
3350 ol.startBold();
3351 ol.docify(cd->displayName());
3352 ol.endBold();
3353 }
3354 ol.writeString(")");
3355 ol.writeString("</td>");
3356 memberWritten=true;
3357 }
3358 if (memberWritten)
3359 {
3360 ol.writeString("<td class=\"entry\">");
3362 cd->getOutputFileBase(),
3363 cd->anchor(),
3364 md->category() ?
3365 md->category()->displayName() :
3366 cd->displayName());
3367 ol.writeString("</td>");
3368 ol.writeString("<td class=\"entry\">");
3369 }
3370 SrcLangExt lang = md->getLanguage();
3371 if (
3372 (prot!=Protection::Public || (virt!=Specifier::Normal && getLanguage()!=SrcLangExt::ObjC) ||
3373 md->isFriend() || md->isRelated() || md->isExplicit() ||
3374 md->isMutable() || (md->isInline() && Config_getBool(INLINE_INFO)) ||
3375 md->isSignal() || md->isSlot() || md->isThreadLocal() ||
3376 (getLanguage()==SrcLangExt::IDL &&
3377 (md->isOptional() || md->isAttribute() || md->isUNOProperty())) ||
3378 md->isStatic() || lang==SrcLangExt::VHDL
3379 )
3380 && memberWritten)
3381 {
3382 StringVector sl;
3383 if (lang==SrcLangExt::VHDL)
3384 {
3385 sl.push_back(theTranslator->trVhdlType(md->getVhdlSpecifiers(),true).str()); //append vhdl type
3386 }
3387 else if (md->isFriend()) sl.emplace_back("friend");
3388 else if (md->isRelated()) sl.emplace_back("related");
3389 else
3390 {
3391 if (Config_getBool(INLINE_INFO) && md->isInline())
3392 sl.emplace_back("inline");
3393 if (md->isExplicit()) sl.emplace_back("explicit");
3394 if (md->isMutable()) sl.emplace_back("mutable");
3395 if (md->isThreadLocal()) sl.emplace_back("thread_local");
3396 if (prot==Protection::Protected) sl.emplace_back("protected");
3397 else if (prot==Protection::Private) sl.emplace_back("private");
3398 else if (prot==Protection::Package) sl.emplace_back("package");
3399 if (virt==Specifier::Virtual && getLanguage()!=SrcLangExt::ObjC)
3400 sl.emplace_back("virtual");
3401 else if (virt==Specifier::Pure) sl.emplace_back("pure virtual");
3402 if (md->isStatic()) sl.emplace_back("static");
3403 if (md->isSignal()) sl.emplace_back("signal");
3404 if (md->isSlot()) sl.emplace_back("slot");
3405// this is the extra member page
3406 if (md->isOptional()) sl.emplace_back("optional");
3407 if (md->isAttribute()) sl.emplace_back("attribute");
3408 if (md->isUNOProperty()) sl.emplace_back("property");
3409 if (md->isReadonly()) sl.emplace_back("readonly");
3410 if (md->isBound()) sl.emplace_back("bound");
3411 if (md->isRemovable()) sl.emplace_back("removable");
3412 if (md->isConstrained()) sl.emplace_back("constrained");
3413 if (md->isTransient()) sl.emplace_back("transient");
3414 if (md->isMaybeVoid()) sl.emplace_back("maybevoid");
3415 if (md->isMaybeDefault()) sl.emplace_back("maybedefault");
3416 if (md->isMaybeAmbiguous()) sl.emplace_back("maybeambiguous");
3417 }
3418 bool firstSpan=true;
3419 for (const auto &s : sl)
3420 {
3421 if (!firstSpan)
3422 {
3423 ol.writeString("</span><span class=\"mlabel\">");
3424 }
3425 else
3426 {
3427 ol.writeString("<span class=\"mlabel\">");
3428 firstSpan=false;
3429 }
3430 ol.docify(s);
3431 }
3432 if (!firstSpan) ol.writeString("</span>");
3433 }
3434 if (memberWritten)
3435 {
3436 ol.writeString("</td>");
3437 ol.writeString("</tr>\n");
3438 }
3439 }
3440 }
3441 }
3442 //ol.endItemList();
3443
3444 if (!first) ol.writeString("</table>");
3445
3446 endFile(ol);
3447 ol.popGeneratorState();
3448}
3449
3450// add a reference to an example
3451bool ClassDefImpl::addExample(const DString &anchor,const DString &nameStr, const DString &file)
3452{
3453 return m_examples.inSort(Example(anchor,nameStr,file));
3454}
3455
3456// returns true if this class is used in an example
3458{
3459 return !m_examples.empty();
3460}
3461
3462void ClassDefImpl::addTypeConstraint(const DString &typeConstraint,const DString &type)
3463{
3464 //printf("addTypeConstraint(%s,%s)\n",qPrint(type),qPrint(typeConstraint));
3465 bool hideUndocRelation = Config_getBool(HIDE_UNDOC_RELATIONS);
3466 if (typeConstraint.empty() || type.empty()) return;
3467 SymbolResolver resolver(getFileDef());
3468 ClassDefMutable *cd = resolver.resolveClassMutable(this,typeConstraint);
3469 if (cd==nullptr && !hideUndocRelation)
3470 {
3471 cd = toClassDefMutable(
3472 Doxygen::hiddenClassLinkedMap->add(typeConstraint,
3473 std::unique_ptr<ClassDef>(
3474 new ClassDefImpl(
3476 getDefColumn(),
3477 typeConstraint,
3478 ClassDef::Class))));
3479 if (cd)
3480 {
3481 cd->setUsedOnly(true);
3482 cd->setLanguage(getLanguage());
3483 //printf("Adding undocumented constraint '%s' to class %s on type %s\n",
3484 // qPrint(typeConstraint),qPrint(name()),qPrint(type));
3485 }
3486 }
3487 if (cd)
3488 {
3489 auto it = std::find_if(m_constraintClassList.begin(),
3491 [&cd](const auto &ccd) { return ccd.classDef==cd; });
3492
3493 if (it==m_constraintClassList.end())
3494 {
3495 m_constraintClassList.emplace_back(cd);
3496 it = m_constraintClassList.end()-1;
3497 }
3498 (*it).addAccessor(type);
3499 //printf("Adding constraint '%s' to class %s on type %s\n",
3500 // qPrint(typeConstraint),qPrint(name()),qPrint(type));
3501 }
3502}
3503
3504// Java Type Constrains: A<T extends C & I>
3506{
3507 for (const Argument &a : m_tempArgs)
3508 {
3509 if (!a.typeConstraint.empty())
3510 {
3511 DString typeConstraint;
3512 size_t i=0,p=0;
3513 while ((i=a.typeConstraint.find('&',p))!=DString::npos) // typeConstraint="A &I" for C<T extends A & I>
3514 {
3515 typeConstraint = a.typeConstraint.mid(p,i-p).stripWhiteSpace();
3516 addTypeConstraint(typeConstraint,a.type);
3517 p=i+1;
3518 }
3519 typeConstraint = a.typeConstraint.mid(p).stripWhiteSpace();
3520 addTypeConstraint(typeConstraint,a.type);
3521 }
3522 }
3523}
3524
3525// C# Type Constraints: D<T> where T : C, I
3530
3532{
3533 m_tempArgs = al;
3534}
3535
3536static bool hasNonReferenceSuperClassRec(const ClassDef *cd,int level)
3537{
3538 bool found=!cd->isReference() && cd->isLinkableInProject() && !cd->isHidden();
3539 if (found)
3540 {
3541 return true; // we're done if this class is not a reference
3542 }
3543 for (const auto &ibcd : cd->subClasses())
3544 {
3545 const ClassDef *bcd=ibcd.classDef;
3546 if (level>256)
3547 {
3548 err("Possible recursive class relation while inside {} and looking for base class {}\n",cd->name(),bcd->name());
3549 return false;
3550 }
3551 // recurse into the super class branch
3552 found = found || hasNonReferenceSuperClassRec(bcd,level+1);
3553 if (!found)
3554 {
3555 // look for template instances that might have non-reference super classes
3556 for (const auto &cil : bcd->getTemplateInstances())
3557 {
3558 // recurse into the template instance branch
3559 found = hasNonReferenceSuperClassRec(cil.classDef,level+1);
3560 if (found) break;
3561 }
3562 }
3563 else
3564 {
3565 break;
3566 }
3567 }
3568 return found;
3569}
3570
3571/*! Returns \c true iff this class or a class inheriting from this class
3572 * is \e not defined in an external tag file.
3573 */
3575{
3576 return hasNonReferenceSuperClassRec(this,0);
3577}
3578
3583
3585{
3586 m_requiresClause = req;
3587}
3588
3593
3594/*! called from MemberDef::writeDeclaration() to (recursively) write the
3595 * definition of an anonymous struct, union or class.
3596 */
3597void ClassDefImpl::writeDeclaration(OutputList &ol,bool inGroup,int indentLevel,
3598 const ClassDef *inheritedFrom,const DString &inheritId) const
3599{
3600 //printf("ClassName='%s' inGroup=%d\n",qPrint(name()),inGroup);
3601
3603 ol.docify(" {");
3605 ol.endMemberDeclaration(DString(),inheritId);
3606
3607 // write user defined member groups
3608 for (const auto &mg : m_memberGroups)
3609 {
3610 mg->writePlainDeclarations(ol,inGroup,this,nullptr,nullptr,nullptr,nullptr,indentLevel,inheritedFrom,inheritId);
3611 }
3612
3613 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
3614 {
3615 if (lde->kind()==LayoutDocEntry::MemberDecl)
3616 {
3617 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
3618 if (lmd)
3619 {
3620 writePlainMemberDeclaration(ol,lmd->type,inGroup,indentLevel,inheritedFrom,inheritId);
3621 }
3622 }
3623 }
3624}
3625
3626/*! a link to this class is possible within this project */
3628{
3629 bool extractLocal = Config_getBool(EXTRACT_LOCAL_CLASSES);
3630 bool extractStatic = Config_getBool(EXTRACT_STATIC);
3631 bool hideUndoc = Config_getBool(HIDE_UNDOC_CLASSES);
3633 {
3635 }
3636 else
3637 {
3638 //printf("%s::isLinkableInProject() conditions: artificial=%d hidden=%d anonymous=%d protection=%d local=%d docs=%d static=%d ref=%d\n",
3639 // qPrint(name()),
3640 // !isArtificial(),
3641 // !isHidden(),
3642 // !isAnonymous(),
3643 // protectionLevelVisible(m_prot),
3644 // !m_isLocal || extractLocal,
3645 // hasDocumentation() || m_tempArgs.hasTemplateDocumentation() || !hideUndoc,
3646 // !m_isStatic || extractStatic,
3647 // !isReference());
3648 return
3649 !isArtificial() && !isHidden() && /* not hidden */
3650 !isAnonymous() && /* not anonymous */
3651 protectionLevelVisible(m_prot) && /* private/internal */
3652 (!m_isLocal || extractLocal) && /* local */
3653 (hasDocumentation() || m_tempArgs.hasTemplateDocumentation() || !hideUndoc) && /* documented */
3654 (!m_isStatic || extractStatic) && /* static */
3655 !isReference(); /* not an external reference */
3656 }
3657}
3658
3660{
3662 {
3663 return m_templateMaster->isLinkable();
3664 }
3665 else
3666 {
3667 return isReference() || isLinkableInProject();
3668 }
3669}
3670
3671
3672/*! the class is visible in a class diagram, or class hierarchy */
3674{
3675 bool allExternals = Config_getBool(ALLEXTERNALS);
3676 bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES);
3677 bool extractStatic = Config_getBool(EXTRACT_STATIC);
3678
3679 //printf("%s: isArtificial=%d isAnonymous=%d protectionLevelVisible=%d hasDocumentation=%d templateInstance=%d static=%d\n",
3680 // qPrint(name()),
3681 // (allExternals && !isArtificial()) || hasNonReferenceSuperClass(),
3682 // !isAnonymous(),
3683 // protectionLevelVisible(m_prot),
3684 // (hasDocumentation() || !hideUndocClasses || (m_templateMaster && m_templateMaster->hasDocumentation()) || isReference()),
3685 // !m_implicitTemplateInstance || !m_inherits.empty() || !m_inheritedBy.empty(),
3686 // !m_isStatic || extractStatic);
3687
3688 return // show all classes or a subclass is visible
3689 ((allExternals && !isArtificial()) || hasNonReferenceSuperClass()) &&
3690 // and not an anonymous compound
3691 !isAnonymous() &&
3692 // and not privately inherited
3694 // documented or shown anyway or documentation is external
3695 (hasDocumentation() ||
3696 !hideUndocClasses ||
3698 isReference()
3699 ) &&
3700 // if this is an implicit template instance then it most be part of the inheritance hierarchy
3701 (!m_implicitTemplateInstance || !m_inherits.empty() || !m_inheritedBy.empty()) &&
3702 // is not part of an unnamed namespace or shown anyway
3703 (!m_isStatic || extractStatic);
3704}
3705
3710
3711//----------------------------------------------------------------------
3712// recursive function:
3713// returns the distance to the base class definition 'bcd' represents an (in)direct base
3714// class of class definition 'cd' or nullptr if it does not.
3715
3716int ClassDefImpl::isBaseClass(const ClassDef *bcd, bool followInstances,const DString &templSpec) const
3717{
3718 int distance=0;
3719 //printf("isBaseClass(cd=%s) looking for %s templSpec=%s\n",qPrint(name()),qPrint(bcd->name()),qPrint(templSpec));
3720 for (const auto &bclass : baseClasses())
3721 {
3722 const ClassDef *ccd = bclass.classDef;
3723 if (!followInstances && ccd->templateMaster())
3724 {
3725 ccd=ccd->templateMaster();
3726 }
3727 if (ccd==bcd && (templSpec.empty() || templSpec==bclass.templSpecifiers))
3728 {
3729 distance=1;
3730 break; // no shorter path possible
3731 }
3732 else
3733 {
3734 int d = ccd->isBaseClass(bcd,followInstances,templSpec);
3735 if (d>256)
3736 {
3737 err("Possible recursive class relation while inside {} and looking for base class {}\n",name(),bcd->name());
3738 return 0;
3739 }
3740 else if (d>0) // path found
3741 {
3742 if (distance==0 || d+1<distance) // update if no path found yet or shorter path found
3743 {
3744 distance=d+1;
3745 }
3746 }
3747 }
3748 }
3749 return distance;
3750}
3751
3752//----------------------------------------------------------------------
3753
3754bool ClassDefImpl::isSubClass(ClassDef *cd,int level) const
3755{
3756 bool found=false;
3757 if (level>256)
3758 {
3759 err("Possible recursive class relation while inside {} and looking for derived class {}\n",name(),cd->name());
3760 return false;
3761 }
3762 for (const auto &iscd : subClasses())
3763 {
3764 ClassDef *ccd=iscd.classDef;
3765 found = (ccd==cd) || ccd->isSubClass(cd,level+1);
3766 if (found) break;
3767 }
3768 return found;
3769}
3770
3771//----------------------------------------------------------------------------
3772
3773static bool isStandardFunc(const MemberDef *md)
3774{
3775 return md->name()=="operator=" || // assignment operator
3776 md->isConstructor() || // constructor
3777 md->isDestructor(); // destructor
3778}
3779
3780void ClassDefImpl::mergeMembersFromBaseClasses(bool mergeVirtualBaseClass)
3781{
3782 SrcLangExt lang = getLanguage();
3784 size_t sepLen = sep.length();
3785 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
3786 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
3787
3788 auto insertMember = [&](const ClassDef *cd,MemberDef *md,Protection prot)
3789 {
3790 if (inlineInheritedMembers && !isStandardFunc(md))
3791 {
3792 //printf(" %s::insertMember(%s)\n",qPrint(name()),qPrint(srcMd->name()));
3793 internalInsertMember(md,prot,false);
3794 if (!cd->isLinkable()) // if the base is not linkable then move the member to this class
3795 {
3797 mdm->moveTo(this);
3798 mdm->setExplicitInherited(true);
3799 }
3800 }
3801 };
3802
3803 //printf(" mergeMembers for %s mergeVirtualBaseClass=%d\n",qPrint(name()),mergeVirtualBaseClass);
3804 // the merge the base members with this class' members
3805 for (const auto &bcd : baseClasses())
3806 {
3807 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
3808 if (bClass)
3809 {
3810 const MemberNameInfoLinkedMap &srcMnd = bClass->memberNameInfoLinkedMap();
3812
3813 for (auto &srcMni : srcMnd)
3814 {
3815 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
3816 if (dstMni)
3817 // a member with that name is already in the class.
3818 // the member may hide or reimplement the one in the sub class
3819 // or there may be another path to the base class that is already
3820 // visited via another branch in the class hierarchy.
3821 {
3822 //printf(" %s hides member name %s\n",qPrint(bClass->name()),qPrint(srcMni->memberName()));
3823 for (auto &srcMi : *srcMni)
3824 {
3825 MemberDef *srcMd = srcMi->memberDef();
3826 bool found=false;
3827 bool ambiguous=false;
3828 bool hidden=false;
3829 const ClassDef *srcCd = srcMd->getClassDef();
3830 for (auto &dstMi : *dstMni)
3831 {
3832 const MemberDef *dstMd = dstMi->memberDef();
3833 if (srcMd!=dstMd) // different members
3834 {
3835 const ClassDef *dstCd = dstMd->getClassDef();
3836 //printf(" Is %s a base class of %s?\n",qPrint(srcCd->name()),qPrint(dstCd->name()));
3837 if (srcCd==dstCd || dstCd->isBaseClass(srcCd,true))
3838 // member is in the same or a base class
3839 {
3840 const ArgumentList &srcAl = srcMd->argumentList();
3841 const ArgumentList &dstAl = dstMd->argumentList();
3842 found=matchArguments2(
3843 srcMd->getOuterScope(),srcMd->getFileDef(),srcMd->typeString(),&srcAl,
3844 dstMd->getOuterScope(),dstMd->getFileDef(),dstMd->typeString(),&dstAl,
3845 true,lang
3846 );
3847 //printf(" Yes, matching (%s<->%s): %d\n",
3848 // qPrint(argListToString(srcMd->argumentList())),
3849 // qPrint(argListToString(dstMd->argumentList())),
3850 // found);
3851 hidden = hidden || !found;
3852 }
3853 else // member is in a non base class => multiple inheritance
3854 // using the same base class.
3855 {
3856 //printf(" $$ Existing member %s %s add scope %s\n",
3857 // qPrint(dstMi->ambiguityResolutionScope()),
3858 // qPrint(dstMd->name()),
3859 // qPrint(dstMi->scopePath().left(dstMi->scopePath().find("::")+2)));
3860
3861 size_t scopeSepPos = dstMi->scopePath().find(sep);
3862 DString scope = dstMi->scopePath().left(scopeSepPos!=DString::npos ? scopeSepPos+sepLen : 0);
3863 if (scope!=dstMi->ambiguityResolutionScope().left(scope.length()))
3864 {
3865 dstMi->setAmbiguityResolutionScope(scope+dstMi->ambiguityResolutionScope());
3866 }
3867 ambiguous=true;
3868 }
3869 }
3870 else // same members
3871 {
3872 // do not add if base class is virtual or
3873 // if scope paths are equal or
3874 // if base class is an interface (and thus implicitly virtual).
3875 //printf(" same member found srcMi->virt=%d dstMi->virt=%d\n",srcMi->virt(),dstMi->virt());
3876 if ((srcMi->virt()!=Specifier::Normal && dstMi->virt()!=Specifier::Normal) ||
3877 bClass->name()+sep+srcMi->scopePath() == dstMi->scopePath() ||
3879 )
3880 {
3881 found=true;
3882 }
3883 else // member can be reached via multiple paths in the
3884 // inheritance tree
3885 {
3886 //printf(" $$ Existing member %s %s add scope %s\n",
3887 // qPrint(dstMi->ambiguityResolutionScope()),
3888 // qPrint(dstMd->name()),
3889 // qPrint(dstMi->scopePath().left(dstMi->scopePath().find("::")+2)));
3890
3891 size_t scopeSepPos = dstMi->scopePath().find(sep);
3892 DString scope = dstMi->scopePath().left(scopeSepPos!=DString::npos ? scopeSepPos+sepLen : 0);
3893 if (scope!=dstMi->ambiguityResolutionScope().left(scope.length()))
3894 {
3895 dstMi->setAmbiguityResolutionScope(dstMi->ambiguityResolutionScope()+scope);
3896 }
3897 ambiguous=true;
3898 }
3899 }
3900 if (found) break;
3901 }
3902 //printf(" member %s::%s hidden %d ambiguous %d srcMi->ambigClass=%p found=%d\n",
3903 // qPrint(srcCd->name()),qPrint(srcMd->name()),hidden,ambiguous,
3904 // (void*)srcMi->ambigClass(),found);
3905
3906 // TODO: fix the case where a member is hidden by inheritance
3907 // of a member with the same name but with another prototype,
3908 // while there is more than one path to the member in the
3909 // base class due to multiple inheritance. In this case
3910 // it seems that the member is not reachable by prefixing a
3911 // scope name either (according to my compiler). Currently,
3912 // this case is shown anyway.
3913 if (!found && srcMd->protection()!=Protection::Private && !srcMd->isFriend() &&
3914 srcMi->virtualBaseClass()==mergeVirtualBaseClass && lang!=SrcLangExt::Python)
3915 {
3916 Protection prot = srcMd->protection();
3917 if (bcd.prot==Protection::Protected && prot==Protection::Public)
3918 {
3919 prot = bcd.prot;
3920 }
3921 else if (bcd.prot==Protection::Private)
3922 {
3923 prot = bcd.prot;
3924 }
3925
3926 insertMember(bClass,srcMd,prot);
3927
3928 Specifier virt=srcMi->virt();
3929 if (virt==Specifier::Normal && bcd.virt!=Specifier::Normal) virt=bcd.virt;
3930 bool virtualBaseClass = bcd.virt!=Specifier::Normal;
3931
3932 auto newMi = std::make_unique<MemberInfo>(srcMd,prot,virt,true,virtualBaseClass);
3933 newMi->setScopePath(bClass->name()+sep+srcMi->scopePath());
3934 if (ambiguous)
3935 {
3936 //printf("$$ New member %s %s add scope %s::\n",
3937 // qPrint(srcMi->ambiguityResolutionScope),
3938 // qPrint(srcMd->name()),
3939 // qPrint(bClass->name()));
3940
3941 DString scope=bClass->name()+sep;
3942 if (scope!=srcMi->ambiguityResolutionScope().left(scope.length()))
3943 {
3944 newMi->setAmbiguityResolutionScope(scope+srcMi->ambiguityResolutionScope());
3945 }
3946 }
3947 if (hidden)
3948 {
3949 if (srcMi->ambigClass()==nullptr)
3950 {
3951 newMi->setAmbigClass(bClass);
3952 newMi->setAmbiguityResolutionScope(bClass->name()+sep);
3953 }
3954 else
3955 {
3956 newMi->setAmbigClass(srcMi->ambigClass());
3957 newMi->setAmbiguityResolutionScope(srcMi->ambigClass()->name()+sep);
3958 }
3959 }
3960 dstMni->push_back(std::move(newMi));
3961 }
3962 }
3963 }
3964 else // base class has a member that is not in the sub class => copy
3965 {
3966 //printf(" %s adds member name %s\n",qPrint(bClass->name()),qPrint(srcMni->memberName()));
3967 // create a deep copy of the list (only the MemberInfo's will be
3968 // copied, not the actual MemberDef's)
3969 MemberNameInfo *newMni = dstMnd.add(srcMni->memberName());
3970
3971 // copy the member(s) from the base to the sub class
3972 for (auto &mi : *srcMni)
3973 {
3974 if (mi->virtualBaseClass()==mergeVirtualBaseClass && !mi->memberDef()->isFriend()) // don't inherit friends
3975 {
3976 Protection prot = mi->prot();
3977 if (bcd.prot==Protection::Protected)
3978 {
3979 if (prot==Protection::Public) prot=Protection::Protected;
3980 }
3981 else if (bcd.prot==Protection::Private)
3982 {
3983 prot=Protection::Private;
3984 }
3985 Specifier virt=mi->virt();
3986 bool virtualBaseClass = bcd.virt!=Specifier::Normal || mi->virtualBaseClass();
3987 if (virt==Specifier::Normal && bcd.virt!=Specifier::Normal) virt=bcd.virt;
3988 //printf(" %s::%s: [mi.prot=%d, bcd.prot=%d => prot=%d], [mi.virt=%d, bcd.virt=%d => virt=%d] virtualBase=%d\n",
3989 // qPrint(name()),qPrint(mi->memberDef()->name()),
3990 // mi->prot(),bcd.prot,prot,
3991 // mi->virt(),bcd.virt,virt,
3992 // virtualBaseClass
3993 // );
3994
3995 if (prot!=Protection::Private || extractPrivate)
3996 {
3997 insertMember(bClass,mi->memberDef(),prot);
3998
3999 //printf("Adding!\n");
4000 std::unique_ptr<MemberInfo> newMi = std::make_unique<MemberInfo>(mi->memberDef(),prot,virt,true,virtualBaseClass);
4001 newMi->setScopePath(bClass->name()+sep+mi->scopePath());
4002 newMi->setAmbigClass(mi->ambigClass());
4003 newMi->setAmbiguityResolutionScope(mi->ambiguityResolutionScope());
4004 newMni->push_back(std::move(newMi));
4005 }
4006 }
4007 }
4008 }
4009 }
4010 }
4011 }
4012}
4013
4014// See issue11260, referring to a variable in a base class will make doxygen
4015// add it as a member to the derived class, but this is not correct for non-private variables
4016// so we correct this here, now we know the inheritance hierarchy
4018{
4019 //printf("hideDerivedVariableInPython()\n");
4020 if (bClass)
4021 {
4022 const MemberNameInfoLinkedMap &srcMnd = bClass->memberNameInfoLinkedMap();
4024
4025 // recurse up the inheritance hierarchy
4026 for (const auto &bcd : bClass->baseClasses())
4027 {
4029 }
4030
4031 for (auto &srcMni : srcMnd) // for each member in a base class
4032 {
4033 //printf(" candidate(%s)\n",qPrint(srcMni->memberName()));
4034 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
4035 if (dstMni) // that is also in this class
4036 {
4038 //printf("%s member in %s and %s\n",qPrint(name()),qPrint(bClass->name()),qPrint(name()));
4039 for (it=dstMni->begin();it!=dstMni->end();)
4040 {
4041 MemberDefMutable *dstMd = toMemberDefMutable((*it)->memberDef());
4042 if (dstMd && dstMd->isVariable() && !dstMd->name().startsWith("__"))
4043 {
4044 //printf(" hiding member %s\n",qPrint(dstMd->name()));
4045 // hide a member variable if it is already defined in a base class, unless
4046 // it is a __private variable
4047 removeMemberFromLists(dstMd);
4048 it = dstMni->erase(it);
4049 }
4050 else
4051 {
4052 ++it;
4053 }
4054 }
4055 if (dstMni->empty()) // if the list has become empty, remove the entry from the dictionary
4056 {
4057 dstMnd.del(srcMni->memberName());
4058 }
4059 }
4060 }
4061 }
4062}
4063
4064/*!
4065 * recursively merges the 'all members' lists of a class base
4066 * with that of this class. Must only be called for classes without
4067 * subclasses!
4068 */
4070{
4071 if (m_membersMerged) return;
4072 if (getLanguage()==SrcLangExt::Python)
4073 {
4074 for (const auto &bcd : baseClasses())
4075 {
4076 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
4078 }
4079 }
4080
4081 //printf("> %s::mergeMembers()\n",qPrint(name()));
4082
4083 m_membersMerged=true;
4084
4085 // first merge the members of the base class recursively
4086 for (const auto &bcd : baseClasses())
4087 {
4088 ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
4089 if (bClass)
4090 {
4091 // merge the members in the base class of this inheritance branch first
4092 bClass->mergeMembers();
4093 }
4094 }
4095
4096 // first merge the member that are not inherited via a virtual base class
4097 // (as this can end up reimplemented via multiple paths, see #10717 for examples)
4099 // then process the member that are inherited via a virtual base class to add the
4100 // ones that are not reimplemented via any path
4102
4103 //printf("< %s::mergeMembers()\n",qPrint(name()));
4104}
4105
4106//----------------------------------------------------------------------------
4107
4108/*! Merges the members of a Objective-C category into this class.
4109 */
4111{
4112 AUTO_TRACE();
4113 ClassDefMutable *category = toClassDefMutable(cat);
4114 if (category)
4115 {
4116 bool extractLocalMethods = Config_getBool(EXTRACT_LOCAL_METHODS);
4117 bool makePrivate = category->isLocal();
4118 // in case extract local methods is not enabled we don't add the methods
4119 // of the category in case it is defined in the .m file.
4120 if (makePrivate && !extractLocalMethods) return;
4121 bool isExtension = category->isExtension();
4122
4123 category->setCategoryOf(this);
4124 if (isExtension)
4125 {
4126 category->setArtificial(true);
4127
4128 // copy base classes/protocols from extension
4129 for (const auto &bcd : category->baseClasses())
4130 {
4131 insertBaseClass(bcd.classDef,bcd.usedName,bcd.prot,bcd.virt,bcd.templSpecifiers);
4132 // correct bcd.classDef so that they do no longer derive from
4133 // category, but from this class!
4134 BaseClassList scl = bcd.classDef->subClasses();
4135 for (auto &scd : scl)
4136 {
4137 if (scd.classDef==category)
4138 {
4139 scd.classDef=this;
4140 }
4141 }
4142 bcd.classDef->updateSubClasses(scl);
4143 }
4144 }
4145 // make methods private for categories defined in the .m file
4146 //printf("%s::mergeCategory makePrivate=%d\n",qPrint(name()),makePrivate);
4147
4148 const MemberNameInfoLinkedMap &srcMnd = category->memberNameInfoLinkedMap();
4150
4151 for (auto &srcMni : srcMnd)
4152 {
4153 MemberNameInfo *dstMni=dstMnd.find(srcMni->memberName());
4154 if (dstMni) // method is already defined in the class
4155 {
4156 AUTO_TRACE_ADD("Existing member {}",srcMni->memberName());
4157 const auto &dstMi = dstMni->front();
4158 const auto &srcMi = srcMni->front();
4159 if (srcMi && dstMi)
4160 {
4161 MemberDefMutable *smdm = toMemberDefMutable(srcMi->memberDef());
4162 MemberDefMutable *dmdm = toMemberDefMutable(dstMi->memberDef());
4163 if (smdm && dmdm)
4164 {
4166 dmdm->setCategory(category);
4167 dmdm->setCategoryRelation(smdm);
4168 smdm->setCategoryRelation(dmdm);
4169 }
4170 }
4171 }
4172 else // new method name
4173 {
4174 AUTO_TRACE_ADD("New member {}",srcMni->memberName());
4175 // create a deep copy of the list
4176 MemberNameInfo *newMni = dstMnd.add(srcMni->memberName());
4177
4178 // copy the member(s) from the category to this class
4179 for (auto &mi : *srcMni)
4180 {
4181 //printf("Adding '%s'\n",qPrint(mi->memberDef->name()));
4182 Protection prot = mi->prot();
4183 //if (makePrivate) prot = Private;
4184 auto newMd = mi->memberDef()->deepCopy();
4185 if (newMd)
4186 {
4187 auto mmd = toMemberDefMutable(newMd.get());
4188 AUTO_TRACE_ADD("Copying member {}",mmd->name());
4189 if (mmd)
4190 {
4191 mmd->moveTo(this);
4192 }
4193
4194 auto newMi=std::make_unique<MemberInfo>(newMd.get(),prot,mi->virt(),mi->inherited(),mi->virtualBaseClass());
4195 newMi->setScopePath(mi->scopePath());
4196 newMi->setAmbigClass(mi->ambigClass());
4197 newMi->setAmbiguityResolutionScope(mi->ambiguityResolutionScope());
4198 newMni->push_back(std::move(newMi));
4199
4200 // also add the newly created member to the global members list
4201
4202 DString name = newMd->name();
4204
4205 if (mmd)
4206 {
4207 mmd->setCategory(category);
4208 mmd->setCategoryRelation(mi->memberDef());
4209 }
4210 auto miMmd = toMemberDefMutable(mi->memberDef());
4211 if (miMmd) miMmd->setCategoryRelation(newMd.get());
4212
4213 if (mmd && (makePrivate || isExtension))
4214 {
4215 mmd->makeImplementationDetail();
4216 }
4217 internalInsertMember(newMd.get(),prot,false);
4218 mn->push_back(std::move(newMd));
4219 }
4220 }
4221 }
4222 }
4223 }
4224}
4225
4226//----------------------------------------------------------------------------
4227
4229 Protection prot)
4230{
4231 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
4232 bool umlLook = Config_getBool(UML_LOOK);
4233 if (prot==Protection::Private && !extractPrivate) return;
4234 //printf("%s::addUsedClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName);
4235
4236 auto it = std::find_if(m_usesImplClassList.begin(),
4237 m_usesImplClassList.end(),
4238 [&cd](const auto &ucd) { return ucd.classDef==cd; });
4239 if (it==m_usesImplClassList.end())
4240 {
4241 m_usesImplClassList.emplace_back(cd);
4242 //printf("Adding used class %s to class %s via accessor %s\n",
4243 // qPrint(cd->name()),qPrint(name()),accessName);
4244 it = m_usesImplClassList.end()-1;
4245 }
4246 DString acc = accessName;
4247 if (umlLook)
4248 {
4249 switch(prot)
4250 {
4251 case Protection::Public: acc.prepend("+"); break;
4252 case Protection::Private: acc.prepend("-"); break;
4253 case Protection::Protected: acc.prepend("#"); break;
4254 case Protection::Package: acc.prepend("~"); break;
4255 }
4256 }
4257 (*it).addAccessor(acc);
4258}
4259
4261 Protection prot)
4262{
4263 bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
4264 bool umlLook = Config_getBool(UML_LOOK);
4265 if (prot==Protection::Private && !extractPrivate) return;
4266 //printf("%s::addUsedByClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName);
4267 //
4268 auto it = std::find_if(m_usedByImplClassList.begin(),
4270 [&cd](const auto &ucd) { return ucd.classDef==cd; });
4271 if (it==m_usedByImplClassList.end())
4272 {
4273 m_usedByImplClassList.emplace_back(cd);
4274 //printf("Adding used by class %s to class %s\n",
4275 // qPrint(cd->name()),qPrint(name()));
4276 it = m_usedByImplClassList.end()-1;
4277 }
4278 DString acc = accessName;
4279 if (umlLook)
4280 {
4281 switch(prot)
4282 {
4283 case Protection::Public: acc.prepend("+"); break;
4284 case Protection::Private: acc.prepend("-"); break;
4285 case Protection::Protected: acc.prepend("#"); break;
4286 case Protection::Package: acc.prepend("~"); break;
4287 }
4288 }
4289 (*it).addAccessor(acc);
4290}
4291
4292
4297
4299{
4300 bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
4301 bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS);
4303 {
4304 Definition *scope=nullptr;
4305 if (inlineGroupedClasses && !partOfGroups().empty())
4306 {
4307 // point to the group that embeds this class
4308 return partOfGroups().front()->getOutputFileBase();
4309 }
4310 else if (inlineSimpleClasses && m_isSimple && !partOfGroups().empty())
4311 {
4312 // point to simple struct inside a group
4313 return partOfGroups().front()->getOutputFileBase();
4314 }
4315 else if (inlineSimpleClasses && m_isSimple && (scope=getOuterScope()))
4316 {
4317 if (scope==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) // simple struct embedded in file
4318 {
4319 return getFileDef()->getOutputFileBase();
4320 }
4321 else if (scope->isLinkableInProject()) // simple struct embedded in other container (namespace/group/class)
4322 {
4323 return getOuterScope()->getOutputFileBase();
4324 }
4325 }
4326 }
4327 AUTO_TRACE("name='{}' m_templateMaster={} m_implicitTemplateInstance={}",name(),(void*)m_templateMaster,m_implicitTemplateInstance);
4329 {
4330 // point to the template of which this class is an instance
4331 return m_templateMaster->getOutputFileBase();
4332 }
4333 return m_fileName;
4334}
4335
4340
4342{
4344 {
4346 }
4347 else
4348 {
4350 }
4351}
4352
4353void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const DString &fileName,int startLine,bool hasDocs)
4354{
4355 gd->addClass(this);
4356 //printf("ClassDefImpl::setGroupDefForAllMembers(%s)\n",qPrint(gd->name()));
4357 for (auto &mni : m_allMemberNameInfoLinkedMap)
4358 {
4359 for (auto &mi : *mni)
4360 {
4361 MemberDefMutable *md = toMemberDefMutable(mi->memberDef());
4362 if (md)
4363 {
4364 md->setGroupDef(gd,pri,fileName,startLine,hasDocs);
4365 gd->insertMember(md,true);
4366 ClassDefMutable *innerClass = toClassDefMutable(const_cast<ClassDef*>(md->getClassDefOfAnonymousType()));
4367 if (innerClass) innerClass->setGroupDefForAllMembers(gd,pri,fileName,startLine,hasDocs);
4368 }
4369 }
4370 }
4371}
4372
4374{
4375 //printf("**** %s::addInnerCompound(%s)\n",qPrint(name()),qPrint(d->name()));
4376 if (d->definitionType()==Definition::TypeClass) // only classes can be nested in classes.
4377 {
4378 ClassDef *cd = toClassDef(d);
4379 m_innerClasses.add(d->localName(),cd);
4380 if (cd && cd->isAnonymous())
4381 {
4382 m_isSimple = false;
4383 }
4384 }
4385}
4386
4388{
4389 return m_innerClasses.find(name);
4390}
4391
4393 int startLine, size_t startColumn, const DString &templSpec,bool &freshInstance)
4394{
4395 freshInstance = false;
4396 auto it = std::find_if(m_templateInstances.begin(),
4397 m_templateInstances.end(),
4398 [&templSpec](const auto &ti) { return templSpec==ti.templSpec; });
4399 ClassDefMutable *templateClass=nullptr;
4400 if (it!=m_templateInstances.end())
4401 {
4402 templateClass = toClassDefMutable((*it).classDef);
4403 }
4404 if (templateClass==nullptr)
4405 {
4406 DString tcname = removeRedundantWhiteSpace(name()+templSpec);
4407 AUTO_TRACE("New template instance class name='{}' templSpec='{}' inside '{}' hidden={}",
4408 name(),templSpec,name(),isHidden());
4409
4410 ClassDef *foundCd = Doxygen::classLinkedMap->find(tcname);
4411 if (foundCd)
4412 {
4413 return foundCd;
4414 }
4415 templateClass =
4417 Doxygen::classLinkedMap->add(tcname,
4418 std::unique_ptr<ClassDef>(
4419 new ClassDefImpl(fileName,startLine,startColumn,tcname,ClassDef::Class))));
4420 if (templateClass)
4421 {
4422 templateClass->setTemplateMaster(this);
4423 ArgumentList tal = *stringToArgumentList(getLanguage(),templSpec);
4424 templateClass->setTemplateArguments(tal);
4425 templateClass->setOuterScope(getOuterScope());
4426 templateClass->setHidden(isHidden());
4427 templateClass->setArtificial(isArtificial());
4428 templateClass->setImplicitTemplateInstance(true);
4429 m_templateInstances.emplace_back(templSpec,templateClass);
4430
4431 // also add nested classes
4432 for (const auto &innerCd : m_innerClasses)
4433 {
4434 DString innerName = tcname+"::"+innerCd->localName();
4435 ClassDefMutable *innerClass =
4437 Doxygen::classLinkedMap->add(innerName,
4438 std::unique_ptr<ClassDef>(
4439 new ClassDefImpl(fileName,startLine,startColumn,innerName,ClassDef::Class))));
4440 if (innerClass)
4441 {
4442 templateClass->addInnerCompound(innerClass);
4443 innerClass->setOuterScope(templateClass);
4444 innerClass->setHidden(isHidden());
4445 innerClass->setArtificial(true);
4446 innerClass->setImplicitTemplateInstance(true);
4447 }
4448 }
4449 freshInstance=true;
4450 }
4451 }
4452 return templateClass;
4453}
4454
4456{
4457 AUTO_TRACE("this={} cd={} templSpec={}",name(),templateClass->name(),templSpec);
4458 m_templateInstances.emplace_back(templSpec,templateClass);
4459}
4460
4462{
4463 m_templBaseClassNames = templateNames;
4464}
4465
4470
4473 const DString &templSpec)
4474{
4475 AUTO_TRACE("this={} md={}",name(),md->name());
4476 auto actualArguments_p = stringToArgumentList(getLanguage(),templSpec);
4477 auto imd = md->createTemplateInstanceMember(templateArguments,actualArguments_p);
4478 auto mmd = toMemberDefMutable(imd.get());
4479 mmd->setMemberClass(this);
4480 mmd->setTemplateMaster(md);
4481 mmd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
4482 mmd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
4483 mmd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
4484 mmd->setMemberSpecifiers(md->getMemberSpecifiers());
4485 mmd->setMemberGroupId(md->getMemberGroupId());
4486 mmd->setArtificial(true);
4487 insertMember(imd.get());
4488 //printf("Adding member=%s %s%s to class %s templSpec %s\n",
4489 // imd->typeString(),qPrint(imd->name()),imd->argsString(),
4490 // qPrint(imd->getClassDef()->name()),templSpec);
4491 // insert imd in the list of all members
4492 //printf("Adding member=%s class=%s\n",qPrint(imd->name()),qPrint(name()));
4493 MemberName *mn = Doxygen::memberNameLinkedMap->add(imd->name());
4494 mn->push_back(std::move(imd));
4495}
4496
4498{
4499 AUTO_TRACE("this={} cd={} templSpec={}",name(),cd->name(),templSpec);
4500 //printf("%s::addMembersToTemplateInstance(%s,%s)\n",qPrint(name()),qPrint(cd->name()),templSpec);
4501 for (const auto &mni : cd->memberNameInfoLinkedMap())
4502 {
4503 for (const auto &mi : *mni)
4504 {
4505 const MemberDef *md = mi->memberDef();
4506 if (m_allMemberNameInfoLinkedMap.find(md->name())==nullptr) // only insert the member if not hidden by one with the same name (#11541)
4507 {
4509 }
4510 }
4511 }
4512 // also instantiate members for nested classes
4513 for (const auto &innerCd : cd->getClasses())
4514 {
4515 ClassDefMutable *ncd = toClassDefMutable(m_innerClasses.find(innerCd->localName()));
4516 if (ncd)
4517 {
4518 ncd->addMembersToTemplateInstance(innerCd,cd->templateArguments(),templSpec);
4519 }
4520 }
4521}
4522
4524{
4526 {
4528 }
4529 else
4530 {
4532 }
4533}
4534
4536{
4538 {
4539 return m_templateMaster->isReference();
4540 }
4541 else
4542 {
4544 }
4545}
4546
4548{
4549 ArgumentLists result;
4551 while (d && d->definitionType()==Definition::TypeClass)
4552 {
4553 result.insert(result.begin(),toClassDef(d)->templateArguments());
4554 d = d->getOuterScope();
4555 }
4556 if (!templateArguments().empty())
4557 {
4558 result.push_back(templateArguments());
4559 }
4560 return result;
4561}
4562
4564 const ArgumentLists *actualParams,uint32_t *actualParamIndex) const
4565{
4566 return makeQualifiedNameWithTemplateParameters(this,actualParams,actualParamIndex);
4567}
4568
4570{
4572 auto lang = getLanguage();
4573 if (lang==SrcLangExt::CSharp)
4574 {
4576 }
4577 return name;
4578}
4579
4581{
4582 m_className = name;
4583}
4584
4586{
4587 if (!isLinkableInProject()) return;
4588 SrcLangExt lang = getLanguage();
4590 qualifiedName(),
4593 displayName(),
4594 DString(),
4595 this
4596 );
4597 for (const auto &mg : m_memberGroups)
4598 {
4599 mg->addListReferences(this);
4600 }
4601 for (auto &ml : m_memberLists)
4602 {
4603 if (ml->listType().isDetailed())
4604 {
4605 ml->addListReferences(this);
4606 }
4607 }
4608}
4609
4611{
4612 if (!isLinkableInProject()) return;
4614 for (const auto &mg : m_memberGroups)
4615 {
4616 mg->addRequirementReferences(this);
4617 }
4618 for (auto &ml : m_memberLists)
4619 {
4620 if (ml->listType().isDetailed())
4621 {
4622 ml->addRequirementReferences(this);
4623 }
4624 }
4625}
4626
4628{
4629 const MemberDef *xmd = nullptr;
4631 if (mni)
4632 {
4633 const int maxInheritanceDepth = 100000;
4634 int mdist=maxInheritanceDepth;
4635 for (auto &mi : *mni)
4636 {
4637 const ClassDef *mcd=mi->memberDef()->getClassDef();
4638 int m=minClassDistance(this,mcd);
4639 //printf("found member in %s linkable=%d m=%d\n",
4640 // qPrint(mcd->name()),mcd->isLinkable(),m);
4641 if (m<mdist)
4642 {
4643 mdist=m;
4644 xmd=mi->memberDef();
4645 }
4646 }
4647 }
4648 //printf("getMemberByName(%s)=%p\n",qPrint(name),xmd);
4649 return xmd;
4650}
4651
4653{
4654 return md->getClassDef() && isBaseClass(md->getClassDef(),true,DString());
4655}
4656
4658{
4659 for (auto &ml : m_memberLists)
4660 {
4661 if (ml->listType()==lt)
4662 {
4663 return ml.get();
4664 }
4665 }
4666 return nullptr;
4667}
4668
4670{
4671 AUTO_TRACE("{} md={} lt={} isBrief={}",name(),md->name(),lt,isBrief);
4672 bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
4673 bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
4674 const auto &ml = m_memberLists.get(lt,MemberListContainer::Class);
4675 ml->setNeedsSorting((isBrief && sortBriefDocs) || (!isBrief && sortMemberDocs));
4676 ml->push_back(md);
4677
4678 // for members in the declaration lists we set the section, needed for member grouping
4679 if (!ml->listType().isDetailed())
4680 {
4682 if (mdm)
4683 {
4684 mdm->setSectionList(this,ml.get());
4685 }
4686 }
4687}
4688
4690{
4691 for (auto &ml : m_memberLists)
4692 {
4693 if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(false); }
4694 }
4695 if (Config_getBool(SORT_BRIEF_DOCS))
4696 {
4697 std::stable_sort(m_innerClasses.begin(),
4699 [](const auto &c1,const auto &c2)
4700 {
4701 return Config_getBool(SORT_BY_SCOPE_NAME) ?
4702 dstricmp_sort(c1->name(), c2->name() )<0 :
4703 dstricmp_sort(c1->className(), c2->className())<0 ;
4704 });
4705 }
4706}
4707
4709 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const
4710{
4711 //printf("%s: countMemberDeclarations for %s and %s\n",qPrint(name()),lt.to_string(),lt2.to_string());
4712 int count=0;
4713 MemberList * ml = getMemberList(lt);
4714 MemberList * ml2 = getMemberList(lt2);
4715 if (getLanguage()!=SrcLangExt::VHDL) // use specific declarations function
4716 {
4717 if (ml)
4718 {
4719 count+=ml->numDecMembers(inheritedFrom);
4720 //printf("-> ml=%d\n",ml->numDecMembers());
4721 }
4722 if (ml2)
4723 {
4724 count+=ml2->numDecMembers(inheritedFrom);
4725 //printf("-> ml2=%d\n",ml2->numDecMembers());
4726 }
4727 // also include grouped members that have their own section in the class (see bug 722759)
4728 if (inheritedFrom)
4729 {
4730 for (const auto &mg : m_memberGroups)
4731 {
4732 count+=mg->countGroupedInheritedMembers(lt);
4733 if (!lt2.isInvalid()) count+=mg->countGroupedInheritedMembers(lt2);
4734 }
4735 }
4736 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
4737 if (!inlineInheritedMembers) // show inherited members as separate lists
4738 {
4739 count+=countInheritedDecMembers(lt,inheritedFrom,invert,showAlways,visitedClasses);
4740 }
4741 }
4742 //printf("-> %d\n",count);
4743 return count;
4744}
4745
4747{
4748 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4749 {
4750 if (lde->kind()==LayoutDocEntry::MemberDecl)
4751 {
4752 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4753 if (lmd)
4754 {
4755 MemberList * ml = getMemberList(lmd->type);
4756 if (ml)
4757 {
4759 }
4760 }
4761 }
4762 else if (lde->kind()==LayoutDocEntry::MemberGroups)
4763 {
4764 for (const auto &mg : m_memberGroups)
4765 {
4766 mg->setAnonymousEnumType();
4767 }
4768 }
4769 }
4770}
4771
4773{
4774 for (auto &ml : m_memberLists)
4775 {
4776 ml->countDecMembers();
4777 ml->countDocMembers();
4778 }
4779 for (const auto &mg : m_memberGroups)
4780 {
4781 mg->countDecMembers();
4782 mg->countDocMembers();
4783 }
4784}
4785
4787 const ClassDef *inheritedFrom,bool invert,bool showAlways,
4788 ClassDefSet &visitedClasses) const
4789{
4790 int inhCount = 0;
4791 int count = countMembersIncludingGrouped(lt,inheritedFrom,false);
4792 bool process = count>0;
4793 //printf("%s: countInheritedDecMembers: lt=%s process=%d count=%d invert=%d\n",
4794 // qPrint(name()),lt.to_string(),process,count,invert);
4795 if ((process^invert) || showAlways)
4796 {
4797 for (const auto &ibcd : m_inherits)
4798 {
4799 ClassDefMutable *icd = toClassDefMutable(ibcd.classDef);
4802 if (icd && icd->isLinkable())
4803 {
4804 convertProtectionLevel(lt,ibcd.prot,&lt1,&lt2);
4805 //printf("%s: convert %s->(%s,%s) prot=%d\n",
4806 // qPrint(icd->name()),lt.to_string(),lt1.to_string(),lt2.to_string(),ibcd.prot);
4807 if (visitedClasses.find(icd)==visitedClasses.end())
4808 {
4809 visitedClasses.insert(icd); // guard for multiple virtual inheritance
4810 if (!lt1.isInvalid())
4811 {
4812 inhCount+=icd->countMemberDeclarations(lt1,inheritedFrom,lt2,false,true,visitedClasses);
4813 }
4814 }
4815 }
4816 }
4817 }
4818 //printf("%s: count=%d\n",qPrint(name()),inhCount);
4819 return inhCount;
4820}
4821
4823 DString &title,DString &subtitle) const
4824{
4825 SrcLangExt lang = getLanguage();
4826 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4827 {
4828 if (lde->kind()==LayoutDocEntry::MemberDecl)
4829 {
4830 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4831 if (lmd && lmd->type==type)
4832 {
4833 title = lmd->title(lang);
4834 subtitle = lmd->subtitle(lang);
4835 return;
4836 }
4837 }
4838 }
4839 title="";
4840 subtitle="";
4841}
4842
4844{
4845 int totalCount=0;
4846 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4847 {
4848 if (lde->kind()==LayoutDocEntry::MemberDecl)
4849 {
4850 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4851 if (lmd && lmd->type!=MemberListType::Friends()) // friendship is not inherited
4852 {
4853 ClassDefSet visited;
4854 totalCount+=countInheritedDecMembers(lmd->type,this,true,false,visited);
4855 }
4856 }
4857 }
4858 //printf("countAdditionalInheritedMembers()=%d\n",totalCount);
4859 return totalCount;
4860}
4861
4863{
4864 //printf("**** writeAdditionalInheritedMembers()\n");
4865 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class))
4866 {
4867 if (lde->kind()==LayoutDocEntry::MemberDecl)
4868 {
4869 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
4870 if (lmd && lmd->type!=MemberListType::Friends())
4871 {
4872 ClassDefSet visited;
4873 writeInheritedMemberDeclarations(ol,visited,lmd->type,MemberListType::Invalid(),lmd->title(getLanguage()),this,true,false);
4874 }
4875 }
4876 }
4877}
4878
4880 const ClassDef *inheritedFrom,bool additional) const
4881{
4882 int count=0;
4883 MemberList *ml = getMemberList(lt);
4884 if (ml)
4885 {
4886 count=ml->countInheritableMembers(inheritedFrom);
4887 }
4888 //printf("%s:countMembersIncludingGrouped: count=%d\n",qPrint(name()),count);
4889 for (const auto &mg : m_memberGroups)
4890 {
4891 bool hasOwnSection = !mg->allMembersInSameSection() ||
4892 !m_subGrouping; // group is in its own section
4893 if ((additional && hasOwnSection) || (!additional && !hasOwnSection))
4894 {
4895 count+=mg->countGroupedInheritedMembers(lt);
4896 }
4897 }
4898 //printf("%s:countMembersIncludingGrouped(lt=%s,%s)=%d\n",
4899 // qPrint(name()),qPrint(lt.to_string()),ml?qPrint(ml->listType().to_string()):"<none>",count);
4900 return count;
4901}
4902
4903
4906 const ClassDef *inheritedFrom,bool invert,bool showAlways) const
4907{
4908 int count = countMembersIncludingGrouped(lt,inheritedFrom,false);
4909 bool process = count>0;
4910 //printf("%s: writeInheritedMemberDec: lt=%s process=%d invert=%d always=%d\n",
4911 // qPrint(name()),qPrint(lt.to_string()),process,invert,showAlways);
4912 if ((process^invert) || showAlways)
4913 {
4914 for (const auto &ibcd : m_inherits)
4915 {
4916 ClassDefMutable *icd=toClassDefMutable(ibcd.classDef);
4917 if (icd && icd->isLinkable())
4918 {
4921 convertProtectionLevel(lt,ibcd.prot,&lt1,&lt3);
4922 if (lt2.isInvalid() && !lt3.isInvalid())
4923 {
4924 lt2=lt3;
4925 }
4926 //printf("%s:convert %s->(%s,%s) prot=%d\n",qPrint(icd->name()),qPrint(lt.to_string()),
4927 // qPrint(lt1.to_string()),qPrint(lt2.to_string()),ibcd.prot);
4928 if (visitedClasses.find(icd)==visitedClasses.end())
4929 {
4930 visitedClasses.insert(icd); // guard for multiple virtual inheritance
4931 if (!lt1.isInvalid())
4932 {
4933 //printf("--> writeMemberDeclarations for type %s\n",qPrint(lt1.to_string()));
4934 icd->writeMemberDeclarations(ol,visitedClasses,lt1,
4935 title,DString(),false,inheritedFrom,lt2,false,true);
4936 }
4937 }
4938 else
4939 {
4940 //printf("%s: class already visited!\n",qPrint(icd->name()));
4941 }
4942 }
4943 }
4944 }
4945}
4946
4948 MemberListType lt,const DString &title,
4949 const DString &subTitle,bool showInline,const ClassDef *inheritedFrom,MemberListType lt2,
4950 bool invert,bool showAlways) const
4951{
4952 //printf("%s: ClassDefImpl::writeMemberDeclarations lt=%s lt2=%s\n",qPrint(name()),qPrint(lt.to_string()),qPrint(lt2.to_string()));
4953 MemberList * ml = getMemberList(lt);
4954 MemberList * ml2 = getMemberList(lt2);
4955 if (getLanguage()==SrcLangExt::VHDL) // use specific declarations function
4956 {
4957 static const ClassDef *cdef;
4958 if (cdef!=this)
4959 { // only one inline link
4961 cdef=this;
4962 }
4963 if (ml)
4964 {
4965 VhdlDocGen::writeVhdlDeclarations(ml,ol,nullptr,this,nullptr,nullptr,nullptr);
4966 }
4967 }
4968 else
4969 {
4970 //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",qPrint(name()),qPrint(title),(void*)ml,(void*)ml2);
4971 DString tt = title, st = subTitle;
4972 if (ml)
4973 {
4974 //printf(" writeDeclarations ml type=%s count=%d\n",qPrint(lt.to_string()),ml->numDecMembers(inheritedFrom));
4975 ml->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,tt,st,false,showInline,inheritedFrom,lt,true);
4976 tt.clear();
4977 st.clear();
4978 }
4979 if (ml2)
4980 {
4981 //printf(" writeDeclarations ml2 type=%s count=%d\n",qPrint(lt2.to_string()),ml2->numDecMembers(inheritedFrom));
4982 ml2->writeDeclarations(ol,this,nullptr,nullptr,nullptr,nullptr,tt,st,false,showInline,inheritedFrom,lt,ml==nullptr);
4983 }
4984 bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB);
4985 if (!inlineInheritedMembers) // show inherited members as separate lists
4986 {
4987 writeInheritedMemberDeclarations(ol,visitedClasses,lt,lt2,title,
4988 inheritedFrom ? inheritedFrom : this,
4989 invert,showAlways);
4990 }
4991 }
4992}
4993
4995 const ClassDef *inheritedFrom,const DString &inheritId) const
4996{
4997 //printf("** %s::addGroupedInheritedMembers() inheritId=%s\n",qPrint(name()),qPrint(inheritId));
4998 for (const auto &mg : m_memberGroups)
4999 {
5000 if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section
5001 {
5002 mg->addGroupedInheritedMembers(ol,this,lt,inheritedFrom,inheritId);
5003 }
5004 }
5005}
5006
5008{
5009 //printf("%s: ClassDefImpl::writeMemberDocumentation()\n",qPrint(name()));
5010 MemberList * ml = getMemberList(lt);
5011 if (ml) ml->writeDocumentation(ol,displayName(),this,title,ml->listType().toLabel(),false,showInline);
5012}
5013
5015{
5016 //printf("%s: ClassDefImpl::writeSimpleMemberDocumentation()\n",qPrint(name()));
5017 MemberList * ml = getMemberList(lt);
5018 if (ml) ml->writeSimpleDocumentation(ol,this);
5019}
5020
5022 MemberListType lt,bool inGroup,
5023 int indentLevel,const ClassDef *inheritedFrom,const DString &inheritId) const
5024{
5025 //printf("%s: ClassDefImpl::writePlainMemberDeclaration()\n",qPrint(name()));
5026 MemberList * ml = getMemberList(lt);
5027 if (ml)
5028 {
5029 ml->writePlainDeclarations(ol,inGroup,this,nullptr,nullptr,nullptr,nullptr,indentLevel,inheritedFrom,inheritId);
5030 }
5031}
5032
5034{
5035 return m_isLocal;
5036}
5037
5042
5047
5049{
5050 return m_inherits;
5051}
5052
5054{
5055 m_inherits = bcd;
5056}
5057
5059{
5060 return m_inheritedBy;
5061}
5062
5064{
5065 m_inheritedBy = bcd;
5066}
5067
5072
5074{
5075 std::stable_sort(m_allMemberNameInfoLinkedMap.begin(),
5077 [](const auto &m1,const auto &m2)
5078 {
5079 return dstricmp_sort(m1->memberName(),m2->memberName())<0;
5080 });
5081}
5082
5084{
5085 return m_prot;
5086}
5087
5089{
5090 return m_tempArgs;
5091}
5092
5094{
5095 return m_fileDef;
5096}
5097
5099{
5100 return m_moduleDef;
5101}
5102
5107
5109{
5110 return m_templateMaster;
5111}
5112
5117
5122
5124{
5125 return !m_tempArgs.empty();
5126}
5127
5129{
5130 return m_incInfo.get();
5131}
5132
5137
5142
5147
5149{
5150 return m_isTemplArg;
5151}
5152
5154{
5155 return m_isAbstract || m_spec.isAbstract();
5156}
5157
5159{
5160 return m_spec.isFinal();
5161}
5162
5164{
5165 return m_spec.isSealed();
5166}
5167
5169{
5170 return m_spec.isPublished();
5171}
5172
5174{
5175 return m_spec.isForwardDecl();
5176}
5177
5179{
5180 return m_spec.isInterface();
5181}
5182
5184{
5185 return getLanguage()==SrcLangExt::ObjC;
5186}
5187
5189{
5190 return getLanguage()==SrcLangExt::Fortran;
5191}
5192
5194{
5195 return getLanguage()==SrcLangExt::CSharp;
5196}
5197
5199{
5200 return m_categoryOf;
5201}
5202
5204{
5205 return m_memberLists;
5206}
5207
5209{
5210 return m_memberGroups;
5211}
5212
5214{
5215 m_fileDef = fd;
5216}
5217
5219{
5220 m_moduleDef = mod;
5221}
5222
5224{
5225 m_subGrouping = enabled;
5226}
5227
5229{
5230 m_prot=p;
5231 if (getLanguage()==SrcLangExt::VHDL && VhdlDocGen::convert(p)==VhdlDocGen::ARCHITECTURECLASS)
5232 {
5233 m_className = name();
5234 }
5235}
5236
5238{
5239 m_isStatic=b;
5240}
5241
5246
5248{
5249 ASSERT(tm!=this);
5251}
5252
5254{
5255 m_isTemplArg = b;
5256}
5257
5259{
5260 m_categoryOf = cd;
5261}
5262
5264{
5265 m_usedOnly = b;
5266}
5267
5269{
5270 return m_usedOnly;
5271}
5272
5274{
5275 return m_isSimple;
5276}
5277
5279{
5280 return m_arrowOperator;
5281}
5282
5284{
5285 md->setMemberType(t);
5286 for (auto &ml : m_memberLists)
5287 {
5288 ml->remove(md);
5289 }
5290 insertMember(md);
5291}
5292
5294{
5295 DString anc;
5297 {
5299 {
5300 // point to the template of which this class is an instance
5302 }
5303 else
5304 {
5305 anc = m_fileName;
5306 }
5307 }
5308 return anc;
5309}
5310
5312{
5313 bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
5314 bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS);
5315
5316 Definition *container = getOuterScope();
5317
5318 bool containerLinkable =
5319 container &&
5320 (
5321 (container==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) || // global class in documented file
5322 container->isLinkableInProject() // class in documented scope
5323 );
5324
5325 if (isAnonymous())
5326 {
5327 return false; // don't inline an anonymous class
5328 }
5329
5330 // inline because of INLINE_GROUPED_CLASSES=YES ?
5331 bool b1 = (inlineGroupedClasses && !partOfGroups().empty()); // a grouped class
5332 // inline because of INLINE_SIMPLE_STRUCTS=YES ?
5333 bool b2 = (inlineSimpleClasses && m_isSimple && // a simple class
5334 (containerLinkable || // in a documented container
5335 !partOfGroups().empty() // or part of a group
5336 )
5337 );
5338 //printf("%s::isEmbeddedInOuterScope(): inlineGroupedClasses=%d "
5339 // "inlineSimpleClasses=%d partOfGroups()=%d m_isSimple=%d "
5340 // "getOuterScope()=%s b1=%d b2=%d\n",
5341 // qPrint(name()),inlineGroupedClasses,inlineSimpleClasses,
5342 // !partOfGroups().empty(),m_isSimple,getOuterScope()?qPrint(getOuterScope()->name()):"<none>",b1,b2);
5343 return b1 || b2; // either reason will do
5344}
5345
5347{
5348 return m_taglessParent;
5349}
5350
5352{
5353 m_taglessParent = cd;
5354}
5355
5357{
5358 return m_hasNamedVariable;
5359}
5360
5365
5367{
5368 for (auto &ml : m_memberLists)
5369 {
5370 ml->remove(md);
5371 }
5372}
5373
5375{
5376 return m_isJavaEnum;
5377}
5378
5380{
5381 m_spec = spec;
5382}
5383
5385{
5386 for (const auto &sx : qualifiers)
5387 {
5388 bool alreadyAdded = std::find(m_qualifiers.begin(), m_qualifiers.end(), sx) != m_qualifiers.end();
5389 if (!alreadyAdded)
5390 {
5391 m_qualifiers.push_back(sx);
5392 }
5393 }
5394}
5395
5400
5402{
5403 AUTO_TRACE("name={}",md->name());
5404 const auto &mni = m_allMemberNameInfoLinkedMap.find(md->name());
5405 if (mni)
5406 {
5407 for (const auto &mi : *mni)
5408 {
5409 const MemberDef *classMd = mi->memberDef();
5410 const ArgumentList &classAl = classMd->argumentList();
5411 const ArgumentList &al = md->argumentList();
5412 bool found = matchArguments2(
5413 classMd->getOuterScope(),classMd->getFileDef(),classMd->typeString(),&classAl,
5414 md->getOuterScope(),md->getFileDef(),md->typeString(),&al,
5415 true,getLanguage()
5416 );
5417 if (found)
5418 {
5419 AUTO_TRACE_EXIT("true");
5420 return true;
5421 }
5422 }
5423 }
5424 AUTO_TRACE_EXIT("false");
5425 return false;
5426}
5427
5429{
5430 DString n = name();
5431 size_t si = n.find('(');
5432 size_t ei = n.find(')');
5433 bool b = si!=DString::npos && ei!=DString::npos && ei>si && n.mid(si+1,ei-si-1).stripWhiteSpace().empty();
5434 return b;
5435}
5436
5438{
5439 return m_files;
5440}
5441
5443{
5444 return m_typeConstraints;
5445}
5446
5448{
5449 return m_examples;
5450}
5451
5453{
5454 return m_subGrouping;
5455}
5456
5458{
5459 return m_spec.isLocal();
5460}
5461
5463{
5464 m_metaData = md;
5465}
5466
5471
5476
5478{
5480}
5481
5483{
5485}
5486
5488{
5489 switch (compoundType())
5490 {
5491 case Class: return CodeSymbolType::Class; break;
5492 case Struct: return CodeSymbolType::Struct; break;
5493 case Union: return CodeSymbolType::Union; break;
5494 case Interface: return CodeSymbolType::Interface; break;
5495 case Protocol: return CodeSymbolType::Protocol; break;
5496 case Category: return CodeSymbolType::Category; break;
5497 case Exception: return CodeSymbolType::Exception; break;
5498 case Service: return CodeSymbolType::Service; break;
5499 case Singleton: return CodeSymbolType::Singleton; break;
5500 }
5501 return CodeSymbolType::Class;
5502}
5503
5508
5513
5514
5515// --- Cast functions
5516//
5518{
5519 if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
5520 {
5521 return static_cast<ClassDef*>(d);
5522 }
5523 else
5524 {
5525 return nullptr;
5526 }
5527}
5528
5530{
5531 Definition *d = toDefinition(md);
5532 if (d && typeid(*d)==typeid(ClassDefImpl))
5533 {
5534 return static_cast<ClassDef*>(d);
5535 }
5536 else
5537 {
5538 return nullptr;
5539 }
5540}
5541
5543{
5544 if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
5545 {
5546 return static_cast<const ClassDef*>(d);
5547 }
5548 else
5549 {
5550 return nullptr;
5551 }
5552}
5553
5555{
5556 if (d && typeid(*d)==typeid(ClassDefImpl))
5557 {
5558 return static_cast<ClassDefMutable*>(d);
5559 }
5560 else
5561 {
5562 return nullptr;
5563 }
5564}
5565
5566// --- Helpers
5567
5568/*! Get a class definition given its name.
5569 * Returns nullptr if the class is not found.
5570 */
5572{
5573 if (n.empty()) return nullptr;
5574 return Doxygen::classLinkedMap->find(n);
5575}
5576
5578{
5579 for (const auto &bcd : bcl)
5580 {
5581 const ClassDef *cd=bcd.classDef;
5582 if (cd->isVisibleInHierarchy()) return true;
5583 if (classHasVisibleRoot(cd->baseClasses())) return true;
5584 }
5585 return false;
5586}
5587
5589{
5590 BaseClassList bcl;
5591
5592 if (cd->getLanguage()==SrcLangExt::VHDL) // reverse baseClass/subClass relation
5593 {
5594 if (cd->baseClasses().empty()) return false;
5595 bcl=cd->baseClasses();
5596 }
5597 else
5598 {
5599 if (cd->subClasses().empty()) return false;
5600 bcl=cd->subClasses();
5601 }
5602
5603 for (const auto &bcd : bcl)
5604 {
5605 if (bcd.classDef->isVisibleInHierarchy())
5606 {
5607 return true;
5608 }
5609 }
5610 return false;
5611}
5612
5614{
5615 bool allExternals = Config_getBool(ALLEXTERNALS);
5616 return (allExternals && cd->isLinkable()) || cd->isLinkableInProject();
5617}
5618
5619//----------------------------------------------------------------------
5620// recursive function that returns the number of branches in the
5621// inheritance tree that the base class 'bcd' is below the class 'cd'
5622
5623int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level)
5624{
5625 const int maxInheritanceDepth = 100000;
5626 if (bcd->categoryOf()) // use class that is being extended in case of
5627 // an Objective-C category
5628 {
5629 bcd=bcd->categoryOf();
5630 }
5631 if (cd==bcd) return level;
5632 if (level==256)
5633 {
5634 warn_uncond("class {} seem to have a recursive inheritance relation!\n",cd->name());
5635 return -1;
5636 }
5637 int m=maxInheritanceDepth;
5638 for (const auto &bcdi : cd->baseClasses())
5639 {
5640 int mc=minClassDistance(bcdi.classDef,bcd,level+1);
5641 if (mc<m) m=mc;
5642 if (m<0) break;
5643 }
5644 return m;
5645}
5646
5648{
5649 if (bcd->categoryOf()) // use class that is being extended in case of
5650 // an Objective-C category
5651 {
5652 bcd=bcd->categoryOf();
5653 }
5654 if (cd==bcd)
5655 {
5656 goto exit;
5657 }
5658 if (level==256)
5659 {
5660 err("Internal inconsistency: found class {} seem to have a recursive "
5661 "inheritance relation! Please send a bug report to doxygen@gmail.com\n",cd->name());
5662 }
5663 else if (prot!=Protection::Private)
5664 {
5665 for (const auto &bcdi : cd->baseClasses())
5666 {
5667 Protection baseProt = classInheritedProtectionLevel(bcdi.classDef,bcd,bcdi.prot,level+1);
5668 if (baseProt==Protection::Private) prot=Protection::Private;
5669 else if (baseProt==Protection::Protected) prot=Protection::Protected;
5670 }
5671 }
5672exit:
5673 //printf("classInheritedProtectionLevel(%s,%s)=%d\n",qPrint(cd->name()),qPrint(bcd->name()),prot);
5674 return prot;
5675}
5676
5677
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:729
bool isFortran() const override
Returns true if this class is implemented in Fortran.
Definition classdef.cpp:695
DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const override
Definition classdef.cpp:688
void writeTagFile(TextStream &ol) const override
Definition classdef.cpp:797
int countMemberDeclarations(MemberListType lt, const ClassDef *inheritedFrom, MemberListType lt2, bool invert, bool showAlways, ClassDefSet &visitedClasses) const override
Definition classdef.cpp:768
DString displayName(bool includeScope=true) const override
Definition classdef.cpp:632
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:664
const UsesClassList & usedByImplementationClasses() const override
Definition classdef.cpp:678
bool hasDetailedDescription() const override
returns true if this class has a non-empty detailed description
Definition classdef.cpp:626
void writePageNavigation(OutputList &ol) const override
Definition classdef.cpp:793
DString title() const override
Definition classdef.cpp:739
ModuleDef * getModuleDef() const override
Returns the C++20 module in which this compound's definition can be found.
Definition classdef.cpp:658
DString getReference() const override
Definition classdef.cpp:616
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:662
void writeDocumentation(OutputList &ol) const override
Definition classdef.cpp:778
DString getMemberListFileName() const override
Definition classdef.cpp:751
const UsesClassList & usedImplementationClasses() const override
Definition classdef.cpp:676
const MemberDef * getMemberByName(const DString &s) const override
Returns the member with the given name.
Definition classdef.cpp:660
DString anchor() const override
Definition classdef.cpp:725
StringVector getQualifiers() const override
Definition classdef.cpp:761
void writeSummaryLinks(OutputList &ol) const override
Definition classdef.cpp:791
bool isVisibleInHierarchy() const override
the class is visible in a class diagram, or class hierarchy
Definition classdef.cpp:650
bool isPublished() const override
Returns true if this class is marked as published.
Definition classdef.cpp:703
const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const override
Returns a dictionary of all members.
Definition classdef.cpp:642
bool isImplicitTemplateInstance() const override
Definition classdef.cpp:775
const FileList & usedFiles() const override
Definition classdef.cpp:743
CodeSymbolType codeSymbolType() const override
Definition classdef.cpp:608
bool isFinal() const override
Returns true if this class is marked as final.
Definition classdef.cpp:699
void addGroupedInheritedMembers(OutputList &ol, MemberListType lt, const ClassDef *inheritedFrom, const DString &inheritId) const override
Definition classdef.cpp:805
const ClassDef * taglessParent() const override
Definition classdef.cpp:731
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:799
const ExampleList & getExamples() const override
Definition classdef.cpp:747
DString getSourceFileBase() const override
Definition classdef.cpp:614
void moveTo(Definition *) override
Definition classdef.cpp:606
bool isReference() const override
Definition classdef.cpp:618
bool isTemplateArgument() const override
Definition classdef.cpp:682
void updateSubClasses(const BaseClassList &) override
Update the list of sub classes to the one passed.
Definition classdef.cpp:810
bool isForwardDeclared() const override
Returns true if this class represents a forward declaration of a template class.
Definition classdef.cpp:707
const ArgumentList & typeConstraints() const override
Definition classdef.cpp:745
std::unique_ptr< ClassDef > deepCopy(const DString &name) const override
Definition classdef.cpp:603
const IncludeInfo * includeInfo() const override
Definition classdef.cpp:674
DString getOutputFileBase() const override
Definition classdef.cpp:610
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:666
void writeMemberPages(OutputList &ol) const override
Definition classdef.cpp:782
DString getInstanceOutputFileBase() const override
Definition classdef.cpp:612
DString requiresClause() const override
Definition classdef.cpp:759
ClassDefAliasImpl(const Definition *newScope, const ClassDef *cd)
Definition classdef.cpp:595
void writeQuickMemberLinks(OutputList &ol, const MemberDef *md) const override
Definition classdef.cpp:789
void updateBaseClasses(const BaseClassList &) override
Update the list of base classes to the one passed.
Definition classdef.cpp:809
bool containsOverload(const MemberDef *md) const override
Definition classdef.cpp:763
bool subGrouping() const override
Definition classdef.cpp:753
const ArgumentList & templateArguments() const override
Returns the template arguments of this class.
Definition classdef.cpp:654
Protection protection() const override
Return the protection level (Public,Protected,Private) in which this compound was found.
Definition classdef.cpp:644
bool isCSharp() const override
Returns true if this class is implemented in C#.
Definition classdef.cpp:697
const MemberGroupList & getMemberGroups() const override
Returns the member groups defined for this class.
Definition classdef.cpp:719
bool isEmbeddedInOuterScope() const override
Definition classdef.cpp:727
DString compoundTypeString() const override
Returns the type of compound as a string.
Definition classdef.cpp:636
int countMembersIncludingGrouped(MemberListType lt, const ClassDef *inheritedFrom, bool additional) const override
Definition classdef.cpp:766
bool isSealed() const override
Returns true if this class is marked as sealed.
Definition classdef.cpp:701
bool hasDocumentation() const override
Definition classdef.cpp:624
FileDef * getFileDef() const override
Returns the file in which this compound's definition can be found.
Definition classdef.cpp:656
ArgumentLists getTemplateParameterLists() const override
Returns the template parameter lists that form the template declaration of this class.
Definition classdef.cpp:686
bool hasNonReferenceSuperClass() const override
Definition classdef.cpp:757
void writeDeclarationLink(OutputList &ol, bool &found, const DString &header, bool localNames) const override
Definition classdef.cpp:772
DString className() const override
Returns the name of the class including outer classes, but not including namespaces.
Definition classdef.cpp:713
void writeInlineDocumentation(OutputList &ol) const override
Definition classdef.cpp:795
const BaseClassList & subClasses() const override
Returns the list of sub classes that directly derive from this class.
Definition classdef.cpp:640
DString generatedFromFiles() const override
Definition classdef.cpp:741
bool isJavaEnum() const override
Definition classdef.cpp:737
~ClassDefAliasImpl() override
Definition classdef.cpp:597
const TemplateInstanceList & getTemplateInstances() const override
Returns a sorted dictionary with all template instances found for this template class.
Definition classdef.cpp:668
bool isLinkableInProject() const override
Definition classdef.cpp:646
bool isLocal() const override
Returns true if this is a local class definition, see EXTRACT_LOCAL_CLASSES.
Definition classdef.cpp:620
void writeDocumentationForInnerClasses(OutputList &ol) const override
Definition classdef.cpp:780
const MemberLists & getMemberLists() const override
Returns the list containing the list of members sorted per type.
Definition classdef.cpp:717
MemberList * getMemberList(MemberListType lt) const override
Returns the members in the list identified by lt.
Definition classdef.cpp:715
ClassDef * categoryOf() const override
Returns the class of which this is a category (Objective-C only).
Definition classdef.cpp:711
void writeDeclaration(OutputList &ol, bool inGroup, int indentLevel, const ClassDef *inheritedFrom, const DString &inheritId) const override
Definition classdef.cpp:786
const ClassDef * getCdAlias() const
Definition classdef.cpp:602
CompoundType compoundType() const override
Returns the type of compound this is, i.e. class/struct/union/...
Definition classdef.cpp:634
const TemplateNameMap & getTemplateBaseClassNames() const override
Definition classdef.cpp:721
DefType definitionType() const override
Definition classdef.cpp:600
bool isLinkable() const override
Definition classdef.cpp:648
const BaseClassList & baseClasses() const override
Returns the list of base classes from which this class directly inherits.
Definition classdef.cpp:638
DString collaborationGraphFileName() const override
returns the file name to use for the collaboration graph
Definition classdef.cpp:628
bool isExtension() const override
Returns true if this class represents an Objective-C 2.0 extension (nameless category).
Definition classdef.cpp:705
ClassLinkedRefMap getClasses() const override
returns the classes nested into this class
Definition classdef.cpp:622
const ConstraintClassList & templateTypeConstraints() const override
Definition classdef.cpp:680
bool isInterface() const override
Returns true if this class represents an interface.
Definition classdef.cpp:709
const Definition * findInnerCompound(const DString &name) const override
Definition classdef.cpp:684
bool isAbstract() const override
Returns true if there is at least one pure virtual member in this class.
Definition classdef.cpp:691
bool hasExamples() const override
Definition classdef.cpp:749
bool visibleInParentsDeclList() const override
show this class in the declaration section of its parent?
Definition classdef.cpp:652
const ClassDef * templateMaster() const override
Returns the template master of which this class is an instance.
Definition classdef.cpp:670
bool isTemplate() const override
Returns true if this class is a template.
Definition classdef.cpp:672
bool isSliceLocal() const override
Definition classdef.cpp:755
bool isUsedOnly() const override
Definition classdef.cpp:723
DString inheritanceGraphFileName() const override
returns the file name to use for the inheritance graph
Definition classdef.cpp:630
bool hasNamedVariable() const override
Definition classdef.cpp:733
const MemberDef * isSmartPointer() const override
Definition classdef.cpp:735
bool isObjectiveC() const override
Returns true if this class is implemented in Objective-C.
Definition classdef.cpp:693
void writeMemberList(OutputList &ol) const override
Definition classdef.cpp:784
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 void writeDeclaration(OutputList &ol, bool inGroup, int indentLevel, const ClassDef *inheritedFrom, const DString &inheritId) const =0
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 hasNamedVariable() 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 const ClassDef * taglessParent() 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 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:507
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:476
void writePageNavigation(OutputList &ol) const override
DString getMemberListFileName() const override
void setHasNamedVariable(bool b) 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:551
ExampleList m_examples
Definition classdef.cpp:482
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:557
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:525
TypeSpecifier m_spec
Definition classdef.cpp:565
DString m_fileName
Definition classdef.cpp:433
ClassDef * m_categoryOf
Definition classdef.cpp:520
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
void setAnonymousEnumType() override
Protection m_prot
Definition classdef.cpp:491
bool isLinkableInProject() const override
void addUsedInterfaceClasses(MemberDef *md, const DString &typeStr)
BaseClassList m_inheritedBy
Definition classdef.cpp:456
void getTitleForMemberListType(MemberListType type, DString &title, DString &subtitle) const
FileList m_files
Definition classdef.cpp:479
const TemplateInstanceList & getTemplateInstances() const override
Returns a sorted dictionary with all template instances found for this template class.
MemberLists m_memberLists
Definition classdef.cpp:522
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
const ExampleList & getExamples() const override
UsesClassList m_usesImplClassList
Definition classdef.cpp:499
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:512
void writeTagFile(TextStream &) const override
void endMemberDeclarations(OutputList &ol) const
bool m_membersMerged
Definition classdef.cpp:534
const MemberGroupList & getMemberGroups() const override
Returns the member groups defined for this class.
void sortMemberLists() override
const FileList & usedFiles() const override
bool m_hasNamedVariable
Definition classdef.cpp:560
void writeDeclaration(OutputList &ol, bool inGroup, int indentLevel, const ClassDef *inheritedFrom, const DString &inheritId) 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:888
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:509
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:825
std::unique_ptr< IncludeInfo > m_incInfo
Definition classdef.cpp:447
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:563
bool isFortran() const override
Returns true if this class is implemented in Fortran.
BaseClassList m_inherits
Definition classdef.cpp:452
void writeMemberPages(OutputList &ol) const override
MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap
Definition classdef.cpp:470
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:567
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:467
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:442
bool m_isSimple
Is this a simple (non-nested) C structure?
Definition classdef.cpp:554
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:575
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
const ClassDef * taglessParent() const override
void mergeMembersFromBaseClasses(bool mergeVirtualBaseClass)
DString m_memberListFileName
Definition classdef.cpp:436
const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const override
Returns a dictionary of all members.
bool m_isAbstract
Definition classdef.cpp:528
StringVector m_qualifiers
Definition classdef.cpp:572
ClassDef * insertTemplateInstance(const DString &fileName, int startLine, size_t startColumn, const DString &templSpec, bool &freshInstance) override
DString m_className
Definition classdef.cpp:515
ArgumentList m_primaryConstructorParams
Definition classdef.cpp:579
FileDef * m_fileDef
Definition classdef.cpp:464
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:485
bool m_hasCollaborationGraph
Definition classdef.cpp:574
const ClassDef * m_taglessParent
Definition classdef.cpp:559
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:496
UsesClassList m_usedByImplClassList
Definition classdef.cpp:500
bool isSliceLocal() const override
DString anchor() const override
ConstraintClassList m_constraintClassList
Definition classdef.cpp:502
void setIsStatic(bool b) override
int countInheritedByNodes() const
void setFileDef(FileDef *fd) override
void setTaglessParent(const ClassDef *cd) override
bool hasNamedVariable() const override
void addUsedByClass(ClassDef *cd, const DString &accessName, Protection prot) override
bool m_isTemplArg
Definition classdef.cpp:539
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:548
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:570
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:577
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:473
void internalInsertMember(MemberDef *md, Protection prot, bool addToAllList)
void startMemberDeclarations(OutputList &ol) const
bool m_subGrouping
Definition classdef.cpp:545
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:439
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:1439
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 const MemberDef * anonymousMemberForDeclaration() 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 MemberDef * anonymousMemberForDetails() 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:813
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:582
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:2033
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:136
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:1795
MemberListType type
Definition layout.h:117
DString title(SrcLangExt lang) const
Definition layout.cpp:1790
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:1802
Definition layout.h:101
DString title(SrcLangExt lang) const
Definition layout.cpp:1783
This file contains a number of basic enums and types.
CodeSymbolType
Definition types.h:481
MemberType
Definition types.h:569
bool isTypeAClassFriend(const DString &type)
Definition types.h:920
Protection
Definition types.h:32
SrcLangExt
Definition types.h:207
Specifier
Definition types.h:80
DString stripExtension(const DString &fName)
Definition util.cpp:3956
bool protectionLevelVisible(Protection prot)
Definition util.cpp:4672
void writeTypeConstraints(OutputList &ol, const Definition *d, const ArgumentList &al)
Definition util.cpp:4284
DString convertToId(const DString &s)
Definition util.cpp:3203
DString insertTemplateSpecifierInScope(const DString &scope, const DString &templ)
Definition util.cpp:3077
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:426
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2864
DString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
Definition util.cpp:903
void addGroupListToTitle(OutputList &ol, const Definition *d)
Definition util.cpp:3922
DString stripScope(const DString &name)
Definition util.cpp:3110
void createSubDirs(const Dir &d)
Definition util.cpp:2970
DString convertToHtml(const DString &s, bool keepEntities)
Definition util.cpp:3292
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4169
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:3932
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
Definition util.cpp:3233
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:4905
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition util.cpp:4630
DString demangleCSharpGenericName(const DString &name, const DString &templArgs)
Definition util.cpp:5344
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.