29fba0759027d0a4d67aad1bef69ba2fa461c91a
[platform/upstream/doxygen.git] / src / membergroup.h
1 /******************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 1997-2015 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 MEMBERGROUP_H
19 #define MEMBERGROUP_H
20
21 #include <qlist.h>
22 #include "sortdict.h"
23 #include "types.h"
24
25 #define DOX_NOGROUP -1
26
27 class MemberList;
28 class MemberDef;
29 class ClassDef;
30 class NamespaceDef;
31 class FileDef;
32 class GroupDef;
33 class OutputList;
34 class Definition;
35 class StorageIntf;
36 class FTextStream;
37 struct ListItemInfo;
38
39 /** A class representing a group of members. */
40 class MemberGroup 
41 {
42   public:
43     MemberGroup();
44     MemberGroup(Definition *parent,int id,const char *header,
45                 const char *docs,const char *docFile,int docLine);
46    ~MemberGroup();
47     QCString header() const { return grpHeader; }
48     int groupId() const { return grpId; }
49     void insertMember(MemberDef *md);
50     void setAnchors();
51     void writePlainDeclarations(OutputList &ol,
52                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
53                ClassDef *inheritedFrom,const char *inheritId);
54     void writeDeclarations(OutputList &ol,
55                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
56                bool showInline=FALSE);
57     void writeDocumentation(OutputList &ol,const char *scopeName,
58                Definition *container,bool showEnumValues,bool showInline);
59     void writeDocumentationPage(OutputList &ol,const char *scopeName,
60                Definition *container);
61     void writeTagFile(FTextStream &);
62     void addGroupedInheritedMembers(OutputList &ol,ClassDef *cd,
63                MemberListType lt,
64                ClassDef *inheritedFrom,const QCString &inheritId);
65
66     const QCString &documentation() const { return doc; }
67     bool allMembersInSameSection() const { return inSameSection; }
68     void addToDeclarationSection();
69     int countDecMembers(GroupDef *gd=0);
70     int countDocMembers();
71     int countGroupedInheritedMembers(MemberListType lt);
72     void distributeMemberGroupDocumentation();
73     void findSectionsInDocumentation();
74     int varCount() const;
75     int funcCount() const;
76     int enumCount() const;
77     int enumValueCount() const;
78     int typedefCount() const;
79     int protoCount() const;
80     int defineCount() const;
81     int friendCount() const;
82     int numDecMembers() const;
83     int numDocMembers() const;
84     int countInheritableMembers(ClassDef *inheritedFrom) const;
85     void setInGroup(bool b);
86     void addListReferences(Definition *d);
87     void setRefItems(const QList<ListItemInfo> *sli);
88     MemberList *members() const { return memberList; }
89     Definition *parent() const { return m_parent; }
90     QCString anchor() const;
91
92     QCString docFile() const { return m_docFile; }
93     int docLine() const { return m_docLine; }
94
95     void marshal(StorageIntf *s);
96     void unmarshal(StorageIntf *s);
97
98   private: 
99     MemberList *memberList;      // list of all members in the group
100     MemberList *inDeclSection;
101     int grpId;
102     QCString grpHeader;
103     QCString fileName;           // base name of the generated file
104     Definition *scope;
105     QCString doc;
106     bool inSameSection;
107     int  m_numDecMembers;
108     int  m_numDocMembers;
109     Definition *m_parent;
110     QCString m_docFile;
111     int m_docLine;
112     QList<ListItemInfo> *m_xrefListItems;
113 };
114
115 /** A list of MemberGroup objects. */
116 class MemberGroupList : public QList<MemberGroup>
117 {
118 };
119
120 /** An iterator for MemberGroup objects in a MemberGroupList. */
121 class MemberGroupListIterator : public QListIterator<MemberGroup>
122 {
123   public:
124     MemberGroupListIterator(const MemberGroupList &l) : 
125       QListIterator<MemberGroup>(l) {}
126 };
127
128 /** A sorted dictionary of MemberGroup objects. */
129 class MemberGroupSDict : public SIntDict<MemberGroup>
130 {
131   public:
132     MemberGroupSDict(int size=17) : SIntDict<MemberGroup>(size) {}
133    ~MemberGroupSDict() {}
134  private:
135     int compareValues(const MemberGroup *item1,const MemberGroup *item2) const
136     {
137       return item1->groupId() - item2->groupId();
138     }
139 };
140
141 /** Data collected for a member group */
142 struct MemberGroupInfo
143 {
144   MemberGroupInfo() : docLine(-1), m_sli(0) {}
145  ~MemberGroupInfo() { delete m_sli; m_sli=0; }
146   void setRefItems(const QList<ListItemInfo> *sli);
147   QCString header;
148   QCString doc;
149   QCString docFile;
150   int docLine;
151   QCString compoundName;
152   QList<ListItemInfo> *m_sli;
153 };
154
155 #endif