Fix for UBSan build
[platform/upstream/doxygen.git] / src / memberlist.h
1 /******************************************************************************
2  *
3  * $Id: memberlist.h,v 1.19 2001/03/19 19:27:41 root Exp $
4  *
5  * Copyright (C) 1997-2012 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 MEMBERLIST_H
19 #define MEMBERLIST_H
20
21 #include <qlist.h>
22 #include "memberdef.h"
23 #include "sortdict.h"
24
25 class GroupDef;
26 class MemberGroup;
27 class MemberGroupList;
28 class StorageIntf;
29
30 /** A list of MemberDef objects. */
31 class MemberList : public QList<MemberDef> 
32
33   public:
34     enum ListType
35     {
36       privateLists       = 0x0800,
37       detailedLists      = 0x1000,
38       declarationLists   = 0x2000,
39       documentationLists = 0x4000,
40
41       pubMethods              = 0,
42       proMethods              = 1,
43       pacMethods              = 2,
44       priMethods              = 3 + privateLists,
45       pubStaticMethods        = 4,
46       proStaticMethods        = 5,
47       pacStaticMethods        = 6,
48       priStaticMethods        = 7 + privateLists,
49       pubSlots                = 8,
50       proSlots                = 9,
51       priSlots                = 10 + privateLists,
52       pubAttribs              = 11,
53       proAttribs              = 12,
54       pacAttribs              = 13,
55       priAttribs              = 14 + privateLists,
56       pubStaticAttribs        = 15,
57       proStaticAttribs        = 16,
58       pacStaticAttribs        = 17,
59       priStaticAttribs        = 18 + privateLists,
60       pubTypes                = 19,
61       proTypes                = 20,
62       pacTypes                = 21,
63       priTypes                = 22 + privateLists,
64       related                 = 23,
65       signals                 = 24,
66       friends                 = 25,
67       dcopMethods             = 26,
68       properties              = 27,
69       events                  = 28,
70
71       typedefMembers          = 29 + detailedLists,
72       enumMembers             = 30 + detailedLists,
73       enumValMembers          = 31 + detailedLists,
74       functionMembers         = 32 + detailedLists,
75       relatedMembers          = 33 + detailedLists,
76       variableMembers         = 34 + detailedLists,
77       propertyMembers         = 35 + detailedLists,
78       eventMembers            = 36 + detailedLists,
79       constructors            = 37 + detailedLists,
80
81       allMembersList          = 38,
82
83       decDefineMembers        = 39 + declarationLists,
84       decProtoMembers         = 40 + declarationLists, 
85       decTypedefMembers       = 41 + declarationLists,
86       decEnumMembers          = 42 + declarationLists,
87       decFuncMembers          = 43 + declarationLists,
88       decVarMembers           = 44 + declarationLists,
89       decEnumValMembers       = 45 + declarationLists,
90       decPubSlotMembers       = 46 + declarationLists,
91       decProSlotMembers       = 47 + declarationLists,
92       decPriSlotMembers       = 48 + declarationLists,
93       decSignalMembers        = 49 + declarationLists,
94       decEventMembers         = 50 + declarationLists,
95       decFriendMembers        = 51 + declarationLists,
96       decPropMembers          = 52 + declarationLists,
97       
98       docDefineMembers        = 53 + documentationLists,
99       docProtoMembers         = 54 + documentationLists,
100       docTypedefMembers       = 55 + documentationLists,
101       docEnumMembers          = 56 + documentationLists,
102       docFuncMembers          = 57 + documentationLists,
103       docVarMembers           = 58 + documentationLists,
104       docEnumValMembers       = 59 + documentationLists,
105       docPubSlotMembers       = 60 + documentationLists,
106       docProSlotMembers       = 61 + documentationLists,
107       docPriSlotMembers       = 62 + documentationLists,
108       docSignalMembers        = 63 + documentationLists,
109       docEventMembers         = 64 + documentationLists,
110       docFriendMembers        = 65 + documentationLists,
111       docPropMembers          = 66 + documentationLists,
112
113       redefinedBy             = 67,
114       enumFields              = 68,
115       memberGroup             = 69
116     };
117
118     MemberList();
119     MemberList(ListType lt);
120    ~MemberList();
121     ListType listType() const { return m_listType; }
122     QCString listTypeAsString() const;
123     bool insert(uint index,const MemberDef *md);
124     void inSort(const MemberDef *md);
125     void append(const MemberDef *md);
126     int compareItems(GCI item1,GCI item2);
127     int varCount() const       { ASSERT(m_numDecMembers!=-1); return m_varCnt;     }
128     int funcCount() const      { ASSERT(m_numDecMembers!=-1); return m_funcCnt;    }
129     int enumCount() const      { ASSERT(m_numDecMembers!=-1); return m_enumCnt;    }
130     int enumValueCount() const { ASSERT(m_numDecMembers!=-1); return m_enumValCnt; }
131     int typedefCount() const   { ASSERT(m_numDecMembers!=-1); return m_typeCnt;    }
132     int protoCount() const     { ASSERT(m_numDecMembers!=-1); return m_protoCnt;   }
133     int defineCount() const    { ASSERT(m_numDecMembers!=-1); return m_defCnt;     }
134     int friendCount() const    { ASSERT(m_numDecMembers!=-1); return m_friendCnt;  }
135     int numDecMembers() const  { ASSERT(m_numDecMembers!=-1); return m_numDecMembers; }
136     int numDocMembers() const  { ASSERT(m_numDocMembers!=-1); return m_numDocMembers; }
137     bool needsSorting() const  { return m_needsSorting; }
138     void countDecMembers(bool countEnumValues=FALSE,GroupDef *gd=0);
139     void countDocMembers(bool countEnumValues=FALSE);
140     int countInheritableMembers(ClassDef *inheritedFrom) const;
141     void writePlainDeclarations(OutputList &ol,
142                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
143                ClassDef *inheritedFrom,const char *inheritId);
144     void writeDeclarations(OutputList &ol,
145                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
146                const char *title,const char *subtitle,
147                bool showEnumValues=FALSE,bool showInline=FALSE,
148                ClassDef *inheritedFrom=0);
149     void writeDocumentation(OutputList &ol,const char *scopeName,
150                Definition *container,const char *title,bool showEnumValues=FALSE,bool showInline=FALSE);
151     void writeSimpleDocumentation(OutputList &ol,Definition *container);
152     void writeDocumentationPage(OutputList &ol,
153                const char *scopeName, Definition *container);
154     bool declVisible() const;
155     void addMemberGroup(MemberGroup *mg);
156     void setInGroup(bool inGroup) { m_inGroup=inGroup; }
157     void setInFile(bool inFile) { m_inFile=inFile; }
158     void addListReferences(Definition *def);
159     void findSectionsInDocumentation();
160     void setNeedsSorting(bool b);
161     MemberGroupList *getMemberGroupList() const { return memberGroupList; }
162
163     void marshal(StorageIntf *s);
164     void unmarshal(StorageIntf *s);
165
166   private:
167     int m_varCnt;
168     int m_funcCnt;
169     int m_enumCnt;
170     int m_enumValCnt;
171     int m_typeCnt;
172     int m_protoCnt;
173     int m_defCnt;
174     int m_friendCnt; 
175     int m_numDecMembers; // number of members in the brief part of the memberlist
176     int m_numDocMembers; // number of members in the detailed part of the memberlist
177     MemberGroupList *memberGroupList;
178     bool m_inGroup; // is this list part of a group definition
179     bool m_inFile;  // is this list part of a file definition
180     ListType m_listType;
181     bool m_needsSorting;
182 };
183
184 /** An iterator for MemberDef objects in a MemberList. */
185 class MemberListIterator : public QListIterator<MemberDef>
186 {
187   public:
188     MemberListIterator(const QList<MemberDef> &list);
189     virtual ~MemberListIterator() {}
190 };
191
192 /** An unsorted dictionary of MemberDef objects. */
193 class MemberDict : public QDict<MemberDef>
194 {
195   public:
196     MemberDict(int size) : QDict<MemberDef>(size) {}
197     virtual ~MemberDict() {}
198 };
199
200 /** A sorted dictionary of MemberDef objects. */
201 class MemberSDict : public SDict<MemberDef>
202 {
203   public:
204     MemberSDict(int size=17) : SDict<MemberDef>(size) {}
205     virtual ~MemberSDict() {}
206     int compareItems(GCI item1,GCI item2);
207 };
208
209
210 #endif