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