doxygen
namespacedef.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2020 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 #ifndef NAMESPACEDEF_H
17 #define NAMESPACEDEF_H
18 
19 #include <set>
20 
21 #include "definition.h"
22 #include "filedef.h"
23 #include "linkedmap.h"
24 #include "membergroup.h"
25 
26 class MemberList;
27 class ClassDef;
28 class ConceptDef;
29 class OutputList;
30 class ClassLinkedRefMap;
32 class MemberDef;
33 class NamespaceDef;
34 class NamespaceDef;
36 
37 // --- Set of namespaces
38 
39 using NamespaceDefSet = std::set<const NamespaceDef*>;
40 
41 class NamespaceLinkedMap : public LinkedMap<NamespaceDef>
42 {
43 };
44 
45 class NamespaceLinkedRefMap : public LinkedRefMap<const NamespaceDef>
46 {
47  public:
48  void writeDeclaration(OutputList &ol,const QCString &title,
49  bool isConstantGroup=false, bool localName=FALSE);
50  bool declVisible(bool isContantGroup) const;
51 };
52 
54 class NamespaceDef : public Definition
55 {
56  public:
57  virtual ~NamespaceDef() {}
58  virtual DefType definitionType() const = 0;
59 
60  // ---- getters
61  virtual QCString getOutputFileBase() const = 0;
62  virtual QCString anchor() const = 0;
63  virtual int numDocMembers() const = 0;
64  virtual LinkedRefMap<const NamespaceDef> getUsedNamespaces() const = 0;
65  virtual LinkedRefMap<const ClassDef> getUsedClasses() const = 0;
66  virtual QCString displayName(bool=TRUE) const = 0;
67  virtual QCString localName() const = 0;
68  virtual bool isConstantGroup() const = 0;
69  virtual bool isModule() const = 0;
70  virtual bool isLibrary() const = 0;
71  virtual bool isInline() const = 0;
72  virtual bool isLinkableInProject() const = 0;
73  virtual bool isLinkable() const = 0;
74  virtual bool hasDetailedDescription() const = 0;
75  virtual const Definition *findInnerCompound(const QCString &name) const = 0;
76  virtual bool subGrouping() const = 0;
77  virtual MemberList *getMemberList(MemberListType lt) const = 0;
78  virtual const MemberLists &getMemberLists() const = 0;
79  virtual const MemberDef *getMemberByName(const QCString &) const = 0;
80 
82  virtual const MemberGroupList &getMemberGroups() const = 0;
83 
85  virtual ClassLinkedRefMap getClasses() const = 0;
86 
88  virtual ClassLinkedRefMap getInterfaces() const = 0;
89 
91  virtual ClassLinkedRefMap getStructs() const = 0;
92 
94  virtual ClassLinkedRefMap getExceptions() const = 0;
95 
97  virtual NamespaceLinkedRefMap getNamespaces() const = 0;
98 
100  virtual ConceptLinkedRefMap getConcepts() const = 0;
101 
102  virtual QCString title() const = 0;
103  virtual QCString compoundTypeString() const = 0;
104 };
105 
107 {
108  public:
109 
110  // --- setters/actions
111  virtual void setMetaData(const QCString &m) = 0;
112  virtual void insertUsedFile(FileDef *fd) = 0;
113  virtual void writeDocumentation(OutputList &ol) = 0;
114  virtual void writeMemberPages(OutputList &ol) = 0;
115  virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0;
116  virtual void writeTagFile(TextStream &) = 0;
117  virtual void insertClass(const ClassDef *cd) = 0;
118  virtual void insertConcept(const ConceptDef *cd) = 0;
119  virtual void insertNamespace(const NamespaceDef *nd) = 0;
120  virtual void insertMember(MemberDef *md) = 0; // md cannot be const, since setSectionList is called on it
121  virtual void computeAnchors() = 0;
122  virtual void countMembers() = 0;
123  virtual void addMembersToMemberGroup() = 0;
124  virtual void distributeMemberGroupDocumentation() = 0;
125  virtual void findSectionsInDocumentation() = 0;
126  virtual void sortMemberLists() = 0;
127  virtual void addInnerCompound(const Definition *d) = 0;
128  virtual void addListReferences() = 0;
129  virtual void setFileName(const QCString &fn) = 0;
130  virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace) = 0;
131  virtual void addUsingDirective(const NamespaceDef *nd) = 0;
132  virtual void addUsingDeclaration(const ClassDef *cd) = 0;
133  virtual void setInline(bool isInline) = 0;
134 };
135 
137 NamespaceDefMutable *createNamespaceDef(const QCString &defFileName,int defLine,int defColumn,
138  const QCString &name,const QCString &ref=QCString(),
139  const QCString &refFile=QCString(),const QCString &type=QCString(),
140  bool isPublished=false);
141 
143 NamespaceDef *createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd);
144 
145 
146 // --- Cast functions
147 
148 NamespaceDef *toNamespaceDef(Definition *d);
149 NamespaceDef *toNamespaceDef(DefinitionMutable *d);
150 const NamespaceDef *toNamespaceDef(const Definition *d);
151 NamespaceDefMutable *toNamespaceDefMutable(Definition *d);
152 NamespaceDefMutable *toNamespaceDefMutable(const Definition *d);
153 
154 // --- Helpers
155 
156 NamespaceDef *getResolvedNamespace(const QCString &key);
157 inline NamespaceDefMutable *getResolvedNamespaceMutable(const QCString &key)
158 {
159  return toNamespaceDefMutable(getResolvedNamespace(key));
160 }
161 bool namespaceHasNestedNamespace(const NamespaceDef *nd);
162 bool namespaceHasNestedConcept(const NamespaceDef *nd);
163 bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct);
164 
165 //------------------------------------------------------------------------
166 
167 #endif
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
Definition: namespacedef.h:41
Text streaming class that buffers data.
Definition: textstream.h:33
A model of a file symbol.
Definition: filedef.h:73
Definition: conceptdef.h:67
Definition: namespacedef.h:45
Definition: namespacedef.h:106
Definition: membergroup.h:109
Definition: memberlist.h:138
Definition: definition.h:308
Definition: conceptdef.h:22
A list of MemberDef objects as shown in documentation sections.
Definition: memberlist.h:81
Container class representing a vector of objects with keys.
Definition: linkedmap.h:35
Container class representing a vector of objects with keys.
Definition: linkedmap.h:231
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:37
CompoundType
The various compound types.
Definition: classdef.h:107
DefType
Definition: definition.h:85
This is an alternative implementation of QCString.
Definition: qcstring.h:108
Definition: classlist.h:30
A abstract class representing of a compound symbol.
Definition: classdef.h:103