1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/******************************************************************************
*
* Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef NAMESPACEDEF_H
#define NAMESPACEDEF_H
#include <set>
#include <qstrlist.h>
#include <qdict.h>
#include "sortdict.h"
#include "definition.h"
#include "filedef.h"
#include "linkedmap.h"
class MemberList;
class ClassDef;
class OutputList;
class ClassLinkedRefMap;
class MemberDef;
class MemberGroupSDict;
class NamespaceSDict;
class FTextStream;
class NamespaceDef;
class NamespaceDefMutable;
// --- Set of namespaces
using NamespaceDefSet = std::set<const NamespaceDef*>;
/** An abstract interface of a namespace symbol. */
class NamespaceDef : public Definition
{
public:
virtual ~NamespaceDef() {}
virtual DefType definitionType() const = 0;
// ---- getters
virtual QCString getOutputFileBase() const = 0;
virtual QCString anchor() const = 0;
virtual int numDocMembers() const = 0;
virtual LinkedRefMap<const NamespaceDef> getUsedNamespaces() const = 0;
virtual LinkedRefMap<const ClassDef> getUsedClasses() const = 0;
virtual QCString displayName(bool=TRUE) const = 0;
virtual QCString localName() const = 0;
virtual bool isConstantGroup() const = 0;
virtual bool isModule() const = 0;
virtual bool isLibrary() const = 0;
virtual bool isInline() const = 0;
virtual bool isLinkableInProject() const = 0;
virtual bool isLinkable() const = 0;
virtual bool hasDetailedDescription() const = 0;
virtual const Definition *findInnerCompound(const char *name) const = 0;
virtual bool subGrouping() const = 0;
virtual MemberList *getMemberList(MemberListType lt) const = 0;
virtual const QList<MemberList> &getMemberLists() const = 0;
virtual MemberDef *getMemberByName(const QCString &) const = 0;
/*! Returns the user defined member groups */
virtual MemberGroupSDict *getMemberGroupSDict() const = 0;
/*! Returns the classes contained in this namespace */
virtual ClassLinkedRefMap getClasses() const = 0;
/*! Returns the Slice interfaces contained in this namespace */
virtual ClassLinkedRefMap getInterfaces() const = 0;
/*! Returns the Slice structs contained in this namespace */
virtual ClassLinkedRefMap getStructs() const = 0;
/*! Returns the Slice exceptions contained in this namespace */
virtual ClassLinkedRefMap getExceptions() const = 0;
/*! Returns the namespaces contained in this namespace */
virtual const NamespaceSDict *getNamespaceSDict() const = 0;
virtual QCString title() const = 0;
virtual QCString compoundTypeString() const = 0;
};
class NamespaceDefMutable : public DefinitionMutable, public NamespaceDef
{
public:
// --- setters/actions
virtual void setMetaData(const QCString &m) = 0;
virtual void insertUsedFile(FileDef *fd) = 0;
virtual void writeDocumentation(OutputList &ol) = 0;
virtual void writeMemberPages(OutputList &ol) = 0;
virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0;
virtual void writeTagFile(FTextStream &) = 0;
virtual void insertClass(const ClassDef *cd) = 0;
virtual void insertNamespace(const NamespaceDef *nd) = 0;
virtual void insertMember(MemberDef *md) = 0; // md cannot be const, since setSectionList is called on it
virtual void computeAnchors() = 0;
virtual void countMembers() = 0;
virtual void addMembersToMemberGroup() = 0;
virtual void distributeMemberGroupDocumentation() = 0;
virtual void findSectionsInDocumentation() = 0;
virtual void sortMemberLists() = 0;
virtual void addInnerCompound(const Definition *d) = 0;
virtual void addListReferences() = 0;
virtual void setFileName(const QCString &fn) = 0;
virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace) = 0;
virtual void addUsingDirective(const NamespaceDef *nd) = 0;
virtual void addUsingDeclaration(const ClassDef *cd) = 0;
virtual void setInline(bool isInline) = 0;
};
/** Factory method to create new NamespaceDef instance */
NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn,
const char *name,const char *ref=0,
const char *refFile=0,const char*type=0,
bool isPublished=false);
/** Factory method to create an alias of an existing namespace. Used for inline namespaces. */
NamespaceDef *createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd);
// --- Cast functions
NamespaceDef *toNamespaceDef(Definition *d);
NamespaceDef *toNamespaceDef(DefinitionMutable *d);
const NamespaceDef *toNamespaceDef(const Definition *d);
NamespaceDefMutable *toNamespaceDefMutable(Definition *d);
NamespaceDefMutable *toNamespaceDefMutable(const Definition *d);
//------------------------------------------------------------------------
/** A list of NamespaceDef objects. */
class NamespaceList : public QList<NamespaceDef>
{
public:
~NamespaceList() {}
int compareValues(const NamespaceDef *nd1,const NamespaceDef *nd2) const
{
return qstricmp(nd1->name(), nd2->name());
}
};
/** An iterator for NamespaceDef objects in a NamespaceList. */
class NamespaceListIterator : public QListIterator<NamespaceDef>
{
public:
NamespaceListIterator(const NamespaceList &l) :
QListIterator<NamespaceDef>(l) {}
};
/** An unsorted dictionary of NamespaceDef objects. */
class NamespaceDict : public QDict<NamespaceDef>
{
public:
NamespaceDict(uint size) : QDict<NamespaceDef>(size) {}
~NamespaceDict() {}
};
/** A sorted dictionary of NamespaceDef objects. */
class NamespaceSDict : public SDict<NamespaceDef>
{
public:
NamespaceSDict(uint size=17) : SDict<NamespaceDef>(size) {}
~NamespaceSDict() {}
void writeDeclaration(OutputList &ol,const char *title,
bool isConstantGroup=false, bool localName=FALSE);
bool declVisible() const;
private:
int compareValues(const NamespaceDef *item1,const NamespaceDef *item2) const
{
return qstricmp(item1->name(),item2->name());
}
};
#endif
|