Imported Upstream version 1.8.8
[platform/upstream/doxygen.git] / src / groupdef.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 GROUPDEF_H
19 #define GROUPDEF_H
20
21 #include "sortdict.h"
22 #include "definition.h"
23
24 class MemberList;
25 class FileList;
26 class ClassSDict;
27 class FileDef;
28 class ClassDef;
29 class NamespaceDef;
30 class GroupList;
31 class OutputList;
32 class NamespaceSDict;
33 class MemberGroupSDict;
34 class MemberNameInfoSDict;
35 class PageSDict;
36 class PageDef;
37 class DirDef;
38 class DirList;
39 class FTVHelp;
40 class Entry;
41 class MemberDef;
42
43 /** A model of a group of symbols. */
44 class GroupDef : public Definition
45 {
46   public:
47     GroupDef(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0);
48    ~GroupDef();
49     DefType definitionType() const { return TypeGroup; }
50     QCString getOutputFileBase() const;
51     QCString anchor() const { return QCString(); }
52     QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : Definition::name(); }
53     const char *groupTitle() const { return title; }
54     void setGroupTitle( const char *newtitle );
55     bool hasGroupTitle( ) const { return titleSet; }
56     void addFile(const FileDef *def); 
57     bool addClass(const ClassDef *def);
58     bool addNamespace(const NamespaceDef *def);
59     void addGroup(const GroupDef *def);
60     void addParentGroup(const GroupDef *def);
61     void addPage(PageDef *def);
62     void addExample(const PageDef *def);
63     void addDir(const DirDef *dd);
64     bool insertMember(MemberDef *def,bool docOnly=FALSE);
65     void removeMember(MemberDef *md);
66     bool containsGroup(const GroupDef *def);    // true if def is already a subgroup
67     void writeDocumentation(OutputList &ol);
68     void writeMemberPages(OutputList &ol);
69     void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
70     int  countMembers() const;
71     bool isLinkableInProject() const;
72     bool isLinkable() const;
73     bool isASubGroup() const;
74     void computeAnchors();
75
76     void addMembersToMemberGroup();
77     void distributeMemberGroupDocumentation();
78     void findSectionsInDocumentation();
79
80     void addListReferences();
81     void sortMemberLists();
82     bool subGrouping() const { return m_subGrouping; }
83
84     bool visited;    // number of times accessed for output - KPW
85
86     //friend void writeGroupTreeNode(OutputList&, GroupDef*, int, FTVHelp*);      
87                     // make accessible for writing tree view of group in index.cpp - KPW
88
89     void setGroupScope(Definition *d) { groupScope = d; }
90     Definition *getGroupScope() const { return groupScope; }
91
92     MemberList *getMemberList(MemberListType lt) const;
93     const QList<MemberList> &getMemberLists() const { return m_memberLists; }
94
95     /* user defined member groups */
96     MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
97
98     FileList *      getFiles() const        { return fileList; }
99     ClassSDict *    getClasses() const      { return classSDict; }
100     NamespaceSDict * getNamespaces() const   { return namespaceSDict; }
101     GroupList *     getSubGroups() const    { return groupList; }
102     PageSDict *     getPages() const        { return pageDict; }
103     DirList *       getDirs() const         { return dirList; }
104     PageSDict *     getExamples() const     { return exampleDict; }
105     bool hasDetailedDescription() const;
106     //MemberList*     getMembers() const      { return allMemberList; }
107     void sortSubGroups();
108     
109   protected:
110     void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
111
112   private: 
113     MemberList *createMemberList(MemberListType lt);
114     void addMemberToList(MemberListType lt,MemberDef *md);
115     void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
116     void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
117     void removeMemberFromList(MemberListType lt,MemberDef *md);
118     void writeGroupGraph(OutputList &ol);
119     void writeFiles(OutputList &ol,const QCString &title);
120     void writeNamespaces(OutputList &ol,const QCString &title);
121     void writeNestedGroups(OutputList &ol,const QCString &title);
122     void writeDirs(OutputList &ol,const QCString &title);
123     void writeClasses(OutputList &ol,const QCString &title);
124     void writeInlineClasses(OutputList &ol);
125     void writePageDocumentation(OutputList &ol);
126     void writeDetailedDescription(OutputList &ol,const QCString &title);
127     void writeBriefDescription(OutputList &ol);
128     void writeMemberGroups(OutputList &ol);
129     void startMemberDeclarations(OutputList &ol);
130     void endMemberDeclarations(OutputList &ol);
131     void startMemberDocumentation(OutputList &ol);
132     void endMemberDocumentation(OutputList &ol);
133     void writeAuthorSection(OutputList &ol);
134     void writeSummaryLinks(OutputList &ol);
135     void updateLanguage(const Definition *);
136
137     QCString title;                      // title of the group
138     bool titleSet;                       // true if title is not the same as the name
139     QCString fileName;                   // base name of the generated file
140     FileList *fileList;                  // list of files in the group
141     ClassSDict *classSDict;              // list of classes in the group
142     NamespaceSDict *namespaceSDict;      // list of namespaces in the group
143     GroupList *groupList;                // list of sub groups.
144     PageSDict *pageDict;                 // list of pages in the group
145     PageSDict *exampleDict;              // list of examples in the group
146     DirList *dirList;                    // list of directories in the group
147
148     MemberList *allMemberList;
149     MemberNameInfoSDict *allMemberNameInfoSDict;
150     
151     Definition *groupScope;
152
153     QList<MemberList> m_memberLists;
154     MemberGroupSDict *memberGroupSDict;
155     bool              m_subGrouping;
156
157 };
158
159 /** A sorted dictionary of GroupDef objects. */
160 class GroupSDict : public SDict<GroupDef>
161 {
162   public:
163     GroupSDict(uint size) : SDict<GroupDef>(size) {}
164     virtual ~GroupSDict() {}
165   private:
166     int compareValues(const GroupDef *item1,const GroupDef *item2) const
167     {
168       return qstrcmp(item1->groupTitle(),item2->groupTitle());
169     }
170 };
171
172 /** A list of GroupDef objects. */
173 class GroupList : public QList<GroupDef>
174 {
175   public:
176     int compareValues(const GroupDef *item1,const GroupDef *item2) const
177     {
178       return qstrcmp(item1->groupTitle(),item2->groupTitle());
179     }
180 };
181
182 /** An iterator for GroupDef objects in a GroupList. */
183 class GroupListIterator : public QListIterator<GroupDef>
184 {
185   public:
186     GroupListIterator(const GroupList &l) : QListIterator<GroupDef>(l) {}
187     virtual ~GroupListIterator() {}
188 };
189
190 void addClassToGroups(Entry *root,ClassDef *cd);
191 void addNamespaceToGroups(Entry *root,NamespaceDef *nd);
192 void addGroupToGroups(Entry *root,GroupDef *subGroup);
193 void addMemberToGroups(Entry *root,MemberDef *md);
194 void addPageToGroups(Entry *root,PageDef *pd);
195 void addExampleToGroups(Entry *root,PageDef *eg);
196 void addDirToGroups(Entry *root,DirDef *dd);
197
198 #endif
199