diff options
Diffstat (limited to 'src/memberlist.h')
-rw-r--r-- | src/memberlist.h | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/memberlist.h b/src/memberlist.h index 422c162..08e2873 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -1,12 +1,10 @@ /****************************************************************************** * - * - * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -18,14 +16,16 @@ #ifndef MEMBERLIST_H #define MEMBERLIST_H +#include <vector> +#include <algorithm> + #include <qlist.h> #include "memberdef.h" -#include "sortdict.h" +#include "linkedmap.h" #include "types.h" +#include "membergroup.h" class GroupDef; -class MemberGroup; -class MemberGroupList; /** A list of MemberDef objects. */ class MemberList : private QList<MemberDef> @@ -81,7 +81,7 @@ class MemberList : private QList<MemberDef> bool showEnumValues=FALSE,bool showInline=FALSE) const; void writeSimpleDocumentation(OutputList &ol,const Definition *container) const; void writeDocumentationPage(OutputList &ol, - const char *scopeName, const Definition *container) const; + const char *scopeName, const DefinitionMutable *container) const; void writeTagFile(FTextStream &); bool declVisible() const; void addMemberGroup(MemberGroup *mg); @@ -90,10 +90,13 @@ class MemberList : private QList<MemberDef> void addListReferences(Definition *def); void findSectionsInDocumentation(const Definition *d); void setNeedsSorting(bool b); - MemberGroupList *getMemberGroupList() const { return memberGroupList; } + const MemberGroupRefList &getMemberGroupList() const { return m_memberGroupRefList; } void setAnonymousEnumType(); + 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; /* @@ -105,13 +108,13 @@ class MemberList : private QList<MemberDef> int m_dictCnt; int m_protoCnt; int m_defCnt; - int m_friendCnt; + 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 int m_numDocEnumValues; - MemberGroupList *memberGroupList; + MemberGroupRefList m_memberGroupRefList; bool m_inGroup; // is this list part of a group definition bool m_inFile; // is this list part of a file definition MemberListType m_listType; @@ -127,23 +130,29 @@ class MemberListIterator : public QListIterator<MemberDef> virtual ~MemberListIterator() {} }; -/** An unsorted dictionary of MemberDef objects. */ -class MemberDict : public QDict<MemberDef> +class MemberLinkedRefMap : public LinkedRefMap<const MemberDef> { - public: - MemberDict(int size) : QDict<MemberDef>(size) {} - virtual ~MemberDict() {} }; -/** A sorted dictionary of MemberDef objects. */ -class MemberSDict : public SDict<MemberDef> +class MemberLists : public std::vector< std::unique_ptr<MemberList> > { public: - MemberSDict(int size=17) : SDict<MemberDef>(size) {} - virtual ~MemberSDict() {} + MemberLists() = default; + const std::unique_ptr<MemberList> &get(MemberListType lt) + { + // find the list with the given type + auto it = std::find_if(begin(),end(),[<](const auto &ml) { return ml->listType()==lt; }); + if (it!=end()) return *it; + // or create a new list if it is not found + emplace_back(std::make_unique<MemberList>(lt)); + return back(); + } + private: - int compareValues(const MemberDef *item1,const MemberDef *item2) const; + MemberLists(const MemberLists &) = delete; + MemberLists &operator=(const MemberLists &) = delete; }; +int genericCompareMembers(const MemberDef *c1,const MemberDef *c2); #endif |