Imported Upstream version 1.8.8
[platform/upstream/doxygen.git] / src / namespacedef.h
1 /******************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 1997-2014 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby 
9  * granted. No representations are made about the suitability of this software 
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17
18 #ifndef NAMESPACEDEF_H
19 #define NAMESPACEDEF_H
20
21 #include <qstrlist.h>
22 #include <qdict.h>
23 #include "sortdict.h"
24 #include "definition.h"
25 #include "filedef.h"
26
27 class MemberList;
28 class ClassDef;
29 class ClassList;
30 class OutputList;
31 class ClassSDict;
32 class MemberDef;
33 class NamespaceList;
34 class MemberGroupSDict;
35 class NamespaceSDict;
36
37 /** A model of a namespace symbol. */
38 class NamespaceDef : public Definition
39 {
40   public:
41     NamespaceDef(const char *defFileName,int defLine,int defColumn,
42                  const char *name,const char *ref=0,
43                  const char *refFile=0,const char*type=0,
44                  bool isPublished=false);
45    ~NamespaceDef();
46     DefType definitionType() const { return TypeNamespace; }
47     QCString getOutputFileBase() const;
48     QCString anchor() const { return QCString(); }
49     void insertUsedFile(FileDef *fd);
50     
51     void writeDocumentation(OutputList &ol);
52     void writeMemberPages(OutputList &ol);
53     void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
54
55     void insertClass(ClassDef *cd);
56     void insertNamespace(NamespaceDef *nd);
57     void insertMember(MemberDef *md);
58
59     void computeAnchors();
60     int countMembers();
61     void addUsingDirective(NamespaceDef *nd);
62     NamespaceSDict *getUsedNamespaces() const;
63     void addUsingDeclaration(Definition *def);
64     SDict<Definition> *getUsedClasses() const { return usingDeclList; }
65     void combineUsingRelations();
66     QCString displayName(bool=TRUE) const;
67     QCString localName() const;
68
69     bool isConstantGroup() const { return CONSTANT_GROUP == m_type; }
70     bool isModule()        const { return MODULE == m_type; }
71     bool isLibrary() const { return LIBRARY == m_type; }
72
73     bool isLinkableInProject() const;
74     bool isLinkable() const;
75     bool hasDetailedDescription() const;
76     void addMembersToMemberGroup();
77     void distributeMemberGroupDocumentation();
78     void findSectionsInDocumentation();
79     void sortMemberLists();
80
81     virtual Definition *findInnerCompound(const char *name);
82     void addInnerCompound(Definition *d);
83     void addListReferences();
84
85     bool subGrouping() const { return m_subGrouping; }
86     
87     MemberList *getMemberList(MemberListType lt) const;
88     const QList<MemberList> &getMemberLists() const { return m_memberLists; }
89     MemberDef    *getMemberByName(const QCString &) const;
90
91     /*! Returns the user defined member groups */
92     MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
93
94     /*! Returns the classes contained in this namespace */
95     ClassSDict *getClassSDict() const { return classSDict; }
96
97     /*! Returns the namespaces contained in this namespace */
98     NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
99
100     QCString title() const;
101     QCString compoundTypeString() const;
102
103     bool visited;
104
105   private:
106     MemberList *createMemberList(MemberListType lt);
107     void addMemberToList(MemberListType lt,MemberDef *md);
108     void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
109     void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
110     void writeDetailedDescription(OutputList &ol,const QCString &title);
111     void writeBriefDescription(OutputList &ol);
112     void startMemberDeclarations(OutputList &ol);
113     void endMemberDeclarations(OutputList &ol);
114     void writeClassDeclarations(OutputList &ol,const QCString &title);
115     void writeInlineClasses(OutputList &ol);
116     void writeNamespaceDeclarations(OutputList &ol,const QCString &title,
117             bool isConstantGroup=false);
118     void writeMemberGroups(OutputList &ol);
119     void writeAuthorSection(OutputList &ol);
120     void startMemberDocumentation(OutputList &ol);
121     void endMemberDocumentation(OutputList &ol);
122     void writeSummaryLinks(OutputList &ol);
123     void addNamespaceAttributes(OutputList &ol);
124
125     QCString              fileName;
126     FileList              files;
127
128     NamespaceSDict       *usingDirList;
129     SDict<Definition>    *usingDeclList;
130     SDict<Definition>    *m_innerCompounds;
131
132     MemberSDict          *m_allMembersDict;
133     QList<MemberList>     m_memberLists;
134     MemberGroupSDict     *memberGroupSDict;
135     ClassSDict           *classSDict;
136     NamespaceSDict       *namespaceSDict;
137     bool                  m_subGrouping;
138     enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type;
139     bool m_isPublished;
140 };
141
142 /** A list of NamespaceDef objects. */
143 class NamespaceList : public QList<NamespaceDef>
144 {
145   public:
146    ~NamespaceList() {}
147     int compareValues(const NamespaceDef *nd1,const NamespaceDef *nd2) const
148     {
149       return qstricmp(nd1->name(), nd2->name());
150     }
151 };
152
153 /** An iterator for NamespaceDef objects in a NamespaceList. */
154 class NamespaceListIterator : public QListIterator<NamespaceDef>
155 {
156   public:
157     NamespaceListIterator(const NamespaceList &l) : 
158       QListIterator<NamespaceDef>(l) {}
159 };
160
161 /** An unsorted dictionary of NamespaceDef objects. */
162 class NamespaceDict : public QDict<NamespaceDef>
163 {
164   public:
165     NamespaceDict(int size) : QDict<NamespaceDef>(size) {}
166    ~NamespaceDict() {}
167 };
168
169 /** A sorted dictionary of NamespaceDef objects. */
170 class NamespaceSDict : public SDict<NamespaceDef>
171 {
172   public:
173     NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {}
174    ~NamespaceSDict() {}
175     void writeDeclaration(OutputList &ol,const char *title,
176             bool isConstantGroup=false, bool localName=FALSE);
177     bool declVisible() const;
178   private:
179     int compareValues(const NamespaceDef *item1,const NamespaceDef *item2) const
180     {
181       return qstricmp(item1->name(),item2->name());
182     }
183 };
184
185
186
187 #endif