481beced18c878ccacf7d86aae5a039c04b50e31
[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
83     bool visited;    // number of times accessed for output - KPW
84
85     //friend void writeGroupTreeNode(OutputList&, GroupDef*, int, FTVHelp*);      
86                     // make accessible for writing tree view of group in index.cpp - KPW
87
88     void setGroupScope(Definition *d) { groupScope = d; }
89     Definition *getGroupScope() const { return groupScope; }
90
91     MemberList *getMemberList(MemberListType lt) const;
92     const QList<MemberList> &getMemberLists() const { return m_memberLists; }
93
94     /* user defined member groups */
95     MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
96
97     FileList *      getFiles() const        { return fileList; }
98     ClassSDict *    getClasses() const      { return classSDict; }
99     NamespaceSDict * getNamespaces() const   { return namespaceSDict; }
100     GroupList *     getSubGroups() const    { return groupList; }
101     PageSDict *     getPages() const        { return pageDict; }
102     DirList *       getDirs() const         { return dirList; }
103     PageSDict *     getExamples() const     { return exampleDict; }
104     //MemberList*     getMembers() const      { return allMemberList; }
105     void sortSubGroups();
106     
107   protected:
108     void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
109
110   private: 
111     MemberList *createMemberList(MemberListType lt);
112     void addMemberToList(MemberListType lt,MemberDef *md);
113     void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
114     void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
115     void removeMemberFromList(MemberListType lt,MemberDef *md);
116     void writeGroupGraph(OutputList &ol);
117     void writeFiles(OutputList &ol,const QCString &title);
118     void writeNamespaces(OutputList &ol,const QCString &title);
119     void writeNestedGroups(OutputList &ol,const QCString &title);
120     void writeDirs(OutputList &ol,const QCString &title);
121     void writeClasses(OutputList &ol,const QCString &title);
122     void writeInlineClasses(OutputList &ol);
123     void writePageDocumentation(OutputList &ol);
124     void writeDetailedDescription(OutputList &ol,const QCString &title);
125     void writeBriefDescription(OutputList &ol);
126     void writeMemberGroups(OutputList &ol);
127     void startMemberDeclarations(OutputList &ol);
128     void endMemberDeclarations(OutputList &ol);
129     void startMemberDocumentation(OutputList &ol);
130     void endMemberDocumentation(OutputList &ol);
131     void writeAuthorSection(OutputList &ol);
132     void writeSummaryLinks(OutputList &ol);
133     void updateLanguage(const Definition *);
134
135     QCString title;                      // title of the group
136     bool titleSet;                       // true if title is not the same as the name
137     QCString fileName;                   // base name of the generated file
138     FileList *fileList;                  // list of files in the group
139     ClassSDict *classSDict;              // list of classes in the group
140     NamespaceSDict *namespaceSDict;      // list of namespaces in the group
141     GroupList *groupList;                // list of sub groups.
142     PageSDict *pageDict;                 // list of pages in the group
143     PageSDict *exampleDict;              // list of examples in the group
144     DirList *dirList;                    // list of directories in the group
145
146     MemberList *allMemberList;
147     MemberNameInfoSDict *allMemberNameInfoSDict;
148     
149     Definition *groupScope;
150
151     QList<MemberList> m_memberLists;
152     MemberGroupSDict *memberGroupSDict;
153
154 };
155
156 /** A sorted dictionary of GroupDef objects. */
157 class GroupSDict : public SDict<GroupDef>
158 {
159   public:
160     GroupSDict(uint size) : SDict<GroupDef>(size) {}
161     virtual ~GroupSDict() {}
162   private:
163     int compareValues(const GroupDef *item1,const GroupDef *item2) const
164     {
165       return qstrcmp(item1->groupTitle(),item2->groupTitle());
166     }
167 };
168
169 /** A list of GroupDef objects. */
170 class GroupList : public QList<GroupDef>
171 {
172   public:
173     int compareValues(const GroupDef *item1,const GroupDef *item2) const
174     {
175       return qstrcmp(item1->groupTitle(),item2->groupTitle());
176     }
177 };
178
179 /** An iterator for GroupDef objects in a GroupList. */
180 class GroupListIterator : public QListIterator<GroupDef>
181 {
182   public:
183     GroupListIterator(const GroupList &l) : QListIterator<GroupDef>(l) {}
184     virtual ~GroupListIterator() {}
185 };
186
187 void addClassToGroups(Entry *root,ClassDef *cd);
188 void addNamespaceToGroups(Entry *root,NamespaceDef *nd);
189 void addGroupToGroups(Entry *root,GroupDef *subGroup);
190 void addMemberToGroups(Entry *root,MemberDef *md);
191 void addPageToGroups(Entry *root,PageDef *pd);
192 void addExampleToGroups(Entry *root,PageDef *eg);
193 void addDirToGroups(Entry *root,DirDef *dd);
194
195 #endif
196