diff options
author | David Hebbeker <david@hebbeker.info> | 2020-05-02 18:05:28 (GMT) |
---|---|---|
committer | David Hebbeker <david@hebbeker.info> | 2020-05-05 16:29:22 (GMT) |
commit | a0755075b7ce190c3eb2a48c9238f34240ea8c8d (patch) | |
tree | 94531c8d6c669f3bec0eb730278b5b7175ba75e6 | |
parent | b5a2d0b03fe7de2570a9b6d326be7062b774c506 (diff) | |
download | Doxygen-a0755075b7ce190c3eb2a48c9238f34240ea8c8d.zip Doxygen-a0755075b7ce190c3eb2a48c9238f34240ea8c8d.tar.gz Doxygen-a0755075b7ce190c3eb2a48c9238f34240ea8c8d.tar.bz2 |
Copied implementation of `QGList::inSort()` to sortInDirList.
-rw-r--r-- | src/dirdef.cpp | 10 | ||||
-rw-r--r-- | src/dirdef.h | 7 | ||||
-rw-r--r-- | src/groupdef.cpp | 3 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/dirdef.cpp b/src/dirdef.cpp index a89a9e6..597875f 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -1097,3 +1097,13 @@ bool compareDirDefs(const DirDef *item1, const DirDef *item2) { return qstricmp(item1->shortName(),item2->shortName()) < 0; } + +void sortInDirList(DirList& list, DirDef *const newItem) +{ + auto potentialSuccessor = list.begin(); + while (potentialSuccessor != list.cend() && compareDirDefs(*potentialSuccessor, newItem)) + { + potentialSuccessor++; + } + list.insert(potentialSuccessor, newItem); +} diff --git a/src/dirdef.h b/src/dirdef.h index 52af2d8..0d73dd3 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -41,6 +41,13 @@ typedef std::deque<DirDef*> DirList; /** Compare referenced objects. */ bool compareDirDefs(const DirDef *item1,const DirDef *item2); +/** + * Sorts the list by the result of the compareDirDefs() function. + * @param list in which item to be inserted + * @param newItem to be inserted + */ +void sortInDirList(DirList &list, DirDef *const newItem); + /** A model of a directory symbol. */ class DirDef : virtual public Definition { diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 5af1cbd..e2d5b12 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -332,8 +332,7 @@ void GroupDefImpl::addDir(const DirDef *def) if (def->isHidden()) return; if (Config_getBool(SORT_BRIEF_DOCS)) { - m_dirList->push_back(def); - m_dirList->sort(); + sortInDirList(*m_dirList, def); } else m_dirList->push_back(def); |