diff options
Diffstat (limited to 'src')
59 files changed, 849 insertions, 895 deletions
diff --git a/src/cite.cpp b/src/cite.cpp index 3e3eb43..53ab9b5 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -310,7 +310,7 @@ void CiteDict::generatePage() const thisDir.remove(bib2xhtmlFile); while (!tempFiles.isEmpty()) { - QCString *s=tempFiles.take(); + QCString *s=tempFiles.take(0); thisDir.remove(*s); } } diff --git a/src/classdef.cpp b/src/classdef.cpp index 7e8b331..b8501ad 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -897,8 +897,9 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, for (spi.toFirst();(al=spi.current());++spi) { ol.docify("template<"); - Argument *a=al->first(); - while (a) + QListIterator<Argument> ali(*al); + Argument *a; + while ((a=ali.current())) { ol.docify(a->type); if (!a->name.isEmpty()) @@ -911,7 +912,8 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, ol.docify(" = "); ol.docify(a->defval); } - a=al->next(); + ++ali; + a=ali.current(); if (a) ol.docify(", "); } ol.docify(">"); @@ -1084,8 +1086,9 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.parseText(generatedFromFiles()); bool first=TRUE; - FileDef *fd = m_impl->files.first(); - while (fd) + QListIterator<FileDef> li(m_impl->files); + FileDef *fd; + for (;(fd=li.current());++li) { if (first) { @@ -1139,8 +1142,6 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.popGeneratorState(); ol.endItemListItem(); - - fd=m_impl->files.next(); } if (!first) ol.endItemList(); @@ -1153,22 +1154,20 @@ int ClassDef::countInheritanceNodes() BaseClassDef *ibcd; if (m_impl->inheritedBy) { - ibcd=m_impl->inheritedBy->first(); - while (ibcd) + BaseClassListIterator it(*m_impl->inheritedBy); + for (;(ibcd=it.current());++it) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_impl->inheritedBy->next(); } } if (m_impl->inherits) { - ibcd=m_impl->inherits->first(); - while (ibcd) + BaseClassListIterator it(*m_impl->inherits); + for (;(ibcd=it.current());++it) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_impl->inherits->next(); } } return count; @@ -2228,8 +2227,9 @@ void ClassDef::writeMemberList(OutputList &ol) MemberNameInfo *mni; for (mnii.toFirst();(mni=mnii.current());++mnii) { - MemberInfo *mi=mni->first(); - while (mi) + MemberNameInfoIterator it(*mni); + MemberInfo *mi; + for (;(mi=it.current());++it) { MemberDef *md=mi->memberDef; ClassDef *cd=md->getClassDef(); @@ -2425,7 +2425,6 @@ void ClassDef::writeMemberList(OutputList &ol) ol.writeString("</tr>\n"); } } - mi=mni->next(); } } //ol.endItemList(); @@ -3732,7 +3731,7 @@ void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const } QCString ClassDef::qualifiedNameWithTemplateParameters( - QList<ArgumentList> *actualParams) const + QList<ArgumentList> *actualParams,int *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES"); @@ -3744,7 +3743,7 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( if (d->definitionType()==Definition::TypeClass) { ClassDef *cd=(ClassDef *)d; - scName = cd->qualifiedNameWithTemplateParameters(actualParams); + scName = cd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } else if (!hideScopeNames) { @@ -3769,13 +3768,14 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( ArgumentList *al=0; if (templateArguments()) { - if (actualParams && (al=actualParams->current())) + if (actualParams && *actualParamIndex<(int)actualParams->count()) { + al = actualParams->at(*actualParamIndex); if (!isSpecialization) { scName+=tempArgListToString(al); } - actualParams->next(); + (*actualParamIndex)++; } else { @@ -3897,14 +3897,14 @@ MemberList *ClassDef::createMemberList(MemberListType lt) MemberList *ClassDef::getMemberList(MemberListType lt) { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = m_impl->memberLists.next(); } return 0; } @@ -3923,11 +3923,11 @@ void ClassDef::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief) void ClassDef::sortMemberLists() { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_impl->memberLists.next(); } } @@ -4441,11 +4441,11 @@ MemberDef *ClassDef::isSmartPointer() const void ClassDef::reclassifyMember(MemberDef *md,MemberType t) { md->setMemberType(t); - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { ml->remove(md); - ml = m_impl->memberLists.next(); } insertMember(md); } @@ -4530,11 +4530,11 @@ void ClassDef::setTagLessReference(ClassDef *cd) void ClassDef::removeMemberFromLists(MemberDef *md) { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { ml->remove(md); - ml = m_impl->memberLists.next(); } } diff --git a/src/classdef.h b/src/classdef.h index 6ce1e73..35c093c 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -246,7 +246,7 @@ class ClassDef : public Definition void getTemplateParameterLists(QList<ArgumentList> &lists) const; QCString qualifiedNameWithTemplateParameters( - QList<ArgumentList> *actualParams=0) const; + QList<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; /** Returns TRUE if there is at least one pure virtual member in this * class. @@ -532,11 +532,11 @@ class BaseClassList : public QList<BaseClassDef> { public: ~BaseClassList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const BaseClassDef *item1,const BaseClassDef *item2) const { - ClassDef *c1=((BaseClassDef *)item1)->classDef; - ClassDef *c2=((BaseClassDef *)item2)->classDef; - if (c1==0 || c2==0) + const ClassDef *c1=item1->classDef; + const ClassDef *c2=item2->classDef; + if (c1==0 || c2==0) return FALSE; else return qstricmp(c1->name(),c2->name()); diff --git a/src/classlist.cpp b/src/classlist.cpp index f19c374..877e993 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -33,30 +33,26 @@ ClassList::~ClassList() { } -static int compItems(void *item1,void *item2) +static int compItems(const ClassDef *c1,const ClassDef *c2) { - ClassDef *c1=(ClassDef *)item1; - ClassDef *c2=(ClassDef *)item2; static bool b = Config_getBool("SORT_BY_SCOPE_NAME"); //printf("compItems: %d %s<->%s\n",b,c1->name().data(),c2->name().data()); if (b) { - return qstricmp(c1->name(), - c2->name()); + return qstricmp(c1->name(), c2->name()); } else { - return qstricmp(c1->className(), - c2->className()); + return qstricmp(c1->className(), c2->className()); } } -int ClassList::compareItems(QCollection::Item item1, QCollection::Item item2) +int ClassList::compareValues(const ClassDef *item1, const ClassDef *item2) const { return compItems(item1,item2); } -int ClassSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int ClassSDict::compareValues(const ClassDef *item1, const ClassDef *item2) const { return compItems(item1,item2); } diff --git a/src/classlist.h b/src/classlist.h index adc781c..6a4d09c 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -28,12 +28,13 @@ class Definition; /** A list of ClassDef objects. */ class ClassList : public QList<ClassDef> -{ +{ public: ClassList(); ~ClassList(); - - int compareItems(QCollection::Item item1,QCollection::Item item2); + + private: + int compareValues(const ClassDef *item1,const ClassDef *item2) const; }; /** An iterator for ClassDef objects in a ClassList. */ @@ -57,11 +58,12 @@ class ClassSDict : public SDict<ClassDef> public: ClassSDict(int size=17) : SDict<ClassDef>(size) {} ~ClassSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); - void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, + void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, const char *header=0,bool localNames=FALSE); - void writeDocumentation(OutputList &ol,Definition *container=0); - bool declVisible(const ClassDef::CompoundType *filter=0) const; + void writeDocumentation(OutputList &ol,Definition *container=0); + bool declVisible(const ClassDef::CompoundType *filter=0) const; + private: + int compareValues(const ClassDef *item1,const ClassDef *item2) const; }; class GenericsCollection : public QIntDict<ClassDef> @@ -299,21 +299,18 @@ ClassDef *VariableContext::findVariable(const QCString &name) { if (name.isEmpty()) return 0; ClassDef *result = 0; - //QListIterator<Scope> sli(m_scopes); + QListIterator<Scope> sli(m_scopes); Scope *scope; QCString key = name; // search from inner to outer scope - scope = m_scopes.last(); - //for (sli.toLast();(scope=sli.current());--sli) - while (scope) + for (sli.toLast();(scope=sli.current());--sli) { result = scope->find(key); - if (result) + if (result) { DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); return result; } - scope = m_scopes.prev(); } // nothing found -> also try the global scope result=m_globalScope.find(name); @@ -671,9 +668,10 @@ static void setParameterList(MemberDef *md) { g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; ArgumentList *al = md->argumentList(); - if (al==0) return; - Argument *a = al->first(); - while (a) + if (al==0) return; + ArgumentListIterator it(*al); + Argument *a; + for (;(a=it.current());++it) { g_parmName = a->name.copy(); g_parmType = a->type.copy(); @@ -684,7 +682,6 @@ static void setParameterList(MemberDef *md) g_parmType.stripPrefix("const "); g_parmType=g_parmType.stripWhiteSpace(); g_theVarContext.addVariable(g_parmType,g_parmName); - a = al->next(); } } @@ -803,13 +800,14 @@ static MemberDef *setCallContextForVar(const QCString &name) } else if (mn->count()>1) // global defined more than once { - MemberDef *md=mn->first(); - while (md) + MemberNameIterator it(*mn); + MemberDef *md; + for (;(md=it.current());++it) { //printf("mn=%p md=%p md->getBodyDef()=%p g_sourceFileDef=%p\n", // mn,md, // md->getBodyDef(),g_sourceFileDef); - + // in case there are multiple members we could link to, we // only link to members if defined in the same file or // defined as external. @@ -821,7 +819,6 @@ static MemberDef *setCallContextForVar(const QCString &name) //printf("returning member %s in source file %s\n",md->name().data(),g_sourceFileDef->name().data()); return md; } - md=mn->next(); } return 0; } diff --git a/src/config.l b/src/config.l index 05df386..22deb4f 100644 --- a/src/config.l +++ b/src/config.l @@ -847,11 +847,11 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) { t << convertToComment(m_header,""); } - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->writeTemplate(t,sl,upd); - option = m_options->next(); } /* print last lines of user comment that were at the end of the file */ if (m_userComment) @@ -863,11 +863,11 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) void Config::convertStrToVal() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->convertStrToVal(); - option = m_options->next(); } } @@ -1003,11 +1003,11 @@ void ConfigEnum::substEnvVars() void Config::substituteEnvironmentVars() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->substEnvVars(); - option = m_options->next(); } } @@ -1577,16 +1577,15 @@ void Config::check() void Config::init() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->init(); - option = m_options->next(); } // sanity check if all depends relations are valid - option = m_options->first(); - while (option) + for (it.toFirst();(option=it.current());++it) { QCString depName = option->dependsOn(); if (!depName.isEmpty()) @@ -1599,7 +1598,6 @@ void Config::init() exit(1); } } - option = m_options->next(); } } diff --git a/src/dbusxmlscanner.cpp b/src/dbusxmlscanner.cpp index 8b8df0d..e841428 100644 --- a/src/dbusxmlscanner.cpp +++ b/src/dbusxmlscanner.cpp @@ -252,7 +252,7 @@ public: COND_DOC_ERROR(idx < 0, QString("Anonymous namespace found.")); m_namespaceStack.append(openNamespace(attributes.value(idx))); - openScopes(m_namespaceStack.last()); + openScopes(m_namespaceStack.getLast()); } if (EXTENSION("struct")) @@ -291,7 +291,7 @@ public: m_currentEntry->type = getType(attributes).utf8(); QString type(getDBusType(m_currentEntry->type)); - m_structStack.last()->type.append(type.utf8()); + m_structStack.getLast()->type.append(type.utf8()); } if (EXTENSION("enum") || EXTENSION("flagset")) @@ -348,9 +348,9 @@ public: // Clean up elements stack: // Since we made sure to get the elements in the proper order when // adding we do not need to do so again here. - COND_DOC_ERROR(m_elementStack.last()->element != qName.utf8(), + COND_DOC_ERROR(m_elementStack.getLast()->element != qName.utf8(), QString("Malformed XML: Unexpected closing element found."). - arg(m_elementStack.last()->element).utf8()); + arg(m_elementStack.getLast()->element).utf8()); m_elementStack.removeLast(); // Interface: @@ -389,7 +389,7 @@ public: if (EXTENSION("namespace")) { - Entry * current = m_namespaceStack.last(); + Entry * current = m_namespaceStack.getLast(); CONDITION(!current, "end of namespace without start."); m_namespaceStack.removeLast(); @@ -399,7 +399,7 @@ public: if (EXTENSION("struct")) { - StructData * data = m_structStack.last(); + StructData * data = m_structStack.getLast(); CONDITION(!data, "end of struct without start."); data->entry->endBodyLine = lineNumber(); @@ -418,7 +418,7 @@ public: if (EXTENSION("member")) { - StructData * data = m_structStack.last(); + StructData * data = m_structStack.getLast(); CONDITION(!data, "end of member outside struct."); data->entry->addSubEntry(m_currentEntry); } @@ -625,7 +625,7 @@ private: QCString scoped_name; if (!m_scopeStack.isEmpty()) { - scoped_name = m_scopeStack.last()->scope->name; + scoped_name = m_scopeStack.getLast()->scope->name; scoped_name.append("::"); } if (!type.isEmpty()) @@ -686,7 +686,7 @@ private: Entry * current_namespace = openNamespace(scope); if (!m_scopeStack.isEmpty()) - { m_scopeStack.last()->scope->addSubEntry(current_namespace); } + { m_scopeStack.getLast()->scope->addSubEntry(current_namespace); } m_scopeStack.append(new ScopeData(current_namespace, m_scopeCount)); } @@ -699,7 +699,7 @@ private: object->name = scoped_name; if (!m_scopeStack.isEmpty()) - { m_scopeStack.last()->scope->addSubEntry(object); } + { m_scopeStack.getLast()->scope->addSubEntry(object); } m_scopeStack.append(new ScopeData(object, m_scopeCount)); ++m_scopeCount; @@ -721,13 +721,13 @@ private: void closeScopes() { - const int current_scope_count(m_scopeStack.last()->count); + const int current_scope_count(m_scopeStack.getLast()->count); // Do not close the root scope. if (current_scope_count == 0) { return; } - while (current_scope_count == m_scopeStack.last()->count) + while (current_scope_count == m_scopeStack.getLast()->count) { m_scopeStack.removeLast(); } } diff --git a/src/define.h b/src/define.h index 843ecec..bc758c0 100644 --- a/src/define.h +++ b/src/define.h @@ -54,9 +54,10 @@ class DefineList : public QList<Define> public: DefineList() : QList<Define>() {} ~DefineList() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const Define *d1,const Define *d2) const { - return qstricmp(((Define *)i1)->name,((Define *)i2)->name); + return qstricmp(d1->name,d2->name); } }; @@ -67,12 +68,12 @@ class DefineName : public QList<Define> DefineName(const char *n) : QList<Define>() { name=n; } ~DefineName() {} const char *nameString() const { return name; } - int compareItems(QCollection::Item i1,QCollection::Item i2) + + private: + int compareValues(const Define *d1,const Define *d2) const { - return qstricmp(((Define *)i1)->name,((Define *)i2)->name); + return qstricmp(d1->name,d2->name); } - - private: QCString name; }; @@ -82,10 +83,10 @@ class DefineNameList : public QList<DefineName> public: DefineNameList() : QList<DefineName>() {} ~DefineNameList() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const DefineName *n1,const DefineName *n2) const { - return qstricmp(((DefineName *)i1)->nameString(), - ((DefineName *)i2)->nameString()); + return qstricmp(n1->nameString(),n2->nameString()); } }; diff --git a/src/definition.cpp b/src/definition.cpp index 46147fc..8be2217 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -417,8 +417,9 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) { if (!anchorList) return; //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); - SectionInfo *si=anchorList->first(); - while (si) + QListIterator<SectionInfo> it(*anchorList); + SectionInfo *si; + for (;(si=it.current());++it) { //printf("Add section `%s' to definition `%s'\n", // si->label.data(),name().data()); @@ -429,7 +430,7 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) gsi = new SectionInfo(*si); Doxygen::sectionDict->append(si->label,gsi); } - if (m_impl->sectionDict==0) + if (m_impl->sectionDict==0) { m_impl->sectionDict = new SectionDict(17); } @@ -438,7 +439,6 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) m_impl->sectionDict->append(gsi->label,gsi); gsi->definition = this; } - si=anchorList->next(); } } diff --git a/src/definition.h b/src/definition.h index f444cc5..b798e14 100644 --- a/src/definition.h +++ b/src/definition.h @@ -371,11 +371,9 @@ class DefinitionList : public QList<Definition>, public DefinitionIntf public: ~DefinitionList() {} DefType definitionType() const { return TypeSymbolList; } - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const Definition *item1,const Definition *item2) const { - return qstricmp(((Definition *)item1)->name(), - ((Definition *)item2)->name() - ); + return qstricmp(item1->name(),item2->name()); } }; diff --git a/src/diagram.cpp b/src/diagram.cpp index 80d0646..a7d2aa4 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -209,18 +209,17 @@ static uint virtToMask(Specifier p) // pre: dil is not empty static Protection getMinProtectionLevel(DiagramItemList *dil) { - DiagramItem *di=dil->first(); + QListIterator<DiagramItem> it(*dil); + DiagramItem *di=it.current(); Protection result=di->protection(); - di=dil->next(); - while (di) + for (++it;(di=it.current());++it) { Protection p=di->protection(); - if (p!=result) + if (p!=result) { if (result==Protected && p==Public) result=p; else if (result==Private) result=p; - } - di=dil->next(); + } } return result; } @@ -371,12 +370,12 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, if (bcl) { /* there are base/sub classes */ - BaseClassDef *bcd=bcl->first(); - while (bcd) + BaseClassListIterator it(*bcl); + BaseClassDef *bcd; + for (;(bcd=it.current());++it) { ClassDef *ccd=bcd->classDef; if (ccd && ccd->isVisibleInHierarchy() /*&& !ccd->visited*/) count++; - bcd=bcl->next(); } } if (count>0 && (prot!=Private || !doBases)) @@ -392,8 +391,9 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, row=diagram->at(level+1); } /* insert base classes in the next row */ - BaseClassDef *bcd=bcl->first(); - while (bcd) + BaseClassListIterator it(*bcl); + BaseClassDef *bcd; + for (;(bcd=it.current());++it) { ClassDef *ccd=bcd->classDef; if (ccd && ccd->isVisibleInHierarchy() /*&& !ccd->visited*/) @@ -402,7 +402,6 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, doBases?bcd->virt:Normal, doBases?bcd->templSpecifiers.data():""); } - bcd=bcl->next(); } } } @@ -423,12 +422,12 @@ TreeDiagram::~TreeDiagram() void TreeDiagram::moveChildren(DiagramItem *root,int dx) { DiagramItemList *dil=root->getChildren(); - DiagramItem *di=dil->first(); - while (di) + QListIterator<DiagramItem> it(*dil); + DiagramItem *di; + for (;(di=it.current());++it) { di->move(dx,0); moveChildren(di,dx); - di=dil->next(); } } @@ -463,11 +462,11 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) } // recurse to children - DiagramItem *di=dil->first(); - while (di && !moved && !di->isInList()) + QListIterator<DiagramItem> it(*dil); + DiagramItem *di; + for (;(di=it.current()) && !moved && !di->isInList();++it) { moved = layoutTree(di,r+1); - di=dil->next(); } } return moved; @@ -475,47 +474,49 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) void TreeDiagram::computeLayout() { - DiagramRow *row=first(); - while (row && row->count()<maxTreeWidth) row=next(); + QListIterator<DiagramRow> it(*this); + DiagramRow *row; + for (;(row=it.current()) && row->count()<maxTreeWidth;++it) {} if (row) { //printf("computeLayout() list row at %d\n",row->number()); - DiagramItem *di=row->first(); + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; DiagramItem *opi=0; int delta=0; bool first=TRUE; - while (di) + for (;(di=rit.current());++rit) { DiagramItem *pi=di->parentItem(); if (pi==opi && !first) { delta-=gridWidth; } first = pi!=opi; opi=pi; - di->move(delta,0); // collapse all items in the same + di->move(delta,0); // collapse all items in the same // list (except the first) di->putInList(); - di=row->next(); } } // re-organize the diagram items DiagramItem *root=getFirst()->getFirst(); while (layoutTree(root,0)) { } - + // move first items of the lists if (row) { - DiagramItem *di=row->first(); - while (di) + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; + while ((di=rit.current())) { DiagramItem *pi=di->parentItem(); if (pi->getChildren()->count()>1) { di->move(gridWidth,0); - while (di && di->parentItem()==pi) di=row->next(); + while (di && di->parentItem()==pi) { ++rit; di=rit.current(); } } else { - di=row->next(); + ++rit; } } } @@ -525,24 +526,25 @@ uint TreeDiagram::computeRows() { //printf("TreeDiagram::computeRows()=%d\n",count()); int count=0; - DiagramRow *row=first(); - while (row && !row->getFirst()->isInList()) + QListIterator<DiagramRow> it(*this); + DiagramRow *row; + for (;(row=it.current()) && !row->getFirst()->isInList();++it) { count++; - row=next(); } //printf("count=%d row=%p\n",count,row); if (row) { int maxListLen=0; int curListLen=0; - DiagramItem *di=row->first(),*opi=0; - while (di) + DiagramItem *opi=0; + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; + for (;(di=rit.current());++rit) { if (di->parentItem()!=opi) curListLen=1; else curListLen++; if (curListLen>maxListLen) maxListLen=curListLen; opi=di->parentItem(); - di=row->next(); } //printf("maxListLen=%d\n",maxListLen); count+=maxListLen; @@ -550,43 +552,22 @@ uint TreeDiagram::computeRows() return count; } -#if 0 -uint TreeDiagram::computeCols() -{ - uint count=0; - DiagramRow *row=first(); - while (row && !row->getFirst()->isInList()) - { - if (row->count()>count) count=row->count(); - row=next(); - } - if (row) - { - row=prev(); - uint cols=row->count(); - if (row->getLast()->getChildren()->count()>1) cols++; - if (cols>count) count=cols; - } - return count; -}; -#endif - void TreeDiagram::computeExtremes(uint *maxLabelLen,uint *maxXPos) { uint ml=0,mx=0; - DiagramRow *dr=first(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; bool done=FALSE; - while (dr && !done) + for (;(dr=it.current()) && !done;++it) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { if (di->isInList()) done=TRUE; if (maxXPos) mx=QMAX(mx,(uint)di->xPos()); if (maxLabelLen) ml=QMAX(ml,Image::stringLength(di->label())); - di=dr->next(); } - dr=next(); } if (maxLabelLen) *maxLabelLen=ml; if (maxXPos) *maxXPos=mx; @@ -599,20 +580,22 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, QCString relPath, bool generateMap) { - DiagramRow *dr=first(); - if (!doBase) dr=next(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; + if (!doBase) ++it; bool done=FALSE; bool firstRow = doBase; - while (dr && !done) + for (;(dr=it.current()) && !done;++it) { int x=0,y=0; float xf=0.0f,yf=0.0f; - DiagramItem *di=dr->first(); + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di = rit.current(); if (di->isInList()) // put boxes in a list { DiagramItem *opi=0; - if (doBase) di=dr->last(); - while (di) + if (doBase) rit.toLast(); else rit.toFirst(); + while ((di=rit.current())) { if (di->parentItem()==opi) { @@ -673,13 +656,13 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, writeVectorBox(t,di,xf,yf,di->getChildren()->count()>0); } - if (doBase) di=dr->prev(); else di=dr->next(); + if (doBase) --rit; else ++rit; } done=TRUE; } else // draw a tree of boxes { - while (di) + for (rit.toFirst();(di=rit.current());++rit) { if (bitmap) { @@ -714,11 +697,8 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, } writeVectorBox(t,di,xf,yf); } - - di=dr->next(); } } - dr=next(); firstRow=FALSE; } } @@ -728,16 +708,18 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, uint baseRows,uint superRows, uint cellWidth,uint cellHeight) { - DiagramRow *dr=first(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; bool done=FALSE; - while (dr && !done) // for each row + for (;(dr=it.current()) && !done;++it) // for each row { - DiagramItem *di=dr->first(); + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di = rit.current(); if (di->isInList()) // row consists of list connectors { int x=0,y=0,ys=0; float xf=0.0f,yf=0.0f,ysf=0.0f; - while (di) + for (;(di=rit.current());++rit) { DiagramItem *pi=di->parentItem(); DiagramItemList *dil=pi->getChildren(); @@ -849,7 +831,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, yf -= 1.0f; } } - di=dr->next(); + ++rit; di=rit.current(); } // add last horizonal line and a vertical connection line if (bitmap) @@ -895,13 +877,12 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } } - di=dr->next(); } done=TRUE; // the tree is drawn now } else // normal tree connector { - while (di) + for (;(di=rit.current());++rit) { int x=0,y=0; DiagramItemList *dil = di->getChildren(); @@ -988,8 +969,8 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } /* write input line */ - DiagramItem *first = dil->first(); - DiagramItem *last = dil->last(); + DiagramItem *first = dil->getFirst(); + DiagramItem *last = dil->getLast(); if (first!=last && !first->isInList()) /* connect with all base classes */ { if (bitmap) @@ -1027,9 +1008,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } } - di=dr->next(); } - dr=next(); } } } @@ -1053,8 +1032,8 @@ ClassDiagram::ClassDiagram(ClassDef *root) clearVisitFlags(); super = new TreeDiagram(root,FALSE); super->computeLayout(); - DiagramItem *baseItem = base->first()->first(); - DiagramItem *superItem = super->first()->first(); + DiagramItem *baseItem = base->getFirst()->getFirst(); + DiagramItem *superItem = super->getFirst()->getFirst(); int xbase = baseItem->xPos(); int xsuper = superItem->xPos(); if (xbase>xsuper) @@ -1307,35 +1286,34 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, t << "boxfont setfont\n"; t << "1 boundaspect scale\n"; - + bool done=FALSE; - DiagramRow *dr=base->first(); - while (dr && !done) + QListIterator<DiagramRow> bit(*base); + DiagramRow *dr; + for (;(dr=bit.current()) && !done;++bit) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { done=di->isInList(); t << "(" << di->label() << ") cw\n"; - di=dr->next(); } - dr=base->next(); } - dr=super->first(); - dr=super->next(); + QListIterator<DiagramRow> sit(*super); + ++sit; done=FALSE; - while (dr && !done) + for (;(dr=sit.current()) && !done;++sit) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { done=di->isInList(); t << "(" << di->label() << ") cw\n"; - di=dr->next(); } - dr=super->next(); } - + t << "/boxwidth boxwidth marginwidth 2 mul add def\n" << "/xspacing boxwidth distx add def\n" << "/yspacing boxheight disty add def\n" diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 5df047a..b7a2a92 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -224,8 +224,9 @@ void DirDef::writeSubDirList(OutputList &ol) ol.parseText(theTranslator->trDir(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - DirDef *dd=m_subdirs.first(); - while (dd) + QListIterator<DirDef> it(m_subdirs); + DirDef *dd; + for (;(dd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); @@ -250,7 +251,6 @@ void DirDef::writeSubDirList(OutputList &ol) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - dd=m_subdirs.next(); } ol.endMemberList(); @@ -266,8 +266,9 @@ void DirDef::writeFileList(OutputList &ol) ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - FileDef *fd=m_fileList->first(); - while (fd) + QListIterator<FileDef> it(*m_fileList); + FileDef *fd; + for (;(fd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); @@ -313,7 +314,6 @@ void DirDef::writeFileList(OutputList &ol) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - fd=m_fileList->next(); } ol.endMemberList(); } @@ -584,10 +584,8 @@ bool DirDef::depGraphIsTrivial() const //---------------------------------------------------------------------- -int FilePairDict::compareItems(QCollection::Item item1,QCollection::Item item2) +int FilePairDict::compareValues(const FilePair *left,const FilePair *right) const { - FilePair *left = (FilePair*)item1; - FilePair *right = (FilePair*)item2; int orderHi = qstricmp(left->source()->name(),right->source()->name()); int orderLo = qstricmp(left->destination()->name(),right->destination()->name()); return orderHi==0 ? orderLo : orderHi; diff --git a/src/dirdef.h b/src/dirdef.h index 8b11b2e..dc2d01e 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -37,7 +37,7 @@ class DirDef; class DirList : public QList<DirDef> { public: - int compareItems(QCollection::Item item1,QCollection::Item item2); + int compareValues(const DirDef *item1,const DirDef *item2) const; }; /** A model of a directory symbol. */ @@ -122,7 +122,8 @@ class FilePairDict : public SDict<FilePair> { public: FilePairDict(int size) : SDict<FilePair>(size) {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const FilePair *item1,const FilePair *item2) const; }; /** Usage information of a directory. */ @@ -160,9 +161,9 @@ class DirRelation UsedDir *m_dst; }; -inline int DirList::compareItems(QCollection::Item item1,QCollection::Item item2) +inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const { - return qstricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName()); + return qstricmp(item1->shortName(),item2->shortName()); } /** A sorted dictionary of DirDef objects. */ @@ -170,9 +171,9 @@ class DirSDict : public SDict<DirDef> { public: DirSDict(int size) : SDict<DirDef>(size) {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const DirDef *item1,const DirDef *item2) const { - return qstricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName()); + return qstricmp(item1->shortName(),item2->shortName()); } }; diff --git a/src/docparser.cpp b/src/docparser.cpp index 4a18b4e..e1e750f 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1719,9 +1719,9 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=0; - if (!children.isEmpty() && children.last()->kind()==DocNode::Kind_Para) + if (!children.isEmpty() && children.getLast()->kind()==DocNode::Kind_Para) { // last child item was a paragraph - lastPar = (DocPara*)children.last(); + lastPar = (DocPara*)children.getLast(); isFirst=FALSE; } do @@ -4654,8 +4654,8 @@ int DocSimpleSect::parse(bool userTitle,bool needsSeparator) } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_Para); - ((DocPara *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_Para); + ((DocPara *)m_children.getLast())->markLast(FALSE); } par->markLast(); if (needsSeparator) m_children.append(new DocSimpleSectSep(this)); @@ -4705,8 +4705,8 @@ int DocSimpleSect::parseXml() } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_Para); - ((DocPara *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_Para); + ((DocPara *)m_children.getLast())->markLast(FALSE); } par->markLast(); m_children.append(par); @@ -4730,14 +4730,14 @@ int DocSimpleSect::parseXml() void DocSimpleSect::appendLinkWord(const QCString &word) { DocPara *p; - if (m_children.isEmpty() || m_children.last()->kind()!=DocNode::Kind_Para) + if (m_children.isEmpty() || m_children.getLast()->kind()!=DocNode::Kind_Para) { p = new DocPara(this); m_children.append(p); } else { - p = (DocPara *)m_children.last(); + p = (DocPara *)m_children.getLast(); // Comma-seperate <seealso> links. p->injectToken(TK_WORD,","); @@ -4881,7 +4881,7 @@ int DocParamList::parseXml(const QCString ¶mName) } else { - m_paragraphs.last()->markLast(FALSE); + m_paragraphs.getLast()->markLast(FALSE); } par->markLast(); m_paragraphs.append(par); @@ -4932,8 +4932,8 @@ int DocParamSect::parse(const QCString &cmdName,bool xmlContext, Direction d) } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_ParamList); - ((DocParamList *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_ParamList); + ((DocParamList *)m_children.getLast())->markLast(FALSE); pl->markLast(); } m_children.append(pl); @@ -4959,12 +4959,12 @@ int DocPara::handleSimpleSection(DocSimpleSect::Type t, bool xmlContext) DocSimpleSect *ss=0; bool needsSeparator = FALSE; if (!m_children.isEmpty() && // previous element - m_children.last()->kind()==Kind_SimpleSect && // was a simple sect - ((DocSimpleSect *)m_children.last())->type()==t && // of same type + m_children.getLast()->kind()==Kind_SimpleSect && // was a simple sect + ((DocSimpleSect *)m_children.getLast())->type()==t && // of same type t!=DocSimpleSect::User) // but not user defined { // append to previous section - ss=(DocSimpleSect *)m_children.last(); + ss=(DocSimpleSect *)m_children.getLast(); needsSeparator = TRUE; } else // start new section @@ -4991,11 +4991,11 @@ int DocPara::handleParamSection(const QCString &cmdName, { DocParamSect *ps=0; if (!m_children.isEmpty() && // previous element - m_children.last()->kind()==Kind_ParamSect && // was a param sect - ((DocParamSect *)m_children.last())->type()==t) // of same type + m_children.getLast()->kind()==Kind_ParamSect && // was a param sect + ((DocParamSect *)m_children.getLast())->type()==t) // of same type { // append to previous section - ps=(DocParamSect *)m_children.last(); + ps=(DocParamSect *)m_children.getLast(); } else // start new section { @@ -5086,13 +5086,15 @@ void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type return; } DocIncOperator *op = new DocIncOperator(this,t,g_token->name,g_context,g_isExample,g_exampleName); - DocNode *n1 = m_children.last(); - DocNode *n2 = n1!=0 ? m_children.prev() : 0; + QListIterator<DocNode> it(m_children); + DocNode *n1 = it.toLast(); + --it; + DocNode *n2 = n1!=0 ? it.current() : 0; bool isFirst = n1==0 || // no last node - (n1->kind()!=DocNode::Kind_IncOperator && + (n1->kind()!=DocNode::Kind_IncOperator && n1->kind()!=DocNode::Kind_WhiteSpace ) || // last node is not operator or whitespace - (n1->kind()==DocNode::Kind_WhiteSpace && + (n1->kind()==DocNode::Kind_WhiteSpace && n2!=0 && n2->kind()!=DocNode::Kind_IncOperator ); // previous not is not operator op->markFirst(isFirst); @@ -6468,7 +6470,7 @@ reparsetoken: // remove leading whitespace !m_children.isEmpty() && // and whitespace after certain constructs - (k=m_children.last()->kind())!=DocNode::Kind_HtmlDescList && + (k=m_children.getLast()->kind())!=DocNode::Kind_HtmlDescList && k!=DocNode::Kind_HtmlTable && k!=DocNode::Kind_HtmlList && k!=DocNode::Kind_SimpleSect && diff --git a/src/dot.cpp b/src/dot.cpp index 8d9ba3f..56ddc83 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -783,10 +783,11 @@ class DotNodeList : public QList<DotNode> public: DotNodeList() : QList<DotNode>() {} ~DotNodeList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { - return qstricmp(((DotNode *)item1)->m_label,((DotNode *)item2)->m_label); - } + private: + int compareValues(const DotNode *n1,const DotNode *n2) const + { + return qstricmp(n1->m_label,n2->m_label); + } }; //-------------------------------------------------------------------- diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 41fca96..fe2f84e 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -220,7 +220,7 @@ class Statistics } void end() { - stats.last()->elapsed=((double)time.elapsed())/1000.0; + stats.getLast()->elapsed=((double)time.elapsed())/1000.0; } void print() { @@ -2319,7 +2319,7 @@ static MemberDef *addVariableToClass( root->fileName,root->startLine,root->startColumn, root->type,name,root->args,root->exception, prot,Normal,root->stat,related, - mtype,root->tArgLists ? root->tArgLists->last() : 0,0); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0); md->setTagInfo(rootNav->tagInfo()); md->setMemberClass(cd); // also sets outer scope (i.e. getOuterScope()) //md->setDefFile(root->fileName); @@ -2556,7 +2556,7 @@ static MemberDef *addVariableToFile( root->fileName,root->startLine,root->startColumn, root->type,name,root->args,0, Public, Normal,root->stat,Member, - mtype,root->tArgLists ? root->tArgLists->last() : 0,0); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0); md->setTagInfo(rootNav->tagInfo()); md->setMemberSpecifiers(root->spec); md->setDocumentation(root->doc,root->docFile,root->docLine); @@ -3245,7 +3245,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, root->stat && root->relatesType != MemberOf, root->relates.isEmpty() ? Member : root->relatesType == MemberOf ? Foreign : Related, - mtype,root->tArgLists ? root->tArgLists->last() : 0,root->argList); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,root->argList); md->setTagInfo(rootNav->tagInfo()); md->setMemberClass(cd); md->setDocumentation(root->doc,root->docFile,root->docLine); @@ -3535,9 +3535,9 @@ static void buildFunctionList(EntryNav *rootNav) ) { GroupDef *gd=0; - if (root->groups->first()!=0) + if (root->groups->getFirst()!=0) { - gd = Doxygen::groupSDict->find(root->groups->first()->groupname.data()); + gd = Doxygen::groupSDict->find(root->groups->getFirst()->groupname.data()); } //printf("match!\n"); //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); @@ -3598,7 +3598,7 @@ static void buildFunctionList(EntryNav *rootNav) md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph); // merge ingroup specifiers - if (md->getGroupDef()==0 && root->groups->first()!=0) + if (md->getGroupDef()==0 && root->groups->getFirst()!=0) { addMemberToGroups(root,md); } @@ -3607,7 +3607,7 @@ static void buildFunctionList(EntryNav *rootNav) //printf("existing member is grouped, new member not\n"); root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); } - else if (md->getGroupDef()!=0 && root->groups->first()!=0) + else if (md->getGroupDef()!=0 && root->groups->getFirst()!=0) { //printf("both members are grouped\n"); } @@ -3629,7 +3629,7 @@ static void buildFunctionList(EntryNav *rootNav) // root->type.data(),rname.data(),root->args.data(),root->bodyLine); // new global function - ArgumentList *tArgList = root->tArgLists ? root->tArgLists->last() : 0; + ArgumentList *tArgList = root->tArgLists ? root->tArgLists->getLast() : 0; QCString name=removeRedundantWhiteSpace(rname); md=new MemberDef( root->fileName,root->startLine,root->startColumn, @@ -5039,8 +5039,9 @@ static void computeTemplateClassRelations() ArgumentList *templArgs = new ArgumentList; stringToArgumentList(templSpec,templArgs); QList<BaseInfo> *baseList=root->extends; - BaseInfo *bi=baseList->first(); - while (bi) // for each base class of the template + QListIterator<BaseInfo> it(*baseList); + BaseInfo *bi; + for (;(bi=it.current());++it) // for each base class of the template { // check if the base class is a template argument BaseInfo tbi(bi->name,bi->prot,bi->virt); @@ -5082,7 +5083,6 @@ static void computeTemplateClassRelations() } delete actualTemplateNames; } - bi=baseList->next(); } delete templArgs; } // class has no base classes @@ -5102,17 +5102,17 @@ static void computeMemberReferences() for (cli.toFirst();(cd=cli.current());++cli) { cd->computeAnchors(); - } - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + } + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { fd->computeAnchors(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; @@ -5143,8 +5143,8 @@ static void addListReferences() md->visited=FALSE; } } - MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); - for (fnli.toFirst();(mn=fnli.current());++fnli) + MemberNameSDict::Iterator fmnli(*Doxygen::functionNameSDict); + for (fmnli.toFirst();(mn=fmnli.current());++fmnli) { MemberNameIterator mni(*mn); MemberDef *md=0; @@ -5159,30 +5159,34 @@ static void addListReferences() for (cli.toFirst();(cd=cli.current());++cli) { cd->addListReferences(); - } - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + } + + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { fd->addListReferences(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; for (nli.toFirst();(nd=nli.current());++nli) { nd->addListReferences(); } + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { gd->addListReferences(); } + PageSDict::Iterator pdi(*Doxygen::pageSDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) @@ -5200,6 +5204,7 @@ static void addListReferences() name,pd->title(),0); } } + DirSDict::Iterator ddi(*Doxygen::directories); DirDef *dd = 0; for (ddi.toFirst();(dd=ddi.current());++ddi) @@ -5486,7 +5491,7 @@ static bool findGlobalMember(EntryNav *rootNav, { //printf("Comparing return types '%s'<->'%s'\n", // md->typeString(),type); - if (md->templateArguments()->count()!=root->tArgLists->last()->count() || + if (md->templateArguments()->count()!=root->tArgLists->getLast()->count() || qstrcmp(md->typeString(),type)!=0) { //printf(" ---> no matching\n"); @@ -5579,10 +5584,12 @@ static QCString substituteTemplatesInString( { ArgumentListIterator tsali(*srclali.current()); ArgumentListIterator tdali(*dstlali.current()); + ArgumentListIterator *fali=0; Argument *tsa =0,*tda=0, *fa=0; if (funcTempArgList) { - fa=funcTempArgList->first(); + fali = new ArgumentListIterator(*funcTempArgList); + fa = fali->current(); } for (tsali.toFirst();(tsa=tsali.current()) && !found;++tsali) @@ -5615,11 +5622,13 @@ static QCString substituteTemplatesInString( found=TRUE; } } - if (tda) - ++tdali; - else if (fa) - fa=funcTempArgList->next(); + if (tda) + ++tdali; + else if (fali) + { ++(*fali); fa=fali->current(); } } + + delete fali; //printf(" srcList='%s' dstList='%s faList='%s'\n", // argListToString(srclali.current()).data(), // argListToString(dstlali.current()).data(), @@ -5643,8 +5652,9 @@ static void substituteTemplatesInArgList( ) { ArgumentListIterator sali(*src); + ArgumentListIterator dali(*dst); Argument *sa=0; - Argument *da=dst->first(); + Argument *da=dali.current(); for (sali.toFirst();(sa=sali.current());++sali) // for each member argument { @@ -5666,7 +5676,8 @@ static void substituteTemplatesInArgList( { da->type=dstType; da->type=dstArray; - da=dst->next(); + ++dali; + da=dali.current(); } } dst->constSpecifier = src->constSpecifier; @@ -5862,7 +5873,7 @@ static void findMember(EntryNav *rootNav, // this as a normal method of a template class. if (!(root->tArgLists && root->tArgLists->count()>0 && - root->tArgLists->first()->count()==0 + root->tArgLists->getFirst()->count()==0 ) ) { @@ -5906,10 +5917,10 @@ static void findMember(EntryNav *rootNav, ClassDef *cd=getClass(scopeName); if (cd) { - if (root->tArgLists) root->tArgLists->first(); if (funcSpec.isEmpty()) { - tempScopeName=cd->qualifiedNameWithTemplateParameters(root->tArgLists); + int argListIndex=0; + tempScopeName=cd->qualifiedNameWithTemplateParameters(root->tArgLists,&argListIndex); } else { @@ -5918,7 +5929,7 @@ static void findMember(EntryNav *rootNav, } //printf("scopeName=%s cd=%p root->tArgLists=%p result=%s\n", // scopeName.data(),cd,root->tArgLists,tempScopeName.data()); - + //printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data()); // rebuild the function declaration (needed to get the scope right). if (!scopeName.isEmpty() && !isRelated && !isFriend && !Config_getBool("HIDE_SCOPE_NAMES")) @@ -6128,8 +6139,8 @@ static void findMember(EntryNav *rootNav, Debug::print(Debug::FindMembers,0, "5b. Comparing return types '%s'<->'%s' #args %d<->%d\n", md->typeString(),funcType.data(), - md->templateArguments()->count(),root->tArgLists->last()->count()); - if (md->templateArguments()->count()!=root->tArgLists->last()->count() || + md->templateArguments()->count(),root->tArgLists->getLast()->count()); + if (md->templateArguments()->count()!=root->tArgLists->getLast()->count() || qstrcmp(memType,funcType)) { //printf(" ---> no matching\n"); @@ -6467,11 +6478,12 @@ static void findMember(EntryNav *rootNav, MemberName *mn = Doxygen::functionNameSDict->find(funcName); if (mn) { - mdDefine = mn->first(); + MemberNameIterator mni(*mn); + mdDefine = mni.current(); while (mdDefine && !isDefine) { isDefine = isDefine || mdDefine->isDefine(); - if (!isDefine) mdDefine = mn->next(); + if (!isDefine) { ++mni; mdDefine=mni.current(); } } } } @@ -6485,8 +6497,9 @@ static void findMember(EntryNav *rootNav, } else { - MemberDef *rmd=mn->first(); - while (rmd && newMember) // see if we got another member with matching arguments + MemberNameIterator mni(*mn); + MemberDef *rmd; + while ((rmd=mni.current()) && newMember) // see if we got another member with matching arguments { ArgumentList *rmdAl = rmd->argumentList(); @@ -6495,7 +6508,7 @@ static void findMember(EntryNav *rootNav, !matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmdAl, cd,fd,root->argList, TRUE); - if (newMember) rmd=mn->next(); + if (newMember) ++mni; } if (!newMember && rmd) // member already exists as rmd -> add docs { @@ -6543,7 +6556,7 @@ static void findMember(EntryNav *rootNav, root->stat && !isMemberOf, isMemberOf ? Foreign : isRelated ? Related : Member, mtype, - (root->tArgLists ? root->tArgLists->last() : 0), + (root->tArgLists ? root->tArgLists->getLast() : 0), funcArgs.isEmpty() ? 0 : root->argList); if (isDefine && mdDefine) @@ -6579,8 +6592,9 @@ static void findMember(EntryNav *rootNav, MemberName *rmn=Doxygen::functionNameSDict->find(funcName); if (rmn) { - MemberDef *rmd=rmn->first(); - while (rmd && !found) // see if we got another member with matching arguments + MemberNameIterator rmni(*rmn); + MemberDef *rmd; + while ((rmd=rmni.current()) && !found) // see if we got another member with matching arguments { ArgumentList *rmdAl = rmd->argumentList(); // check for matching argument lists @@ -6592,7 +6606,7 @@ static void findMember(EntryNav *rootNav, { found=TRUE; } - if (!found) rmd=rmn->next(); + if (!found) ++rmni; } if (rmd) // member found -> copy line number info { @@ -7423,7 +7437,7 @@ static void findEnumDocumentation(EntryNav *rootNav) md->setRefItems(root->sli); GroupDef *gd=md->getGroupDef(); - if (gd==0 &&root->groups->first()!=0) // member not grouped but out-of-line documentation is + if (gd==0 &&root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -7457,7 +7471,7 @@ static void findEnumDocumentation(EntryNav *rootNav) md->setMemberGroupId(root->mGrpId); GroupDef *gd=md->getGroupDef(); - if (gd==0 && root->groups->first()!=0) // member not grouped but out-of-line documentation is + if (gd==0 && root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -7574,11 +7588,12 @@ static void computeMemberRelations() for ( ; (mn=mnli.current()) ; ++mnli ) // for each member name { MemberNameIterator mdi(*mn); + MemberNameIterator bmdi(*mn); MemberDef *md; + MemberDef *bmd; for ( ; (md=mdi.current()) ; ++mdi ) // for each member with a specific name { - MemberDef *bmd = mn->first(); // for each other member with the same name - while (bmd) + for ( bmdi.toFirst() ; (bmd=bmdi.current()); ++bmdi ) // for each other member with the same name { ClassDef *mcd = md->getClassDef(); if (mcd && mcd->baseClasses()) @@ -7625,10 +7640,9 @@ static void computeMemberRelations() } } } - bmd = mn->next(); } } - } + } } @@ -8132,16 +8146,16 @@ static void addMembersToMemberGroup() cd->addMembersToMemberGroup(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->addMembersToMemberGroup(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8171,16 +8185,16 @@ static void distributeMemberGroupDocumentation() cd->distributeMemberGroupDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->distributeMemberGroupDocumentation(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8210,16 +8224,16 @@ static void findSectionsInDocumentation() cd->findSectionsInDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->findSectionsInDocumentation(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8380,17 +8394,16 @@ static void findDefineDocumentation(EntryNav *rootNav) MemberName *mn=Doxygen::functionNameSDict->find(root->name); if (mn) { + MemberNameIterator mni(*mn); + MemberDef *md; int count=0; - MemberDef *md=mn->first(); - while (md) + for (;(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) count++; - md=mn->next(); } if (count==1) { - md=mn->first(); - while (md) + for (mni.toFirst();(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) { @@ -8409,20 +8422,18 @@ static void findDefineDocumentation(EntryNav *rootNav) if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId); addMemberToGroups(root,md); } - md=mn->next(); } } - else if (count>1 && - (!root->doc.isEmpty() || - !root->brief.isEmpty() || + else if (count>1 && + (!root->doc.isEmpty() || + !root->brief.isEmpty() || root->bodyLine!=-1 ) - ) + ) // multiple defines don't know where to add docs // but maybe they are in different files together with their documentation { - md=mn->first(); - while (md) + for (mni.toFirst();(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) { @@ -8456,7 +8467,6 @@ static void findDefineDocumentation(EntryNav *rootNav) addMemberToGroups(root,md); } } - md=mn->next(); } //warn("define %s found in the following files:\n",root->name.data()); //warn("Cannot determine where to add the documentation found " @@ -9255,16 +9265,15 @@ static void parseFiles(Entry *root,EntryNav *rootNav) // create a dictionary with files to process QDict<void> g_filesToProcess(10007); - QCString *s=g_inputFiles.first(); - while (s) + StringListIterator it(g_inputFiles); + QCString *s; + for (;(s=it.current());++it) { g_filesToProcess.insert(*s,(void*)0x8); - s=g_inputFiles.next(); } - s=g_inputFiles.first(); // process source files (and their include dependencies) - while (s) + for (it.toFirst();(s=it.current());++it) { bool ambig; FileDef *fd=findFileDef(Doxygen::inputNameDict,s->data(),ambig); @@ -9298,11 +9307,9 @@ static void parseFiles(Entry *root,EntryNav *rootNav) parser->finishTranslationUnit(); g_processedFiles.insert(*s,(void*)0x8); } - s=g_inputFiles.next(); } // process remaining files - s=g_inputFiles.first(); - while (s) + for (it.toFirst();(s=it.current());++it) { if (!g_processedFiles.find(*s)) // not yet processed { @@ -9316,14 +9323,14 @@ static void parseFiles(Entry *root,EntryNav *rootNav) parser->finishTranslationUnit(); g_processedFiles.insert(*s,(void*)0x8); } - s=g_inputFiles.next(); } } else // normal pocessing #endif { - QCString *s=g_inputFiles.first(); - while (s) + StringListIterator it(g_inputFiles); + QCString *s; + for (;(s=it.current());++it) { bool ambig; QStrList filesInSameTu; @@ -9332,7 +9339,6 @@ static void parseFiles(Entry *root,EntryNav *rootNav) ParserInterface * parser = getParserForFile(s->data()); parser->startTranslationUnit(s->data()); parseFile(parser,root,rootNav,fd,s->data(),FALSE,filesInSameTu); - s=g_inputFiles.next(); } } } diff --git a/src/doxygen.h b/src/doxygen.h index ff9c620..99d6931 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -65,6 +65,7 @@ class SectionDict; struct MemberGroupInfo; typedef QList<QCString> StringList; +typedef QListIterator<QCString> StringListIterator; //typedef QDict<FileDef> FileDict; //typedef QDict<GroupDef> GroupDict; diff --git a/src/example.h b/src/example.h index 8a2b529..c0f405c 100644 --- a/src/example.h +++ b/src/example.h @@ -38,9 +38,10 @@ class ExampleSDict : public SDict<Example> public: ExampleSDict(int size=17) : SDict<Example>(size) {} ~ExampleSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const Example *item1,const Example *item2) const { - return qstricmp(((Example *)item1)->name,((Example *)item2)->name); + return qstricmp(item1->name,item2->name); } }; diff --git a/src/filedef.cpp b/src/filedef.cpp index 1368628..543be1d 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1408,7 +1408,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) // add new branch to the root if (!root->children().isEmpty()) { - root->children().last()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(base); return newBranch; @@ -1428,7 +1428,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) Directory *newBranch = new Directory(root,baseName); if (!root->children().isEmpty()) { - root->children().last()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(newBranch); return newBranch; @@ -1443,7 +1443,7 @@ static void mergeFileDef(Directory *root,FileDef *fd) Directory *dirNode = findDirNode(root,filePath); if (!dirNode->children().isEmpty()) { - dirNode->children().last()->setLast(FALSE); + dirNode->children().getLast()->setLast(FALSE); } DirEntry *e=new DirEntry(dirNode,fd); dirNode->addChild(e); @@ -1721,25 +1721,24 @@ void FileDef::addMemberToList(MemberListType lt,MemberDef *md) void FileDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); } } MemberList *FileDef::getMemberList(MemberListType lt) const { - FileDef *that = (FileDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } diff --git a/src/filedef.h b/src/filedef.h index 58b17bd..6cb4665 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -241,13 +241,11 @@ class FileList : public QList<FileDef> FileList(const char *path) : QList<FileDef>(), m_pathName(path) {} ~FileList() {} QCString path() const { return m_pathName; } - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const FileDef *md1,const FileDef *md2) const { - FileDef *md1 = (FileDef *)item1; - FileDef *md2 = (FileDef *)item2; return qstricmp(md1->name(),md2->name()); } - private: QCString m_pathName; }; @@ -256,10 +254,9 @@ class OutputNameList : public QList<FileList> public: OutputNameList() : QList<FileList>() {} ~OutputNameList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const FileList *fl1,const FileList *fl2) const { - FileList *fl1 = (FileList *)item1; - FileList *fl2 = (FileList *)item2; return qstricmp(fl1->path(),fl2->path()); } }; diff --git a/src/filename.cpp b/src/filename.cpp index da0dccc..0919024 100644 --- a/src/filename.cpp +++ b/src/filename.cpp @@ -34,18 +34,17 @@ FileName::~FileName() void FileName::generateDiskNames() { //QCString commonPrefix; - FileDef *fd=first(); + QListIterator<FileDef> it(*this); + FileDef *fd; int count=0; - while (fd) - { - if (!fd->isReference()) count++; - fd=next(); + for (;(fd=it.current());++it) + { + if (!fd->isReference()) count++; } if (count==1) { - fd=first(); // skip references - while (fd && fd->isReference()) fd=next(); + for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } // name if unique, so diskname is simply the name //printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data()); fd->m_diskName=name; @@ -57,12 +56,11 @@ void FileName::generateDiskNames() bool found=FALSE; while (!found) // search for the common prefix of all paths { - fd=first(); - while (fd && fd->isReference()) fd=next(); + for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } char c=fd->m_path.at(i); if (c=='/') j=i; // remember last position of dirname - fd=next(); - while (fd && !found) + ++it; + while ((fd=it.current()) && !found) { if (!fd->isReference()) { @@ -75,15 +73,14 @@ void FileName::generateDiskNames() } else if (fd->m_path[i]!=c) { - found=TRUE; + found=TRUE; } - } - fd=next(); + } + ++it; } i++; } - fd=first(); - while (fd) + for (it.toFirst();(fd=it.current());++it) { //printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data()); if (!fd->isReference()) @@ -93,15 +90,12 @@ void FileName::generateDiskNames() //printf("!!!!!!!! non unique disk name=%s for fd=%s\n",(prefix+name).data(),fd->diskname.data()); fd->m_diskName=prefix+name; } - fd=next(); } } } -int FileName::compareItems(QCollection::Item item1, QCollection::Item item2) +int FileName::compareValues(const FileDef *f1, const FileDef *f2) const { - FileName *f1=(FileName *)item1; - FileName *f2=(FileName *)item2; return qstricmp(f1->fileName(),f2->fileName()); } @@ -120,20 +114,16 @@ FileNameList::~FileNameList() void FileNameList::generateDiskNames() { - FileName *fn=first(); - while (fn) + FileNameListIterator it(*this); + FileName *fn; + for (;(fn=it.current());++it) { fn->generateDiskNames(); - fn=next(); } } -int FileNameList::compareItems(QCollection::Item item1, QCollection::Item item2) +int FileNameList::compareValues(const FileName *f1, const FileName *f2) const { - FileName *f1=(FileName *)item1; - FileName *f2=(FileName *)item2; - //printf("FileNameList::compareItems `%s'<->`%s'\n", - // f1->fileName(),f2->fileName()); return Config_getBool("FULL_PATH_NAMES") ? qstricmp(f1->fullName(),f2->fullName()) : qstricmp(f1->fileName(),f2->fileName()); diff --git a/src/filename.h b/src/filename.h index 1cd160c..e7383b8 100644 --- a/src/filename.h +++ b/src/filename.h @@ -24,16 +24,16 @@ /** Class representing all files with a certain base name */ class FileName : public FileList -{ +{ public: FileName(const char *fn,const char *name); ~FileName(); const char *fileName() const { return name; } const char *fullName() const { return fName; } void generateDiskNames(); - int compareItems(QCollection::Item item1,QCollection::Item item2); private: + int compareValues(const FileDef *item1,const FileDef *item2) const; QCString name; QCString fName; }; @@ -52,7 +52,8 @@ class FileNameList : public QList<FileName> FileNameList(); ~FileNameList(); void generateDiskNames(); - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const FileName *item1,const FileName *item2) const; }; /** Iterator for FileName objects in a FileNameList. */ diff --git a/src/fortrancode.l b/src/fortrancode.l index 8ee825b..cd1c97e 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -437,9 +437,11 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ // look in local variables - for (Scope *scope=scopeStack.last(); scope!=NULL; scope=scopeStack.prev()) + QListIterator<Scope> it(scopeStack); + Scope *scope; + for (it.toLast();(scope=it.current());--it) { - if(scope->localVars.find(memberName)) + if (scope->localVars.find(memberName)) return FALSE; } @@ -636,13 +638,13 @@ static void endScope() static void addUse(const QCString &moduleName) { if (!scopeStack.isEmpty()) - scopeStack.last()->useNames.append(moduleName); + scopeStack.getLast()->useNames.append(moduleName); } static void addLocalVar(const QCString &varName) { if (!scopeStack.isEmpty()) - scopeStack.last()->localVars.insert(varName, (void*)1); + scopeStack.getLast()->localVars.insert(varName, (void*)1); } //---------------------------------------------------------------------------- diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 4cdea23..6af76b8 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2126,7 +2126,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) int lineNr = brief ? current->briefLine : current->docLine; while (parseCommentBlock( g_thisParser, - docBlockInBody ? subrCurrent.first() : current, + docBlockInBody ? subrCurrent.getFirst() : current, doc, // text yyFileName, // file lineNr, @@ -2153,7 +2153,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) { QCString loc_doc; Entry *tmp_entry = current; - current = subrCurrent.first(); // temporarily switch to the entry of the subroutine / function + current = subrCurrent.getFirst(); // temporarily switch to the entry of the subroutine / function // Still in the specification section so no inbodyDocs yet, but parameter documentation current->inbodyDocs = ""; diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 11d3b1d..1a30e71 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -1023,15 +1023,16 @@ struct NavIndexEntry QCString path; }; -class NavIndexEntryList : public QList<NavIndexEntry> +class NavIndexEntryList : public QList<NavIndexEntry> { public: NavIndexEntryList() : QList<NavIndexEntry>() { setAutoDelete(TRUE); } ~NavIndexEntryList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const NavIndexEntry *item1,const NavIndexEntry *item2) const { // sort list based on url - return qstrcmp(((NavIndexEntry*)item1)->url,((NavIndexEntry*)item2)->url); + return qstrcmp(item1->url,item2->url); } }; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 9426c24..0624892 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -659,8 +659,9 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - FileDef *fd=fileList->first(); - while (fd) + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); @@ -679,7 +680,6 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - fd=fileList->next(); } ol.endMemberList(); } @@ -697,11 +697,11 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) int count=0; if (groupList->count()>0) { - GroupDef *gd=groupList->first(); - while (gd) + QListIterator<GroupDef> it(*groupList); + GroupDef *gd; + for (;(gd=it.current());++it) { if (gd->isVisible()) count++; - gd=groupList->next(); } } if (count>0) @@ -714,8 +714,9 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) { groupList->sort(); } - GroupDef *gd=groupList->first(); - while (gd) + QListIterator<GroupDef> it(*groupList); + GroupDef *gd; + for (;(gd=it.current());++it) { if (gd->isVisible()) { @@ -738,7 +739,6 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) } ol.endMemberDeclaration(0,0); } - gd=groupList->next(); } ol.endMemberList(); } @@ -753,8 +753,9 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - DirDef *dd=dirList->first(); - while (dd) + QListIterator<DirDef> it(*dirList); + DirDef *dd; + for (;(dd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); @@ -773,7 +774,6 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - dd=dirList->next(); } ol.endMemberList(); @@ -1436,26 +1436,24 @@ void GroupDef::addMemberToList(MemberListType lt,MemberDef *md) void GroupDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); } } - MemberList *GroupDef::getMemberList(MemberListType lt) const { - GroupDef *that = (GroupDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } diff --git a/src/groupdef.h b/src/groupdef.h index bd53ff5..0d1a5ca 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -159,9 +159,10 @@ class GroupSDict : public SDict<GroupDef> public: GroupSDict(uint size) : SDict<GroupDef>(size) {} virtual ~GroupSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const GroupDef *item1,const GroupDef *item2) const { - return qstrcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); + return qstrcmp(item1->groupTitle(),item2->groupTitle()); } }; @@ -169,9 +170,9 @@ class GroupSDict : public SDict<GroupDef> class GroupList : public QList<GroupDef> { public: - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const GroupDef *item1,const GroupDef *item2) const { - return qstrcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); + return qstrcmp(item1->groupTitle(),item2->groupTitle()); } }; diff --git a/src/htmlattrib.h b/src/htmlattrib.h index 203fb48..0b139aa 100644 --- a/src/htmlattrib.h +++ b/src/htmlattrib.h @@ -40,33 +40,31 @@ class HtmlAttribList : public QList<HtmlAttrib> { clear(); QList<HtmlAttrib>::operator=(l); return *this; } QCString find(const QCString name) const { - HtmlAttribList *that = (HtmlAttribList *)this; + QListIterator<HtmlAttrib> it(*this); QCString result; - HtmlAttrib *attr=that->first(); - while (attr) + HtmlAttrib *attr; + for (;(attr=it.current());++it) { if (attr->name==name) return attr->value; - attr=that->next(); } return result; } QCString toString() const { - HtmlAttribList *that = (HtmlAttribList *)this; + QListIterator<HtmlAttrib> it(*this); QCString result; - HtmlAttrib *attr=that->first(); - while (attr) + HtmlAttrib *attr; + for (;(attr=it.current());++it) { result+=" "+attr->name+"=\""+attr->value+"\""; - attr=that->next(); } return result; } private: - QCollection::Item newItem( QCollection::Item d ) - { return (QCollection::Item)new HtmlAttrib(*(HtmlAttrib *)d); } - void deleteItem(QCollection::Item d) - { delete (HtmlAttrib *)d; } + HtmlAttrib *newValue( HtmlAttrib *v ) const + { return new HtmlAttrib(*v); } + void deleteValue(HtmlAttrib *v) const + { delete v; } }; /*! @brief Html attribute list iterator */ diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index 23d5194..aa0727c 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -54,9 +54,10 @@ class IndexFieldSDict : public SDict<IndexField> public: IndexFieldSDict() : SDict<IndexField>(17) {} ~IndexFieldSDict() {} - int compareItems(QCollection::Item item1, QCollection::Item item2) + private: + int compareValues(const IndexField *item1, const IndexField *item2) const { - return qstricmp(((IndexField *)item1)->name,((IndexField *)item2)->name); + return qstricmp(item1->name,item2->name); } }; diff --git a/src/index.cpp b/src/index.cpp index ae96c80..392acfa 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -122,10 +122,8 @@ class MemberIndexList : public QList<MemberDef> typedef MemberDef ElementType; MemberIndexList(uint letter) : QList<MemberDef>(), m_letter(letter) {} ~MemberIndexList() {} - int compareItems(QCollection::Item item1, QCollection::Item item2) + int compareValues(const MemberDef *md1, const MemberDef *md2) const { - MemberDef *md1=(MemberDef *)item1; - MemberDef *md2=(MemberDef *)item2; int result = qstricmp(md1->name(),md2->name()); if (result==0) { @@ -628,9 +626,10 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv FileList *fileList=dd->getFiles(); int fileCount=0; if (fileList && fileList->count()>0) - { - FileDef *fd=fileList->first(); - while (fd) + { + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { //static bool allExternals = Config_getBool("ALLEXTERNALS"); //if ((allExternals && fd->isLinkable()) || fd->isLinkableInProject()) @@ -646,13 +645,11 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv { fileCount++; } - fd=fileList->next(); } if (fileCount>0) { startIndexHierarchy(ol,level+1); - fd=fileList->first(); - while (fd) + for (it.toFirst();(fd=it.current());++it) { bool doc,src; doc = fileVisibleInIndex(fd,src); @@ -678,7 +675,6 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv 0,FALSE,FALSE,fd); } } - fd=fileList->next(); } endIndexHierarchy(ol,level+1); } @@ -689,8 +685,9 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv // write files of this directory if (fileCount>0) { - FileDef *fd=fileList->first(); - while (fd) + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { //static bool allExternals = Config_getBool("ALLEXTERNALS"); //if ((allExternals && fd->isLinkable()) || fd->isLinkableInProject()) @@ -706,7 +703,6 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv FALSE, convertToHtml(fd->name(),TRUE), 0, fd->getSourceFileBase(), 0, FALSE, TRUE, fd); } - fd=fileList->next(); } } } @@ -1085,6 +1081,82 @@ static void countFiles(int &htmlFiles,int &files) } } +static void writeSingleFileIndex(OutputList &ol,FileDef *fd) +{ + //printf("Found filedef %s\n",fd->name().data()); + bool doc = fd->isLinkableInProject(); + bool src = fd->generateSourceFile(); + bool nameOk = !fd->isDocumentationFile(); + if (nameOk && (doc || src) && !fd->isReference()) + { + QCString path; + if (Config_getBool("FULL_PATH_NAMES")) + { + path=stripFromPath(fd->getPath().copy()); + } + QCString fullName=fd->name(); + if (!path.isEmpty()) + { + if (path.at(path.length()-1)!='/') fullName.prepend("/"); + fullName.prepend(path); + } + + ol.startIndexKey(); + ol.docify(path); + if (doc) + { + ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); + //if (addToIndex) + //{ + // addMembersToIndex(fd,LayoutDocManager::File,fullName,QCString()); + //} + } + else + { + ol.startBold(); + ol.docify(fd->name()); + ol.endBold(); + //if (addToIndex) + //{ + // Doxygen::indexList->addContentsItem(FALSE,fullName,0,0,0); + //} + } + if (src) + { + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.docify(" "); + ol.startTextLink(fd->includeName(),0); + ol.docify("["); + ol.parseText(theTranslator->trCode()); + ol.docify("]"); + ol.endTextLink(); + ol.popGeneratorState(); + } + ol.endIndexKey(); + bool hasBrief = !fd->briefDescription().isEmpty(); + ol.startIndexValue(hasBrief); + if (hasBrief) + { + //ol.docify(" ("); + ol.generateDoc( + fd->briefFile(),fd->briefLine(), + fd,0, + fd->briefDescription(TRUE), + FALSE, // index words + FALSE, // isExample + 0, // example name + TRUE, // single line + TRUE // link from index + ); + //ol.docify(")"); + } + ol.endIndexValue(fd->getOutputFileBase(),hasBrief); + //ol.popGeneratorState(); + // -------------------------------------------------------- + } +} + //---------------------------------------------------------------------------- static void writeFileIndex(OutputList &ol) @@ -1131,135 +1203,67 @@ static void writeFileIndex(OutputList &ol) OutputNameDict outputNameDict(1009); OutputNameList outputNameList; outputNameList.setAutoDelete(TRUE); - + if (Config_getBool("FULL_PATH_NAMES")) { // re-sort input files in (dir,file) output order instead of (file,dir) input order - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { QCString path=fd->getPath(); if (path.isEmpty()) path="[external]"; FileList *fl = outputNameDict.find(path); if (fl) { - fl->inSort(fd); + fl->append(fd); //printf("+ inserting %s---%s\n",fd->getPath().data(),fd->name().data()); } else { //printf("o inserting %s---%s\n",fd->getPath().data(),fd->name().data()); fl = new FileList(path); - fl->inSort(fd); - outputNameList.inSort(fl); + fl->append(fd); + outputNameList.append(fl); outputNameDict.insert(path,fl); } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } - + ol.startIndexList(); - FileList *fl=0; if (Config_getBool("FULL_PATH_NAMES")) { - fl = outputNameList.first(); + outputNameList.sort(); + QListIterator<FileList> fnli(outputNameList); + FileList *fl; + for (fnli.toFirst();(fl=fnli.current());++fnli) + { + fl->sort(); + QListIterator<FileDef> it(*fl); + FileDef *fd; + for (;(fd=it.current());++it) + { + writeSingleFileIndex(ol,fd); + } + } } else { - fl = Doxygen::inputNameList->first(); - } - while (fl) - { - FileDef *fd=fl->first(); - while (fd) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - //printf("Found filedef %s\n",fd->name().data()); - bool doc = fd->isLinkableInProject(); - bool src = fd->generateSourceFile(); - bool nameOk = !fd->isDocumentationFile(); - if (nameOk && (doc || src) && - !fd->isReference()) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { - QCString path; - if (Config_getBool("FULL_PATH_NAMES")) - { - path=stripFromPath(fd->getPath().copy()); - } - QCString fullName=fd->name(); - if (!path.isEmpty()) - { - if (path.at(path.length()-1)!='/') fullName.prepend("/"); - fullName.prepend(path); - } - - ol.startIndexKey(); - ol.docify(path); - if (doc) - { - ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); - //if (addToIndex) - //{ - // addMembersToIndex(fd,LayoutDocManager::File,fullName,QCString()); - //} - } - else - { - ol.startBold(); - ol.docify(fd->name()); - ol.endBold(); - //if (addToIndex) - //{ - // Doxygen::indexList->addContentsItem(FALSE,fullName,0,0,0); - //} - } - if (src) - { - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - ol.docify(" "); - ol.startTextLink(fd->includeName(),0); - ol.docify("["); - ol.parseText(theTranslator->trCode()); - ol.docify("]"); - ol.endTextLink(); - ol.popGeneratorState(); - } - ol.endIndexKey(); - bool hasBrief = !fd->briefDescription().isEmpty(); - ol.startIndexValue(hasBrief); - if (hasBrief) - { - //ol.docify(" ("); - ol.generateDoc( - fd->briefFile(),fd->briefLine(), - fd,0, - fd->briefDescription(TRUE), - FALSE, // index words - FALSE, // isExample - 0, // example name - TRUE, // single line - TRUE // link from index - ); - //ol.docify(")"); - } - ol.endIndexValue(fd->getOutputFileBase(),hasBrief); - //ol.popGeneratorState(); - // -------------------------------------------------------- + writeSingleFileIndex(ol,fd); } - fd=fl->next(); - } - if (Config_getBool("FULL_PATH_NAMES")) - { - fl=outputNameList.next(); - } - else - { - fl=Doxygen::inputNameList->next(); } } ol.endIndexList(); @@ -1672,17 +1676,14 @@ class PrefixIgnoreClassList : public ClassList public: typedef ClassDef ElementType; PrefixIgnoreClassList(uint letter) : m_letter(letter) {} - virtual int compareItems(QCollection::Item item1, QCollection::Item item2) + uint letter() const { return m_letter; } + private: + virtual int compareValue(const ClassDef *c1, const ClassDef *c2) const { - ClassDef *c1=(ClassDef *)item1; - ClassDef *c2=(ClassDef *)item2; - QCString n1 = c1->className(); QCString n2 = c2->className(); return qstricmp (n1.data()+getPrefixIndex(n1), n2.data()+getPrefixIndex(n2)); } - uint letter() const { return m_letter; } - private: uint m_letter; }; @@ -1734,12 +1735,6 @@ class UsedIndexLetters : public SIntDict<uint> { public: UsedIndexLetters() : SIntDict<uint>(257) { setAutoDelete(TRUE); } - int compareItems( QCollection::Item item1, QCollection::Item item2) - { - int *p1=(int *)item1; - int *p2=(int *)item2; - return *p1 - *p2; // subtracting is done by int not uint. - } void add(uint letter) { uint *v = find(letter); @@ -1748,6 +1743,11 @@ class UsedIndexLetters : public SIntDict<uint> append(letter,new uint(letter)); } } + private: + int compareValues( const uint *p1, const uint *p2) const + { + return (int)*p1 - (int)*p2; // subtracting is done by int not uint. + } }; // write an alphabetical index of all class with a header for each letter diff --git a/src/latexgen.cpp b/src/latexgen.cpp index e473e79..93eed7e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -726,11 +726,13 @@ void LatexGenerator::startIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -742,9 +744,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; @@ -919,11 +919,13 @@ void LatexGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -949,9 +951,7 @@ void LatexGenerator::endIndexSection(IndexSections is) } } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index d2964d4..f26e453 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -133,13 +133,14 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, if (md->getLanguage()==SrcLangExt_Tcl) { if (defArgList->count()==0) return FALSE; - Argument *a=defArgList->first(); + ArgumentListIterator ali(*defArgList); + Argument *a; ol.endMemberDocName(); ol.startParameterList(FALSE); ol.startParameterType(TRUE,0); ol.endParameterType(); ol.startParameterName(FALSE); - while (a) + for (;(a=ali.current());++ali) { if (a->defval.isEmpty()) { @@ -149,7 +150,6 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, { ol.docify("?"+a->name+"? "); } - a=defArgList->next(); } ol.endParameterName(TRUE,FALSE,FALSE); return TRUE; @@ -181,7 +181,6 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.popGeneratorState(); //printf("===> name=%s isDefine=%d\n",md->name().data(),md->isDefine()); - Argument *a=defArgList->first(); QCString cName; if (cd) { @@ -208,6 +207,8 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, bool first=TRUE; bool paramTypeStarted=FALSE; bool isDefine = md->isDefine(); + ArgumentListIterator ali(*defArgList); + Argument *a=ali.current(); while (a) { if (isDefine || first) @@ -302,7 +303,8 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.endTypewriter(); } - a=defArgList->next(); + ++ali; + a=ali.current(); if (a) { if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments @@ -432,7 +434,8 @@ static void writeExceptionList(OutputList &ol, ClassDef *cd, MemberDef *md) static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) { ol.docify("template<"); - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a = ali.current(); while (a) { ol.docify(a->type); @@ -443,7 +446,8 @@ static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) ol.docify(" = "); ol.docify(a->defval); } - a=al->next(); + ++ali; + a=ali.current(); if (a) ol.docify(", "); } ol.docify("> "); @@ -1348,7 +1352,7 @@ bool MemberDef::isBriefSectionVisible() const bool visibleIfNotDefaultCDTor = !(cOrDTor && m_impl->defArgList && (m_impl->defArgList->isEmpty() || - m_impl->defArgList->first()->type == "void" + m_impl->defArgList->getFirst()->type == "void" ) && !hasDocs ); @@ -2286,8 +2290,9 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, //printf("** %s: enum values=%d\n",name().data(),fmdl!=0 ? fmdl->count() : 0); if (fmdl) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator it(*fmdl); + MemberDef *fmd; + for (;(fmd=it.current());++it) { //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable()); if (fmd->isLinkable()) @@ -2349,7 +2354,6 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, } ol.endDescTableData(); } - fmd=fmdl->next(); } } if (!first) @@ -3713,11 +3717,11 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, uint numVisibleEnumValues=0; if (fmdl) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator mli(*fmdl); + MemberDef *fmd; + for (mli.toFirst();(fmd=mli.current());++mli) { if (fmd->isBriefSectionVisible()) numVisibleEnumValues++; - fmd=fmdl->next(); } } if (numVisibleEnumValues==0 && !isBriefSectionVisible()) @@ -3757,7 +3761,8 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, typeDecl.docify("{ "); if (fmdl) { - MemberDef *fmd=fmdl->first(); + MemberListIterator mli(*fmdl); + MemberDef *fmd=mli.current(); bool fmdVisible = fmd->isBriefSectionVisible(); while (fmd) { @@ -3797,7 +3802,8 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, } bool prevVisible = fmdVisible; - fmd=fmdl->next(); + ++mli; + fmd=mli.current(); if (fmd && (fmdVisible=fmd->isBriefSectionVisible())) { typeDecl.writeString(", "); diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 2df4a89..055ddbf 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -75,7 +75,7 @@ void MemberGroup::insertMember(MemberDef *md) // md->getSectionList(m_parent), // md,md->name().data()); - MemberDef *firstMd = memberList->first(); + MemberDef *firstMd = memberList->getFirst(); if (inSameSection && memberList->count()>0 && firstMd->getSectionList(m_parent)!=md->getSectionList(m_parent)) { @@ -215,8 +215,9 @@ int MemberGroup::countInheritableMembers(ClassDef *inheritedFrom) const void MemberGroup::distributeMemberGroupDocumentation() { //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",grpHeader.data()); - MemberDef *md=memberList->first(); - while (md) + MemberListIterator li(*memberList); + MemberDef *md; + for (li.toFirst();(md=li.current());++li) { //printf("checking md=%s\n",md->name().data()); // find the first member of the group with documentation @@ -228,16 +229,15 @@ void MemberGroup::distributeMemberGroupDocumentation() //printf("found it!\n"); break; } - md=memberList->next(); } if (md) // distribute docs of md to other members of the list { //printf("Member %s has documentation!\n",md->name().data()); - MemberDef *omd=memberList->first(); - while (omd) + MemberDef *omd; + for (li.toFirst();(omd=li.current());++li) { - if (md!=omd && omd->documentation().isEmpty() && - omd->briefDescription().isEmpty() && + if (md!=omd && omd->documentation().isEmpty() && + omd->briefDescription().isEmpty() && omd->inbodyDocumentation().isEmpty() ) { @@ -246,7 +246,6 @@ void MemberGroup::distributeMemberGroupDocumentation() omd->setDocumentation(md->documentation(),md->docFile(),md->docLine()); omd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine()); } - omd=memberList->next(); } } } diff --git a/src/membergroup.h b/src/membergroup.h index c5a2d0c..1c744d3 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -125,9 +125,10 @@ class MemberGroupSDict : public SIntDict<MemberGroup> public: MemberGroupSDict(int size=17) : SIntDict<MemberGroup>(size) {} ~MemberGroupSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const MemberGroup *item1,const MemberGroup *item2) const { - return ((MemberGroup *)item1)->groupId() - ((MemberGroup*)item2)->groupId(); + return item1->groupId() - item2->groupId(); } }; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 101293a..d5f9ea4 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -55,11 +55,9 @@ MemberList::~MemberList() delete memberGroupList; } -int MemberList::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberList::compareValues(const MemberDef *c1, const MemberDef *c2) const { static bool sortConstructorsFirst = Config_getBool("SORT_MEMBERS_CTORS_1ST"); - MemberDef *c1=(MemberDef *)item1; - MemberDef *c2=(MemberDef *)item2; if (sortConstructorsFirst) { int ord1 = c1->isConstructor() ? 2 : (c1->isDestructor() ? 1 : 0); int ord2 = c2->isConstructor() ? 2 : (c2->isDestructor() ? 1 : 0); @@ -938,15 +936,9 @@ QCString MemberList::listTypeAsString(MemberListType type) //-------------------------------------------------------------------------- -int MemberSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberSDict::compareValues(const MemberDef *c1, const MemberDef *c2) const { - // NOTE: this function can be triggered from unmarshalMemberSDict - // so it may not result in called to MemberDef::makeResident(). - // As a result, the data returned by MemberDef::name() and - // MemberDef::getDefLine() will always be kept in memory. - MemberDef *c1=(MemberDef *)item1; - MemberDef *c2=(MemberDef *)item2; - //printf("MemberSDict::compareItems(%s,%s)\n",c1->name().data(),c2->name().data()); + //printf("MemberSDict::compareValues(%s,%s)\n",c1->name().data(),c2->name().data()); int cmp = qstricmp(c1->name(),c2->name()); if (cmp) { diff --git a/src/memberlist.h b/src/memberlist.h index 9dfa104..aa20807 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -40,7 +40,6 @@ class MemberList : public QList<MemberDef> bool insert(uint index,const MemberDef *md); void inSort(const MemberDef *md); void append(const MemberDef *md); - int compareItems(QCollection::Item item1,QCollection::Item item2); 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; } @@ -82,6 +81,7 @@ class MemberList : public QList<MemberDef> void unmarshal(StorageIntf *s); private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; int m_varCnt; int m_funcCnt; int m_enumCnt; @@ -121,7 +121,8 @@ class MemberSDict : public SDict<MemberDef> public: MemberSDict(int size=17) : SDict<MemberDef>(size) {} virtual ~MemberSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; }; diff --git a/src/membername.cpp b/src/membername.cpp index 58eaf8c..946ce43 100644 --- a/src/membername.cpp +++ b/src/membername.cpp @@ -30,10 +30,8 @@ MemberName::~MemberName() { } -int MemberName::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberName::compareValues(const MemberDef *m1, const MemberDef *m2) const { - MemberDef *m1=(MemberDef *)item1; - MemberDef *m2=(MemberDef *)item2; ClassDef *c1=m1->getClassDef(); ClassDef *c2=m2->getClassDef(); FileDef *f1=m1->getFileDef(); @@ -52,10 +50,8 @@ MemberNameInfo::MemberNameInfo(const char *n) : QList<MemberInfo>() setAutoDelete(TRUE); } -int MemberNameInfo::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberNameInfo::compareValues(const MemberInfo *m1,const MemberInfo *m2) const { - MemberInfo *m1=(MemberInfo *)item1; - MemberInfo *m2=(MemberInfo *)item2; ClassDef *c1=m1->memberDef->getClassDef(); ClassDef *c2=m2->memberDef->getClassDef(); FileDef *f1=m1->memberDef->getFileDef(); @@ -72,12 +68,10 @@ MemberNameIterator::MemberNameIterator(const MemberName &mnlist) : { } -int MemberNameSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberNameSDict::compareValues(const MemberName *n1,const MemberName *n2) const { - MemberName *n1=(MemberName *)item1; - MemberName *n2=(MemberName *)item2; return qstricmp(n1->memberName()+getPrefixIndex(n1->memberName()), - n2->memberName()+getPrefixIndex(n2->memberName()) - ); + n2->memberName()+getPrefixIndex(n2->memberName()) + ); } diff --git a/src/membername.h b/src/membername.h index 0004aea..1b9dd47 100644 --- a/src/membername.h +++ b/src/membername.h @@ -24,14 +24,14 @@ /** Class representing all MemberDef objects with the same name */ class MemberName : public QList<MemberDef> -{ +{ public: MemberName(const char *name); ~MemberName(); const char *memberName() const { return name; } - - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; QCString name; }; @@ -49,7 +49,8 @@ class MemberNameSDict : public SDict<MemberName> MemberNameSDict(int size) : SDict<MemberName>(size) {} ~MemberNameSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberName *item1,const MemberName *item2) const; }; /** Data associated with a MemberDef in an inheritance relation. */ @@ -74,8 +75,8 @@ class MemberNameInfo : public QList<MemberInfo> MemberNameInfo(const char *name); ~MemberNameInfo() {} const char *memberName() const { return name; } - int compareItems(QCollection::Item item1,QCollection::Item item2); private: + int compareValues(const MemberInfo *item1,const MemberInfo *item2) const; QCString name; }; @@ -93,11 +94,10 @@ class MemberNameInfoSDict : public SDict<MemberNameInfo> public: MemberNameInfoSDict(int size) : SDict<MemberNameInfo>(size) {} ~MemberNameInfoSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { return qstricmp( - ((MemberNameInfo *)item1)->memberName(), - ((MemberNameInfo *)item2)->memberName() - ); + private: + int compareValues(const MemberNameInfo *item1,const MemberNameInfo *item2) const + { + return qstricmp(item1->memberName(), item2->memberName()); } }; diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index c39b38f..c0d4389 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -987,11 +987,11 @@ void NamespaceDef::addMemberToList(MemberListType lt,MemberDef *md) void NamespaceDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); } } @@ -999,15 +999,14 @@ void NamespaceDef::sortMemberLists() MemberList *NamespaceDef::getMemberList(MemberListType lt) const { - NamespaceDef *that = (NamespaceDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } diff --git a/src/namespacedef.h b/src/namespacedef.h index 2fe5e4a..c4afac9 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -137,14 +137,12 @@ class NamespaceDef : public Definition /** A list of NamespaceDef objects. */ class NamespaceList : public QList<NamespaceDef> -{ +{ public: ~NamespaceList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const NamespaceDef *nd1,const NamespaceDef *nd2) const { - return qstricmp(((NamespaceDef *)item1)->name(), - ((NamespaceDef *)item2)->name() - ); + return qstricmp(nd1->name(), nd2->name()); } }; @@ -170,15 +168,14 @@ class NamespaceSDict : public SDict<NamespaceDef> public: NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {} ~NamespaceSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { - return qstricmp(((NamespaceDef *)item1)->name(), - ((NamespaceDef *)item2)->name() - ); - } void writeDeclaration(OutputList &ol,const char *title, bool isConstantGroup=false, bool localName=FALSE); bool declVisible() const; + private: + int compareValues(const NamespaceDef *item1,const NamespaceDef *item2) const + { + return qstricmp(item1->name(),item2->name()); + } }; diff --git a/src/outputlist.cpp b/src/outputlist.cpp index f5df477..4efbd9c 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -33,100 +33,98 @@ OutputList::OutputList(bool) { //printf("OutputList::OutputList()\n"); - outputs = new QList<OutputGenerator>; - outputs->setAutoDelete(TRUE); + m_outputs.setAutoDelete(TRUE); } OutputList::~OutputList() { //printf("OutputList::~OutputList()\n"); - delete outputs; } void OutputList::add(const OutputGenerator *og) { - if (og) outputs->append(og); + if (og) m_outputs.append(og); } void OutputList::disableAllBut(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disableIfNot(o); - og=outputs->next(); } } void OutputList::enableAll() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->enable(); - og=outputs->next(); } } void OutputList::disableAll() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disable(); - og=outputs->next(); } } void OutputList::disable(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disableIf(o); - og=outputs->next(); } } void OutputList::enable(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->enableIf(o); - og=outputs->next(); } } bool OutputList::isEnabled(OutputGenerator::OutputType o) { bool result=FALSE; - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { result=result || og->isEnabled(o); - og=outputs->next(); } return result; } void OutputList::pushGeneratorState() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->pushGeneratorState(); - og=outputs->next(); } } void OutputList::popGeneratorState() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->popGeneratorState(); - og=outputs->next(); } } @@ -138,12 +136,12 @@ bool OutputList::generateDoc(const char *fileName,int startLine, { int count=0; if (docStr.isEmpty()) return TRUE; - - OutputGenerator *og=outputs->first(); - while (og) + + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) count++; - og=outputs->next(); } if (count==0) return TRUE; // no output formats enabled. @@ -163,13 +161,13 @@ bool OutputList::generateDoc(const char *fileName,int startLine, void OutputList::writeDoc(DocRoot *root,Definition *ctx,MemberDef *md) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { //printf("og->printDoc(extension=%s)\n", // ctx?ctx->getDefFileExtension().data():"<null>"); if (og->isEnabled()) og->writeDoc(root,ctx,md); - og=outputs->next(); } VhdlDocGen::setFlowMember(0); @@ -178,21 +176,19 @@ void OutputList::writeDoc(DocRoot *root,Definition *ctx,MemberDef *md) bool OutputList::parseText(const QCString &textStr) { int count=0; - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) count++; - og=outputs->next(); } if (count==0) return TRUE; // no output formats enabled. DocText *root = validatingParseText(textStr); - og=outputs->first(); - while (og) + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) og->writeDoc(root,0,0); - og=outputs->next(); } bool isEmpty = root->isEmpty(); @@ -211,11 +207,11 @@ bool OutputList::parseText(const QCString &textStr) // zero arguments void OutputList::forall(void (OutputGenerator::*func)()) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) (og->*func)(); - og=outputs->next(); } } @@ -223,98 +219,98 @@ void OutputList::forall(void (OutputGenerator::*func)()) #define FORALL1(a1,p1) \ void OutputList::forall(void (OutputGenerator::*func)(a1),a1) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1); \ - og=outputs->next(); \ } \ -} +} // two arguments #define FORALL2(a1,a2,p1,p2) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2),a1,a2) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2); \ - og=outputs->next(); \ } \ -} +} // three arguments #define FORALL3(a1,a2,a3,p1,p2,p3) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3),a1,a2,a3) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3); \ - og=outputs->next(); \ } \ -} +} // four arguments #define FORALL4(a1,a2,a3,a4,p1,p2,p3,p4) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4),a1,a2,a3,a4) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4); \ - og=outputs->next(); \ } \ -} +} // five arguments #define FORALL5(a1,a2,a3,a4,a5,p1,p2,p3,p4,p5) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5),a1,a2,a3,a4,a5) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5); \ - og=outputs->next(); \ } \ -} +} // six arguments #define FORALL6(a1,a2,a3,a4,a5,a6,p1,p2,p3,p4,p5,p6) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6),a1,a2,a3,a4,a5,a6) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6); \ - og=outputs->next(); \ } \ -} +} // seven arguments #define FORALL7(a1,a2,a3,a4,a5,a6,a7,p1,p2,p3,p4,p5,p6,p7) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7),a1,a2,a3,a4,a5,a6,a7) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7); \ - og=outputs->next(); \ } \ -} +} // eight arguments #define FORALL8(a1,a2,a3,a4,a5,a6,a7,a8,p1,p2,p3,p4,p5,p6,p7,p8) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7,a8),a1,a2,a3,a4,a5,a6,a7,a8) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7,p8); \ - og=outputs->next(); \ } \ -} +} // now instantiate only the ones we need. diff --git a/src/outputlist.h b/src/outputlist.h index a12d9f5..fc41aae 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -58,7 +58,7 @@ class OutputList : public OutputDocInterface virtual ~OutputList(); void add(const OutputGenerator *); - uint count() const { return outputs->count(); } + uint count() const { return m_outputs.count(); } void disableAllBut(OutputGenerator::OutputType o); void enableAll(); @@ -483,28 +483,28 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::addWord,word,hiPriority); } void startPlainFile(const char *name) - { - OutputGenerator *og=outputs->first(); - while (og) + { + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (;(og=it.current());++it) { if (og->isEnabled()) (og->startPlainFile)(name); - og=outputs->next(); } } - void endPlainFile() - { - OutputGenerator *og=outputs->first(); - while (og) + void endPlainFile() + { + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (;(og=it.current());++it) { if (og->isEnabled()) (og->endPlainFile)(); - og=outputs->next(); } } private: void debug(); void clear(); - + void forall(void (OutputGenerator::*func)()); FORALLPROTO1(const char *); FORALLPROTO1(char); @@ -546,9 +546,9 @@ class OutputList : public OutputDocInterface FORALLPROTO5(const char *,const char *,const char *,const char *,bool); FORALLPROTO6(const char *,const char *,const char *,const char *,const char *,const char *); FORALLPROTO6(const char *,const DocLinkInfo &,const char *,const char *,const SourceLinkInfo &,const SourceLinkInfo &); - + OutputList(const OutputList &ol); - QList<OutputGenerator> *outputs; + QList<OutputGenerator> m_outputs; }; #endif diff --git a/src/pagedef.h b/src/pagedef.h index 141c03b..01823cb 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -81,9 +81,10 @@ class PageSDict : public SDict<PageDef> public: PageSDict(int size) : SDict<PageDef>(size) {} virtual ~PageSDict() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const PageDef *i1,const PageDef *i2) const { - return qstricmp(((PageDef *)i1)->name(),((PageDef *)i2)->name()); + return qstricmp(i1->name(),i2->name()); } }; diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index 5537438..237cb8f 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -2098,7 +2098,7 @@ void PerlModGenerator::generatePerlModForGroup(GroupDef *gd) { m_output.openList("files"); QListIterator<FileDef> fli(*fl); - FileDef *fd = fl->first(); + FileDef *fd; for (fli.toFirst();(fd=fli.current());++fli) m_output.openHash() .addFieldQuotedString("name", fd->name()) diff --git a/src/reflist.h b/src/reflist.h index 3124582..2fb25cf 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -44,10 +44,9 @@ class SortedRefItems : public SDict<RefItem> public: SortedRefItems(int size=17) : SDict<RefItem>(size) {} virtual ~SortedRefItems() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const RefItem *r1,const RefItem *r2) const { - RefItem *r1 = (RefItem*)item1; - RefItem *r2 = (RefItem*)item2; return qstricmp(r1->title,r2->title); } }; diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index d8c34ee..14110cb 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -492,11 +492,13 @@ void RTFGenerator::startIndexSection(IndexSections is) { //File Documentation bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -507,9 +509,7 @@ void RTFGenerator::startIndexSection(IndexSections is) break; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; @@ -792,13 +792,15 @@ void RTFGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl; - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -819,9 +821,7 @@ void RTFGenerator::endIndexSection(IndexSections is) t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; diff --git a/src/scanner.l b/src/scanner.l index bbe90a3..e61826e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -5510,7 +5510,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( CopyArgComment ); } <CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block - current->typeConstr->last()->docs = fullArgString; + current->typeConstr->getLast()->docs = fullArgString; } <CSConstraintType>"{" { // end of type constraint reached // parse documentation of the constraints @@ -5528,24 +5528,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <CSConstraintName>{ID} { // parameter name - current->typeConstr->last()->name=yytext; + current->typeConstr->getLast()->name=yytext; } <CSConstraintType>"where" { // another constraint for a different param current->typeConstr->append(new Argument); BEGIN( CSConstraintName ); } <CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? { - if (current->typeConstr->last()->type.isEmpty()) + if (current->typeConstr->getLast()->type.isEmpty()) // first type constraint for this parameter { - current->typeConstr->last()->type=yytext; + current->typeConstr->getLast()->type=yytext; } else // new type constraint for same parameter { - QCString name = current->typeConstr->last()->name; + QCString name = current->typeConstr->getLast()->name; current->typeConstr->append(new Argument); - current->typeConstr->last()->name=name; - current->typeConstr->last()->type=yytext; + current->typeConstr->getLast()->name=name; + current->typeConstr->getLast()->type=yytext; } } <CSConstraintName,CSConstraintType>\n { diff --git a/src/searchindex.cpp b/src/searchindex.cpp index f023e4d..9c37ea2 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -632,16 +632,14 @@ class SearchIndexList : public SDict< SearchDefinitionList > } l->append(d); } - int compareItems(QCollection::Item item1, QCollection::Item item2) + uint letter() const { return m_letter; } + private: + int compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const { - QList<Definition> *md1=(QList<Definition> *)item1; - QList<Definition> *md2=(QList<Definition> *)item2; - QCString n1 = md1->first()->localName(); - QCString n2 = md2->first()->localName(); + QCString n1 = md1->getFirst()->localName(); + QCString n2 = md2->getFirst()->localName(); return qstricmp(n1.data(),n2.data()); } - uint letter() const { return m_letter; } - private: uint m_letter; }; @@ -1077,7 +1075,7 @@ void writeJavascriptSearchIndex() int itemCount=0; for (li.toFirst();(dl=li.current());++li) { - Definition *d = dl->first(); + Definition *d = dl->getFirst(); QCString id = d->localName(); if (!firstEntry) diff --git a/src/settings.h b/src/settings.h index a9fd128..1d3fbbf 100644 --- a/src/settings.h +++ b/src/settings.h @@ -2,7 +2,7 @@ #define SETTINGS_H #define USE_SQLITE3 0 -#define USE_LIBCLANG 0 +#define USE_LIBCLANG 1 #define IS_SUPPORTED(x) \ ((USE_SQLITE3 && strcmp("USE_SQLITE3",(x))==0) || \ diff --git a/src/sortdict.h b/src/sortdict.h index e111075..fe51e24 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -73,7 +73,7 @@ const uint SDict_primes[] = template<class T> class SDict; template<class T> class SIntDict; -/** internal wrapper class that redirects compareItems() to the +/** internal wrapper class that redirects compareValues() to the * dictionary */ template<class T> @@ -82,9 +82,9 @@ class SList : public QList<T> public: SList(SDict<T> *owner) : m_owner(owner) {} virtual ~SList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const T *item1,const T *item2) const { - return m_owner->compareItems(item1,item2); + return m_owner->compareValues(item1,item2); } private: SDict<T> *m_owner; @@ -264,7 +264,7 @@ class SDict * Overload this to properly sort items. * \sa inSort() */ - virtual int compareItems(QCollection::Item item1,QCollection::Item item2) + virtual int compareValues(const T *item1,const T *item2) const { return item1!=item2; } @@ -421,7 +421,7 @@ class SDict }; }; -/** internal wrapper class that redirects compareItems() to the +/** internal wrapper class that redirects compareValues() to the * dictionary */ template<class T> @@ -430,11 +430,11 @@ class SIntList : public QList<T> public: SIntList(SIntDict<T> *owner) : m_owner(owner) {} virtual ~SIntList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const T *item1,const T *item2) const { - return m_owner->compareItems(item1,item2); + return m_owner->compareValues(item1,item2); } - private: SIntDict<T> *m_owner; }; @@ -573,7 +573,7 @@ class SIntDict * Overload this to properly sort items. * \sa inSort() */ - virtual int compareItems(QCollection::Item item1,QCollection::Item item2) + virtual int compareValues(const T *item1,const T *item2) const { return item1!=item2; } diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 03cc020..cbdf996 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1274,8 +1274,9 @@ static QCString stripPath(const QCString &s) void TagFileParser::buildLists(Entry *root) { // build class list - TagClassInfo *tci = m_tagFileClasses.first(); - while (tci) + QListIterator<TagClassInfo> cit(m_tagFileClasses); + TagClassInfo *tci; + for (cit.toFirst();(tci=cit.current());++cit) { Entry *ce = new Entry; ce->section = Entry::CLASS_SEC; @@ -1290,7 +1291,7 @@ void TagFileParser::buildLists(Entry *root) case TagClassInfo::Category: ce->spec = Entry::Category; break; } ce->name = tci->name; - if (tci->kind==TagClassInfo::Protocol) + if (tci->kind==TagClassInfo::Protocol) { ce->name+="-p"; } @@ -1309,14 +1310,14 @@ void TagFileParser::buildLists(Entry *root) } if (tci->templateArguments) { - if (ce->tArgLists==0) + if (ce->tArgLists==0) { ce->tArgLists = new QList<ArgumentList>; ce->tArgLists->setAutoDelete(TRUE); } ArgumentList *al = new ArgumentList; ce->tArgLists->append(al); - + QListIterator<QCString> sli(*tci->templateArguments); QCString *argName; for (;(argName=sli.current());++sli) @@ -1330,12 +1331,12 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(ce,tci->members); root->addSubEntry(ce); - tci = m_tagFileClasses.next(); } // build file list - TagFileInfo *tfi = m_tagFileFiles.first(); - while (tfi) + QListIterator<TagFileInfo> fit(m_tagFileFiles); + TagFileInfo *tfi; + for (fit.toFirst();(tfi=fit.current());++fit) { Entry *fe = new Entry; fe->section = guessSection(tfi->name); @@ -1367,12 +1368,12 @@ void TagFileParser::buildLists(Entry *root) } buildMemberList(fe,tfi->members); root->addSubEntry(fe); - tfi = m_tagFileFiles.next(); } // build namespace list - TagNamespaceInfo *tni = m_tagFileNamespaces.first(); - while (tni) + QListIterator<TagNamespaceInfo> nit(m_tagFileNamespaces); + TagNamespaceInfo *tni; + for (nit.toFirst();(tni=nit.current());++nit) { Entry *ne = new Entry; ne->section = Entry::NAMESPACE_SEC; @@ -1386,12 +1387,12 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(ne,tni->members); root->addSubEntry(ne); - tni = m_tagFileNamespaces.next(); } // build package list - TagPackageInfo *tpgi = m_tagFilePackages.first(); - while (tpgi) + QListIterator<TagPackageInfo> pit(m_tagFilePackages); + TagPackageInfo *tpgi; + for (pit.toFirst();(tpgi=pit.current());++pit) { Entry *pe = new Entry; pe->section = Entry::PACKAGE_SEC; @@ -1404,34 +1405,31 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(pe,tpgi->members); root->addSubEntry(pe); - tpgi = m_tagFilePackages.next(); } - // build group list, but only if config file says to include it - //if (Config_getBool("EXTERNAL_GROUPS")) - //{ - TagGroupInfo *tgi = m_tagFileGroups.first(); - while (tgi) - { - Entry *ge = new Entry; - ge->section = Entry::GROUPDOC_SEC; - ge->name = tgi->name; - ge->type = tgi->title; - addDocAnchors(ge,tgi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tgi->filename; - ge->tagInfo = ti; - - buildMemberList(ge,tgi->members); - root->addSubEntry(ge); - tgi = m_tagFileGroups.next(); - } - //} + // build group list + QListIterator<TagGroupInfo> git(m_tagFileGroups); + TagGroupInfo *tgi; + for (git.toFirst();(tgi=git.current());++git) + { + Entry *ge = new Entry; + ge->section = Entry::GROUPDOC_SEC; + ge->name = tgi->name; + ge->type = tgi->title; + addDocAnchors(ge,tgi->docAnchors); + TagInfo *ti = new TagInfo; + ti->tagName = m_tagName; + ti->fileName = tgi->filename; + ge->tagInfo = ti; + + buildMemberList(ge,tgi->members); + root->addSubEntry(ge); + } // build page list - TagPageInfo *tpi = m_tagFilePages.first(); - while (tpi) + QListIterator<TagPageInfo> pgit(m_tagFilePages); + TagPageInfo *tpi; + for (pgit.toFirst();(tpi=pgit.current());++pgit) { Entry *pe = new Entry; pe->section = Entry::PAGEDOC_SEC; @@ -1444,14 +1442,14 @@ void TagFileParser::buildLists(Entry *root) pe->tagInfo = ti; root->addSubEntry(pe); - tpi = m_tagFilePages.next(); } } void TagFileParser::addIncludes() { - TagFileInfo *tfi = m_tagFileFiles.first(); - while (tfi) + QListIterator<TagFileInfo> fit(m_tagFileFiles); + TagFileInfo *tfi; + for (fit.toFirst();(tfi=fit.current());++fit) { //printf("tag file tagName=%s path=%s name=%s\n",m_tagName.data(),tfi->path.data(),tfi->name.data()); FileName *fn = Doxygen::inputNameDict->find(tfi->name); @@ -1489,9 +1487,8 @@ void TagFileParser::addIncludes() } } } - } + } } - tfi = m_tagFileFiles.next(); } } diff --git a/src/template.cpp b/src/template.cpp index af15a47..793d769 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -1594,12 +1594,12 @@ TemplateContextImpl::~TemplateContextImpl() void TemplateContextImpl::set(const char *name,const TemplateVariant &v) { - TemplateVariant *pv = m_contextStack.first()->find(name); + TemplateVariant *pv = m_contextStack.getFirst()->find(name); if (pv) { - m_contextStack.first()->remove(name); + m_contextStack.getFirst()->remove(name); } - m_contextStack.first()->insert(name,new TemplateVariant(v)); + m_contextStack.getFirst()->insert(name,new TemplateVariant(v)); } TemplateVariant TemplateContextImpl::get(const QCString &name) const @@ -3325,7 +3325,7 @@ TemplateToken *TemplateParser::takeNextToken() const TemplateToken *TemplateParser::currentToken() const { - return m_tokens.first(); + return m_tokens.getFirst(); }; void TemplateParser::removeNextToken() diff --git a/src/util.cpp b/src/util.cpp index 545cd43..72696d3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2143,11 +2143,12 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType,bool showDefVals { QCString result; if (al==0) return result; - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a=ali.current(); result+="("; while (a) { - QCString type1 = useCanonicalType && !a->canType.isEmpty() ? + QCString type1 = useCanonicalType && !a->canType.isEmpty() ? a->canType : a->type; QCString type2; int i=type1.find(")("); // hack to deal with function pointers @@ -2172,8 +2173,9 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType,bool showDefVals { result+="="+a->defval; } - a = al->next(); - if (a) result+=", "; + ++ali; + a = ali.current(); + if (a) result+=", "; } result+=")"; if (al->constSpecifier) result+=" const"; @@ -2188,7 +2190,8 @@ QCString tempArgListToString(ArgumentList *al) QCString result; if (al==0) return result; result="<"; - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a=ali.current(); while (a) { if (!a->name.isEmpty()) // add template argument name @@ -2216,7 +2219,8 @@ QCString tempArgListToString(ArgumentList *al) result+=a->type; } } - a=al->next(); + ++ali; + a=ali.current(); if (a) result+=", "; } result+=">"; @@ -2486,13 +2490,13 @@ int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) int m=maxInheritanceDepth; if (cd->baseClasses()) { - BaseClassDef *bcdi = cd->baseClasses()->first(); - while (bcdi) + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcdi; + for (;(bcdi=bcli.current());++bcli) { int mc=minClassDistance(bcdi->classDef,bcd,level+1); if (mc<m) m=mc; if (m<0) break; - bcdi = cd->baseClasses()->next(); } } return m; @@ -2516,13 +2520,13 @@ Protection classInheritedProtectionLevel(ClassDef *cd,ClassDef *bcd,Protection p } else if (cd->baseClasses()) { - BaseClassDef *bcdi = cd->baseClasses()->first(); - while (bcdi && prot!=Private) + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcdi; + for (;(bcdi=bcli.current()) && prot!=Private;++bcli) { Protection baseProt = classInheritedProtectionLevel(bcdi->classDef,bcd,bcdi->prot,level+1); if (baseProt==Private) prot=Private; else if (baseProt==Protected) prot=Protected; - bcdi = cd->baseClasses()->next(); } } exit: @@ -4285,10 +4289,10 @@ bool getDefs(const QCString &scName, //printf("found %d members\n",members.count()); if (members.count()!=1 && args && !qstrcmp(args,"()")) { - // no exact match found, but if args="()" an arbitrary + // no exact match found, but if args="()" an arbitrary // member will do - md=mn->last(); - while (md /* && md->isLinkable()*/) + MemberListIterator mni(*mn); + for (mni.toLast();(md=mni.current());--mni) { //printf("Found member `%s'\n",md->name().data()); //printf("member is linkable md->name()=`%s'\n",md->name().data()); @@ -4302,7 +4306,6 @@ bool getDefs(const QCString &scName, { members.append(md); } - md=mn->prev(); } } //printf("found %d candidate members\n",members.count()); @@ -4311,23 +4314,22 @@ bool getDefs(const QCString &scName, if (currentFile) { //printf("multiple results; pick one from file:%s\n", currentFile->name().data()); - md = members.first(); - while (md) + QListIterator<MemberDef> mit(members); + for (mit.toFirst();(md=mit.current());++mit) { if (md->getFileDef() && md->getFileDef()->name() == currentFile->name()) { break; // found match in the current file } - md=members.next(); } if (!md) // member not in the current file { - md=members.last(); + md=members.getLast(); } - } - else + } + else { - md=members.last(); + md=members.getLast(); } } if (md && (md->getEnumScope()==0 || !md->getEnumScope()->isStrong())) @@ -5829,8 +5831,9 @@ void addMembersToMemberGroup(MemberList *ml, MemberList *fmdl=md->enumFieldList(); if (fmdl!=0) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator fmli(*fmdl); + MemberDef *fmd; + for (fmli.toFirst();(fmd=fmli.current());++fmli) { int groupId=fmd->getMemberGroupId(); if (groupId!=-1) @@ -5861,7 +5864,6 @@ void addMembersToMemberGroup(MemberList *ml, fmd->setMemberGroup(mg); } } - fmd=fmdl->next(); } } } @@ -6059,15 +6061,16 @@ QCString substituteTemplateArgumentsInString( result += name.mid(p,i-p); QCString n = name.mid(i,l); ArgumentListIterator formAli(*formalArgs); + ArgumentListIterator actAli(*actualArgs); Argument *formArg; - Argument *actArg=actualArgs->first(); + Argument *actArg; // if n is a template argument, then we substitute it // for its template instance argument. bool found=FALSE; for (formAli.toFirst(); - (formArg=formAli.current()) && !found; - ++formAli,actArg=actualArgs->next() + (formArg=formAli.current()) && !found && (actArg=actAli.current()); + ++formAli,++actAli ) { if (formArg->type.left(6)=="class " && formArg->name.isEmpty()) @@ -95,12 +95,6 @@ class LetterToIndexMap : public SIntDict<T> { public: LetterToIndexMap() { SIntDict<T>::setAutoDelete(TRUE); } - int compareItems(QCollection::Item item1, QCollection::Item item2) - { - T *l1=(T *)item1; - T *l2=(T *)item2; - return (int)l1->letter()-(int)l2->letter(); - } void append(uint letter,typename T::ElementType *elem) { T *l = SIntDict<T>::find((int)letter); @@ -111,6 +105,11 @@ class LetterToIndexMap : public SIntDict<T> } l->append(elem); } + private: + int compareValues(const T *l1, const T *l2) const + { + return (int)l1->letter()-(int)l2->letter(); + } }; //-------------------------------------------------------------------- diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 94ba3c0..85164bf 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -436,9 +436,10 @@ static void setParameterList(MemberDef *md) { g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; ArgumentList *al = md->argumentList(); - if (al==0) return; - Argument *a = al->first(); - while (a) + if (al==0) return; + ArgumentListIterator ali(*al); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) { g_parmName = a->name.copy(); g_parmType = a->type.copy(); @@ -449,7 +450,6 @@ static void setParameterList(MemberDef *md) g_parmType.stripPrefix("const "); g_parmType=g_parmType.stripWhiteSpace(); // g_theVarContext.addVariable(g_parmType,g_parmName); - a = al->next(); } } diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index aa0207a..afdf55f 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -2772,7 +2772,6 @@ static void writeUCFLink(const MemberDef* mdef,OutputList &ol) bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) { - FileName *fn=Doxygen::inputNameList->first(); //LayoutNavEntry *cc = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Files); LayoutNavEntry *kk = lne->parent();// find(LayoutNavEntry::Files); @@ -2788,17 +2787,22 @@ bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) kk->addChild(oo); } - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { - file = convertNameToFile(fd->name().data(),FALSE,FALSE); - LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); - kk->addChild(ucf); - break; + if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) + { + file = convertNameToFile(fd->name().data(),FALSE,FALSE); + LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); + kk->addChild(ucf); + break; + } } - fn=Doxygen::inputNameList->next(); } return FALSE; } diff --git a/src/vhdlparser.y b/src/vhdlparser.y index 4e4e675..69f5968 100644 --- a/src/vhdlparser.y +++ b/src/vhdlparser.y @@ -2364,7 +2364,7 @@ static void addConfigureNode(const char* a,const char*b, bool,bool isLeaf,bool i if(!configL.isEmpty()) { - VhdlConfNode* vc=configL.last(); + VhdlConfNode* vc=configL.getLast(); level=vc->level; if (levelCounter==0) pushLabel(forL,ent); diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l index 716c0c0..e1257ec 100644 --- a/src/vhdlscanner.l +++ b/src/vhdlscanner.l @@ -988,7 +988,7 @@ static bool checkMultiComment(QCString& qcs,int line) qcs.stripPrefix("--!"); while (!pTemp->isEmpty()) { - Entry *e=(Entry*)pTemp->first(); + Entry *e=(Entry*)pTemp->getFirst(); e->briefLine=line; e->brief+=qcs; iDocLine=-1; |