diff options
-rw-r--r-- | qtools/qcstringlist.h | 4 | ||||
-rw-r--r-- | qtools/qstring.h | 15 | ||||
-rw-r--r-- | qtools/qvaluelist.h | 16 | ||||
-rw-r--r-- | src/context.cpp | 7 | ||||
-rw-r--r-- | src/dirdef.cpp | 11 | ||||
-rw-r--r-- | src/dirdef.h | 26 | ||||
-rw-r--r-- | src/dotgroupcollaboration.cpp | 30 | ||||
-rw-r--r-- | src/doxygen.cpp | 22 | ||||
-rw-r--r-- | src/groupdef.cpp | 36 | ||||
-rw-r--r-- | src/groupdef.h | 4 | ||||
-rw-r--r-- | src/index.cpp | 4 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 23 |
12 files changed, 96 insertions, 102 deletions
diff --git a/qtools/qcstringlist.h b/qtools/qcstringlist.h index 604a196..7ffd4d2 100644 --- a/qtools/qcstringlist.h +++ b/qtools/qcstringlist.h @@ -29,6 +29,10 @@ public: QCStringList( const QValueList<QCString>& l ) : QValueList<QCString>(l) { } QCStringList( const QCString& i ) { append(i); } QCStringList( const char* i ) { append(i); } + QCStringList &operator=(const QCStringList &l) + { + return static_cast<QCStringList&>(QValueList<QCString>::operator=(l)); + } static QCStringList fromStrList(const QStrList&); diff --git a/qtools/qstring.h b/qtools/qstring.h index 293768f..ed56d7f 100644 --- a/qtools/qstring.h +++ b/qtools/qstring.h @@ -1,5 +1,5 @@ /**************************************************************************** -** +** ** ** Definition of the QString class, and related Unicode ** functions. @@ -64,6 +64,7 @@ public: QChar( short rc ); QChar( uint rc ); QChar( int rc ); + QChar &operator=(const QChar &c); QT_STATIC_CONST QChar null; // 0000 QT_STATIC_CONST QChar replacement; // FFFD @@ -266,6 +267,15 @@ inline QChar::QChar( int rc ) #endif } +inline QChar &QChar::operator=(const QChar &c) +{ + rw = c.rw; + cl = c.cl; +#ifdef QT_QSTRING_UCS_4 + grp = 0; +#endif + return *this; +} inline int operator==( char ch, QChar c ) { @@ -409,7 +419,7 @@ public: inline QString(const Null &): d(shared_null) { d->ref(); } inline QString &operator=(const Null &) { *this = QString(); return *this; } inline bool isNull() const { return d == shared_null; } - + bool isEmpty() const; uint length() const; void truncate( uint pos ); @@ -603,6 +613,7 @@ class Q_EXPORT QCharRef { QString& s; uint p; QCharRef(QString* str, uint pos) : s(*str), p(pos) { } + QCharRef(const QCharRef &ref) : s(ref.s), p(ref.p) { } public: // Most QChar operations repeated here... diff --git a/qtools/qvaluelist.h b/qtools/qvaluelist.h index eb827fe..8885bea 100644 --- a/qtools/qvaluelist.h +++ b/qtools/qvaluelist.h @@ -1,5 +1,5 @@ /**************************************************************************** -** +** ** ** Definition of QValueList class ** @@ -50,7 +50,7 @@ public: QValueListNode( const T& t ) : data( t ) { } QValueListNode() { } #if defined(Q_TEMPLATEDLL) - // Workaround MS bug in memory de/allocation in DLL vs. EXE + // Workaround MS bug in memory de/allocation in DLL vs. EXE virtual ~QValueListNode() { } #endif @@ -79,6 +79,11 @@ class Q_EXPORT QValueListIterator QValueListIterator() : node( 0 ) {} QValueListIterator( NodePtr p ) : node( p ) {} QValueListIterator( const QValueListIterator<T>& it ) : node( it.node ) {} + QValueListIterator &operator=(const QValueListIterator &it) + { + node = it.node; + return *this; + } bool operator==( const QValueListIterator<T>& it ) const { return node == it.node; } bool operator!=( const QValueListIterator<T>& it ) const { return node != it.node; } @@ -132,6 +137,11 @@ class Q_EXPORT QValueListConstIterator QValueListConstIterator( NodePtr p ) : node( p ) {} QValueListConstIterator( const QValueListConstIterator<T>& it ) : node( it.node ) {} QValueListConstIterator( const QValueListIterator<T>& it ) : node( it.node ) {} + QValueListConstIterator &operator=(const QValueListConstIterator &it) + { + node = it.node; + return *this; + } bool operator==( const QValueListConstIterator<T>& it ) const { return node == it.node; } bool operator!=( const QValueListConstIterator<T>& it ) const { return node != it.node; } @@ -195,7 +205,7 @@ public: } #if defined(Q_TEMPLATEDLL) - // Workaround MS bug in memory de/allocation in DLL vs. EXE + // Workaround MS bug in memory de/allocation in DLL vs. EXE virtual #endif ~QValueListPrivate() { diff --git a/src/context.cpp b/src/context.cpp index 3e163a0..9684870 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -5457,12 +5457,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.dirs) { TemplateList *dirList = TemplateList::alloc(); - if (m_groupDef->getDirs()) + for(const auto dd : m_groupDef->getDirs()) { - for(const auto dd : *(m_groupDef->getDirs())) - { - dirList->append(DirContext::alloc(dd)); - } + dirList->append(DirContext::alloc(dd)); } cache.dirs.reset(dirList); } diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 597875f..0f8f04b 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -160,7 +160,7 @@ void DirDefImpl::addFile(FileDef *fd) void DirDefImpl::sort() { - std::sort(m_subdirs.begin(), m_subdirs.end(), &compareDirDefs); + std::sort(m_subdirs.begin(), m_subdirs.end(), compareDirDefs); m_fileList->sort(); } @@ -1098,12 +1098,3 @@ 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 0d73dd3..399e0c2 100644 --- a/src/dirdef.h +++ b/src/dirdef.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. * @@ -21,7 +19,7 @@ #include "sortdict.h" #include "definition.h" -#include <deque> +#include <vector> #include <qglobal.h> #include <qcstring.h> @@ -36,17 +34,9 @@ class FTextStream; class DirDef; /** A list of directories. */ -typedef std::deque<DirDef*> DirList; - -/** Compare referenced objects. */ -bool compareDirDefs(const DirDef *item1,const DirDef *item2); +typedef std::vector<DirDef*> DirList; -/** - * 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); +bool compareDirDefs(const DirDef *item1, const DirDef *item2); /** A model of a directory symbol. */ class DirDef : virtual public Definition @@ -90,7 +80,7 @@ class DirDef : virtual public Definition }; /** Class representing a pair of FileDef objects */ -class FilePair +class FilePair { public: FilePair(FileDef *src,FileDef *dst) : m_src(src), m_dst(dst) {} @@ -133,7 +123,7 @@ class UsedDir class DirRelation { public: - DirRelation(const QCString &name,const DirDef *src,UsedDir *dst) + DirRelation(const QCString &name,const DirDef *src,UsedDir *dst) : m_name(name), m_src(src), m_dst(dst) {} const DirDef *source() const { return m_src; } UsedDir *destination() const { return m_dst; } diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 5c1f9e1..8121657 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -122,7 +122,7 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd) { tmp_url+="#"+def->anchor(); } - addCollaborationMember( def, tmp_url, DotGroupCollaboration::tclass ); + addCollaborationMember( def, tmp_url, DotGroupCollaboration::tclass ); } } @@ -134,7 +134,7 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd) for (;(def=defli.current());++defli) { tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension; - addCollaborationMember( def, tmp_url, DotGroupCollaboration::tnamespace ); + addCollaborationMember( def, tmp_url, DotGroupCollaboration::tnamespace ); } } @@ -146,7 +146,7 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd) for (;(def=defli.current());++defli) { tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension; - addCollaborationMember( def, tmp_url, DotGroupCollaboration::tfile ); + addCollaborationMember( def, tmp_url, DotGroupCollaboration::tfile ); } } @@ -158,17 +158,17 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd) for (;(def=defli.current());++defli) { tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension; - addCollaborationMember( def, tmp_url, DotGroupCollaboration::tpages ); + addCollaborationMember( def, tmp_url, DotGroupCollaboration::tpages ); } } // Add directories - if ( gd->getDirs() && gd->getDirs()->size() ) + if ( !gd->getDirs().empty() ) { - for(const auto def : *(gd->getDirs())) + for(const auto def : gd->getDirs()) { tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension; - addCollaborationMember( def, tmp_url, DotGroupCollaboration::tdir ); + addCollaborationMember( def, tmp_url, DotGroupCollaboration::tdir ); } } } @@ -186,7 +186,7 @@ void DotGroupCollaboration::addMemberList( MemberList* ml ) } } -DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( +DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( DotNode* _pNStart, DotNode* _pNEnd, EdgeType _eType, const QCString& _label, const QCString& _url ) { @@ -195,9 +195,9 @@ DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( Edge* newEdge = 0; for ( lli.toFirst(); (newEdge=lli.current()); ++lli) { - if ( newEdge->pNStart==_pNStart && + if ( newEdge->pNStart==_pNStart && newEdge->pNEnd==_pNEnd && - newEdge->eType==_eType + newEdge->eType==_eType ) { // edge already found break; @@ -207,7 +207,7 @@ DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( { newEdge = new Edge(_pNStart,_pNEnd,_eType); m_edges.append( newEdge ); - } + } if (!_label.isEmpty()) { @@ -217,7 +217,7 @@ DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( return newEdge; } -void DotGroupCollaboration::addCollaborationMember( +void DotGroupCollaboration::addCollaborationMember( const Definition* def, QCString& url, EdgeType eType ) { // Create group nodes @@ -302,8 +302,8 @@ void DotGroupCollaboration::Edge::write( FTextStream &t ) const "darkorchid3" ,"orange" ,"blueviolet" - ,"darkgreen" - ,"firebrick4" + ,"darkgreen" + ,"firebrick4" ,"grey75" ,"midnightblue" }; @@ -339,7 +339,7 @@ void DotGroupCollaboration::Edge::write( FTextStream &t ) const const int maxLabels = 10; for( lli.toFirst(); (link=lli.current()) && count<maxLabels; ++lli,++count) { - if (first) first=FALSE; else t << "\\n"; + if (first) first=FALSE; else t << "\\n"; t << DotNode::convertLabel(link->label); } if (count==maxLabels) t << "\\n..."; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 41d7b0a..efd8294 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11172,6 +11172,17 @@ void parseInput() vhdlCorrectMemberProperties(); g_s.end(); + if (Config_getBool(SORT_GROUP_NAMES)) + { + Doxygen::groupSDict->sort(); + GroupSDict::Iterator gli(*Doxygen::groupSDict); + GroupDef *gd; + for (gli.toFirst();(gd=gli.current());++gli) + { + gd->sortSubGroups(); + } + } + } void generateOutput() @@ -11349,17 +11360,6 @@ void generateOutput() generateDirDocs(*g_outputList); g_s.end(); - if (Config_getBool(SORT_GROUP_NAMES)) - { - Doxygen::groupSDict->sort(); - GroupSDict::Iterator gli(*Doxygen::groupSDict); - GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) - { - gd->sortSubGroups(); - } - } - if (g_outputList->count()>0) { writeIndexHierarchy(*g_outputList); diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 162f460..3b4d537 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -64,7 +64,7 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual void addGroup(const GroupDef *def); virtual void addPage(PageDef *def); virtual void addExample(const PageDef *def); - virtual void addDir(DirDef *const dd); + virtual void addDir(DirDef *dd); virtual bool insertMember(MemberDef *def,bool docOnly=FALSE); virtual void removeMember(MemberDef *md); virtual bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group @@ -101,7 +101,7 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual NamespaceSDict * getNamespaces() const { return m_namespaceSDict; } virtual GroupList * getSubGroups() const { return m_groupList; } virtual PageSDict * getPages() const { return m_pageDict; } - virtual DirList * getDirs() const { return m_dirList; } + virtual const DirList & getDirs() const { return m_dirList; } virtual PageSDict * getExamples() const { return m_exampleDict; } virtual bool hasDetailedDescription() const; virtual void sortSubGroups(); @@ -141,7 +141,7 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef GroupList * m_groupList; // list of sub groups. PageSDict * m_pageDict; // list of pages in the group PageSDict * m_exampleDict; // list of examples in the group - DirList * m_dirList; // list of directories in the group + DirList m_dirList; // list of directories in the group MemberList * m_allMemberList; MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap; Definition * m_groupScope; @@ -169,7 +169,6 @@ GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t, m_namespaceSDict = new NamespaceSDict(17); m_pageDict = new PageSDict(17); m_exampleDict = new PageSDict(17); - m_dirList = new DirList; if (refFileName) { m_fileName=stripExtension(refFileName); @@ -199,7 +198,6 @@ GroupDefImpl::~GroupDefImpl() delete m_exampleDict; delete m_allMemberList; delete m_memberGroupSDict; - delete m_dirList; } void GroupDefImpl::setGroupTitle( const char *t ) @@ -324,15 +322,10 @@ bool GroupDefImpl::addNamespace(const NamespaceDef *def) return FALSE; } -void GroupDefImpl::addDir(DirDef *const def) +void GroupDefImpl::addDir(DirDef *def) { if (def->isHidden()) return; - if (Config_getBool(SORT_BRIEF_DOCS)) - { - sortInDirList(*m_dirList, def); - } - else - m_dirList->push_back(def); + m_dirList.push_back(def); } void GroupDefImpl::addPage(PageDef *def) @@ -755,14 +748,11 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupDirs: { - if (m_dirList) + for(const auto dd : m_dirList) { - for(const auto dd : *m_dirList) + if (dd->isLinkableInProject()) { - if (dd->isLinkableInProject()) - { - tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>" << endl; - } + tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>" << endl; } } } @@ -1022,13 +1012,13 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) { // write list of directories - if (m_dirList->size()>0) + if (!m_dirList.empty()) { ol.startMemberHeader("dirs"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - for(const auto dd : *m_dirList) + for(const auto dd : m_dirList) { if (!dd->hasDocumentation()) continue; ol.startMemberDeclaration(); @@ -1158,7 +1148,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaceSDict->declVisible()) || (lde->kind()==LayoutDocEntry::GroupFiles && m_fileList->count()>0) || (lde->kind()==LayoutDocEntry::GroupNestedGroups && m_groupList->count()>0) || - (lde->kind()==LayoutDocEntry::GroupDirs && m_dirList->size()>0) + (lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty()) ) { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; @@ -1691,6 +1681,10 @@ void GroupDefImpl::sortMemberLists() { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } + if (Config_getBool(SORT_BRIEF_DOCS)) + { + std::sort(m_dirList.begin(), m_dirList.end(), compareDirDefs); + } } MemberList *GroupDefImpl::getMemberList(MemberListType lt) const diff --git a/src/groupdef.h b/src/groupdef.h index b6a200d..82fa004 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -61,7 +61,7 @@ class GroupDef : virtual public Definition virtual void addGroup(const GroupDef *def) = 0; virtual void addPage(PageDef *def) = 0; virtual void addExample(const PageDef *def) = 0; - virtual void addDir(DirDef *const dd) = 0; + virtual void addDir(DirDef *dd) = 0; virtual bool insertMember(MemberDef *def,bool docOnly=FALSE) = 0; virtual void removeMember(MemberDef *md) = 0; virtual bool findGroup(const GroupDef *def) const = 0; @@ -98,7 +98,7 @@ class GroupDef : virtual public Definition virtual NamespaceSDict * getNamespaces() const = 0; virtual GroupList * getSubGroups() const = 0; virtual PageSDict * getPages() const = 0; - virtual DirList * getDirs() const = 0; + virtual const DirList & getDirs() const = 0; virtual PageSDict * getExamples() const = 0; virtual bool hasDetailedDescription() const = 0; virtual void sortSubGroups() = 0; diff --git a/src/index.cpp b/src/index.cpp index 07dda3e..db58129 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -3988,7 +3988,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* numSubItems += gd->getNamespaces()->count(); numSubItems += gd->getClasses()->count(); numSubItems += gd->getFiles()->count(); - numSubItems += gd->getDirs()->size(); + numSubItems += gd->getDirs().size(); numSubItems += gd->getPages()->count(); } @@ -4121,7 +4121,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* } else if (lde->kind()==LayoutDocEntry::GroupDirs && addToIndex) { - for(const auto dd : *(gd->getDirs())) + for (const auto dd : gd->getDirs()) { if (dd->isVisible()) { diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 957095a..f767eab 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1336,20 +1336,15 @@ static void writeInnerFiles(const FileList *fl, struct Refid outer_refid) } } -static void writeInnerDirs(const DirList *dl, struct Refid outer_refid) +static void writeInnerDirs(const DirList &dl, struct Refid outer_refid) { - if (dl) + for (const auto subdir : dl) { - QListIterator<DirDef> subdirs(*dl); - const DirDef *subdir; - for (subdirs.toFirst();(subdir=subdirs.current());++subdirs) - { - struct Refid inner_refid = insertRefid(subdir->getOutputFileBase()); + struct Refid inner_refid = insertRefid(subdir->getOutputFileBase()); - bindIntParameter(contains_insert,":inner_rowid", inner_refid.rowid); - bindIntParameter(contains_insert,":outer_rowid", outer_refid.rowid); - step(contains_insert); - } + bindIntParameter(contains_insert,":inner_rowid", inner_refid.rowid); + bindIntParameter(contains_insert,":outer_rowid", outer_refid.rowid); + step(contains_insert); } } @@ -2423,7 +2418,7 @@ static void generateSqlite3ForDir(const DirDef *dd) step(compounddef_insert); // + files - writeInnerDirs(&dd->subDirs(),refid); + writeInnerDirs(dd->subDirs(),refid); // + files writeInnerFiles(dd->getFiles(),refid); @@ -2516,12 +2511,14 @@ static sqlite3* openDbConnection() if (rc != SQLITE_OK) { err("sqlite3_initialize failed\n"); + return NULL; } if (stat (outputDirectory+"/doxygen_sqlite3.db", &buf) == 0) { - err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate. Aborting!\n"); + err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n"); + return NULL; } rc = sqlite3_open_v2( |