38f0e8933781559c9ad716caa95d0164b27f35f4
[platform/upstream/doxygen.git] / src / memberlist.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 MEMBERLIST_H
19 #define MEMBERLIST_H
20
21 #include <qlist.h>
22 #include "memberdef.h"
23 #include "sortdict.h"
24 #include "types.h"
25
26 class GroupDef;
27 class MemberGroup;
28 class MemberGroupList;
29 class StorageIntf;
30
31 /** A list of MemberDef objects. */
32 class MemberList : private QList<MemberDef>
33 {
34     friend class MemberListIterator;
35   public:
36     MemberList();
37     MemberList(MemberListType lt);
38    ~MemberList();
39     MemberListType listType() const { return m_listType; }
40     static QCString listTypeAsString(MemberListType type);
41
42     /* ---- standard QList methods ---- */
43     void inSort(const MemberDef *md);
44     void append(const MemberDef *md);
45     void remove(const MemberDef *md);
46     void sort();
47     uint count() const;
48     int findRef(const MemberDef *md) const;
49     MemberDef *getFirst() const;
50     MemberDef *take(uint index);
51
52
53     int varCount() const       { ASSERT(m_numDecMembers!=-1); return m_varCnt;     }
54     int funcCount() const      { ASSERT(m_numDecMembers!=-1); return m_funcCnt;    }
55     int enumCount() const      { ASSERT(m_numDecMembers!=-1); return m_enumCnt;    }
56     int enumValueCount() const { ASSERT(m_numDecMembers!=-1); return m_enumValCnt; }
57     int typedefCount() const   { ASSERT(m_numDecMembers!=-1); return m_typeCnt;    }
58     int protoCount() const     { ASSERT(m_numDecMembers!=-1); return m_protoCnt;   }
59     int defineCount() const    { ASSERT(m_numDecMembers!=-1); return m_defCnt;     }
60     int friendCount() const    { ASSERT(m_numDecMembers!=-1); return m_friendCnt;  }
61     int numDecMembers() const  { ASSERT(m_numDecMembers!=-1); return m_numDecMembers; }
62     int numDocMembers() const  { ASSERT(m_numDocMembers!=-1); return m_numDocMembers; }
63     bool needsSorting() const  { return m_needsSorting; }
64     void countDecMembers(bool countEnumValues=FALSE,GroupDef *gd=0);
65     void countDocMembers(bool countEnumValues=FALSE);
66     int countInheritableMembers(ClassDef *inheritedFrom) const;
67     void writePlainDeclarations(OutputList &ol,
68                ClassDef *cd,NamespaceDef *nd,FileDef *fd, GroupDef *gd,
69                ClassDef *inheritedFrom,const char *inheritId);
70     void writeDeclarations(OutputList &ol,
71                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
72                const char *title,const char *subtitle,
73                bool showEnumValues=FALSE,bool showInline=FALSE,
74                ClassDef *inheritedFrom=0,MemberListType lt=MemberListType_pubMethods);
75     void writeDocumentation(OutputList &ol,const char *scopeName,
76                Definition *container,const char *title,bool showEnumValues=FALSE,bool showInline=FALSE);
77     void writeSimpleDocumentation(OutputList &ol,Definition *container);
78     void writeDocumentationPage(OutputList &ol,
79                const char *scopeName, Definition *container);
80     void writeTagFile(FTextStream &);
81     bool declVisible() const;
82     void addMemberGroup(MemberGroup *mg);
83     void setInGroup(bool inGroup) { m_inGroup=inGroup; }
84     void setInFile(bool inFile) { m_inFile=inFile; }
85     void addListReferences(Definition *def);
86     void findSectionsInDocumentation();
87     void setNeedsSorting(bool b);
88     MemberGroupList *getMemberGroupList() const { return memberGroupList; }
89
90     void marshal(StorageIntf *s);
91     void unmarshal(StorageIntf *s);
92
93   private:
94     int compareValues(const MemberDef *item1,const MemberDef *item2) const;
95     int countEnumValues(MemberDef *md,bool setAnonEnumType) const;
96     int m_varCnt;
97     int m_funcCnt;
98     int m_enumCnt;
99     int m_enumValCnt;
100     int m_typeCnt;
101     int m_protoCnt;
102     int m_defCnt;
103     int m_friendCnt; 
104     int m_numDecMembers; // number of members in the brief part of the memberlist
105     int m_numDocMembers; // number of members in the detailed part of the memberlist
106     MemberGroupList *memberGroupList;
107     bool m_inGroup; // is this list part of a group definition
108     bool m_inFile;  // is this list part of a file definition
109     MemberListType m_listType;
110     bool m_needsSorting;
111     QDict<int> m_overloadCount;
112 };
113
114 /** An iterator for MemberDef objects in a MemberList. */
115 class MemberListIterator : public QListIterator<MemberDef>
116 {
117   public:
118     MemberListIterator(const MemberList &list);
119     virtual ~MemberListIterator() {}
120 };
121
122 /** An unsorted dictionary of MemberDef objects. */
123 class MemberDict : public QDict<MemberDef>
124 {
125   public:
126     MemberDict(int size) : QDict<MemberDef>(size) {}
127     virtual ~MemberDict() {}
128 };
129
130 /** A sorted dictionary of MemberDef objects. */
131 class MemberSDict : public SDict<MemberDef>
132 {
133   public:
134     MemberSDict(int size=17) : SDict<MemberDef>(size) {}
135     virtual ~MemberSDict() {}
136   private:
137     int compareValues(const MemberDef *item1,const MemberDef *item2) const;
138 };
139
140
141 #endif