summaryrefslogtreecommitdiffstats
path: root/src/memberlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/memberlist.h')
-rw-r--r--src/memberlist.h101
1 files changed, 48 insertions, 53 deletions
diff --git a/src/memberlist.h b/src/memberlist.h
index 08e2873..33920d5 100644
--- a/src/memberlist.h
+++ b/src/memberlist.h
@@ -19,7 +19,6 @@
#include <vector>
#include <algorithm>
-#include <qlist.h>
#include "memberdef.h"
#include "linkedmap.h"
#include "types.h"
@@ -27,8 +26,10 @@
class GroupDef;
+int genericCompareMembers(const MemberDef *c1,const MemberDef *c2);
+
/** A list of MemberDef objects. */
-class MemberList : private QList<MemberDef>
+class MemberList
{
friend class MemberListIterator;
public:
@@ -38,28 +39,45 @@ class MemberList : private QList<MemberDef>
MemberListType listType() const { return m_listType; }
static QCString listTypeAsString(MemberListType type);
- /* ---- standard QList methods ---- */
- void inSort(const MemberDef *md);
- void append(const MemberDef *md);
- void remove(const MemberDef *md);
- void sort();
- uint count() const;
- int findRef(const MemberDef *md) const;
- MemberDef *getFirst() const;
- MemberDef *take(uint index);
+ /* --- standard vector interface ---- */
+ using Ptr = const MemberDef *;
+ using Vec = std::vector<Ptr>;
+ using iterator = typename Vec::iterator;
+ using const_iterator = typename Vec::const_iterator;
+ void push_back(const MemberDef *md) { m_members.push_back(md); }
+ iterator begin() { return m_members.begin(); }
+ iterator end() { return m_members.end(); }
+ const_iterator begin() const { return m_members.cbegin(); }
+ const_iterator end() const { return m_members.cend(); }
+ bool empty() const { return m_members.empty(); }
+ size_t size() const { return m_members.size(); }
+ Ptr& front() { return m_members.front(); }
+ Ptr& back() { return m_members.back(); }
+
+ /* --- other methods ---- */
+ static bool lessThan(const MemberDef *md1,const MemberDef *md2)
+ {
+ return genericCompareMembers(md1,md2)<0;
+ }
+ void sort()
+ {
+ std::sort(m_members.begin(),m_members.end(),lessThan);
+ }
+ void inSort(const MemberDef *md)
+ {
+ m_members.insert( std::upper_bound( m_members.begin(), m_members.end(), md, lessThan), md);
+ }
+ void remove(const MemberDef *md)
+ {
+ auto it = std::find(m_members.begin(),m_members.end(),md);
+ if (it!=m_members.end()) m_members.erase(it);
+ }
+ bool contains(const MemberDef *md)
+ {
+ auto it = std::find(m_members.begin(),m_members.end(),md);
+ return it!=m_members.end();
+ }
-/*
- int varCount() const { ASSERT(m_numDecMembers!=-1); return m_varCnt; }
- int funcCount() const { ASSERT(m_numDecMembers!=-1); return m_funcCnt; }
- int enumCount() const { ASSERT(m_numDecMembers!=-1); return m_enumCnt; }
- int enumValueCount() const { ASSERT(m_numDecMembers!=-1); return m_enumValCnt; }
- int typedefCount() const { ASSERT(m_numDecMembers!=-1); return m_typeCnt; }
- int sequenceCount() const { ASSERT(m_numDecMembers!=-1); return m_seqCnt; }
- int dictionaryCount() const { ASSERT(m_numDecMembers!=-1); return m_dictCnt; }
- int protoCount() const { ASSERT(m_numDecMembers!=-1); return m_protoCnt; }
- int defineCount() const { ASSERT(m_numDecMembers!=-1); return m_defCnt; }
- int friendCount() const { ASSERT(m_numDecMembers!=-1); return m_friendCnt; }
-*/
int numDecMembers() const { ASSERT(m_numDecMembers!=-1); return m_numDecMembers; }
int numDecEnumValues() const { return m_numDecEnumValues; }
int numDocMembers() const { ASSERT(m_numDocMembers!=-1); return m_numDocMembers; }
@@ -70,19 +88,19 @@ class MemberList : private QList<MemberDef>
int countInheritableMembers(const ClassDef *inheritedFrom) const;
void writePlainDeclarations(OutputList &ol,
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd, const GroupDef *gd,
- const ClassDef *inheritedFrom,const char *inheritId) const;
+ const ClassDef *inheritedFrom,const QCString &inheritId) const;
void writeDeclarations(OutputList &ol,
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
- const char *title,const char *subtitle,
+ const QCString &title,const QCString &subtitle,
bool showEnumValues=FALSE,bool showInline=FALSE,
const ClassDef *inheritedFrom=0,MemberListType lt=MemberListType_pubMethods) const;
- void writeDocumentation(OutputList &ol,const char *scopeName,
- const Definition *container,const char *title,
+ void writeDocumentation(OutputList &ol,const QCString &scopeName,
+ const Definition *container,const QCString &title,
bool showEnumValues=FALSE,bool showInline=FALSE) const;
void writeSimpleDocumentation(OutputList &ol,const Definition *container) const;
void writeDocumentationPage(OutputList &ol,
- const char *scopeName, const DefinitionMutable *container) const;
- void writeTagFile(FTextStream &);
+ const QCString &scopeName, const DefinitionMutable *container) const;
+ void writeTagFile(TextStream &);
bool declVisible() const;
void addMemberGroup(MemberGroup *mg);
void setInGroup(bool inGroup) { m_inGroup=inGroup; }
@@ -95,21 +113,7 @@ class MemberList : private QList<MemberDef>
void setAnchors();
private:
- MemberList(const MemberList &) = delete;
- MemberList &operator=(const MemberList &) = delete;
- int compareValues(const MemberDef *item1,const MemberDef *item2) const;
int countEnumValues(const MemberDef *md) const;
- /*
- int m_varCnt;
- int m_funcCnt;
- int m_enumCnt;
- int m_typeCnt;
- int m_seqCnt;
- int m_dictCnt;
- int m_protoCnt;
- int m_defCnt;
- int m_friendCnt;
- */
int m_numDecMembers; // number of members in the brief part of the memberlist
int m_numDecEnumValues;
int m_numDocMembers; // number of members in the detailed part of the memberlist
@@ -119,15 +123,7 @@ class MemberList : private QList<MemberDef>
bool m_inFile; // is this list part of a file definition
MemberListType m_listType;
bool m_needsSorting;
- QDict<int> m_overloadCount;
-};
-
-/** An iterator for MemberDef objects in a MemberList. */
-class MemberListIterator : public QListIterator<MemberDef>
-{
- public:
- MemberListIterator(const MemberList &list);
- virtual ~MemberListIterator() {}
+ Vec m_members;
};
class MemberLinkedRefMap : public LinkedRefMap<const MemberDef>
@@ -153,6 +149,5 @@ class MemberLists : public std::vector< std::unique_ptr<MemberList> >
MemberLists &operator=(const MemberLists &) = delete;
};
-int genericCompareMembers(const MemberDef *c1,const MemberDef *c2);
#endif