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 <memory>
20 #include <unordered_set>
21 
22 #include "definition.h"
23 #include "filedef.h"
24 #include "linkedmap.h"
25 #include "membergroup.h"
26 
27 class MemberList;
28 class ClassDef;
29 class ConceptDef;
30 class OutputList;
31 class ClassLinkedRefMap;
33 class MemberDef;
34 class NamespaceDef;
36 
37 // --- Set of namespaces
38 
39 using NamespaceDefSet = std::unordered_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  ABSTRACT_BASE_CLASS(NamespaceDef)
58 
59  // ---- getters
60  virtual int numDocMembers() const = 0;
61  virtual const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const = 0;
62  virtual const LinkedRefMap<ClassDef> &getUsedClasses() const = 0;
63  virtual bool isConstantGroup() const = 0;
64  virtual bool isModule() const = 0;
65  virtual bool isLibrary() const = 0;
66  virtual bool isInline() const = 0;
67  virtual bool isVisibleInHierarchy() const = 0;
68  virtual bool hasDetailedDescription() const = 0;
69  virtual bool subGrouping() const = 0;
70  virtual MemberList *getMemberList(MemberListType lt) const = 0;
71  virtual const MemberLists &getMemberLists() const = 0;
72  virtual const MemberDef *getMemberByName(const QCString &) const = 0;
73  virtual int countVisibleMembers() const = 0;
74 
76  virtual const MemberGroupList &getMemberGroups() const = 0;
77 
79  virtual ClassLinkedRefMap getClasses() const = 0;
80 
82  virtual ClassLinkedRefMap getInterfaces() const = 0;
83 
85  virtual ClassLinkedRefMap getStructs() const = 0;
86 
88  virtual ClassLinkedRefMap getExceptions() const = 0;
89 
91  virtual NamespaceLinkedRefMap getNamespaces() const = 0;
92 
94  virtual ConceptLinkedRefMap getConcepts() const = 0;
95 
96  virtual QCString title() const = 0;
97  virtual QCString compoundTypeString() const = 0;
98 };
99 
101 {
102  public:
103  ABSTRACT_BASE_CLASS(NamespaceDefMutable)
104 
105  // --- setters/actions
106  virtual void setMetaData(const QCString &m) = 0;
107  virtual void insertUsedFile(FileDef *fd) = 0;
108  virtual void writeDocumentation(OutputList &ol) = 0;
109  virtual void writeMemberPages(OutputList &ol) = 0;
110  virtual void writeTagFile(TextStream &) = 0;
111  virtual void insertClass(ClassDef *cd) = 0;
112  virtual void insertConcept(ConceptDef *cd) = 0;
113  virtual void insertNamespace(NamespaceDef *nd) = 0;
114  virtual void insertMember(MemberDef *md) = 0;
115  virtual void computeAnchors() = 0;
116  virtual void countMembers() = 0;
117  virtual void addMembersToMemberGroup() = 0;
118  virtual void distributeMemberGroupDocumentation() = 0;
119  virtual void findSectionsInDocumentation() = 0;
120  virtual void sortMemberLists() = 0;
121  virtual void addListReferences() = 0;
122  virtual void setFileName(const QCString &fn) = 0;
123  virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace) = 0;
124  virtual void addUsingDirective(NamespaceDef *nd) = 0;
125  virtual void addUsingDeclaration(ClassDef *cd) = 0;
126  virtual void setInline(bool isInline) = 0;
127 };
128 
130 std::unique_ptr<NamespaceDef> createNamespaceDef(const QCString &defFileName,int defLine,int defColumn,
131  const QCString &name,const QCString &ref=QCString(),
132  const QCString &refFile=QCString(),const QCString &type=QCString(),
133  bool isPublished=false);
134 
136 std::unique_ptr<NamespaceDef> createNamespaceDefAlias(const Definition *newScope,const NamespaceDef *nd);
137 
138 
139 // --- Cast functions
140 
141 NamespaceDef *toNamespaceDef(Definition *d);
142 NamespaceDef *toNamespaceDef(DefinitionMutable *d);
143 const NamespaceDef *toNamespaceDef(const Definition *d);
144 NamespaceDefMutable *toNamespaceDefMutable(Definition *d);
145 
146 // --- Helpers
147 
148 NamespaceDef *getResolvedNamespace(const QCString &key);
149 inline NamespaceDefMutable *getResolvedNamespaceMutable(const QCString &key)
150 {
151  return toNamespaceDefMutable(getResolvedNamespace(key));
152 }
153 bool namespaceHasNestedNamespace(const NamespaceDef *nd);
154 bool namespaceHasNestedConcept(const NamespaceDef *nd);
155 bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct);
156 
157 //------------------------------------------------------------------------
158 
159 #endif
The common base class of all entity definitions found in the sources.
Definition: definition.h:75
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
A model of a class/file/namespace member symbol.
Definition: memberdef.h:47
Definition: namespacedef.h:41
Text streaming class that buffers data.
Definition: textstream.h:35
A model of a file symbol.
Definition: filedef.h:98
Definition: conceptdef.h:73
Definition: namespacedef.h:45
Definition: namespacedef.h:100
Definition: membergroup.h:109
Definition: memberlist.h:165
Definition: definition.h:305
Definition: conceptdef.h:26
A list of MemberDef objects as shown in documentation sections.
Definition: memberlist.h:107
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:530
CompoundType
The various compound types.
Definition: classdef.h:109
This is an alternative implementation of QCString.
Definition: qcstring.h:93
Definition: classlist.h:30
A abstract class representing of a compound symbol.
Definition: classdef.h:103