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 
53 /** An abstract interface of a namespace symbol. */
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;
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 
81  /*! Returns the user defined member groups */
82  virtual const MemberGroupList &getMemberGroups() const = 0;
83 
84  /*! Returns the classes contained in this namespace */
85  virtual ClassLinkedRefMap getClasses() const = 0;
86 
87  /*! Returns the Slice interfaces contained in this namespace */
88  virtual ClassLinkedRefMap getInterfaces() const = 0;
89 
90  /*! Returns the Slice structs contained in this namespace */
91  virtual ClassLinkedRefMap getStructs() const = 0;
92 
93  /*! Returns the Slice exceptions contained in this namespace */
94  virtual ClassLinkedRefMap getExceptions() const = 0;
95 
96  /*! Returns the namespaces contained in this namespace */
97  virtual NamespaceLinkedRefMap getNamespaces() const = 0;
98 
99  /*! Returns the concepts contained in this namespace */
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 
136 /** Factory method to create new NamespaceDef instance */
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 
142 /** Factory method to create an alias of an existing namespace. Used for inline namespaces. */
143 NamespaceDef *createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd);
144 
145 
146 // --- Cast functions
147 
150 const NamespaceDef *toNamespaceDef(const Definition *d);
153 
154 // --- Helpers
155 
158 {
160 }
163 bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct);
164 
165 //------------------------------------------------------------------------
166 
167 #endif
NamespaceDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
NamespaceDef::definitionType
virtual DefType definitionType() const =0
LinkedRefMap
Container class representing a vector of objects with keys.
Definition: linkedmap.h:231
NamespaceDef::getUsedNamespaces
virtual LinkedRefMap< const NamespaceDef > getUsedNamespaces() const =0
ConceptDef
Definition: conceptdef.h:22
NamespaceDef::isConstantGroup
virtual bool isConstantGroup() const =0
membergroup.h
MemberListType
MemberListType
Definition: types.h:100
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
NamespaceDefMutable::insertClass
virtual void insertClass(const ClassDef *cd)=0
NamespaceDef::localName
virtual QCString localName() const =0
NamespaceDef
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
NamespaceDefMutable::writeDocumentation
virtual void writeDocumentation(OutputList &ol)=0
NamespaceDefMutable::setInline
virtual void setInline(bool isInline)=0
NamespaceDef::getExceptions
virtual ClassLinkedRefMap getExceptions() const =0
NamespaceDef::getMemberLists
virtual const MemberLists & getMemberLists() const =0
NamespaceDefMutable::addUsingDeclaration
virtual void addUsingDeclaration(const ClassDef *cd)=0
ClassDef::CompoundType
CompoundType
The various compound types
Definition: classdef.h:107
getResolvedNamespace
NamespaceDef * getResolvedNamespace(const QCString &key)
Definition: namespacedef.cpp:1606
NamespaceDef::title
virtual QCString title() const =0
NamespaceDef::getInterfaces
virtual ClassLinkedRefMap getInterfaces() const =0
NamespaceDef::isInline
virtual bool isInline() const =0
NamespaceDef::anchor
virtual QCString anchor() const =0
namespaceHasNestedConcept
bool namespaceHasNestedConcept(const NamespaceDef *nd)
Definition: namespacedef.cpp:1646
MemberLists
Definition: memberlist.h:138
TextStream
Text streaming class that buffers data.
Definition: textstream.h:33
NamespaceDef::getMemberByName
virtual const MemberDef * getMemberByName(const QCString &) const =0
NamespaceDef::getMemberGroups
virtual const MemberGroupList & getMemberGroups() const =0
linkedmap.h
NamespaceLinkedRefMap
Definition: namespacedef.h:45
NamespaceDefMutable::writeTagFile
virtual void writeTagFile(TextStream &)=0
NamespaceDefMutable::computeAnchors
virtual void computeAnchors()=0
NamespaceDefMutable::combineUsingRelations
virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace)=0
NamespaceDef::isLinkableInProject
virtual bool isLinkableInProject() const =0
OutputList
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:37
NamespaceDef::getUsedClasses
virtual LinkedRefMap< const ClassDef > getUsedClasses() const =0
NamespaceDef::subGrouping
virtual bool subGrouping() const =0
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
NamespaceDef::hasDetailedDescription
virtual bool hasDetailedDescription() const =0
toNamespaceDefMutable
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)
Definition: namespacedef.cpp:1579
NamespaceDefMutable::distributeMemberGroupDocumentation
virtual void distributeMemberGroupDocumentation()=0
ClassDef
A abstract class representing of a compound symbol.
Definition: classdef.h:103
NamespaceDef::isModule
virtual bool isModule() const =0
DefinitionMutable
Definition: definition.h:308
NamespaceDef::getClasses
virtual ClassLinkedRefMap getClasses() const =0
NamespaceDef::displayName
virtual QCString displayName(bool=TRUE) const =0
NamespaceDefMutable::insertConcept
virtual void insertConcept(const ConceptDef *cd)=0
Definition::name
virtual QCString name() const =0
NamespaceDef::~NamespaceDef
virtual ~NamespaceDef()
Definition: namespacedef.h:57
NamespaceDefMutable::addMembersToMemberGroup
virtual void addMembersToMemberGroup()=0
NamespaceDefMutable::sortMemberLists
virtual void sortMemberLists()=0
NamespaceDef::findInnerCompound
virtual const Definition * findInnerCompound(const QCString &name) const =0
NamespaceDef::getMemberList
virtual MemberList * getMemberList(MemberListType lt) const =0
TRUE
#define TRUE
Definition: qcstring.h:36
createNamespaceDef
NamespaceDefMutable * createNamespaceDef(const QCString &defFileName, int defLine, int defColumn, const QCString &name, const QCString &ref=QCString(), const QCString &refFile=QCString(), const QCString &type=QCString(), bool isPublished=false)
Factory method to create new NamespaceDef instance
Definition: namespacedef.cpp:163
filedef.h
NamespaceDefMutable::insertUsedFile
virtual void insertUsedFile(FileDef *fd)=0
namespaceHasNestedClass
bool namespaceHasNestedClass(const NamespaceDef *nd, bool filterClasses, ClassDef::CompoundType ct)
Definition: namespacedef.cpp:1666
Definition::DefType
DefType
Definition: definition.h:85
NamespaceDef::getNamespaces
virtual NamespaceLinkedRefMap getNamespaces() const =0
NamespaceDefMutable::setMetaData
virtual void setMetaData(const QCString &m)=0
NamespaceDefMutable::countMembers
virtual void countMembers()=0
NamespaceDefMutable::addListReferences
virtual void addListReferences()=0
NamespaceDefMutable::addInnerCompound
virtual void addInnerCompound(const Definition *d)=0
NamespaceDef::getConcepts
virtual ConceptLinkedRefMap getConcepts() const =0
NamespaceDef::isLinkable
virtual bool isLinkable() const =0
NamespaceDefMutable::findSectionsInDocumentation
virtual void findSectionsInDocumentation()=0
definition.h
MemberGroupList
Definition: membergroup.h:109
NamespaceLinkedRefMap::declVisible
bool declVisible(bool isContantGroup) const
Definition: namespacedef.cpp:1284
toNamespaceDef
NamespaceDef * toNamespaceDef(Definition *d)
Definition: namespacedef.cpp:1541
ConceptLinkedRefMap
Definition: conceptdef.h:67
NamespaceDefMutable::writeQuickMemberLinks
virtual void writeQuickMemberLinks(OutputList &ol, const MemberDef *currentMd) const =0
NamespaceDef::compoundTypeString
virtual QCString compoundTypeString() const =0
NamespaceDef::numDocMembers
virtual int numDocMembers() const =0
NamespaceDefMutable
Definition: namespacedef.h:106
FileDef
A model of a file symbol.
Definition: filedef.h:73
LinkedMap
Container class representing a vector of objects with keys.
Definition: linkedmap.h:35
NamespaceDefMutable::writeMemberPages
virtual void writeMemberPages(OutputList &ol)=0
NamespaceDefMutable::insertNamespace
virtual void insertNamespace(const NamespaceDef *nd)=0
NamespaceDef::getStructs
virtual ClassLinkedRefMap getStructs() const =0
createNamespaceDefAlias
NamespaceDef * createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd)
Factory method to create an alias of an existing namespace.
Definition: namespacedef.cpp:244
NamespaceDefMutable::addUsingDirective
virtual void addUsingDirective(const NamespaceDef *nd)=0
NamespaceLinkedRefMap::writeDeclaration
void writeDeclaration(OutputList &ol, const QCString &title, bool isConstantGroup=false, bool localName=FALSE)
Definition: namespacedef.cpp:1314
NamespaceDefSet
std::set< const NamespaceDef * > NamespaceDefSet
Definition: namespacedef.h:39
MemberList
A list of MemberDef objects as shown in documentation sections.
Definition: memberlist.h:81
namespaceHasNestedNamespace
bool namespaceHasNestedNamespace(const NamespaceDef *nd)
Definition: namespacedef.cpp:1634
ClassLinkedRefMap
Definition: classlist.h:30
NamespaceDef::isLibrary
virtual bool isLibrary() const =0
NamespaceDefMutable::setFileName
virtual void setFileName(const QCString &fn)=0
NamespaceLinkedMap
Definition: namespacedef.h:41
getResolvedNamespaceMutable
NamespaceDefMutable * getResolvedNamespaceMutable(const QCString &key)
Definition: namespacedef.h:157
NamespaceDefMutable::insertMember
virtual void insertMember(MemberDef *md)=0
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108