diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-09-10 20:49:41 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-09-10 20:49:41 (GMT) |
commit | c844985adde0459f1f01ed00d0a289591fbcd2af (patch) | |
tree | fe67587a09765b41e54254d65f53b6c9352816e9 /src | |
parent | cde82403ec8974fb86de34828b41bf9547587b6e (diff) | |
download | Doxygen-c844985adde0459f1f01ed00d0a289591fbcd2af.zip Doxygen-c844985adde0459f1f01ed00d0a289591fbcd2af.tar.gz Doxygen-c844985adde0459f1f01ed00d0a289591fbcd2af.tar.bz2 |
Release-1.4.7-20060910
Diffstat (limited to 'src')
55 files changed, 6351 insertions, 2563 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index a753940..1470ee3 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -43,6 +43,205 @@ // return result; //} +class ClassDefImpl +{ + public: + ClassDefImpl(); + ~ClassDefImpl(); + void init(const char *defFileName, const char *name, + const QCString &ctStr, const char *fName); + + /*! file name that forms the base for the output file containing the + * class documentation. For compatibility with Qt (e.g. links via tag + * files) this name cannot be derived from the class name directly. + */ + QCString fileName; + + /*! Include information about the header file should be included + * in the documentation. 0 by default, set by setIncludeFile(). + */ + IncludeInfo *incInfo; + + /*! List of base class (or super-classes) from which this class derives + * directly. + */ + BaseClassList *inherits; + + /*! List of sub-classes that directly derive from this class + */ + BaseClassList *inheritedBy; + + /*! Namespace this class is part of + * (this is the inner most namespace in case of nested namespaces) + */ + NamespaceDef *nspace; + + /*! File this class is defined in */ + FileDef *fileDef; + + /*! List of all members (including inherited members) */ + MemberNameInfoSDict *allMemberNameInfoSDict; + + /*! Template arguments of this class */ + ArgumentList *tempArgs; + + /*! Files that were used for generating the class documentation. */ + QStrList files; + + /*! Examples that use this class */ + ExampleSDict *exampleSDict; + + /*! Holds the kind of "class" this is. */ + ClassDef::CompoundType compType; + + /*! The protection level in which this class was found. + * Typically Public, but for nested classes this can also be Protected + * or Private. + */ + Protection prot; + + /*! The inner classes contained in this class. Will be 0 if there are + * no inner classes. + */ + ClassSDict *innerClasses; + + /* classes for the collaboration diagram */ + UsesClassDict *usesImplClassDict; + UsesClassDict *usedByImplClassDict; + UsesClassDict *usesIntfClassDict; + + /*! Template instances that exists of this class, the key in the + * dictionary is the template argument list. + */ + QDict<ClassDef> *templateInstances; + + /*! Template instances that exists of this class, as defined by variables. + * We do NOT want to document these individually. The key in the + * dictionary is the template argument list. + */ + QDict<ClassDef> *variableInstances; + + QDict<int> *templBaseClassNames; + + /*! The class this class is an instance of. */ + ClassDef *templateMaster; + + /*! class name with outer class scope, but without namespace scope. */ + QCString className; + + /*! If this class is a Objective-C category, then this points to the + * class which is extended. + */ + ClassDef *categoryOf; + + QList<MemberList> memberLists; + + /* user defined member groups */ + MemberGroupSDict *memberGroupSDict; + + /*! Indicated whether this class exists because it is used by + * some other class only (TRUE) or if some class inherits from + * it (FALSE). This is need to remove used-only classes from + * the inheritance tree. + */ + bool artificial; + + /*! Is this an abstact class? */ + bool isAbstract; + + /*! Is the class part of an unnamed namespace? */ + bool isStatic; + + /*! Is the class part implemented in Objective C? */ + bool isObjC; + + /*! TRUE if classes members are merged with those of the base classes. */ + bool membersMerged; + + /*! TRUE if the class is defined in a source file rather than a header file. */ + bool isLocal; + + bool isTemplArg; + + /*! Does this class group its user-grouped members + * as a sub-section of the normal (public/protected/..) + * groups? + */ + bool subGrouping; +}; + +void ClassDefImpl::init(const char *defFileName, const char *name, + const QCString &ctStr, const char *fName) +{ + if (fName) + { + fileName=stripExtension(fName); + } + else + { + fileName=ctStr+name; + } + exampleSDict = 0; + inherits = 0; + inheritedBy = 0; + allMemberNameInfoSDict = 0; + incInfo=0; + tempArgs=0; + prot=Public; + nspace=0; + fileDef=0; + usesImplClassDict=0; + usedByImplClassDict=0; + usesIntfClassDict=0; + memberGroupSDict = 0; + innerClasses = 0; + subGrouping=Config_getBool("SUBGROUPING"); + templateInstances = 0; + variableInstances = 0; + templateMaster =0; + templBaseClassNames = 0; + artificial = FALSE; + isAbstract = FALSE; + isStatic = FALSE; + isTemplArg = FALSE; + membersMerged = FALSE; + categoryOf = 0; + QCString ns; + extractNamespaceName(name,className,ns); + //printf("m_name=%s m_className=%s ns=%s\n",m_name.data(),m_className.data(),ns.data()); + + if (((QCString)defFileName).right(5)!=".java" && + guessSection(defFileName)==Entry::SOURCE_SEC) + { + isLocal=TRUE; + } + else + { + isLocal=FALSE; + } +} + +ClassDefImpl::ClassDefImpl() +{ +} + +ClassDefImpl::~ClassDefImpl() +{ + delete inherits; + delete inheritedBy; + delete allMemberNameInfoSDict; + delete exampleSDict; + delete usesImplClassDict; + delete usedByImplClassDict; + delete usesIntfClassDict; + delete incInfo; + delete memberGroupSDict; + delete innerClasses; + delete templateInstances; + delete variableInstances; + delete templBaseClassNames; + delete tempArgs; +} // constructs a new class definition ClassDef::ClassDef( @@ -52,6 +251,14 @@ ClassDef::ClassDef( bool isSymbol) : Definition(defFileName,defLine,removeRedundantWhiteSpace(nm),0,0,isSymbol) { + visited=FALSE; + setReference(lref); + m_impl = new ClassDefImpl; + m_impl->compType = ct; + m_impl->isObjC = FALSE; + m_impl->init(defFileName,name(),compoundTypeString(),fName); + +#if 0 m_compType=ct; m_isObjC = FALSE; QCString compoundName=compoundTypeString(); @@ -67,8 +274,6 @@ ClassDef::ClassDef( m_inherits = 0; m_inheritedBy = 0; m_allMemberNameInfoSDict = 0; - visited=FALSE; - setReference(lref); m_incInfo=0; m_tempArgs=0; m_prot=Public; @@ -103,55 +308,13 @@ ClassDef::ClassDef( { m_isLocal=FALSE; } - - -#if 0 - pubMethods=0; - proMethods=0; - pacMethods=0; - priMethods=0; - pubStaticMethods=0; - proStaticMethods=0; - pacStaticMethods=0; - priStaticMethods=0; - pubSlots=0; - proSlots=0; - priSlots=0; - pubAttribs=0; - proAttribs=0; - pacAttribs=0; - priAttribs=0; - pubStaticAttribs=0; - proStaticAttribs=0; - pacStaticAttribs=0; - priStaticAttribs=0; - pubTypes=0; - proTypes=0; - pacTypes=0; - priTypes=0; - related=0; - signals=0; - friends=0; - dcopMethods=0; - properties=0; - events=0; - - constructors=0; - typedefMembers=0; - enumMembers=0; - enumValMembers=0; - functionMembers=0; - relatedMembers=0; - variableMembers=0; - propertyMembers=0; - eventMembers=0; #endif - } // destroy the class definition ClassDef::~ClassDef() { +#if 0 delete m_inherits; delete m_inheritedBy; delete m_allMemberNameInfoSDict; @@ -166,48 +329,8 @@ ClassDef::~ClassDef() delete m_variableInstances; delete m_templBaseClassNames; delete m_tempArgs; - -#if 0 - delete pubMethods; - delete proMethods; - delete pacMethods; - delete priMethods; - delete pubStaticMethods; - delete proStaticMethods; - delete pacStaticMethods; - delete priStaticMethods; - delete pubSlots; - delete proSlots; - delete priSlots; - delete pubAttribs; - delete proAttribs; - delete pacAttribs; - delete priAttribs; - delete pubStaticAttribs; - delete proStaticAttribs; - delete pacStaticAttribs; - delete priStaticAttribs; - delete pubTypes; - delete proTypes; - delete pacTypes; - delete priTypes; - delete related; - delete signals; - delete friends; - delete dcopMethods; - delete properties; - delete events; - - delete constructors; - delete typedefMembers; - delete enumMembers; - delete enumValMembers; - delete functionMembers; - delete relatedMembers; - delete variableMembers; - delete propertyMembers; - delete eventMembers; #endif + delete m_impl; } QCString ClassDef::getMemberListFileName() const @@ -222,7 +345,7 @@ QCString ClassDef::displayName() const QCString n; if (hideScopeNames) { - n=m_className; + n=m_impl->className; } else { @@ -232,7 +355,7 @@ QCString ClassDef::displayName() const { n=substitute(n,"::","."); } - if (m_compType==ClassDef::Protocol && n.right(2)=="-p") + if (m_impl->compType==ClassDef::Protocol && n.right(2)=="-p") { n="< "+n.left(n.length()-2)+" >"; } @@ -245,12 +368,12 @@ void ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p, { //printf("*** insert base class %s into %s\n",cd->name().data(),name().data()); //inherits->inSort(new BaseClassDef(cd,p,s,t)); - if (m_inherits==0) + if (m_impl->inherits==0) { - m_inherits = new BaseClassList; - m_inherits->setAutoDelete(TRUE); + m_impl->inherits = new BaseClassList; + m_impl->inherits->setAutoDelete(TRUE); } - m_inherits->append(new BaseClassDef(cd,n,p,s,t)); + m_impl->inherits->append(new BaseClassDef(cd,n,p,s,t)); } // inserts a sub class in the inherited list @@ -258,34 +381,34 @@ void ClassDef::insertSubClass(ClassDef *cd,Protection p, Specifier s,const char *t) { //printf("*** insert sub class %s into %s\n",cd->name().data(),name().data()); - if (m_inheritedBy==0) + if (m_impl->inheritedBy==0) { - m_inheritedBy = new BaseClassList; - m_inheritedBy->setAutoDelete(TRUE); + m_impl->inheritedBy = new BaseClassList; + m_impl->inheritedBy->setAutoDelete(TRUE); } - m_inheritedBy->inSort(new BaseClassDef(cd,0,p,s,t)); + m_impl->inheritedBy->inSort(new BaseClassDef(cd,0,p,s,t)); } void ClassDef::addMembersToMemberGroup() { - QListIterator<MemberList> mli(m_memberLists); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { if ((ml->listType()&MemberList::detailedLists)==0) { - ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + ::addMembersToMemberGroup(ml,&m_impl->memberGroupSDict,this); } } // add members inside sections to their groups - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - if (mg->allMembersInSameSection() && m_subGrouping) + if (mg->allMembersInSameSection() && m_impl->subGrouping) { //printf("addToDeclarationSection(%s)\n",mg->header().data()); mg->addToDeclarationSection(); @@ -533,9 +656,10 @@ void ClassDef::internalInsertMember(MemberDef *md, if (md->virtualness()==Pure) { - m_isAbstract=TRUE; + m_impl->isAbstract=TRUE; } + ::addClassMemberNameToIndex(md); if (addToAllList && !(Config_getBool("HIDE_FRIEND_COMPOUNDS") && md->isFriend() && @@ -547,12 +671,12 @@ void ClassDef::internalInsertMember(MemberDef *md, MemberInfo *mi = new MemberInfo((MemberDef *)md, prot,md->virtualness(),FALSE); MemberNameInfo *mni=0; - if (m_allMemberNameInfoSDict==0) + if (m_impl->allMemberNameInfoSDict==0) { - m_allMemberNameInfoSDict = new MemberNameInfoSDict(17); - m_allMemberNameInfoSDict->setAutoDelete(TRUE); + m_impl->allMemberNameInfoSDict = new MemberNameInfoSDict(17); + m_impl->allMemberNameInfoSDict->setAutoDelete(TRUE); } - if ((mni=m_allMemberNameInfoSDict->find(md->name()))) + if ((mni=m_impl->allMemberNameInfoSDict->find(md->name()))) { mni->append(mi); } @@ -560,7 +684,7 @@ void ClassDef::internalInsertMember(MemberDef *md, { mni = new MemberNameInfo(md->name()); mni->append(mi); - m_allMemberNameInfoSDict->append(mni->memberName(),mni); + m_impl->allMemberNameInfoSDict->append(mni->memberName(),mni); } } } @@ -575,7 +699,7 @@ void ClassDef::computeAnchors() { ClassDef *context = Config_getBool("INLINE_INHERITED_MEMB") ? this : 0; const char *letters = "abcdefghijklmnopqrstuvwxyz0123456789"; - QListIterator<MemberList> mli(m_memberLists); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; int index = 0; for (mli.toFirst();(ml=mli.current());++mli) @@ -586,9 +710,9 @@ void ClassDef::computeAnchors() } } - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -599,9 +723,9 @@ void ClassDef::computeAnchors() void ClassDef::distributeMemberGroupDocumentation() { - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -613,16 +737,16 @@ void ClassDef::distributeMemberGroupDocumentation() void ClassDef::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { mg->findSectionsInDocumentation(); } } - QListIterator<MemberList> mli(m_memberLists); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { @@ -637,10 +761,10 @@ void ClassDef::findSectionsInDocumentation() // add a file name to the used files set void ClassDef::insertUsedFile(const char *f) { - if (m_files.find(f)==-1) m_files.append(f); - if (m_templateInstances) + if (m_impl->files.find(f)==-1) m_impl->files.append(f); + if (m_impl->templateInstances) { - QDictIterator<ClassDef> qdi(*m_templateInstances); + QDictIterator<ClassDef> qdi(*m_impl->templateInstances); ClassDef *cd; for (qdi.toFirst();(cd=qdi.current());++qdi) { @@ -675,17 +799,17 @@ void ClassDef::setIncludeFile(FileDef *fd, const char *includeName,bool local, bool force) { //printf("ClassDef::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force); - if (!m_incInfo) m_incInfo=new IncludeInfo; - if ((includeName && m_incInfo->includeName.isEmpty()) || - (fd!=0 && m_incInfo->fileDef==0) + if (!m_impl->incInfo) m_impl->incInfo=new IncludeInfo; + if ((includeName && m_impl->incInfo->includeName.isEmpty()) || + (fd!=0 && m_impl->incInfo->fileDef==0) ) { //printf("Setting file info\n"); - m_incInfo->fileDef = fd; - m_incInfo->includeName = includeName; - m_incInfo->local = local; + m_impl->incInfo->fileDef = fd; + m_impl->incInfo->includeName = includeName; + m_impl->incInfo->local = local; } - if (force && includeName) m_incInfo->includeName = includeName; + if (force && includeName) m_impl->incInfo->includeName = includeName; } // TODO: fix this: a nested template class can have multiple outer templates @@ -694,7 +818,7 @@ void ClassDef::setIncludeFile(FileDef *fd, // int ti; // ClassDef *pcd=0; // int pi=0; -// if (m_tempArgs) return m_tempArgs; +// if (m_impl->tempArgs) return m_impl->tempArgs; // // find the outer most class scope // while ((ti=name().find("::",pi))!=-1 && // (pcd=getClass(name().left(ti)))==0 @@ -825,12 +949,12 @@ void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &pageType ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); } // write examples - if (exampleFlag && m_exampleSDict) + if (exampleFlag && m_impl->exampleSDict) { ol.startSimpleSect(BaseOutputDocInterface::Examples,0,0,theTranslator->trExamples()+": "); ol.writeDescItem(); ol.newParagraph(); - writeExample(ol,m_exampleSDict); + writeExample(ol,m_impl->exampleSDict); ol.endSimpleSect(); } ol.newParagraph(); @@ -849,11 +973,11 @@ void ClassDef::showUsedFiles(OutputList &ol) { ol.writeRuler(); ol.parseText(theTranslator->trGeneratedFromFiles( - m_isObjC && m_compType==Interface ? Class : m_compType, - m_files.count()==1)); + m_impl->isObjC && m_impl->compType==Interface ? Class : m_impl->compType, + m_impl->files.count()==1)); bool first=TRUE; - const char *file = m_files.first(); + const char *file = m_impl->files.first(); while (file) { bool ambig; @@ -914,7 +1038,7 @@ void ClassDef::showUsedFiles(OutputList &ol) } - file=m_files.next(); + file=m_impl->files.next(); } if (!first) ol.endItemList(); } @@ -928,8 +1052,8 @@ void ClassDef::writeDocumentation(OutputList &ol) pageType += compoundTypeString(); toupper(pageType.at(1)); QCString pageTitle = theTranslator->trCompoundReference(displayName(), - m_compType == Interface && m_isObjC ? Class : m_compType, - m_tempArgs != 0); + m_impl->compType == Interface && m_impl->isObjC ? Class : m_impl->compType, + m_impl->tempArgs != 0); startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible); if (getOuterScope()!=Doxygen::globalScope) @@ -947,9 +1071,9 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.writeString("<!-- doxytag: class=\""); ol.docify(name()); ol.writeString("\" -->"); - if (m_inherits && m_inherits->count()>0) + if (m_impl->inherits && m_impl->inherits->count()>0) { - BaseClassListIterator bli(*m_inherits); + BaseClassListIterator bli(*m_impl->inherits); ol.writeString("<!-- doxytag: inherits=\""); BaseClassDef *bcd=0; bool first=TRUE; @@ -1005,13 +1129,13 @@ void ClassDef::writeDocumentation(OutputList &ol) } ol.writeSynopsis(); - if (m_incInfo && Config_getBool("SHOW_INCLUDE_FILES")) + if (m_impl->incInfo && Config_getBool("SHOW_INCLUDE_FILES")) { - QCString nm=m_incInfo->includeName.isEmpty() ? - (m_incInfo->fileDef ? - m_incInfo->fileDef->docName().data() : "" + QCString nm=m_impl->incInfo->includeName.isEmpty() ? + (m_impl->incInfo->fileDef ? + m_impl->incInfo->fileDef->docName().data() : "" ) : - m_incInfo->includeName.data(); + m_impl->incInfo->includeName.data(); if (!nm.isEmpty()) { ol.startTypewriter(); @@ -1030,7 +1154,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.docify("#include "); } - if (m_incInfo->local || isIDLorJava) + if (m_impl->incInfo->local || isIDLorJava) ol.docify("\""); else ol.docify("<"); @@ -1039,16 +1163,16 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.docify(nm); ol.disableAllBut(OutputGenerator::Html); ol.enable(OutputGenerator::Html); - if (m_incInfo->fileDef) + if (m_impl->incInfo->fileDef) { - ol.writeObjectLink(0,m_incInfo->fileDef->includeName(),0,nm); + ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm); } else { ol.docify(nm); } ol.popGeneratorState(); - if (m_incInfo->local || isIDLorJava) + if (m_impl->incInfo->local || isIDLorJava) ol.docify("\""); else ol.docify(">"); @@ -1068,9 +1192,9 @@ void ClassDef::writeDocumentation(OutputList &ol) Doxygen::tagFile << ">" << endl; Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; - if (m_tempArgs) + if (m_impl->tempArgs) { - ArgumentListIterator ali(*m_tempArgs); + ArgumentListIterator ali(*m_impl->tempArgs); Argument *a; for (;(a=ali.current());++ali) { @@ -1085,11 +1209,11 @@ void ClassDef::writeDocumentation(OutputList &ol) // write super classes int count; - if (m_inherits && (count=m_inherits->count())>0) + if (m_impl->inherits && (count=m_impl->inherits->count())>0) { //parseText(ol,theTranslator->trInherits()+" "); - QCString inheritLine = theTranslator->trInheritsList(m_inherits->count()); + QCString inheritLine = theTranslator->trInheritsList(m_impl->inherits->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1098,7 +1222,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.parseText(inheritLine.mid(index,newIndex-index)); bool ok; uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); - BaseClassDef *bcd=m_inherits->at(entryIndex); + BaseClassDef *bcd=m_impl->inherits->at(entryIndex); if (ok && bcd) { ClassDef *cd=bcd->classDef; @@ -1139,9 +1263,9 @@ void ClassDef::writeDocumentation(OutputList &ol) } // write subclasses - if (m_inheritedBy && (count=m_inheritedBy->count())>0) + if (m_impl->inheritedBy && (count=m_impl->inheritedBy->count())>0) { - QCString inheritLine = theTranslator->trInheritedByList(m_inheritedBy->count()); + QCString inheritLine = theTranslator->trInheritedByList(m_impl->inheritedBy->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1150,7 +1274,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.parseText(inheritLine.mid(index,newIndex-index)); bool ok; uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); - BaseClassDef *bcd=m_inheritedBy->at(entryIndex); + BaseClassDef *bcd=m_impl->inheritedBy->at(entryIndex); if (ok && bcd) { ClassDef *cd=bcd->classDef; @@ -1175,24 +1299,24 @@ void ClassDef::writeDocumentation(OutputList &ol) count=0; BaseClassDef *ibcd; - if (m_inheritedBy) + if (m_impl->inheritedBy) { - ibcd=m_inheritedBy->first(); + ibcd=m_impl->inheritedBy->first(); while (ibcd) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_inheritedBy->next(); + ibcd=m_impl->inheritedBy->next(); } } - if (m_inherits) + if (m_impl->inherits) { - ibcd=m_inherits->first(); + ibcd=m_impl->inherits->first(); while (ibcd) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_inherits->next(); + ibcd=m_impl->inherits->next(); } } @@ -1257,7 +1381,7 @@ void ClassDef::writeDocumentation(OutputList &ol) } // write link to list of all members (HTML only) - if (m_allMemberNameInfoSDict && + if (m_impl->allMemberNameInfoSDict && !Config_getBool("OPTIMIZE_OUTPUT_FOR_C") ) { @@ -1286,13 +1410,13 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startMemberSections(); // write user defined member groups - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section + if (!mg->allMembersInSameSection() || !m_impl->subGrouping) // group is in its own section { mg->writeDeclarations(ol,this,0,0,0); } @@ -1306,92 +1430,64 @@ void ClassDef::writeDocumentation(OutputList &ol) // public types writeMemberDeclarations(ol,MemberList::pubTypes,theTranslator->trPublicTypes()); - //if (pubTypes) pubTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicTypes(),0); // public methods writeMemberDeclarations(ol,MemberList::pubSlots,theTranslator->trPublicSlots()); - //if (pubSlots) pubSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicSlots(),0); writeMemberDeclarations(ol,MemberList::signals,theTranslator->trSignals()); - //if (signals) signals->writeDeclarations(ol,this,0,0,0,theTranslator->trSignals(),0); writeMemberDeclarations(ol,MemberList::dcopMethods,theTranslator->trDCOPMethods()); - //if (dcopMethods) dcopMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trDCOPMethods(),0); writeMemberDeclarations(ol,MemberList::pubMethods,theTranslator->trPublicMembers()); - //if (pubMethods) pubMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicMembers(),0); writeMemberDeclarations(ol,MemberList::pubStaticMethods,theTranslator->trStaticPublicMembers()); - //if (pubStaticMethods) pubStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicMembers(),0); // public attribs writeMemberDeclarations(ol,MemberList::pubAttribs,theTranslator->trPublicAttribs()); - //if (pubAttribs) pubAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicAttribs(),0); writeMemberDeclarations(ol,MemberList::pubStaticAttribs,theTranslator->trStaticPublicAttribs()); - //if (pubStaticAttribs) pubStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicAttribs(),0); // protected types writeMemberDeclarations(ol,MemberList::proTypes,theTranslator->trProtectedTypes()); - //if (proTypes) proTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedTypes(),0); // protected methods writeMemberDeclarations(ol,MemberList::proSlots,theTranslator->trProtectedSlots()); - //if (proSlots) proSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedSlots(),0); writeMemberDeclarations(ol,MemberList::proMethods,theTranslator->trProtectedMembers()); - //if (proMethods) proMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedMembers(),0); writeMemberDeclarations(ol,MemberList::proStaticMethods,theTranslator->trStaticProtectedMembers()); - //if (proStaticMethods) proStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedMembers(),0); // protected attribs writeMemberDeclarations(ol,MemberList::proAttribs,theTranslator->trProtectedAttribs()); - //if (proAttribs) proAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedAttribs(),0); writeMemberDeclarations(ol,MemberList::proStaticAttribs,theTranslator->trStaticProtectedAttribs()); - //if (proStaticAttribs) proStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedAttribs(),0); // package types writeMemberDeclarations(ol,MemberList::pacTypes,theTranslator->trPackageTypes()); - //if (pacTypes) pacTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageTypes(),0); // package methods writeMemberDeclarations(ol,MemberList::pacMethods,theTranslator->trPackageMembers()); - //if (pacMethods) pacMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageMembers(),0); writeMemberDeclarations(ol,MemberList::pacStaticMethods,theTranslator->trStaticPackageMembers()); - //if (pacStaticMethods) pacStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPackageMembers(),0); // package attribs writeMemberDeclarations(ol,MemberList::pacAttribs,theTranslator->trPackageAttribs()); - //if (pacAttribs) pacAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageAttribs(),0); writeMemberDeclarations(ol,MemberList::pacStaticAttribs,theTranslator->trStaticPackageAttribs()); - //if (pacStaticAttribs) pacStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPackageAttribs(),0); // package writeMemberDeclarations(ol,MemberList::properties,theTranslator->trProperties()); - //if (properties) properties->writeDeclarations(ol,this,0,0,0,theTranslator->trProperties(),0); // events writeMemberDeclarations(ol,MemberList::events,theTranslator->trEvents()); - //if (events) events->writeDeclarations(ol,this,0,0,0,theTranslator->trEvents(),0); if (Config_getBool("EXTRACT_PRIVATE")) { // private types writeMemberDeclarations(ol,MemberList::priTypes,theTranslator->trPrivateTypes()); - //if (priTypes) priTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateTypes(),0); // private members writeMemberDeclarations(ol,MemberList::priSlots,theTranslator->trPrivateSlots()); - //if (priSlots) priSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateSlots(),0); writeMemberDeclarations(ol,MemberList::priMethods,theTranslator->trPrivateMembers()); - //if (priMethods) priMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateMembers(),0); writeMemberDeclarations(ol,MemberList::priStaticMethods,theTranslator->trStaticPrivateMembers()); - //if (priStaticMethods) priStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateMembers(),0); // private attribs writeMemberDeclarations(ol,MemberList::priAttribs,theTranslator->trPrivateAttribs()); - //if (priAttribs) priAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateAttribs(),0); writeMemberDeclarations(ol,MemberList::priStaticAttribs,theTranslator->trStaticPrivateAttribs()); - //if (priStaticAttribs) priStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateAttribs(),0); } // friends writeMemberDeclarations(ol,MemberList::friends,theTranslator->trFriends()); - //if (friends) friends->writeDeclarations(ol,this,0,0,0,theTranslator->trFriends(),0); // related functions writeMemberDeclarations(ol,MemberList::related,theTranslator->trRelatedFunctions(), @@ -1403,7 +1499,7 @@ void ClassDef::writeDocumentation(OutputList &ol) // ); // nested classes - if (m_innerClasses) m_innerClasses->writeDeclaration(ol,0,0,TRUE); + if (m_impl->innerClasses) m_impl->innerClasses->writeDeclaration(ol,0,0,TRUE); ol.endMemberSections(); @@ -1463,36 +1559,13 @@ void ClassDef::writeMemberDocumentation(OutputList &ol) } writeMemberDocumentation(ol,MemberList::typedefMembers,theTranslator->trMemberTypedefDocumentation()); - //if (typedefMembers) typedefMembers->writeDocumentation(ol,name(),this, - // theTranslator->trMemberTypedefDocumentation()); - writeMemberDocumentation(ol,MemberList::enumMembers,theTranslator->trMemberEnumerationDocumentation()); - //if (enumMembers) enumMembers->writeDocumentation(ol,name(),this, - // theTranslator->trMemberEnumerationDocumentation()); - writeMemberDocumentation(ol,MemberList::constructors,theTranslator->trConstructorDocumentation()); - //if (constructors) constructors->writeDocumentation(ol,name(),this, - // theTranslator->trConstructorDocumentation()); - writeMemberDocumentation(ol,MemberList::functionMembers,theTranslator->trMemberFunctionDocumentation()); - //if (functionMembers) functionMembers->writeDocumentation(ol,name(),this, - // theTranslator->trMemberFunctionDocumentation()); - writeMemberDocumentation(ol,MemberList::relatedMembers,theTranslator->trRelatedFunctionDocumentation()); - //if (relatedMembers) relatedMembers->writeDocumentation(ol,name(),this, - // theTranslator->trRelatedFunctionDocumentation()); - writeMemberDocumentation(ol,MemberList::variableMembers,theTranslator->trMemberDataDocumentation()); - //if (variableMembers) variableMembers->writeDocumentation(ol,name(),this, - // theTranslator->trMemberDataDocumentation()); - writeMemberDocumentation(ol,MemberList::propertyMembers,theTranslator->trPropertyDocumentation()); - //if (propertyMembers) propertyMembers->writeDocumentation(ol,name(),this, - // theTranslator->trPropertyDocumentation()); - writeMemberDocumentation(ol,MemberList::eventMembers,theTranslator->trEventDocumentation()); - //if (eventMembers) eventMembers->writeDocumentation(ol,name(),this, - // theTranslator->trEventDocumentation()); if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -1510,7 +1583,7 @@ void ClassDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - QListIterator<MemberList> mli(m_memberLists); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { @@ -1519,16 +1592,6 @@ void ClassDef::writeMemberPages(OutputList &ol) ml->writeDocumentationPage(ol,name(),this); } } -#if 0 - if (typedefMembers) typedefMembers->writeDocumentationPage(ol,name(),this); - if (enumMembers) enumMembers->writeDocumentationPage(ol,name(),this); - if (constructors) constructors->writeDocumentationPage(ol,name(),this); - if (functionMembers) functionMembers->writeDocumentationPage(ol,name(),this); - if (relatedMembers) relatedMembers->writeDocumentationPage(ol,name(),this); - if (variableMembers) variableMembers->writeDocumentationPage(ol,name(),this); - if (propertyMembers) propertyMembers->writeDocumentationPage(ol,name(),this); - if (eventMembers) eventMembers->writeDocumentationPage(ol,name(),this); -#endif ol.popGeneratorState(); } @@ -1540,9 +1603,9 @@ void ClassDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); - if (m_allMemberNameInfoSDict) + if (m_impl->allMemberNameInfoSDict) { - MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoSDict); + MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; for (;(mni=mnili.current());++mnili) { @@ -1587,9 +1650,9 @@ void ClassDef::writeDocumentationForInnerClasses(OutputList &ol) { // write inner classes after the parent, so the tag files contain // the definition in proper order! - if (m_innerClasses) + if (m_impl->innerClasses) { - ClassSDict::Iterator cli(*m_innerClasses); + ClassSDict::Iterator cli(*m_impl->innerClasses); ClassDef *innerCd; for (cli.toFirst();(innerCd=cli.current());++cli) { @@ -1609,7 +1672,7 @@ void ClassDef::writeDocumentationForInnerClasses(OutputList &ol) // write the list of all (inherited) members for this class void ClassDef::writeMemberList(OutputList &ol) { - if (m_allMemberNameInfoSDict==0 || + if (m_impl->allMemberNameInfoSDict==0 || Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) return; // only for HTML ol.pushGeneratorState(); @@ -1628,8 +1691,8 @@ void ClassDef::writeMemberList(OutputList &ol) //ol.startItemList(); ol.writeString("<p><table>\n"); - //MemberNameInfo *mni=m_allMemberNameInfoList->first(); - MemberNameInfoSDict::Iterator mnii(*m_allMemberNameInfoSDict); + //MemberNameInfo *mni=m_impl->allMemberNameInfoList->first(); + MemberNameInfoSDict::Iterator mnii(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; for (mnii.toFirst();(mni=mnii.current());++mnii) { @@ -1754,7 +1817,7 @@ void ClassDef::writeMemberList(OutputList &ol) ol.writeString("<td>"); } if ( - (prot!=Public || (virt!=Normal && !m_isObjC) || + (prot!=Public || (virt!=Normal && !m_impl->isObjC) || md->isFriend() || md->isRelated() || md->isExplicit() || md->isMutable() || (md->isInline() && Config_getBool("INLINE_INFO")) || md->isSignal() || md->isSlot() || @@ -1777,7 +1840,7 @@ void ClassDef::writeMemberList(OutputList &ol) else if (prot==Private) sl.append("private"); else if (prot==Package) sl.append("package"); if (virt==Virtual && - !m_isObjC) sl.append("virtual"); + !m_impl->isObjC) sl.append("virtual"); else if (virt==Pure) sl.append("pure virtual"); if (md->isStatic()) sl.append("static"); if (md->isSignal()) sl.append("signal"); @@ -1815,18 +1878,18 @@ void ClassDef::writeMemberList(OutputList &ol) bool ClassDef::addExample(const char *anchor,const char *nameStr, const char *file) { - if (m_exampleSDict==0) + if (m_impl->exampleSDict==0) { - m_exampleSDict = new ExampleSDict; - m_exampleSDict->setAutoDelete(TRUE); + m_impl->exampleSDict = new ExampleSDict; + m_impl->exampleSDict->setAutoDelete(TRUE); } - if (!m_exampleSDict->find(nameStr)) + if (!m_impl->exampleSDict->find(nameStr)) { Example *e=new Example; e->anchor=anchor; e->name=nameStr; e->file=file; - m_exampleSDict->inSort(nameStr,e); + m_impl->exampleSDict->inSort(nameStr,e); return TRUE; } return FALSE; @@ -1835,23 +1898,23 @@ bool ClassDef::addExample(const char *anchor,const char *nameStr, // returns TRUE if this class is used in an example bool ClassDef::hasExamples() { - if (m_exampleSDict==0) + if (m_impl->exampleSDict==0) return FALSE; else - return m_exampleSDict->count()>0; + return m_impl->exampleSDict->count()>0; } void ClassDef::setTemplateArguments(ArgumentList *al) { if (al==0) return; - if (!m_tempArgs) delete m_tempArgs; // delete old list if needed - m_tempArgs=new ArgumentList; + if (!m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed + m_impl->tempArgs=new ArgumentList; ArgumentListIterator ali(*al); Argument *a; for (;(a=ali.current());++ali) { - m_tempArgs->append(new Argument(*a)); + m_impl->tempArgs->append(new Argument(*a)); } } @@ -1865,9 +1928,9 @@ bool ClassDef::hasNonReferenceSuperClass() { return TRUE; // we're done if this class is not a reference } - if (m_inheritedBy) + if (m_impl->inheritedBy) { - BaseClassListIterator bcli(*m_inheritedBy); + BaseClassListIterator bcli(*m_impl->inheritedBy); for ( ; bcli.current() && !found ; ++bcli ) // for each super class { ClassDef *bcd=bcli.current()->classDef; @@ -1924,9 +1987,9 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup) ol.endMemberItem(); // write user defined member groups - if (memberGroupSDict) + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1936,122 +1999,64 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup) } writePlainMemberDeclaration(ol,MemberList::pubTypes,inGroup); - //if (pubTypes) pubTypes->setInGroup(inGroup); - //if (pubTypes) pubTypes->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pubMethods,inGroup); - //if (pubMethods) pubMethods->setInGroup(inGroup); - //if (pubMethods) pubMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pubAttribs,inGroup); - //if (pubAttribs) pubAttribs->setInGroup(inGroup); - //if (pubAttribs) pubAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pubSlots,inGroup); - //if (pubSlots) pubSlots->setInGroup(inGroup); - //if (pubSlots) pubSlots->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::signals,inGroup); - //if (signals) signals->setInGroup(inGroup); - //if (signals) signals->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::dcopMethods,inGroup); - //if (dcopMethods) dcopMethods->setInGroup(inGroup); - //if (dcopMethods) dcopMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::properties,inGroup); - //if (properties) properties->setInGroup(inGroup); - //if (properties) properties->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::events,inGroup); - //if (events) events->setInGroup(inGroup); - //if (events) events->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pubStaticMethods,inGroup); - //if (pubStaticMethods) pubStaticMethods->setInGroup(inGroup); - //if (pubStaticMethods) pubStaticMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pubStaticAttribs,inGroup); - //if (pubStaticAttribs) pubStaticAttribs->setInGroup(inGroup); - //if (pubStaticAttribs) pubStaticAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proTypes,inGroup); - //if (proTypes) proTypes->setInGroup(inGroup); - //if (proTypes) proTypes->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proMethods,inGroup); - //if (proMethods) proMethods->setInGroup(inGroup); - //if (proMethods) proMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proAttribs,inGroup); - //if (proAttribs) proAttribs->setInGroup(inGroup); - //if (proAttribs) proAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proSlots,inGroup); - //if (proSlots) proSlots->setInGroup(inGroup); - //if (proSlots) proSlots->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proStaticMethods,inGroup); - //if (proStaticMethods) proStaticMethods->setInGroup(inGroup); - //if (proStaticMethods) proStaticMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::proStaticAttribs,inGroup); - //if (proStaticAttribs) proStaticAttribs->setInGroup(inGroup); - //if (proStaticAttribs) proStaticAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pacTypes,inGroup); - //if (pacTypes) pacTypes->setInGroup(inGroup); - //if (pacTypes) pacTypes->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pacMethods,inGroup); - //if (pacMethods) pacMethods->setInGroup(inGroup); - //if (pacMethods) pacMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pacAttribs,inGroup); - //if (pacAttribs) pacAttribs->setInGroup(inGroup); - //if (pacAttribs) pacAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pacStaticMethods,inGroup); - //if (pacStaticMethods) pacStaticMethods->setInGroup(inGroup); - //if (pacStaticMethods) pacStaticMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::pacStaticAttribs,inGroup); - //if (pacStaticAttribs) pacStaticAttribs->setInGroup(inGroup); - //if (pacStaticAttribs) pacStaticAttribs->writePlainDeclarations(ol,this,0,0,0); if (Config_getBool("EXTRACT_PRIVATE")) { writePlainMemberDeclaration(ol,MemberList::priTypes,inGroup); - //if (priTypes) priTypes->setInGroup(inGroup); - //if (priTypes) priTypes->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::priMethods,inGroup); - //if (priMethods) priMethods->setInGroup(inGroup); - //if (priMethods) priMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::priAttribs,inGroup); - //if (priAttribs) priAttribs->setInGroup(inGroup); - //if (priAttribs) priAttribs->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::priSlots,inGroup); - //if (priSlots) priSlots->setInGroup(inGroup); - //if (priSlots) priSlots->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::priStaticMethods,inGroup); - //if (priStaticMethods) priStaticMethods->setInGroup(inGroup); - //if (priStaticMethods) priStaticMethods->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::priStaticAttribs,inGroup); - //if (priStaticAttribs) priStaticAttribs->setInGroup(inGroup); - //if (priStaticAttribs) priStaticAttribs->writePlainDeclarations(ol,this,0,0,0); } writePlainMemberDeclaration(ol,MemberList::friends,inGroup); - //if (friends) friends->setInGroup(inGroup); - //if (friends) friends->writePlainDeclarations(ol,this,0,0,0); writePlainMemberDeclaration(ol,MemberList::related,inGroup); - //if (related) related->setInGroup(inGroup); - //if (related) related->writePlainDeclarations(ol,this,0,0,0); } /*! a link to this class is possible within this project */ bool ClassDef::isLinkableInProject() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->isLinkableInProject(); + return m_impl->templateMaster->isLinkableInProject(); } else { return !name().isEmpty() && /* no name */ - !m_artificial && !isHidden() && + !m_impl->artificial && !isHidden() && name().find('@')==-1 && /* anonymous compound */ - (m_prot!=Private || Config_getBool("EXTRACT_PRIVATE")) && /* private */ - (!m_isLocal || Config_getBool("EXTRACT_LOCAL_CLASSES")) && /* local */ + (m_impl->prot!=Private || Config_getBool("EXTRACT_PRIVATE")) && /* private */ + (!m_impl->isLocal || Config_getBool("EXTRACT_LOCAL_CLASSES")) && /* local */ hasDocumentation() && /* documented */ !isReference() && /* not an external reference */ - (!m_isStatic || Config_getBool("EXTRACT_STATIC")); + (!m_impl->isStatic || Config_getBool("EXTRACT_STATIC")); } } bool ClassDef::isLinkable() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->isLinkable(); + return m_impl->templateMaster->isLinkable(); } else { @@ -2073,17 +2078,17 @@ bool ClassDef::isVisibleInHierarchy() // and not an annonymous compound name().find('@')==-1 && // not an artifically introduced class - !m_artificial && + !m_impl->artificial && // and not privately inherited - (m_prot!=Private || extractPrivate) && + (m_impl->prot!=Private || extractPrivate) && // documented or shown anyway or documentation is external (hasDocumentation() || !hideUndocClasses || - (m_templateMaster && m_templateMaster->hasDocumentation()) || + (m_impl->templateMaster && m_impl->templateMaster->hasDocumentation()) || isReference() ) && // is not part of an unnamed namespace or shown anyway - (!m_isStatic || extractStatic); + (!m_impl->isStatic || extractStatic); } bool ClassDef::hasDocumentation() const @@ -2139,8 +2144,8 @@ static bool isStandardFunc(MemberDef *md) void ClassDef::mergeMembers() { - if (m_membersMerged) return; - m_membersMerged=TRUE; + if (m_impl->membersMerged) return; + m_impl->membersMerged=TRUE; //printf(" mergeMembers for %s\n",name().data()); bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB" ); if (baseClasses()) @@ -2154,8 +2159,8 @@ void ClassDef::mergeMembers() // merge the members in the base class of this inheritance branch first bClass->mergeMembers(); - MemberNameInfoSDict *srcMnd = bClass->m_allMemberNameInfoSDict; - MemberNameInfoSDict *dstMnd = m_allMemberNameInfoSDict; + MemberNameInfoSDict *srcMnd = bClass->memberNameInfoSDict(); + MemberNameInfoSDict *dstMnd = m_impl->allMemberNameInfoSDict; if (srcMnd && dstMnd) { @@ -2192,9 +2197,11 @@ void ClassDef::mergeMembers() if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE)) // member is in the same or a base class { + LockingPtr<ArgumentList> srcAl = srcMd->argumentList(); + LockingPtr<ArgumentList> dstAl = dstMd->argumentList(); found=matchArguments2( - srcMd->getOuterScope(),srcMd->getFileDef(),srcMd->argumentList(), - dstMd->getOuterScope(),dstMd->getFileDef(),dstMd->argumentList(), + srcMd->getOuterScope(),srcMd->getFileDef(),srcAl.pointer(), + dstMd->getOuterScope(),dstMd->getFileDef(),dstAl.pointer(), TRUE ); //printf(" Yes, matching (%s<->%s): %d\n", @@ -2371,10 +2378,10 @@ void ClassDef::mergeMembers() */ void ClassDef::mergeCategory(ClassDef *category) { - category->m_categoryOf = this; + category->setCategoryOf(this); - MemberNameInfoSDict *srcMnd = category->m_allMemberNameInfoSDict; - MemberNameInfoSDict *dstMnd = m_allMemberNameInfoSDict; + MemberNameInfoSDict *srcMnd = category->memberNameInfoSDict(); + MemberNameInfoSDict *dstMnd = m_impl->allMemberNameInfoSDict; if (srcMnd && dstMnd) { @@ -2419,16 +2426,16 @@ void ClassDef::mergeCategory(ClassDef *category) void ClassDef::addUsedClass(ClassDef *cd,const char *accessName) { //printf("%s::addUsedClass(%s,%s)\n",name().data(),cd->name().data(),accessName); - if (m_usesImplClassDict==0) + if (m_impl->usesImplClassDict==0) { - m_usesImplClassDict = new UsesClassDict(17); - m_usesImplClassDict->setAutoDelete(TRUE); + m_impl->usesImplClassDict = new UsesClassDict(17); + m_impl->usesImplClassDict->setAutoDelete(TRUE); } - UsesClassDef *ucd=m_usesImplClassDict->find(cd->name()); + UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name()); if (ucd==0) { ucd = new UsesClassDef(cd); - m_usesImplClassDict->insert(cd->name(),ucd); + m_impl->usesImplClassDict->insert(cd->name(),ucd); //printf("Adding used class %s to class %s\n", // cd->name().data(),name().data()); } @@ -2437,16 +2444,16 @@ void ClassDef::addUsedClass(ClassDef *cd,const char *accessName) void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName) { - if (m_usedByImplClassDict==0) + if (m_impl->usedByImplClassDict==0) { - m_usedByImplClassDict = new UsesClassDict(17); - m_usedByImplClassDict->setAutoDelete(TRUE); + m_impl->usedByImplClassDict = new UsesClassDict(17); + m_impl->usedByImplClassDict->setAutoDelete(TRUE); } - UsesClassDef *ucd=m_usedByImplClassDict->find(cd->name()); + UsesClassDef *ucd=m_impl->usedByImplClassDict->find(cd->name()); if (ucd==0) { ucd = new UsesClassDef(cd); - m_usedByImplClassDict->insert(cd->name(),ucd); + m_impl->usedByImplClassDict->insert(cd->name(),ucd); //printf("Adding used by class %s to class %s\n", // cd->name().data(),name().data()); } @@ -2462,7 +2469,7 @@ void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName) void ClassDef::determineImplUsageRelation() { - MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoSDict); + MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; for (;(mni=mnili.current());++mnili) { @@ -2495,12 +2502,12 @@ void ClassDef::determineImplUsageRelation() if (arg->name==usedClassName) // type is a template argument { found=TRUE; - if (m_usesImplClassDict==0) m_usesImplClassDict = new UsesClassDict(257); + if (m_impl->usesImplClassDict==0) m_impl->usesImplClassDict = new UsesClassDict(257); cd = new ClassDef(cd->getDefFileName(),cd->getDefLine(), usedClassName,ClassDef::Class); cd->setIsTemplateBaseClass(count); UsesClassDef *ucd = new UsesClassDef(cd); - m_usesImplClassDict->insert(cd->name(),ucd); + m_impl->usesImplClassDict->insert(cd->name(),ucd); ucd->templSpecifiers = templSpec; ucd->addAccessor(md->name()); Doxygen::hiddenClasses.append(cd); @@ -2525,16 +2532,16 @@ void ClassDef::determineImplUsageRelation() if (cd) // class exists { found=TRUE; - if (m_usesImplClassDict==0) + if (m_impl->usesImplClassDict==0) { - m_usesImplClassDict = new UsesClassDict(257); - m_usesImplClassDict->setAutoDelete(TRUE); + m_impl->usesImplClassDict = new UsesClassDict(257); + m_impl->usesImplClassDict->setAutoDelete(TRUE); } - UsesClassDef *ucd=m_usesImplClassDict->find(cd->name()); + UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name()); if (ucd==0 || ucd->templSpecifiers!=templSpec) { ucd = new UsesClassDef(cd); - m_usesImplClassDict->insert(cd->name(),ucd); + m_impl->usesImplClassDict->insert(cd->name(),ucd); ucd->templSpecifiers = templSpec; //printf("Adding used class %s to class %s\n", // cd->name().data(),name().data()); @@ -2549,10 +2556,10 @@ void ClassDef::determineImplUsageRelation() } } #ifdef DUMP - if (m_usesClassDict) + if (m_impl->usesClassDict) { msg("Class %s uses the following classes:\n",name().data()); - UsesClassDictIterator ucdi(*m_usesClassDict); + UsesClassDictIterator ucdi(*m_impl->usesClassDict); UsesClassDef *ucd; for (;(ucd=ucdi.current());++ucdi) { @@ -2585,15 +2592,15 @@ void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) if (cd==0) cd=getClass(type.mid(i,l)); // TODO: also try inbetween scopes! if (cd && cd!=this && !isBaseClass(cd)) { - if (m_usesIntfClassDict==0) + if (m_impl->usesIntfClassDict==0) { - m_usesIntfClassDict = new UsesClassDict(257); + m_impl->usesIntfClassDict = new UsesClassDict(257); } - UsesClassDef *ucd=m_usesIntfClassDict->find(cd->name()); + UsesClassDef *ucd=m_impl->usesIntfClassDict->find(cd->name()); if (ucd==0) { ucd = new UsesClassDef(cd); - m_usesIntfClassDict->insert(cd->name(),ucd); + m_impl->usesIntfClassDict->insert(cd->name(),ucd); //printf("in class `%s' adding used intf class `%s'\n", // name().data(),cd->name().data()); } @@ -2607,7 +2614,7 @@ void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) void ClassDef::determineIntfUsageRelation() { - MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoList); + MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoList); MemberNameInfo *mni; for (;(mni=mnili.current());++mnili) { @@ -2653,8 +2660,8 @@ void ClassDef::determineIntfUsageRelation() QCString ClassDef::compoundTypeString() const { - if (m_compType==Interface && m_isObjC) return "class"; - switch (m_compType) + if (m_impl->compType==Interface && m_impl->isObjC) return "class"; + switch (m_impl->compType) { case Class: return "class"; case Struct: return "struct"; @@ -2669,17 +2676,17 @@ QCString ClassDef::compoundTypeString() const QCString ClassDef::getOutputFileBase() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->getOutputFileBase(); + return m_impl->templateMaster->getOutputFileBase(); } else if (isReference()) { - return m_fileName; + return m_impl->fileName; } else { - return convertNameToFile(m_fileName); + return convertNameToFile(m_impl->fileName); } } @@ -2687,35 +2694,35 @@ QCString ClassDef::getInstanceOutputFileBase() const { if (isReference()) { - return m_fileName; + return m_impl->fileName; } else { - return convertNameToFile(m_fileName); + return convertNameToFile(m_impl->fileName); } } QCString ClassDef::getFileBase() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->getFileBase(); + return m_impl->templateMaster->getFileBase(); } else { - return m_fileName; + return m_impl->fileName; } } QCString ClassDef::getSourceFileBase() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->getSourceFileBase(); + return m_impl->templateMaster->getSourceFileBase(); } else { - return convertNameToFile(m_fileName+"-source"); + return convertNameToFile(m_impl->fileName+"-source"); } } @@ -2723,8 +2730,8 @@ void ClassDef::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,co { gd->addClass(this); //printf("ClassDef::setGroupDefForAllMembers(%s)\n",gd->name().data()); - if (m_allMemberNameInfoSDict==0) return; - MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoSDict); + if (m_impl->allMemberNameInfoSDict==0) return; + MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; for (;(mni=mnili.current());++mnili) { @@ -2746,23 +2753,28 @@ void ClassDef::addInnerCompound(Definition *d) if (d->definitionType()==Definition::TypeClass) // only classes can be // nested in classes. { - if (m_innerClasses==0) + if (m_impl->innerClasses==0) { - m_innerClasses = new ClassSDict(17); + m_impl->innerClasses = new ClassSDict(17); } - m_innerClasses->inSort(d->localName(),(ClassDef *)d); + m_impl->innerClasses->inSort(d->localName(),(ClassDef *)d); } } Definition *ClassDef::findInnerCompound(const char *name) { - if (name==0 || m_innerClasses==0) return 0; - return m_innerClasses->find(name); + Definition *result=0; + if (name==0) return 0; + if (m_impl->innerClasses) + { + result = m_impl->innerClasses->find(name); + } + return result; } //void ClassDef::initTemplateMapping() //{ -// m_templateMapping->clear(); +// m_impl->templateMapping->clear(); // ArgumentList *al = templateArguments(); // if (al) // { @@ -2777,21 +2789,21 @@ Definition *ClassDef::findInnerCompound(const char *name) //void ClassDef::setTemplateArgumentMapping(const char *formal,const char *actual) //{ // //printf("ClassDef::setTemplateArgumentMapping(%s,%s)\n",formal,actual); -// if (m_templateMapping && formal) +// if (m_impl->templateMapping && formal) // { -// if (m_templateMapping->find(formal)) +// if (m_impl->templateMapping->find(formal)) // { -// m_templateMapping->remove(formal); +// m_impl->templateMapping->remove(formal); // } -// m_templateMapping->insert(formal,new QCString(actual)); +// m_impl->templateMapping->insert(formal,new QCString(actual)); // } //} // //QCString ClassDef::getTemplateArgumentMapping(const char *formal) const //{ -// if (m_templateMapping && formal) +// if (m_impl->templateMapping && formal) // { -// QCString *s = m_templateMapping->find(formal); +// QCString *s = m_impl->templateMapping->find(formal); // if (s) // { // return *s; @@ -2804,11 +2816,11 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, int startLine, const QCString &templSpec,bool &freshInstance) { freshInstance = FALSE; - if (m_templateInstances==0) + if (m_impl->templateInstances==0) { - m_templateInstances = new QDict<ClassDef>(17); + m_impl->templateInstances = new QDict<ClassDef>(17); } - ClassDef *templateClass=m_templateInstances->find(templSpec); + ClassDef *templateClass=m_impl->templateInstances->find(templSpec); if (templateClass==0) { Debug::print(Debug::Classes,0," New template instance class `%s'`%s'\n",name().data(),templSpec.data()); @@ -2817,7 +2829,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, templateClass->setTemplateMaster(this); templateClass->setOuterScope(getOuterScope()); templateClass->setHidden(isHidden()); - m_templateInstances->insert(templSpec,templateClass); + m_impl->templateInstances->insert(templSpec,templateClass); freshInstance=TRUE; } return templateClass; @@ -2825,12 +2837,12 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, ClassDef *ClassDef::getVariableInstance(const char *templSpec) { - if (m_variableInstances==0) + if (m_impl->variableInstances==0) { - m_variableInstances = new QDict<ClassDef>(17); - m_variableInstances->setAutoDelete(TRUE); + m_impl->variableInstances = new QDict<ClassDef>(17); + m_impl->variableInstances->setAutoDelete(TRUE); } - ClassDef *templateClass=m_variableInstances->find(templSpec); + ClassDef *templateClass=m_impl->variableInstances->find(templSpec); if (templateClass==0) { Debug::print(Debug::Classes,0," New template variable instance class `%s'`%s'\n",name().data(),templSpec); @@ -2838,7 +2850,7 @@ ClassDef *ClassDef::getVariableInstance(const char *templSpec) ClassDef::Class,0,0,FALSE); templateClass->addMembersToTemplateInstance( this, templSpec ); templateClass->setTemplateMaster(this); - m_variableInstances->insert(templSpec,templateClass); + m_impl->variableInstances->insert(templSpec,templateClass); } return templateClass; } @@ -2846,32 +2858,32 @@ ClassDef *ClassDef::getVariableInstance(const char *templSpec) void ClassDef::setTemplateBaseClassNames(QDict<int> *templateNames) { if (templateNames==0) return; - if (m_templBaseClassNames==0) + if (m_impl->templBaseClassNames==0) { - m_templBaseClassNames = new QDict<int>(17); - m_templBaseClassNames->setAutoDelete(TRUE); + m_impl->templBaseClassNames = new QDict<int>(17); + m_impl->templBaseClassNames->setAutoDelete(TRUE); } // make a deep copy of the dictionary. QDictIterator<int> qdi(*templateNames); for (;qdi.current();++qdi) { - if (m_templBaseClassNames->find(qdi.currentKey())==0) + if (m_impl->templBaseClassNames->find(qdi.currentKey())==0) { - m_templBaseClassNames->insert(qdi.currentKey(),new int(*qdi.current())); + m_impl->templBaseClassNames->insert(qdi.currentKey(),new int(*qdi.current())); } } } QDict<int> *ClassDef::getTemplateBaseClassNames() const { - return m_templBaseClassNames; + return m_impl->templBaseClassNames; } void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) { //printf("%s::addMembersToTemplateInstance(%s,%s)\n",name().data(),cd->name().data(),templSpec); - if (cd->m_allMemberNameInfoSDict==0) return; - MemberNameInfoSDict::Iterator mnili(*cd->m_allMemberNameInfoSDict); + if (cd->memberNameInfoSDict()==0) return; + MemberNameInfoSDict::Iterator mnili(*cd->memberNameInfoSDict()); MemberNameInfo *mni; for (;(mni=mnili.current());++mnili) { @@ -2898,11 +2910,11 @@ void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) // imd->getClassDef()->name().data(),templSpec); // insert imd in the list of all members //printf("Adding member=%s class=%s\n",imd->name().data(),name().data()); - MemberName *mn = Doxygen::memberNameSDict[imd->name()]; + MemberName *mn = Doxygen::memberNameSDict->find(imd->name()); if (mn==0) { mn = new MemberName(imd->name()); - Doxygen::memberNameSDict.append(imd->name(),mn); + Doxygen::memberNameSDict->append(imd->name(),mn); } mn->append(imd); } @@ -2911,9 +2923,9 @@ void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) QCString ClassDef::getReference() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->getReference(); + return m_impl->templateMaster->getReference(); } else { @@ -2923,9 +2935,9 @@ QCString ClassDef::getReference() const bool ClassDef::isReference() const { - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->isReference(); + return m_impl->templateMaster->isReference(); } else { @@ -3004,27 +3016,30 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( QCString ClassDef::className() const { - return m_className; + return m_impl->className; }; void ClassDef::addListReferences() { if (!isLinkableInProject()) return; //printf("ClassDef(%s)::addListReferences()\n",name().data()); - addRefItem(xrefListItems(), + { + LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); + addRefItem(xrefItems.pointer(), theTranslator->trClass(TRUE,TRUE), getOutputFileBase(),displayName() ); - if (memberGroupSDict) + } + if (m_impl->memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { mg->addListReferences(this); } } - QListIterator<MemberList> mli(m_memberLists); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { @@ -3035,12 +3050,12 @@ void ClassDef::addListReferences() } } -MemberDef *ClassDef::getMemberByName(const QCString &name) +MemberDef *ClassDef::getMemberByName(const QCString &name) const { MemberDef *xmd = 0; - if (m_allMemberNameInfoSDict) + if (m_impl->allMemberNameInfoSDict) { - MemberNameInfo *mni = m_allMemberNameInfoSDict->find(name); + MemberNameInfo *mni = m_impl->allMemberNameInfoSDict->find(name); if (mni) { const int maxInheritanceDepth = 100000; @@ -3067,8 +3082,8 @@ MemberDef *ClassDef::getMemberByName(const QCString &name) MemberList *ClassDef::createMemberList(MemberList::ListType lt) { - m_memberLists.setAutoDelete(TRUE); - QListIterator<MemberList> mli(m_memberLists); + m_impl->memberLists.setAutoDelete(TRUE); + QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { @@ -3079,20 +3094,20 @@ MemberList *ClassDef::createMemberList(MemberList::ListType lt) } // not found, create a new member list ml = new MemberList(lt); - m_memberLists.append(ml); + m_impl->memberLists.append(ml); return ml; } MemberList *ClassDef::getMemberList(MemberList::ListType lt) { - MemberList *ml = m_memberLists.first(); + MemberList *ml = m_impl->memberLists.first(); while (ml) { if (ml->listType()==lt) { return ml; } - ml = m_memberLists.next(); + ml = m_impl->memberLists.next(); } return 0; } @@ -3131,3 +3146,178 @@ void ClassDef::writePlainMemberDeclaration(OutputList &ol,MemberList::ListType l } } +bool ClassDef::isLocal() const +{ + return m_impl->isLocal; +} + +bool ClassDef::isArtificial() const +{ + return m_impl->artificial; +} + +ClassSDict *ClassDef::getInnerClasses() +{ + return m_impl->innerClasses; +} + +ClassDef::CompoundType ClassDef::compoundType() const +{ + return m_impl->compType; +} + +BaseClassList *ClassDef::baseClasses() const +{ + return m_impl->inherits; +} + +BaseClassList *ClassDef::subClasses() const +{ + return m_impl->inheritedBy; +} + +MemberNameInfoSDict *ClassDef::memberNameInfoSDict() const +{ + return m_impl->allMemberNameInfoSDict; +} + +Protection ClassDef::protection() const +{ + return m_impl->prot; +} + +ArgumentList *ClassDef::templateArguments() const +{ + return m_impl->tempArgs; +} + +NamespaceDef *ClassDef::getNamespaceDef() const +{ + return m_impl->nspace; +} + +FileDef *ClassDef::getFileDef() const +{ + return m_impl->fileDef; +} + +QDict<ClassDef> *ClassDef::getTemplateInstances() const +{ + return m_impl->templateInstances; +} + +ClassDef *ClassDef::templateMaster() const +{ + return m_impl->templateMaster; +} + +bool ClassDef::isTemplate() const +{ + return m_impl->tempArgs!=0; +} + +IncludeInfo *ClassDef::includeInfo() const +{ + return m_impl->incInfo; +} + +UsesClassDict *ClassDef::usedImplementationClasses() const +{ + return m_impl->usesImplClassDict; +} + +UsesClassDict *ClassDef::usedByImplementationClasses() const +{ + return m_impl->usedByImplClassDict; +} + +UsesClassDict *ClassDef::usedInterfaceClasses() const +{ + return m_impl->usesIntfClassDict; +} + +bool ClassDef::isTemplateArgument() const +{ + return m_impl->isTemplArg; +} + +bool ClassDef::isAbstract() const +{ + return m_impl->isAbstract; +} + +bool ClassDef::isObjectiveC() const +{ + return m_impl->isObjC; +} + +ClassDef *ClassDef::categoryOf() const +{ + return m_impl->categoryOf; +} + +const QList<MemberList> &ClassDef::getMemberLists() const +{ + return m_impl->memberLists; +} + +MemberGroupSDict *ClassDef::getMemberGroupSDict() const +{ + return m_impl->memberGroupSDict; +} + +void ClassDef::setNamespace(NamespaceDef *nd) +{ + m_impl->nspace = nd; +} + +void ClassDef::setFileDef(FileDef *fd) +{ + m_impl->fileDef=fd; +} + +void ClassDef::setSubGrouping(bool enabled) +{ + m_impl->subGrouping = enabled; +} + +void ClassDef::setProtection(Protection p) +{ + m_impl->prot=p; +} + +void ClassDef::setClassIsArtificial() +{ + m_impl->artificial = TRUE; +} + +void ClassDef::setIsStatic(bool b) +{ + m_impl->isStatic=b; +} + +void ClassDef::setIsObjectiveC(bool b) +{ + m_impl->isObjC=b; +} + +void ClassDef::setCompoundType(CompoundType t) +{ + m_impl->compType = t; +} + +void ClassDef::setTemplateMaster(ClassDef *tm) +{ + m_impl->templateMaster=tm; +} + +void ClassDef::makeTemplateArgument(bool b) +{ + m_impl->isTemplArg = b; +} + +void ClassDef::setCategoryOf(ClassDef *cd) +{ + m_impl->categoryOf = cd; +} + diff --git a/src/classdef.h b/src/classdef.h index b57ecb4..c417244 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -45,6 +45,7 @@ class PackageDef; class GroupDef; class StringDict; struct IncludeInfo; +class ClassDefImpl; /*! \brief This class contains all information about a compound. * @@ -108,15 +109,15 @@ class ClassDef : public Definition bool isReference() const; /*! Returns TRUE if this is a local class definition, see EXTRACT_LOCAL_CLASSES */ - bool isLocal() const { return m_isLocal; } + bool isLocal() const; /*! returns TRUE if this class was artificially introduced, for instance because * it is used to show a template instantiation relation. */ - bool isArtificial() const { return m_artificial; } + bool isArtificial() const; /*! returns the classes nested into this class */ - ClassSDict *getInnerClasses() { return m_innerClasses; } + ClassSDict *getInnerClasses(); /*! returns TRUE if this class has documentation */ bool hasDocumentation() const; @@ -125,7 +126,7 @@ class ClassDef : public Definition QCString displayName() const; /*! Returns the type of compound this is, i.e. class/struct/union/.. */ - CompoundType compoundType() const { return m_compType; } + CompoundType compoundType() const; /*! Returns the type of compound as a string */ QCString compoundTypeString() const; @@ -133,21 +134,21 @@ class ClassDef : public Definition /*! Returns the list of base classes from which this class directly * inherits. */ - BaseClassList *baseClasses() { return m_inherits; } + BaseClassList *baseClasses() const; /*! Returns the list of sub classes that directly derive from this class */ - BaseClassList *subClasses() { return m_inheritedBy; } + BaseClassList *subClasses() const; /*! Returns a dictionary of all members. This includes any inherited * members. Members are sorted alphabetically. */ - MemberNameInfoSDict *memberNameInfoSDict() { return m_allMemberNameInfoSDict; } + MemberNameInfoSDict *memberNameInfoSDict() const; /*! Return the protection level (Public,Protected,Private) in which * this compound was found. */ - Protection protection() const { return m_prot; } + Protection protection() const; /*! returns TRUE iff a link is possible to this item within this project. */ @@ -164,23 +165,22 @@ class ClassDef : public Definition /*! Returns the template arguments of this class * Will return 0 if not applicable. */ - ArgumentList *templateArguments() const { return m_tempArgs; } + ArgumentList *templateArguments() const; /*! Returns the namespace this compound is in, or 0 if it has a global * scope. */ - NamespaceDef *getNamespaceDef() { return m_nspace; } + NamespaceDef *getNamespaceDef() const; /*! Returns the file in which this compound's definition can be found. * Should not return 0 (but it might be a good idea to check anyway). */ - FileDef *getFileDef() const { return m_fileDef; } + FileDef *getFileDef() const; /*! Returns the Java package this class is in or 0 if not applicable. */ - //PackageDef *packageDef() const; - MemberDef *getMemberByName(const QCString &); + MemberDef *getMemberByName(const QCString &) const; /*! Returns TRUE iff \a bcd is a direct or indirect base class of this * class. This function will recusively traverse all branches of the @@ -191,37 +191,25 @@ class ClassDef : public Definition /*! Returns a sorted dictionary with all template instances found for * this template class. Returns 0 if not a template or no instances. */ - QDict<ClassDef> *getTemplateInstances() const { return m_templateInstances; } + QDict<ClassDef> *getTemplateInstances() const; /*! Returns the template master of which this class is an instance. * Returns 0 if not applicable. */ - ClassDef *templateMaster() const { return m_templateMaster; } + ClassDef *templateMaster() const; /*! Returns TRUE if this class is a template */ - bool isTemplate() const { return m_tempArgs!=0; } + bool isTemplate() const; - IncludeInfo *includeInfo() const { return m_incInfo; } + IncludeInfo *includeInfo() const; - UsesClassDict *usedImplementationClasses() const - { - return m_usesImplClassDict; - } + UsesClassDict *usedImplementationClasses() const; - UsesClassDict *usedByImplementationClasses() const - { - return m_usedByImplClassDict; - } + UsesClassDict *usedByImplementationClasses() const; - UsesClassDict *usedInterfaceClasses() const - { - return m_usesIntfClassDict; - } + UsesClassDict *usedInterfaceClasses() const; - bool isTemplateArgument() const - { - return m_isTemplArg; - } + bool isTemplateArgument() const; /*! Returns the definition of a nested compound if * available, or 0 otherwise. @@ -244,13 +232,13 @@ class ClassDef : public Definition /*! Returns TRUE if there is at least one pure virtual member in this * class. */ - bool isAbstract() const { return m_isAbstract; } + bool isAbstract() const; /*! Returns TRUE if this class is implemented in Objective-C */ - bool isObjectiveC() const { return m_isObjC; } + bool isObjectiveC() const; /*! Returns the class of which this is a category (Objective-C only) */ - ClassDef *categoryOf() const { return m_categoryOf; } + ClassDef *categoryOf() const; /*! Returns the name of the class including outer classes, but not * including namespaces. @@ -261,12 +249,13 @@ class ClassDef : public Definition MemberList *getMemberList(MemberList::ListType lt); /*! Returns the list containing the list of members sorted per type */ - const QList<MemberList> &getMemberLists() const { return m_memberLists; } + const QList<MemberList> &getMemberLists() const; /*! Returns the member groups defined for this class */ - MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + MemberGroupSDict *getMemberGroupSDict() const; QDict<int> *getTemplateBaseClassNames() const; + ClassDef *getVariableInstance(const char *templSpec); //----------------------------------------------------------------------------------- @@ -280,28 +269,27 @@ class ClassDef : public Definition void insertUsedFile(const char *); bool addExample(const char *anchor,const char *name, const char *file); void mergeCategory(ClassDef *category); - void setNamespace(NamespaceDef *nd) { m_nspace = nd; } - void setFileDef(FileDef *fd) { m_fileDef=fd; } - void setSubGrouping(bool enabled) { m_subGrouping = enabled; } - void setProtection(Protection p) { m_prot=p; } + void setNamespace(NamespaceDef *nd); + void setFileDef(FileDef *fd); + void setSubGrouping(bool enabled); + void setProtection(Protection p); void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs); void addInnerCompound(Definition *d); ClassDef *insertTemplateInstance(const QCString &fileName,int startLine, const QCString &templSpec,bool &freshInstance); void addUsedClass(ClassDef *cd,const char *accessName); void addUsedByClass(ClassDef *cd,const char *accessName); - void setClassIsArtificial() { m_artificial = TRUE; } - void setIsStatic(bool b) { m_isStatic=b; } - void setIsObjectiveC(bool b) { m_isObjC=b; } - void setCompoundType(CompoundType t) { m_compType = t; } + void setClassIsArtificial(); + void setIsStatic(bool b); + void setIsObjectiveC(bool b); + void setCompoundType(CompoundType t); void setTemplateArguments(ArgumentList *al); void setTemplateBaseClassNames(QDict<int> *templateNames); - void setTemplateMaster(ClassDef *tm) { m_templateMaster=tm; } + void setTemplateMaster(ClassDef *tm); void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec); - - /*! Marks this class as a template argument of some another class */ - void makeTemplateArgument(bool b=TRUE) { m_isTemplArg = b; } + void makeTemplateArgument(bool b=TRUE); + void setCategoryOf(ClassDef *cd); //----------------------------------------------------------------------------------- // --- actions ---- @@ -340,6 +328,9 @@ class ClassDef : public Definition void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); void writePlainMemberDeclaration(OutputList &ol,MemberList::ListType lt,bool inGroup); + ClassDefImpl *m_impl; + +#if 0 /*! file name that forms the base for the output file containing the * class documentation. For compatibility with Qt (e.g. links via tag * files) this name cannot be derived from the class name directly. @@ -394,7 +385,6 @@ class ClassDef : public Definition */ ClassSDict *m_innerClasses; - /* classes for the collaboration diagram */ UsesClassDict *m_usesImplClassDict; UsesClassDict *m_usedByImplClassDict; @@ -458,6 +448,7 @@ class ClassDef : public Definition * groups? */ bool m_subGrouping; +#endif }; @@ -51,7 +51,7 @@ static CodeOutputInterface * g_code; -static ClassSDict g_codeClassSDict(17); +static ClassSDict *g_codeClassSDict = 0; static QCString g_curClassName; static QStrList g_curClassBases; @@ -127,10 +127,12 @@ static ObjCCallCtx *g_currentCtx=0; static int g_currentCtxId=0; static int g_currentNameId=0; static int g_currentObjId=0; +static int g_currentWordId=0; static QStack<ObjCCallCtx> g_contextStack; static QIntDict<ObjCCallCtx> g_contextDict; static QIntDict<QCString> g_nameDict; static QIntDict<QCString> g_objectDict; +static QIntDict<QCString> g_wordDict; static int g_braceCount=0; static void saveObjCContext(); @@ -225,7 +227,7 @@ void VariableContext::addVariable(const QCString &type,const QCString &name) ClassDef *varType; int i=0; if ( - (varType=g_codeClassSDict[ltype]) || // look for class definitions inside the code block + (varType=g_codeClassSDict->find(ltype)) || // look for class definitions inside the code block (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,ltype)) // look for global class definitions ) { @@ -240,7 +242,7 @@ void VariableContext::addVariable(const QCString &type,const QCString &name) QCString templateArgs(ltype.right(ltype.length() - i)); if ( ( // look for class definitions inside the code block - (varType=g_codeClassSDict[typeName]) || + (varType=g_codeClassSDict->find(typeName)) || // otherwise look for global class definitions (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,typeName)) ) && // and it must be a template @@ -607,7 +609,7 @@ static void addUsingDirective(const char *name) { if (g_exampleBlock && g_sourceFileDef && name) { - NamespaceDef *nd = Doxygen::namespaceSDict.find(name); + NamespaceDef *nd = Doxygen::namespaceSDict->find(name); if (nd) { g_sourceFileDef->addUsingDirective(nd); @@ -618,7 +620,7 @@ static void addUsingDirective(const char *name) static void setParameterList(MemberDef *md) { g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; - ArgumentList *al = md->argumentList(); + LockingPtr<ArgumentList> al = md->argumentList(); if (al==0) return; Argument *a = al->first(); while (a) @@ -721,7 +723,7 @@ static MemberDef *setCallContextForVar(const QCString &name) } // look for a global member - if ((mn=Doxygen::functionNameSDict[name])) + if ((mn=Doxygen::functionNameSDict->find(name))) { //printf("global var `%s'\n",name.data()); if (mn->count()==1) // global defined only once @@ -1109,7 +1111,7 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, if (vcd && vcd->isLinkable()) { //printf("Found class %s for variable `%s'\n",g_classScope.data(),varName.data()); - MemberName *vmn=Doxygen::memberNameSDict[varName]; + MemberName *vmn=Doxygen::memberNameSDict->find(varName); if (vmn==0) { int vi; @@ -1119,7 +1121,7 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, { ClassDef *jcd = getClass(vn.left(vi)); vn=vn.right(vn.length()-vi-2); - vmn=Doxygen::memberNameSDict[vn]; + vmn=Doxygen::memberNameSDict->find(vn); //printf("Trying name `%s' scope=%s\n",vn.data(),scope.data()); if (vmn) { @@ -1192,7 +1194,7 @@ static void generateFunctionLink(CodeOutputInterface &ol,char *funcName) } } //printf("generateFunctionLink(%s) classScope=`%s'\n",locFunc.data(),locScope.data()); - if (!locScope.isEmpty() && (ccd=g_codeClassSDict[locScope])) + if (!locScope.isEmpty() && (ccd=g_codeClassSDict->find(locScope))) { //printf("using classScope %s\n",g_classScope.data()); if (ccd->baseClasses()) @@ -1505,7 +1507,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (QCString(ictx->method->typeString())=="id") { // see if the method name is unique, if so we link to it - MemberName *mn=Doxygen::memberNameSDict.find(ctx->methodName); + MemberName *mn=Doxygen::memberNameSDict->find(ctx->methodName); //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", // mn==0?-1:(int)mn->count(), // ictx->method->name().data(), @@ -1531,6 +1533,21 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) //printf("Invalid context: id=%d\n",refId); } } + else if (nc=='w') // some word + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pWord = g_wordDict.find(refId); + if (pWord) + { + g_code->linkableSymbol(g_yyLineNr,pWord->data(),0, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); + codifyLines(pWord->data()); + } + } else // illegal marker { ASSERT(!"invalid escape sequence"); @@ -1571,6 +1588,15 @@ static QCString escapeObject(const char *s) return result; } +static QCString escapeWord(const char *s) +{ + QCString result; + result.sprintf("$w%d",g_currentWordId); + g_wordDict.insert(g_currentWordId,new QCString(s)); + g_currentWordId++; + return result; +} + /* ----------------------------------------------------------------- */ #undef YY_INPUT @@ -1723,7 +1749,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} g_parmType=yytext; } <ObjCParamType>{ID} { - g_code->codify(yytext); + generateClassOrGlobalLink(*g_code,yytext); g_parmType=yytext; } <ObjCParamType>")" { @@ -1731,6 +1757,8 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} BEGIN(ObjCParams); } <ObjCParams>{ID} { + g_code->linkableSymbol(g_yyLineNr,yytext,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); g_code->codify(yytext); g_parmName=yytext; g_theVarContext.addVariable(g_parmType,g_parmName); @@ -1960,13 +1988,13 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} //printf("Adding new class %s\n",g_curClassName.data()); ClassDef *ncd=new ClassDef("<code>",1, g_curClassName,ClassDef::Class,0,0,FALSE); - g_codeClassSDict.append(g_curClassName,ncd); + g_codeClassSDict->append(g_curClassName,ncd); // insert base classes. char *s=g_curClassBases.first(); while (s) { ClassDef *bcd; - bcd=g_codeClassSDict[s]; + bcd=g_codeClassSDict->find(s); if (bcd==0) bcd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s); if (bcd && bcd!=ncd) { @@ -2321,9 +2349,11 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} g_contextDict.setAutoDelete(TRUE); g_nameDict.setAutoDelete(TRUE); g_objectDict.setAutoDelete(TRUE); + g_wordDict.setAutoDelete(TRUE); g_contextDict.clear(); g_nameDict.clear(); g_objectDict.clear(); + g_wordDict.clear(); g_currentCtxId = 0; g_currentNameId = 0; g_currentObjId = 0; @@ -2443,7 +2473,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} } else { - g_currentCtx->format+=yytext; + g_currentCtx->format+=escapeWord(yytext); } } <ObjCMName>{ID}/{BN}*":" { @@ -2470,6 +2500,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} <ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#) g_currentCtx->format+=yytext; } +<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { g_currentCtx->format+=escapeWord(yytext); } <ObjCCall,ObjCMName,ObjCSkipStr>. { g_currentCtx->format+=*yytext; } <ObjCCall,ObjCMName,ObjCSkipStr>\n { g_currentCtx->format+=*yytext; } @@ -3028,11 +3059,11 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} g_lastCContext = YY_START ; BEGIN( SkipCxxComment ) ; } -<*>"(" { +<*>"("|"[" { g_code->codify(yytext); g_theCallContext.pushScope(); } -<*>")" { +<*>")"|"]" { g_code->codify(yytext); g_theCallContext.popScope(); } @@ -3107,8 +3138,10 @@ void resetCCodeParserState() { //printf("***initParseCodeContext()\n"); g_theVarContext.clear(); - g_codeClassSDict.setAutoDelete(TRUE); - g_codeClassSDict.clear(); + delete g_codeClassSDict; + g_codeClassSDict = new ClassSDict(17); + g_codeClassSDict->setAutoDelete(TRUE); + g_codeClassSDict->clear(); g_curClassBases.clear(); g_anchorCount = 0; } @@ -3120,6 +3153,10 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, { //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd); if (s.isEmpty()) return; + if (g_codeClassSDict==0) + { + resetCCodeParserState(); + } g_code = &od; g_inputString = s; g_inputPosition = 0; diff --git a/src/defgen.cpp b/src/defgen.cpp index 119fa69..428cef4 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -137,7 +137,7 @@ void generateDEFForMember(MemberDef *md, if (isFunc) //function { ArgumentList *declAl = new ArgumentList; - ArgumentList *defAl = md->argumentList(); + LockingPtr<ArgumentList> defAl = md->argumentList(); stringToArgumentList(md->argsString(),declAl); QCString fcnPrefix = " " + memPrefix + "param-"; @@ -213,9 +213,10 @@ void generateDEFForMember(MemberDef *md, // TODO: exceptions, const volatile if (md->memberType()==MemberDef::Enumeration) // enum { - if (md->enumFieldList()) + LockingPtr<MemberList> enumList = md->enumFieldList(); + if (enumList!=0) { - MemberListIterator emli(*md->enumFieldList()); + MemberListIterator emli(*enumList); MemberDef *emd; for (emli.toFirst();(emd=emli.current());++emli) { @@ -239,9 +240,11 @@ void generateDEFForMember(MemberDef *md, << md->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl; //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers()); - if (md->getReferencesMembers()) + + LockingPtr<MemberSDict> mdict = md->getReferencesMembers(); + if (!mdict.isNull()) { - MemberSDict::Iterator mdi(*md->getReferencesMembers()); + MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; QCString refPrefix = " " + memPrefix + "ref-"; @@ -271,9 +274,10 @@ void generateDEFForMember(MemberDef *md, } } /* for (mdi.toFirst...) */ } - if (md->getReferencedByMembers()) + mdict = md->getReferencedByMembers(); + if (!mdict.isNull()) { - MemberSDict::Iterator mdi(*md->getReferencedByMembers()); + MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; QCString refPrefix = " " + memPrefix + "ref-"; @@ -602,15 +606,15 @@ void generateDEF() QTextStream t(&f); t << "AutoGen Definitions dummy;" << endl; - if (Doxygen::classSDict.count()+Doxygen::inputNameList.count()>0) + if (Doxygen::classSDict->count()+Doxygen::inputNameList->count()>0) { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { generateDEFForClass(cd,t); } - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { diff --git a/src/definition.cpp b/src/definition.cpp index ddb2a41..b837a37 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -20,6 +20,7 @@ #include <qregexp.h> #include <stdio.h> #include <stdlib.h> +#include <assert.h> #include "config.h" #include "definition.h" #include "doxygen.h" @@ -33,91 +34,46 @@ #include "section.h" #include "htags.h" #include "parserintf.h" +#include "objcache.h" +#include "marshal.h" #if defined(_MSC_VER) || defined(__BORLANDC__) #define popen _popen #define pclose _pclose #endif +#define START_MARKER 0x4445465B // DEF[ +#define END_MARKER 0x4445465D // DEF] + class DefinitionImpl { public: + DefinitionImpl(); + ~DefinitionImpl(); void init(const char *df,int dl, const char *n,const char *b, - const char *d,bool isSym) - { - defFileName = df; - int lastDot = defFileName.findRev('.'); - if (lastDot!=-1) - { - defFileExt = defFileName.mid(lastDot); - } - defLine = dl; - name=n; - if (name!="<globalScope>") - { - //extractNamespaceName(m_name,m_localName,ns); - localName=stripScope(n); - } - else - { - localName=n; - } - //printf("m_localName=%s\n",m_localName.data()); + const char *d); - if (b) - { - brief = new DocInfo; - brief->doc = b; - } - else - { - brief = 0; - } + SectionDict *sectionDict; // dictionary of all sections, not accessible - if (d) - { - details = new DocInfo; - details->doc = d; - } - else - { - details = 0; - } - body = 0; - sourceRefByDict=0; - sourceRefsDict=0; - sectionDict=0, - outerScope=Doxygen::globalScope; - partOfGroups=0; - xrefListItems=0; - isSymbol = isSym; - hidden = FALSE; - } - - SectionDict *sectionDict; // dictionary of all sections + MemberSDict *sourceRefByDict; + MemberSDict *sourceRefsDict; + QList<ListItemInfo> *xrefListItems; + GroupList *partOfGroups; - MemberSDict *sourceRefByDict; - MemberSDict *sourceRefsDict; + DocInfo *details; // not exported + DocInfo *brief; // not exported + BodyInfo *body; // not exported - DocInfo *details; - DocInfo *brief; - BodyInfo *body; - - QCString name; // name of the definition QCString localName; // local (unqualified) name of the definition // in the future m_name should become m_localName - QCString symbolName; QCString qualifiedName; QCString ref; // reference to external documentation - QList<ListItemInfo> *xrefListItems; - bool isSymbol; bool hidden; - Definition *outerScope; - GroupList *partOfGroups; + Definition *outerScope; // not owner // where the item was found QCString defFileName; @@ -125,9 +81,81 @@ class DefinitionImpl QCString defFileExt; }; +DefinitionImpl::DefinitionImpl() + : sectionDict(0), sourceRefByDict(0), sourceRefsDict(0), + xrefListItems(0), partOfGroups(0), + details(0), brief(0), body(0), + outerScope(0) +{ +} + +DefinitionImpl::~DefinitionImpl() +{ + delete sectionDict; + delete sourceRefByDict; + delete sourceRefsDict; + delete partOfGroups; + delete xrefListItems; + delete brief; + delete details; + delete body; +} + +void DefinitionImpl::init(const char *df,int dl, + const char *n,const char *b, + const char *d) +{ + defFileName = df; + int lastDot = defFileName.findRev('.'); + if (lastDot!=-1) + { + defFileExt = defFileName.mid(lastDot); + } + defLine = dl; + QCString name = n; + if (name!="<globalScope>") + { + //extractNamespaceName(m_name,m_localName,ns); + localName=stripScope(n); + } + else + { + localName=n; + } + //printf("m_localName=%s\n",m_localName.data()); + + if (b) + { + brief = new DocInfo; + brief->doc = b; + } + else + { + brief = 0; + } + + if (d) + { + details = new DocInfo; + details->doc = d; + } + else + { + details = 0; + } + body = 0; + sourceRefByDict=0; + sourceRefsDict=0; + sectionDict=0, + outerScope=Doxygen::globalScope; + partOfGroups=0; + xrefListItems=0; + hidden = FALSE; +} + //----------------------------------------------------------------------------------------- -static void addToMap(const char *name,Definition *d) +void Definition::addToMap(const char *name,Definition *d) { QCString symbolName = name; int index=computeQualifiedIndex(symbolName); @@ -169,11 +197,11 @@ static void addToMap(const char *name,Definition *d) Doxygen::symbolMap->resize(SDict_primes[++sizeIndex]); } - d->setSymbolName(symbolName); + d->_setSymbolName(symbolName); } } -static void removeFromMap(Definition *d) +void Definition::removeFromMap(Definition *d) { QCString symbolName = d->symbolName(); int index=computeQualifiedIndex(symbolName); @@ -209,28 +237,38 @@ Definition::Definition(const char *df,int dl, const char *name,const char *b, const char *d,bool isSymbol) { + m_storagePos=-1; + m_name = name; m_impl = new DefinitionImpl; - m_impl->init(df,dl,name,b,d,isSymbol); + m_impl->init(df,dl,name,b,d); + m_isSymbol = isSymbol; if (isSymbol) addToMap(name,this); + m_cacheHandle=-1; + m_flushPending = FALSE; } Definition::~Definition() { - if (m_impl->isSymbol) removeFromMap(this); - delete m_impl->sectionDict; - delete m_impl->sourceRefByDict; - delete m_impl->sourceRefsDict; - delete m_impl->partOfGroups; - delete m_impl->xrefListItems; - delete m_impl->brief; - delete m_impl->details; - delete m_impl->body; - delete m_impl; + if (m_isSymbol) + { + removeFromMap(this); + } + if (m_impl) + { + delete m_impl; + m_impl=0; + } + if (m_cacheHandle!=-1) + { + Doxygen::symbolCache->del(m_cacheHandle); + m_cacheHandle=-1; + } } void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) { if (!anchorList) return; + makeResident(); //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); SectionInfo *si=anchorList->first(); while (si) @@ -258,6 +296,7 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) void Definition::writeDocAnchorsToTagFile() { + makeResident(); if (!Config_getString("GENERATE_TAGFILE").isEmpty() && m_impl->sectionDict) { //printf("%s: writeDocAnchorsToTagFile(%d)\n",name().data(),m_sectionDict->count()); @@ -280,33 +319,11 @@ void Definition::writeDocAnchorsToTagFile() void Definition::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) { if (d==0) return; + makeResident(); //printf("Definition::setDocumentation(%s,%s,%d,%d)\n",d,docFile,docLine,stripWhiteSpace); QCString doc = d; if (stripWhiteSpace) { -#if 0 - // strip leading empty lines in front of the text, but not the - // leading spaces in front of the first line, so list items are - // parsed with the correct indent - const char *p=d; - char c; - int s=0,so=0; - while ((c=*p) && (c==' ' || c=='\r' || c=='\n')) - { - if (c=='\n') so=s; - p++; - s++; - } - if (c=='\0') return; - doc=d+so; - // zero any trailing whitespace - int e=doc.length()-1; - while (e>=0 && (c=doc.at(e)) && (c==' ' || c=='\r' || c=='\n')) - { - doc.at(e)='\0'; - e--; - } -#endif doc = stripLeadingAndTrailingEmptyLines(doc); } else // don't strip whitespace @@ -332,6 +349,7 @@ void Definition::setBriefDescription(const char *b,const char *briefFile,int bri static bool needsDot = outputLanguage!="Japanese" && outputLanguage!="Chinese" && outputLanguage!="Korean"; + makeResident(); //fprintf(stderr,"Definition::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine); if (m_impl->brief==0) @@ -474,6 +492,7 @@ static bool readCodeFragment(const char *fileName, /*! Write a reference to the source code defining this definition */ void Definition::writeSourceDef(OutputList &ol,const char *) { + makeResident(); ol.pushGeneratorState(); //printf("Definition::writeSourceRef %d %p\n",bodyLine,bodyDef); if (Config_getBool("SOURCE_BROWSER") && @@ -563,6 +582,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) void Definition::setBodySegment(int bls,int ble) { + makeResident(); //printf("setBodySegment(%d,%d) for %s\n",bls,ble,name().data()); if (m_impl->body==0) m_impl->body = new BodyInfo; m_impl->body->startLine=bls; @@ -571,6 +591,7 @@ void Definition::setBodySegment(int bls,int ble) void Definition::setBodyDef(FileDef *fd) { + makeResident(); if (m_impl->body==0) m_impl->body = new BodyInfo; m_impl->body->fileDef=fd; } @@ -578,6 +599,7 @@ void Definition::setBodyDef(FileDef *fd) /*! Write code of this definition into the documentation */ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) { + makeResident(); ol.pushGeneratorState(); //printf("Source Fragment %s: %d-%d bodyDef=%p\n",name().data(), // m_startBodyLine,m_endBodyLine,m_bodyDef); @@ -618,7 +640,7 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) /*! Write a reference to the source code fragments in which this * definition is used. */ -void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, +void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, const QCString &text,MemberSDict *members,bool /*funcOnly*/) { ol.pushGeneratorState(); @@ -711,24 +733,27 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, void Definition::writeSourceReffedBy(OutputList &ol,const char *scopeName) { + makeResident(); if (Config_getBool("REFERENCED_BY_RELATION")) { - writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE); + _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE); } } void Definition::writeSourceRefs(OutputList &ol,const char *scopeName) { + makeResident(); if (Config_getBool("REFERENCES_RELATION")) { - writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE); + _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE); } } bool Definition::hasDocumentation() const { - static bool extractAll = Config_getBool("EXTRACT_ALL"); + static bool extractAll = Config_getBool("EXTRACT_ALL"); static bool sourceBrowser = Config_getBool("SOURCE_BROWSER"); + makeResident(); bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || // has detailed docs (m_impl->brief && !m_impl->brief->doc.isEmpty()) || // has brief description @@ -740,9 +765,10 @@ bool Definition::hasDocumentation() const bool Definition::hasUserDocumentation() const { + makeResident(); bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || - (m_impl->brief && !m_impl->brief->doc.isEmpty()); + (m_impl->brief && !m_impl->brief->doc.isEmpty()); return hasDocs; } @@ -750,6 +776,7 @@ void Definition::addSourceReferencedBy(MemberDef *md) { if (md) { + makeResident(); QCString name = md->name(); QCString scope = md->getScopeString(); @@ -775,6 +802,7 @@ void Definition::addSourceReferences(MemberDef *md) { QCString name = md->name(); QCString scope = md->getScopeString(); + makeResident(); if (!scope.isEmpty()) { @@ -805,6 +833,7 @@ void Definition::addInnerCompound(Definition *) QCString Definition::qualifiedName() { + makeResident(); if (!m_impl->qualifiedName.isEmpty()) return m_impl->qualifiedName; //printf("start Definition::qualifiedName() localName=%s\n",m_localName.data()); @@ -828,6 +857,7 @@ QCString Definition::qualifiedName() void Definition::setOuterScope(Definition *d) { + makeResident(); if (m_impl->outerScope!=d) { m_impl->qualifiedName.resize(0); // flush cached scope name @@ -837,11 +867,13 @@ void Definition::setOuterScope(Definition *d) QCString Definition::localName() const { + makeResident(); return m_impl->localName; } void Definition::makePartOfGroup(GroupDef *gd) { + makeResident(); if (m_impl->partOfGroups==0) m_impl->partOfGroups = new GroupList; m_impl->partOfGroups->append(gd); } @@ -850,6 +882,7 @@ void Definition::setRefItems(const QList<ListItemInfo> *sli) { if (sli) { + makeResident(); // deep copy the list if (m_impl->xrefListItems==0) { @@ -867,19 +900,21 @@ void Definition::setRefItems(const QList<ListItemInfo> *sli) void Definition::mergeRefItems(Definition *d) { - if (d->xrefListItems()) + LockingPtr< QList<ListItemInfo> > xrefList = d->xrefListItems(); + if (xrefList!=0) { + makeResident(); // deep copy the list if (m_impl->xrefListItems==0) { m_impl->xrefListItems=new QList<ListItemInfo>; m_impl->xrefListItems->setAutoDelete(TRUE); } - QListIterator<ListItemInfo> slii(*d->xrefListItems()); + QListIterator<ListItemInfo> slii(*xrefList); ListItemInfo *lii; for (slii.toFirst();(lii=slii.current());++slii) { - if (getXRefListId(lii->type)==-1) + if (_getXRefListId(lii->type)==-1) { m_impl->xrefListItems->append(new ListItemInfo(*lii)); } @@ -887,8 +922,9 @@ void Definition::mergeRefItems(Definition *d) } } -int Definition::getXRefListId(const char *listName) const +int Definition::_getXRefListId(const char *listName) const { + makeResident(); if (m_impl->xrefListItems) { QListIterator<ListItemInfo> slii(*m_impl->xrefListItems); @@ -904,14 +940,16 @@ int Definition::getXRefListId(const char *listName) const return -1; } -const QList<ListItemInfo> *Definition::xrefListItems() const +LockingPtr< QList<ListItemInfo> > Definition::xrefListItems() const { - return m_impl->xrefListItems; + makeResident(); + return LockingPtr< QList<ListItemInfo> >(this,m_impl->xrefListItems); } QCString Definition::convertNameToFile(const char *name,bool allowDots) const { + makeResident(); if (!m_impl->ref.isEmpty()) { return name; @@ -924,6 +962,7 @@ QCString Definition::convertNameToFile(const char *name,bool allowDots) const void Definition::writePathFragment(OutputList &ol) const { + makeResident(); if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope) { m_impl->outerScope->writePathFragment(ol); @@ -981,144 +1020,292 @@ void Definition::writeNavigationPath(OutputList &ol) const ol.popGeneratorState(); } -const QCString& Definition::name() const -{ - return m_impl->name; -} - QCString Definition::symbolName() const { - return m_impl->symbolName; + return m_symbolName; } QCString Definition::documentation() const { + makeResident(); return m_impl->details ? m_impl->details->doc : QCString(""); } int Definition::docLine() const { + makeResident(); return m_impl->details ? m_impl->details->line : 1; } QCString Definition::docFile() const { - return m_impl->details ? m_impl->details->file : QCString("<"+m_impl->name+">"); + makeResident(); + return m_impl->details ? m_impl->details->file : QCString("<"+m_name+">"); } QCString Definition::briefDescription() const { + makeResident(); return m_impl->brief ? m_impl->brief->doc : QCString(""); } int Definition::briefLine() const { + makeResident(); return m_impl->brief ? m_impl->brief->line : 1; } QCString Definition::briefFile() const { - return m_impl->brief ? m_impl->brief->file : QCString("<"+m_impl->name+">"); + makeResident(); + return m_impl->brief ? m_impl->brief->file : QCString("<"+m_name+">"); } QCString Definition::getDefFileName() const { + makeResident(); return m_impl->defFileName; } QCString Definition::getDefFileExtension() const { + makeResident(); return m_impl->defFileExt; } int Definition::getDefLine() const { + makeResident(); return m_impl->defLine; } bool Definition::isHidden() const { + makeResident(); return m_impl->hidden; } bool Definition::isVisibleInProject() const { - return m_impl->hidden || isLinkableInProject(); + return isLinkableInProject() || m_impl->hidden; } bool Definition::isVisible() const { - return m_impl->hidden || isLinkable(); + return isLinkable() || m_impl->hidden; } QCString Definition::getReference() const { + makeResident(); return m_impl->ref; } bool Definition::isReference() const { + makeResident(); return !m_impl->ref.isEmpty(); } int Definition::getStartBodyLine() const { + makeResident(); return m_impl->body ? m_impl->body->startLine : -1; } int Definition::getEndBodyLine() const { + makeResident(); return m_impl->body ? m_impl->body->endLine : -1; } FileDef *Definition::getBodyDef() { + makeResident(); return m_impl->body ? m_impl->body->fileDef : 0; } -GroupList *Definition::partOfGroups() const +LockingPtr<GroupList> Definition::partOfGroups() const { - return m_impl->partOfGroups; + makeResident(); + return LockingPtr<GroupList>(this,m_impl->partOfGroups); } Definition *Definition::getOuterScope() const { + makeResident(); return m_impl->outerScope; } -MemberSDict *Definition::getReferencesMembers() const -{ - return m_impl->sourceRefsDict; -} - -MemberSDict *Definition::getReferencedByMembers() const +LockingPtr<MemberSDict> Definition::getReferencesMembers() const { - return m_impl->sourceRefByDict; + makeResident(); + return LockingPtr<MemberSDict>(this,m_impl->sourceRefsDict); } -void Definition::setName(const char *name) +LockingPtr<MemberSDict> Definition::getReferencedByMembers() const { - m_impl->name=name; + makeResident(); + return LockingPtr<MemberSDict>(this,m_impl->sourceRefByDict); } void Definition::setReference(const char *r) { + makeResident(); m_impl->ref=r; } -void Definition::setSymbolName(const QCString &name) +void Definition::_setSymbolName(const QCString &name) { - m_impl->symbolName=name; + m_symbolName=name; } void Definition::setHidden(bool b) { + makeResident(); m_impl->hidden = b; } void Definition::setLocalName(const QCString name) { + makeResident(); m_impl->localName=name; } +void Definition::makeResident() const +{ + if (m_cacheHandle==-1) // not yet in cache + { + Definition *victim = 0; + Definition *that = (Definition*)this; // fake method constness + that->m_cacheHandle = Doxygen::symbolCache->add(that,(void **)&victim); + //printf("adding %s to cache, handle=%d\n",m_impl->name.data(),that->m_cacheHandle); + if (victim) // cache was full, victim was the least recently used item and has to go + { + victim->m_cacheHandle=-1; // invalidate cache handle + victim->saveToDisk(); // store the item on disk + } + else // cache not yet full + { + //printf("Adding %s to cache, handle=%d\n",m_impl->name.data(),m_cacheHandle); + } + if (m_storagePos!=-1) // already been written to disk + { + if (isLocked()) // locked in memory + { + assert(m_impl!=0); + that->m_flushPending=FALSE; // no need to flush anymore + } + else // not locked in memory + { + assert(m_impl==0); + loadFromDisk(); + } + } + } + else // already cached, make this object the most recently used. + { + assert(m_impl!=0); + //printf("Touching symbol %s\n",m_impl->name.data()); + Doxygen::symbolCache->use(m_cacheHandle); + } +} + +void Definition::saveToDisk() const +{ + assert(m_impl!=0); + Definition *that = (Definition *)this; + if (isLocked()) // cannot flush the item as it is locked + { + that->m_flushPending=TRUE; // flush when unlocked + } + else // ready to flush the item to disk + { + //printf("Adding %s to cache, handle=%d by replacing %s\n", + // m_impl->name.data(),m_cacheHandle,victim->m_impl->name.data()); + if (m_storagePos!=-1) + // if victim was stored on disk already and is not locked + { + // free the storage space occupied by the old store item + Doxygen::symbolStorage->release(m_storagePos); // free up space for others + } + // write a the new (possibly modified) instance to disk + flushToDisk(); + // end to write sequence (unless nothing was written due to the lock) + Doxygen::symbolStorage->end(); + } +} + +void Definition::flushToDisk() const +{ + //printf("%p: Definition::flushToDisk()\n",this); + Definition *that = (Definition *)this; + that->m_storagePos = Doxygen::symbolStorage->alloc(); + //printf("Definition::flushToDisk(): pos=%d\n",(int)m_storagePos); + marshalUInt(Doxygen::symbolStorage,START_MARKER); + marshalSectionDict (Doxygen::symbolStorage,m_impl->sectionDict); + marshalMemberSDict (Doxygen::symbolStorage,m_impl->sourceRefByDict); + marshalMemberSDict (Doxygen::symbolStorage,m_impl->sourceRefsDict); + marshalItemInfoList (Doxygen::symbolStorage,m_impl->xrefListItems); + marshalGroupList (Doxygen::symbolStorage,m_impl->partOfGroups); + marshalDocInfo (Doxygen::symbolStorage,m_impl->details); + marshalDocInfo (Doxygen::symbolStorage,m_impl->brief); + marshalBodyInfo (Doxygen::symbolStorage,m_impl->body); + marshalQCString (Doxygen::symbolStorage,m_impl->localName); + marshalQCString (Doxygen::symbolStorage,m_impl->qualifiedName); + marshalQCString (Doxygen::symbolStorage,m_impl->ref); + marshalBool (Doxygen::symbolStorage,m_impl->hidden); + marshalObjPointer (Doxygen::symbolStorage,m_impl->outerScope); + marshalQCString (Doxygen::symbolStorage,m_impl->defFileName); + marshalInt (Doxygen::symbolStorage,m_impl->defLine); + marshalQCString (Doxygen::symbolStorage,m_impl->defFileExt); + marshalUInt(Doxygen::symbolStorage,END_MARKER); + delete that->m_impl; + that->m_impl = 0; + that->m_flushPending=FALSE; +} + +void Definition::loadFromDisk() const +{ + //printf("%p: Definition::loadFromDisk()\n",this); + Definition *that = (Definition *)this; + assert(m_impl==0); + that->m_impl = new DefinitionImpl; + Doxygen::symbolStorage->seek(m_storagePos); + uint marker = unmarshalUInt(Doxygen::symbolStorage); + assert(marker==START_MARKER); + m_impl->sectionDict = unmarshalSectionDict (Doxygen::symbolStorage); + m_impl->sourceRefByDict = unmarshalMemberSDict (Doxygen::symbolStorage); + m_impl->sourceRefsDict = unmarshalMemberSDict (Doxygen::symbolStorage); + m_impl->xrefListItems = unmarshalItemInfoList (Doxygen::symbolStorage); + m_impl->partOfGroups = unmarshalGroupList (Doxygen::symbolStorage); + m_impl->details = unmarshalDocInfo (Doxygen::symbolStorage); + m_impl->brief = unmarshalDocInfo (Doxygen::symbolStorage); + m_impl->body = unmarshalBodyInfo (Doxygen::symbolStorage); + m_impl->localName = unmarshalQCString (Doxygen::symbolStorage); + m_impl->qualifiedName = unmarshalQCString (Doxygen::symbolStorage); + m_impl->ref = unmarshalQCString (Doxygen::symbolStorage); + m_impl->hidden = unmarshalBool (Doxygen::symbolStorage); + m_impl->outerScope = (Definition *)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->defFileName = unmarshalQCString (Doxygen::symbolStorage); + m_impl->defLine = unmarshalInt (Doxygen::symbolStorage); + m_impl->defFileExt = unmarshalQCString (Doxygen::symbolStorage); + marker = unmarshalUInt(Doxygen::symbolStorage); + assert(marker==END_MARKER); +} + +void Definition::lock() const +{ +} + +void Definition::unlock() const +{ + if (m_flushPending && !isLocked()) + { + // write a the new (possibly modified) instance to disk + flushToDisk(); + // end to write sequence (unless nothing was written due to the lock) + Doxygen::symbolStorage->end(); + } +} diff --git a/src/definition.h b/src/definition.h index c5cbfae..8f46e7a 100644 --- a/src/definition.h +++ b/src/definition.h @@ -21,6 +21,9 @@ #include "qtbc.h" #include <qlist.h> #include <qdict.h> +#include <sys/types.h> + +#include "lockingptr.h" class FileDef; class OutputList; @@ -64,9 +67,15 @@ class DefinitionIntf /*! Types of derived classes */ enum DefType { - TypeClass, TypeMember, TypeFile, TypeGroup, - TypeNamespace, TypePackage, TypePage, TypeDir, - TypeSymbolList + TypeClass = 0, + TypeFile = 1, + TypeNamespace = 2, + TypeMember = 3, + TypeGroup = 4, + TypePackage = 5, + TypePage = 6, + TypeDir = 7, + TypeSymbolList = 8 }; /*! Use this for dynamic inspection of the type of the derived class */ virtual DefType definitionType() const = 0; @@ -76,7 +85,7 @@ class DefinitionIntf * This can be a class or a member function, or a file, or a namespace, etc. * Use definitionType() to find which type of definition this is. */ -class Definition : public DefinitionIntf +class Definition : public DefinitionIntf, public LockableObj { public: @@ -94,7 +103,7 @@ class Definition : public DefinitionIntf //----------------------------------------------------------------------------------- /*! Returns the name of the definition */ - const QCString& name() const; + const QCString& name() const { return m_name; } /*! Returns the local name without any scope qualifiers. */ QCString localName() const; @@ -200,22 +209,22 @@ class Definition : public DefinitionIntf */ FileDef *getBodyDef(); - GroupList *partOfGroups() const; + LockingPtr<GroupList> partOfGroups() const; - const QList<ListItemInfo> *xrefListItems() const; + LockingPtr< QList<ListItemInfo> > xrefListItems() const; virtual Definition *findInnerCompound(const char *name); virtual Definition *getOuterScope() const; - MemberSDict *getReferencesMembers() const; - MemberSDict *getReferencedByMembers() const; + LockingPtr<MemberSDict> getReferencesMembers() const; + LockingPtr<MemberSDict> getReferencedByMembers() const; //----------------------------------------------------------------------------------- // ---- setters ----- //----------------------------------------------------------------------------------- /*! Sets a new \a name for the definition */ - void setName(const char *name); + void setName(const char *name) { m_name = name; } /*! Sets the documentation of this definition to \a d. */ void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); @@ -228,10 +237,6 @@ class Definition : public DefinitionIntf /*! Sets the tag file id via which this definition was imported. */ void setReference(const char *r); - /*! Sets the name of this definition as it should appear in the symbol map. - */ - void setSymbolName(const QCString &name); - /*! Add the list of anchors that mark the sections that are found in the * documentation. */ @@ -271,19 +276,35 @@ class Definition : public DefinitionIntf protected: void setLocalName(const QCString name); - - int getXRefListId(const char *listName) const; - void writeSourceRefList(OutputList &ol,const char *scopeName, - const QCString &text,MemberSDict *members,bool); - virtual void flushToDisk() {} - virtual void loadFromDisk() {} - virtual void makeResident() { if (m_impl==0) loadFromDisk(); } - virtual bool isResident() const { return m_impl!=0; } + virtual void flushToDisk() const; + virtual void loadFromDisk() const; + void makeResident() const; + bool isResident() const + { + return m_cacheHandle!=-1; + } private: + void lock() const; + void unlock() const; + + static void addToMap(const char *name,Definition *d); + static void removeFromMap(Definition *d); + void saveToDisk() const; + + void _setSymbolName(const QCString &name); + + int _getXRefListId(const char *listName) const; + void _writeSourceRefList(OutputList &ol,const char *scopeName, + const QCString &text,MemberSDict *members,bool); DefinitionImpl *m_impl; // internal structure holding all private data - uint64 m_storagePos; // location where the item is stored in file (if impl==0) + off_t m_storagePos; // location where the item is stored in file (if impl==0) + int m_cacheHandle; + QCString m_name; + bool m_flushPending; + bool m_isSymbol; + QCString m_symbolName; }; diff --git a/src/diagram.cpp b/src/diagram.cpp index b09cf2b..d169617 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -928,7 +928,7 @@ void TreeDiagram::drawConnectors(QTextStream &t,Image *image, void clearVisitFlags() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (;(cd=cli.current());++cli) { diff --git a/src/dirdef.cpp b/src/dirdef.cpp index f7874e1..ef5d7b9 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -507,13 +507,13 @@ FilePair *UsedDir::findFilePair(const char *name) DirDef *DirDef::createNewDir(const char *path) { ASSERT(path!=0); - DirDef *dir = Doxygen::directories.find(path); + DirDef *dir = Doxygen::directories->find(path); if (dir==0) // new dir { //printf("Adding new dir %s\n",path); dir = new DirDef(path); //printf("createNewDir %s short=%s\n",path,dir->shortName().data()); - Doxygen::directories.inSort(path,dir); + Doxygen::directories->inSort(path,dir); } return dir; } @@ -781,7 +781,7 @@ void DirRelation::writeDocumentation(OutputList &ol) void buildDirectories() { // for each input file - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -793,7 +793,7 @@ void buildDirectories() if (fd->getReference().isEmpty() && !fd->isDocumentationFile()) { DirDef *dir; - if ((dir=Doxygen::directories.find(fd->getPath()))==0) // new directory + if ((dir=Doxygen::directories->find(fd->getPath()))==0) // new directory { dir = DirDef::mergeDirectoryInTree(fd->getPath()); } @@ -809,7 +809,7 @@ void buildDirectories() //DirDef *root = new DirDef("root:"); // compute relations between directories => introduce container dirs. DirDef *dir; - DirSDict::Iterator sdi(Doxygen::directories); + DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { //printf("New dir %s\n",dir->displayName().data()); @@ -817,7 +817,7 @@ void buildDirectories() int i=name.findRev('/',name.length()-2); if (i>0) { - DirDef *parent = Doxygen::directories.find(name.left(i+1)); + DirDef *parent = Doxygen::directories->find(name.left(i+1)); //if (parent==0) parent=root; if (parent) { @@ -832,7 +832,7 @@ void buildDirectories() void computeDirDependencies() { DirDef *dir; - DirSDict::Iterator sdi(Doxygen::directories); + DirSDict::Iterator sdi(*Doxygen::directories); // compute nesting level for each directory for (sdi.toFirst();(dir=sdi.current());++sdi) { @@ -877,7 +877,7 @@ void writeDirDependencyGraph(const char *dirName) { QString path; DirDef *dir; - DirSDict::Iterator sdi(Doxygen::directories); + DirSDict::Iterator sdi(*Doxygen::directories); QFile htmlPage(QCString(dirName)+"/dirdeps.html"); if (htmlPage.open(IO_WriteOnly)) { @@ -921,7 +921,7 @@ void writeDirDependencyGraph(const char *dirName) void generateDirDocs(OutputList &ol) { DirDef *dir; - DirSDict::Iterator sdi(Doxygen::directories); + DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { dir->writeDocumentation(ol); diff --git a/src/docparser.cpp b/src/docparser.cpp index 2e97277..3d34aa3 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -255,7 +255,7 @@ static void checkArgumentName(const QString &name,bool isParam) { if (!Config_getBool("WARN_IF_DOC_ERROR")) return; if (g_memberDef==0) return; // not a member - ArgumentList *al=g_memberDef->isDocsForDefinition() ? + LockingPtr<ArgumentList> al=g_memberDef->isDocsForDefinition() ? g_memberDef->argumentList() : g_memberDef->declArgumentList(); if (al==0) return; // no argument list @@ -304,7 +304,7 @@ static void checkArgumentName(const QString &name,bool isParam) "Warning: argument `%s' of command @param " "is not found in the argument list of %s%s%s%s", aName.data(),scope.data(),g_memberDef->name().data(), - argListToString(al).data(),inheritedFrom.data()); + argListToString(al.pointer()).data(),inheritedFrom.data()); } p=i+l; } @@ -319,10 +319,10 @@ static void checkUndocumentedParams() { if (g_memberDef && g_hasParamCommand && Config_getBool("WARN_IF_DOC_ERROR")) { - ArgumentList *al=g_memberDef->isDocsForDefinition() ? + LockingPtr<ArgumentList> al=g_memberDef->isDocsForDefinition() ? g_memberDef->argumentList() : g_memberDef->declArgumentList(); - if (al) + if (al!=0) { ArgumentListIterator ali(*al); Argument *a; @@ -342,7 +342,7 @@ static void checkUndocumentedParams() QString errMsg= "Warning: The following parameters of "+ QString(g_memberDef->qualifiedName()) + - QString(argListToString(al)) + + QString(argListToString(al.pointer())) + " are not documented:\n"; for (ali.toFirst();(a=ali.current());++ali) { @@ -374,8 +374,8 @@ static void detectNoDocumentedParams() { if (g_memberDef && Config_getBool("WARN_NO_PARAMDOC")) { - ArgumentList *al = g_memberDef->argumentList(); - ArgumentList *declAl = g_memberDef->declArgumentList(); + LockingPtr<ArgumentList> al = g_memberDef->argumentList(); + LockingPtr<ArgumentList> declAl = g_memberDef->declArgumentList(); QString returnType = g_memberDef->typeString(); if (!g_memberDef->hasDocumentedParams() && @@ -388,7 +388,7 @@ static void detectNoDocumentedParams() { bool allDoc=TRUE; // no paramater => all parameters are documented if ( // member has parameters - al && // but the member has a parameter list + al!=0 && // but the member has a parameter list al->count()>0 // with at least one parameter (that is not void) ) { @@ -405,7 +405,7 @@ static void detectNoDocumentedParams() //printf("a->type=%s a->name=%s doc=%s\n", // a->type.data(),a->name.data(),a->docs.data()); } - if (!allDoc && declAl) // try declaration arguments as well + if (!allDoc && declAl!=0) // try declaration arguments as well { allDoc=TRUE; ArgumentListIterator ali(*declAl); @@ -595,7 +595,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, //printf("Trying fullName=`%s'\n",fullName.data()); // try class, namespace, group, page, file reference - cd = Doxygen::classSDict[fullName]; + cd = Doxygen::classSDict->find(fullName); if (cd) // class { *pDoc=cd->documentation(); @@ -603,7 +603,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, *pDef=cd; return TRUE; } - nd = Doxygen::namespaceSDict[fullName]; + nd = Doxygen::namespaceSDict->find(fullName); if (nd) // namespace { *pDoc=nd->documentation(); @@ -611,7 +611,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, *pDef=nd; return TRUE; } - gd = Doxygen::groupSDict[cmdArg]; + gd = Doxygen::groupSDict->find(cmdArg); if (gd) // group { *pDoc=gd->documentation(); @@ -2048,6 +2048,15 @@ void DocRef::parse() } } + if (m_children.isEmpty() && !m_text.isEmpty()) + { + g_insideHtmlLink=TRUE; + docParserPushContext(); + internalValidatingParseDoc(this,m_children,m_text); + docParserPopContext(); + g_insideHtmlLink=FALSE; + } + handlePendingStyleCommands(this,m_children); DBG(("DocRef::parse() end\n")); DocNode *n=g_nodeStack.pop(); diff --git a/src/dot.cpp b/src/dot.cpp index 382a031..1e1b3c5 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -1260,10 +1260,10 @@ DotGfxHierarchyTable::DotGfxHierarchyTable() // build a graph with each class as a node and the inheritance relations // as edges - initClassHierarchy(&Doxygen::classSDict); - initClassHierarchy(&Doxygen::hiddenClasses); - addClassList(&Doxygen::classSDict); - addClassList(&Doxygen::hiddenClasses); + initClassHierarchy(Doxygen::classSDict); + initClassHierarchy(Doxygen::hiddenClasses); + addClassList(Doxygen::classSDict); + addClassList(Doxygen::hiddenClasses); // m_usedNodes now contains all nodes in the graph // color the graph into a set of independent subgraphs @@ -2359,8 +2359,8 @@ QCString DotCallGraph::writeGraph(QTextStream &out, GraphOutputFormat format, void DotCallGraph::buildGraph(DotNode *n,MemberDef *md,int distance) { - MemberSDict *refs = m_inverse ? md->getReferencedByMembers() : md->getReferencesMembers(); - if (refs) + LockingPtr<MemberSDict> refs = m_inverse ? md->getReferencedByMembers() : md->getReferencesMembers(); + if (!refs.isNull()) { MemberSDict::Iterator mri(*refs); MemberDef *rmd; @@ -2733,9 +2733,10 @@ void DotGroupCollaboration::buildGraph(GroupDef* gd,int) // hierarchy. // Write parents - if ( gd->partOfGroups() ) + LockingPtr<GroupList> groups = gd->partOfGroups(); + if ( groups!=0 ) { - GroupListIterator gli(*gd->partOfGroups()); + GroupListIterator gli(*groups); GroupDef *d; for (gli.toFirst();(d=gli.current());++gli) { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6f79229..0b60c3d 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -68,6 +68,9 @@ #include "htags.h" #include "pyscanner.h" #include "code.h" +#include "objcache.h" +#include "store.h" +#include "marshal.h" #define RECURSE_ENTRYTREE(func,var) \ @@ -83,59 +86,49 @@ #endif // globally accessible variables -ClassSDict Doxygen::classSDict(1009); -ClassSDict Doxygen::hiddenClasses(257); - -NamespaceSDict Doxygen::namespaceSDict(20); - -MemberNameSDict Doxygen::memberNameSDict(10000); - -MemberNameSDict Doxygen::functionNameSDict(10000); - -FileNameList Doxygen::inputNameList; // all input files -FileNameDict *Doxygen::inputNameDict; - -GroupSDict Doxygen::groupSDict(17); - -FormulaList Doxygen::formulaList; // all formulas -FormulaDict Doxygen::formulaDict(1009); // all formulas -FormulaDict Doxygen::formulaNameDict(1009); // the label name of all formulas - -PageSDict *Doxygen::pageSDict = new PageSDict(1009); // all doc pages -PageSDict *Doxygen::exampleSDict = new PageSDict(1009); // all examples -SectionDict Doxygen::sectionDict(257); // all page sections -StringDict Doxygen::aliasDict(257); // aliases -FileNameDict *Doxygen::includeNameDict; // include names -FileNameDict *Doxygen::exampleNameDict; // examples -FileNameDict *Doxygen::imageNameDict; // images -FileNameDict *Doxygen::dotFileNameDict; // dot files -StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases -StringDict Doxygen::tagDestinationDict(257); // all tag locations - // a member group -QDict<void> Doxygen::expandAsDefinedDict(257); // all macros that should be expanded - +ClassSDict *Doxygen::classSDict = 0; +ClassSDict *Doxygen::hiddenClasses = 0; +NamespaceSDict *Doxygen::namespaceSDict = 0; +MemberNameSDict *Doxygen::memberNameSDict = 0; +MemberNameSDict *Doxygen::functionNameSDict = 0; +FileNameList *Doxygen::inputNameList = 0; // all input files +FileNameDict *Doxygen::inputNameDict = 0; +GroupSDict *Doxygen::groupSDict = 0; +FormulaList Doxygen::formulaList; // all formulas +FormulaDict Doxygen::formulaDict(1009); // all formulas +FormulaDict Doxygen::formulaNameDict(1009); // the label name of all formulas +PageSDict *Doxygen::pageSDict = 0; +PageSDict *Doxygen::exampleSDict = 0; +SectionDict Doxygen::sectionDict(257); // all page sections +StringDict Doxygen::aliasDict(257); // aliases +FileNameDict *Doxygen::includeNameDict = 0; // include names +FileNameDict *Doxygen::exampleNameDict = 0; // examples +FileNameDict *Doxygen::imageNameDict = 0; // images +FileNameDict *Doxygen::dotFileNameDict = 0; // dot files +StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases +StringDict Doxygen::tagDestinationDict(257); // all tag locations +QDict<void> Doxygen::expandAsDefinedDict(257); // all macros that should be expanded QIntDict<MemberGroupInfo> Doxygen::memGrpInfoDict(1009); // dictionary of the member groups heading - -PageDef *Doxygen::mainPage = 0; -bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page? -QTextStream Doxygen::tagFile; -NamespaceDef *Doxygen::globalScope; - -QDict<RefList> *Doxygen::xrefLists = new QDict<RefList>; // dictionary of cross-referenced item lists - -bool Doxygen::parseSourcesNeeded = FALSE; -double Doxygen::sysElapsedTime = 0.0; -QTime Doxygen::runningTime; -SearchIndex * Doxygen::searchIndex=0; +PageDef *Doxygen::mainPage = 0; +bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page? +QTextStream Doxygen::tagFile; +NamespaceDef *Doxygen::globalScope = 0; +QDict<RefList> *Doxygen::xrefLists = new QDict<RefList>; // dictionary of cross-referenced item lists +bool Doxygen::parseSourcesNeeded = FALSE; +double Doxygen::sysElapsedTime = 0.0; +QTime Doxygen::runningTime; +SearchIndex * Doxygen::searchIndex=0; QDict<DefinitionIntf> *Doxygen::symbolMap; -bool Doxygen::outputToWizard=FALSE; -QDict<int> * Doxygen::htmlDirMap = 0; +bool Doxygen::outputToWizard=FALSE; +QDict<int> * Doxygen::htmlDirMap = 0; QCache<LookupInfo> Doxygen::lookupCache(50000,50000); -DirSDict Doxygen::directories(17); +DirSDict *Doxygen::directories; SDict<DirRelation> Doxygen::dirRelations(257); -ParserManager *Doxygen::parserManager = 0; +ParserManager *Doxygen::parserManager = 0; QCString Doxygen::htmlFileExtension; -bool Doxygen::suppressDocWarnings = FALSE; +bool Doxygen::suppressDocWarnings = FALSE; +ObjCache *Doxygen::symbolCache = 0; +Store *Doxygen::symbolStorage; // locally accessible globals static QDict<EntryNav> classEntries(1009); @@ -146,7 +139,7 @@ static OutputList *outputList = 0; // list of output generating obje static QDict<FileDef> g_usingDeclarations(1009); // used classes static const char idMask[] = "[A-Za-z_][A-Za-z_0-9]*"; -QFile g_storage; +FileStorage *g_storage = 0; QCString spaces; @@ -157,13 +150,12 @@ void clearAll() excludeNameDict.clear(); delete outputList; outputList=0; - Doxygen::classSDict.clear(); - Doxygen::namespaceSDict.clear(); + Doxygen::classSDict->clear(); + Doxygen::namespaceSDict->clear(); Doxygen::pageSDict->clear(); Doxygen::exampleSDict->clear(); - Doxygen::inputNameList.clear(); + Doxygen::inputNameList->clear(); Doxygen::formulaList.clear(); - Doxygen::classSDict.clear(); Doxygen::sectionDict.clear(); Doxygen::inputNameDict->clear(); Doxygen::includeNameDict->clear(); @@ -317,6 +309,21 @@ static void addSTLMember(EntryNav *rootNav,const char *type,const char *name) rootNav->addChild(memEntryNav); } +static void addSTLIterator(EntryNav *classEntryNav,const char *name) +{ + Entry *iteratorClassEntry = new Entry; + iteratorClassEntry->fileName = "[STL]"; + iteratorClassEntry->startLine = 1; + iteratorClassEntry->name = name; + iteratorClassEntry->section = Entry::CLASS_SEC; + iteratorClassEntry->brief = "STL iterator class"; + iteratorClassEntry->hidden = TRUE; + EntryNav *iteratorClassEntryNav = new EntryNav(classEntryNav,iteratorClassEntry); + iteratorClassEntryNav->setEntry(iteratorClassEntry); + classEntryNav->addChild(iteratorClassEntryNav); +} + + static void addSTLClasses(EntryNav *rootNav) { Entry *namespaceEntry = new Entry; @@ -389,6 +396,14 @@ static void addSTLClasses(EntryNav *rootNav) { classEntry->extends->append(new BaseInfo(info->baseClass2,Public,info->virtualInheritance?Virtual:Normal)); } + if (info->iterators) + { + // add iterator class + addSTLIterator(classEntryNav,fullName+"::iterator"); + addSTLIterator(classEntryNav,fullName+"::const_iterator"); + addSTLIterator(classEntryNav,fullName+"::reverse_iterator"); + addSTLIterator(classEntryNav,fullName+"::const_reverse_iterator"); + } info++; } } @@ -425,7 +440,7 @@ static void addRelatedPage(EntryNav *rootNav) Grouping *g; for (;(g=gli.current());++gli) { - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) break; + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) break; } //printf("---> addRelatedPage() %s gd=%p\n",root->name.data(),gd); QCString doc; @@ -464,7 +479,7 @@ static void buildGroupListFiltered(EntryNav *rootNav,bool additional) { GroupDef *gd; - if ((gd=Doxygen::groupSDict[root->name])) + if ((gd=Doxygen::groupSDict->find(root->name))) { if ( root->groupDocType==Entry::GROUPDOC_NORMAL ) { @@ -506,7 +521,7 @@ static void buildGroupListFiltered(EntryNav *rootNav,bool additional) gd->setBriefDescription(root->brief,root->briefFile,root->briefLine); gd->setDocumentation(root->doc,root->docFile,root->docLine); gd->addSectionsToDefinition(root->anchors); - Doxygen::groupSDict.append(root->name,gd); + Doxygen::groupSDict->append(root->name,gd); gd->setRefItems(root->sli); } } @@ -538,7 +553,7 @@ static void findGroupScope(EntryNav *rootNav) rootNav->parent() && !rootNav->parent()->name().isEmpty()) { GroupDef *gd; - if ((gd=Doxygen::groupSDict[rootNav->name()])) + if ((gd=Doxygen::groupSDict->find(rootNav->name()))) { QCString scope = rootNav->parent()->name(); if (rootNav->parent()->section()==Entry::PACKAGEDOC_SEC) @@ -568,7 +583,7 @@ static void organizeSubGroupsFiltered(EntryNav *rootNav,bool additional) (root->groupDocType!=Entry::GROUPDOC_NORMAL && additional)) { GroupDef *gd; - if ((gd=Doxygen::groupSDict[root->name])) + if ((gd=Doxygen::groupSDict->find(root->name))) { //printf("adding %s to group %s\n",root->name.data(),gd->name().data()); addGroupToGroups(root,gd); @@ -640,7 +655,7 @@ static void buildFileList(EntryNav *rootNav) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { gd->addFile(fd); //printf("File %s: in group %s\n",fd->name().data(),s->data()); @@ -828,7 +843,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name,int level) QCString nsName = name.mid(idx,l); if (!fullScope.isEmpty()) fullScope+="::"; fullScope+=nsName; - NamespaceDef *nd=Doxygen::namespaceSDict.find(fullScope); + NamespaceDef *nd=Doxygen::namespaceSDict->find(fullScope); Definition *innerScope = nd; ClassDef *cd=0; if (nd==0) cd = getClass(fullScope); @@ -844,7 +859,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name,int level) "[generated]",1,fullScope); // add namespace to the list - Doxygen::namespaceSDict.inSort(fullScope,nd); + Doxygen::namespaceSDict->inSort(fullScope,nd); innerScope = nd; } else // scope is a namespace @@ -949,7 +964,7 @@ ArgumentList *getTemplateArgumentsFromName( int i,p=0; while ((i=name.find("::",p))!=-1) { - NamespaceDef *nd = Doxygen::namespaceSDict[name.left(i)]; + NamespaceDef *nd = Doxygen::namespaceSDict->find(name.left(i)); if (nd==0) { ClassDef *cd = getClass(name.left(i)); @@ -1024,7 +1039,7 @@ static void addClassToContext(EntryNav *rootNav) QCString qualifiedName = scName.isEmpty() ? fullName : scName+"::"+fullName; ClassDef *cd = getClass(qualifiedName); - + Debug::print(Debug::Classes,0, " Found class with name %s (qualifiedName=%s -> cd=%p)\n", cd ? cd->name().data() : root->name.data(), qualifiedName.data(),cd); @@ -1137,7 +1152,7 @@ static void addClassToContext(EntryNav *rootNav) // add class to the list //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data()); - Doxygen::classSDict.append(fullName,cd); + Doxygen::classSDict->append(fullName,cd); } @@ -1191,7 +1206,7 @@ static void buildClassDocList(EntryNav *rootNav) static void resolveClassNestingRelations() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; int nestingLevel=0; @@ -1200,13 +1215,60 @@ static void resolveClassNestingRelations() { // iterate over all classes searching for a class with right nesting // level (starting with 0 and going up until no more classes are found) + // + // we start with all classes that are inside a namespace and then + // do the ones outside the namespace to avoid an "internal inconsistency" for the + // following: + // File A: + // using namespace N; + // class C::P {} + // File B: + // namespace N { class C { class P {}; }; } + // + // If file A is parsed before file B then without it C::P would not be related to N. done=TRUE; - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; + // first handle any class inside a namespace + for (cli.toFirst();(cd=cli.current());++cli) + { + QCString c,n; + extractNamespaceName(cd->name(),c,n,TRUE); + if (cd->name().contains("::")==nestingLevel && !n.isEmpty()) + { + cd->visited=TRUE; + //printf("Level=%d processing=%s\n",nestingLevel,cd->name().data()); + // also add class to the correct structural context + Definition *d = findScopeFromQualifiedName(Doxygen::globalScope, + cd->name(),cd->getFileDef()); + if (d==0) // we didn't find anything, create the scope artificially + // anyway, so we can at least relate scopes properly. + { + Definition *d = buildScopeFromQualifiedName(cd->name(),cd->name().contains("::")); + if (d!=cd) // avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; } + // for this case doxygen assumes the exitance of a namespace N::N in which C is to be found! + { + d->addInnerCompound(cd); + cd->setOuterScope(d); + warn(cd->getDefFileName(),cd->getDefLine(), + "Warning: Internal inconsistency: scope for class %s not " + "found!\n",cd->name().data() + ); + } + } + else + { + //printf("****** adding %s to scope %s\n",cd->name().data(),d->name().data()); + d->addInnerCompound(cd); + cd->setOuterScope(d); + } + } + if (!cd->visited) done=FALSE; + } + // and now the same for classes outside any namespace for (cli.toFirst();(cd=cli.current());++cli) { - //printf("nested relation for class %s\n",cd->name().data()); - if (cd->name().contains("::")==nestingLevel) + if (cd->name().contains("::")==nestingLevel && !cd->visited) { cd->visited=TRUE; //printf("Level=%d processing=%s\n",nestingLevel,cd->name().data()); @@ -1271,7 +1333,7 @@ static void buildNamespaceList(EntryNav *rootNav) //printf("Found namespace %s in %s at line %d\n",root->name.data(), // root->fileName.data(), root->startLine); NamespaceDef *nd; - if ((nd=Doxygen::namespaceSDict[fullName])) // existing namespace + if ((nd=Doxygen::namespaceSDict->find(fullName))) // existing namespace { if (!root->doc.isEmpty() || !root->brief.isEmpty()) // block contains docs { @@ -1341,7 +1403,7 @@ static void buildNamespaceList(EntryNav *rootNav) nd->setBodySegment(root->bodyLine,root->endBodyLine); nd->setBodyDef(fd); // add class to the list - Doxygen::namespaceSDict.inSort(fullName,nd); + Doxygen::namespaceSDict->inSort(fullName,nd); // also add namespace to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName); @@ -1409,7 +1471,7 @@ static void findUsingDirectives(EntryNav *rootNav) // see if the using statement was found inside a namespace or inside // the global file scope. if (rootNav->parent() && rootNav->parent()->section()==Entry::NAMESPACE_SEC && - (fd==0 || fd->name().right(5)!=".java") // not a .java file + (fd==0 || !fd->isJava()) // not a .java file ) { nsName=stripAnonymousNamespaceScope(rootNav->parent()->name()); @@ -1497,7 +1559,7 @@ static void findUsingDirectives(EntryNav *rootNav) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) gd->addNamespace(nd); } @@ -1512,7 +1574,7 @@ static void findUsingDirectives(EntryNav *rootNav) nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->insertUsedFile(root->fileName); // add class to the list - Doxygen::namespaceSDict.inSort(name,nd); + Doxygen::namespaceSDict->inSort(name,nd); nd->setRefItems(root->sli); } } @@ -1591,7 +1653,7 @@ static void findUsingDeclarations(EntryNav *rootNav) usingCd = getClass(name); if (usingCd==0) { - usingCd = Doxygen::hiddenClasses.find(name); + usingCd = Doxygen::hiddenClasses->find(name); } //printf("%s -> %p\n",root->name.data(),usingCd); @@ -1602,7 +1664,7 @@ static void findUsingDeclarations(EntryNav *rootNav) usingCd = new ClassDef( "<using>",1, name,ClassDef::Class); - Doxygen::hiddenClasses.append(root->name,usingCd); + Doxygen::hiddenClasses->append(root->name,usingCd); usingCd->setClassIsArtificial(); } else @@ -1692,15 +1754,20 @@ static void findUsingDeclImports(EntryNav *rootNav) Entry *root = rootNav->entry(); //printf("found member %s\n",mni->memberName()); - MemberDef *newMd = new MemberDef( + MemberDef *newMd = 0; + { + LockingPtr<ArgumentList> templAl = md->templateArguments(); + LockingPtr<ArgumentList> al = md->templateArguments(); + newMd = new MemberDef( root->fileName,root->startLine, md->typeString(),memName,md->argsString(), md->excpString(),root->protection,root->virt, md->isStatic(),FALSE,md->memberType(), - md->templateArguments(),md->argumentList() + templAl.pointer(),al.pointer() ); - cd->insertMember(newMd); + } newMd->setMemberClass(cd); + cd->insertMember(newMd); if (!root->doc.isEmpty() || !root->brief.isEmpty()) { newMd->setDocumentation(root->doc,root->docFile,root->docLine); @@ -1743,7 +1810,7 @@ static void findUsingDeclImports(EntryNav *rootNav) static void findIncludedUsingDirectives() { // first mark all files as not visited - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -1832,7 +1899,7 @@ static MemberDef *addVariableToClass( // see if the member is already found in the same scope // (this may be the case for a static member that is initialized // outside the class) - MemberName *mn=Doxygen::memberNameSDict[name]; + MemberName *mn=Doxygen::memberNameSDict->find(name); if (mn) { MemberNameIterator mni(*mn); @@ -1897,7 +1964,7 @@ static MemberDef *addVariableToClass( //printf("Adding memberName=%s\n",mn->memberName()); //Doxygen::memberNameDict.insert(name,mn); //Doxygen::memberNameList.append(mn); - Doxygen::memberNameSDict.append(name,mn); + Doxygen::memberNameSDict->append(name,mn); // add the member to the class } cd->insertMember(md); @@ -1982,7 +2049,7 @@ static MemberDef *addVariableToFile( } def.stripPrefix("static "); - MemberName *mn=Doxygen::functionNameSDict[name]; + MemberName *mn=Doxygen::functionNameSDict->find(name); if (mn) { //QCString nscope=removeAnonymousScopes(scope); @@ -2055,16 +2122,16 @@ static MemberDef *addVariableToFile( md->setRefItems(root->sli); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { - nd->insertMember(md); md->setNamespace(nd); + nd->insertMember(md); } // add member to the file (we do this even if we have already inserted // it into the namespace. if (fd) { - fd->insertMember(md); md->setFileDef(fd); + fd->insertMember(md); } // add member definition to the list of globals @@ -2076,7 +2143,7 @@ static MemberDef *addVariableToFile( { mn = new MemberName(name); mn->append(md); - Doxygen::functionNameSDict.append(name,mn); + Doxygen::functionNameSDict->append(name,mn); } rootNav->changeSection(Entry::EMPTY_SEC); return md; @@ -2143,7 +2210,7 @@ static bool isVarWithConstructor(EntryNav *rootNav) } if (!rootNav->parent()->name().isEmpty()) { - ctx=Doxygen::namespaceSDict.find(rootNav->parent()->name()); + ctx=Doxygen::namespaceSDict->find(rootNav->parent()->name()); } type = root->type; // remove qualifiers @@ -2601,7 +2668,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, // add member to the global list of all members //printf("Adding member=%s class=%s\n",md->name().data(),cd->name().data()); MemberName *mn; - if ((mn=Doxygen::memberNameSDict[name])) + if ((mn=Doxygen::memberNameSDict->find(name))) { mn->append(md); } @@ -2609,7 +2676,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, { mn = new MemberName(name); mn->append(md); - Doxygen::memberNameSDict.append(name,mn); + Doxygen::memberNameSDict->append(name,mn); } // add member to the class cd @@ -2684,7 +2751,7 @@ static void buildFunctionList(EntryNav *rootNav) int te=rname.find('>'); if (memIndex>0 && (ts==-1 || te==-1)) { - nd = Doxygen::namespaceSDict.find(rname.left(memIndex)); + nd = Doxygen::namespaceSDict->find(rname.left(memIndex)); isMember = nd==0; if (nd) { @@ -2729,7 +2796,7 @@ static void buildFunctionList(EntryNav *rootNav) bool found=FALSE; MemberName *mn; MemberDef *md=0; - if ((mn=Doxygen::functionNameSDict[rname])) + if ((mn=Doxygen::functionNameSDict->find(rname))) { Debug::print(Debug::Functions,0," --> function %s already found!\n",rname.data()); MemberNameIterator mni(*mn); @@ -2747,8 +2814,9 @@ static void buildFunctionList(EntryNav *rootNav) if (rnd) rnsName = rnd->name().copy(); //printf("matching arguments for %s%s %s%s\n", // md->name().data(),md->argsString(),rname.data(),argListToString(root->argList).data()); + LockingPtr<ArgumentList> mdAl = md->argumentList(); if ( - matchArguments2(md->getOuterScope(),mfd,md->argumentList(), + matchArguments2(md->getOuterScope(),mfd,mdAl.pointer(), rnd ? rnd : Doxygen::globalScope,rfd,root->argList, FALSE) ) @@ -2756,7 +2824,7 @@ static void buildFunctionList(EntryNav *rootNav) GroupDef *gd=0; if (root->groups->first()!=0) { - gd = Doxygen::groupSDict[root->groups->first()->groupname.data()]; + gd = Doxygen::groupSDict->find(root->groups->first()->groupname.data()); } //printf("match!\n"); // see if we need to create a new member @@ -2778,7 +2846,7 @@ static void buildFunctionList(EntryNav *rootNav) if (found) { // merge argument lists - mergeArguments(md->argumentList(),root->argList,!root->doc.isEmpty()); + mergeArguments(mdAl.pointer(),root->argList,!root->doc.isEmpty()); // merge documentation if (md->documentation().isEmpty() && !root->doc.isEmpty()) { @@ -2936,21 +3004,21 @@ static void buildFunctionList(EntryNav *rootNav) if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { // add member to namespace - nd->insertMember(md); md->setNamespace(nd); + nd->insertMember(md); } if (fd) { // add member to the file (we do this even if we have already // inserted it into the namespace) - fd->insertMember(md); md->setFileDef(fd); + fd->insertMember(md); } // add member to the list of file members //printf("Adding member=%s\n",md->name().data()); MemberName *mn; - if ((mn=Doxygen::functionNameSDict[name])) + if ((mn=Doxygen::functionNameSDict->find(name))) { mn->append(md); } @@ -2958,7 +3026,7 @@ static void buildFunctionList(EntryNav *rootNav) { mn = new MemberName(name); mn->append(md); - Doxygen::functionNameSDict.append(name,mn); + Doxygen::functionNameSDict->append(name,mn); } addMemberToGroups(root,md); if (!root->relatesDup) // if this is a relatesalso command, allow find @@ -3001,13 +3069,13 @@ static void buildFunctionList(EntryNav *rootNav) static void findFriends() { //printf("findFriends()\n"); - MemberNameSDict::Iterator fnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); MemberName *fn; for (;(fn=fnli.current());++fnli) // for each global function name { //printf("Function name=`%s'\n",fn->memberName()); MemberName *mn; - if ((mn=Doxygen::memberNameSDict[fn->memberName()])) + if ((mn=Doxygen::memberNameSDict->find(fn->memberName()))) { // there are members with the same name //printf("Function name is also a member name\n"); MemberNameIterator fni(*fn); @@ -3021,16 +3089,18 @@ static void findFriends() //printf("Checking for matching arguments // mmd->isRelated()=%d mmd->isFriend()=%d mmd->isFunction()=%d\n", // mmd->isRelated(),mmd->isFriend(),mmd->isFunction()); + LockingPtr<ArgumentList> mmdAl = mmd->argumentList(); + LockingPtr<ArgumentList> fmdAl = fmd->argumentList(); if ((mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) && - matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), mmd->argumentList(), - fmd->getOuterScope(), fmd->getFileDef(), fmd->argumentList(), + matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), mmdAl.pointer(), + fmd->getOuterScope(), fmd->getFileDef(), fmdAl.pointer(), TRUE ) ) // if the member is related and the arguments match then the // function is actually a friend. { - mergeArguments(mmd->argumentList(),fmd->argumentList()); + mergeArguments(mmdAl.pointer(),fmdAl.pointer()); if (!fmd->documentation().isEmpty()) { mmd->setDocumentation(fmd->documentation(),fmd->docFile(),fmd->docLine()); @@ -3115,7 +3185,7 @@ static void transferFunctionDocumentation() //printf("transferFunctionDocumentation()\n"); // find matching function declaration and definitions. - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn; for (;(mn=mnli.current());++mnli) { @@ -3140,9 +3210,11 @@ static void transferFunctionDocumentation() //printf("mdef=(%p,%s) mdec=(%p,%s)\n", // mdef, mdef ? mdef->name().data() : "", // mdec, mdec ? mdec->name().data() : ""); - if (mdef && mdec && - matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdef->argumentList(), - mdec->getOuterScope(),mdec->getFileDef(),mdec->argumentList(), + + LockingPtr<ArgumentList> mdefAl = mdef->argumentList(); + LockingPtr<ArgumentList> mdecAl = mdec->argumentList(); + if (matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdefAl.pointer(), + mdec->getOuterScope(),mdec->getFileDef(),mdecAl.pointer(), TRUE ) ) /* match found */ @@ -3154,7 +3226,7 @@ static void transferFunctionDocumentation() // ); // first merge argument documentation - transferArgumentDocumentation(mdec->argumentList(),mdef->argumentList()); + transferArgumentDocumentation(mdecAl.pointer(),mdefAl.pointer()); /* copy documentation between function definition and declaration */ if (!mdec->briefDescription().isEmpty()) @@ -3170,12 +3242,12 @@ static void transferFunctionDocumentation() //printf("transfering docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString()); mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine()); mdec->setDocsForDefinition(mdef->isDocsForDefinition()); - if (mdef->argumentList()) + if (mdefAl!=0) { - ArgumentList *mdefAl = new ArgumentList; - stringToArgumentList(mdef->argsString(),mdefAl); - transferArgumentDocumentation(mdef->argumentList(),mdefAl); - mdec->setArgumentList(mdefAl); + ArgumentList *mdefAlComb = new ArgumentList; + stringToArgumentList(mdef->argsString(),mdefAlComb); + transferArgumentDocumentation(mdefAl.pointer(),mdefAlComb); + mdec->setArgumentList(mdefAlComb); } } else if (!mdec->documentation().isEmpty()) @@ -3183,12 +3255,12 @@ static void transferFunctionDocumentation() //printf("transfering docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString()); mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine()); mdef->setDocsForDefinition(mdec->isDocsForDefinition()); - if (mdec->argumentList()) + if (mdecAl!=0) { - ArgumentList *mdecAl = new ArgumentList; - stringToArgumentList(mdec->argsString(),mdecAl); - transferArgumentDocumentation(mdec->argumentList(),mdecAl); - mdef->setDeclArgumentList(mdecAl); + ArgumentList *mdecAlComb = new ArgumentList; + stringToArgumentList(mdec->argsString(),mdecAlComb); + transferArgumentDocumentation(mdecAl.pointer(),mdecAlComb); + mdef->setDeclArgumentList(mdecAlComb); } } if (!mdef->inbodyDocumentation().isEmpty()) @@ -3261,7 +3333,7 @@ static void transferFunctionDocumentation() static void transferFunctionReferences() { - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn; for (;(mn=mnli.current());++mnli) { @@ -3280,63 +3352,68 @@ static void transferFunctionReferences() else if (md->isVariable() && !md->isExternal() && !md->isStatic()) mdef=md; } - if (mdef && mdec && - matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdef->argumentList(), - mdec->getOuterScope(),mdec->getFileDef(),mdec->argumentList(), - TRUE - ) - ) /* match found */ + if (mdef && mdec) { - MemberSDict *defDict = mdef->getReferencesMembers(); - MemberSDict *decDict = mdec->getReferencesMembers(); - if (defDict) - { - MemberSDict::Iterator msdi(*defDict); - MemberDef *rmd; - for (msdi.toFirst();(rmd=msdi.current());++msdi) + LockingPtr<ArgumentList> mdefAl = mdef->argumentList(); + LockingPtr<ArgumentList> mdecAl = mdec->argumentList(); + if ( + matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdefAl.pointer(), + mdec->getOuterScope(),mdec->getFileDef(),mdecAl.pointer(), + TRUE + ) + ) /* match found */ + { + LockingPtr<MemberSDict> defDict = mdef->getReferencesMembers(); + LockingPtr<MemberSDict> decDict = mdec->getReferencesMembers(); + if (defDict!=0) { - if (decDict==0 || decDict->find(rmd->name())==0) + MemberSDict::Iterator msdi(*defDict); + MemberDef *rmd; + for (msdi.toFirst();(rmd=msdi.current());++msdi) { - mdec->addSourceReferences(rmd); + if (decDict==0 || decDict->find(rmd->name())==0) + { + mdec->addSourceReferences(rmd); + } } } - } - if (decDict) - { - MemberSDict::Iterator msdi(*decDict); - MemberDef *rmd; - for (msdi.toFirst();(rmd=msdi.current());++msdi) + if (decDict!=0) { - if (defDict==0 || defDict->find(rmd->name())==0) + MemberSDict::Iterator msdi(*decDict); + MemberDef *rmd; + for (msdi.toFirst();(rmd=msdi.current());++msdi) { - mdef->addSourceReferences(rmd); + if (defDict==0 || defDict->find(rmd->name())==0) + { + mdef->addSourceReferences(rmd); + } } } - } - defDict = mdef->getReferencedByMembers(); - decDict = mdec->getReferencedByMembers(); - if (defDict) - { - MemberSDict::Iterator msdi(*defDict); - MemberDef *rmd; - for (msdi.toFirst();(rmd=msdi.current());++msdi) + defDict = mdef->getReferencedByMembers(); + decDict = mdec->getReferencedByMembers(); + if (defDict!=0) { - if (decDict==0 || decDict->find(rmd->name())==0) + MemberSDict::Iterator msdi(*defDict); + MemberDef *rmd; + for (msdi.toFirst();(rmd=msdi.current());++msdi) { - mdec->addSourceReferencedBy(rmd); + if (decDict==0 || decDict->find(rmd->name())==0) + { + mdec->addSourceReferencedBy(rmd); + } } } - } - if (decDict) - { - MemberSDict::Iterator msdi(*decDict); - MemberDef *rmd; - for (msdi.toFirst();(rmd=msdi.current());++msdi) + if (decDict!=0) { - if (defDict==0 || defDict->find(rmd->name())==0) + MemberSDict::Iterator msdi(*decDict); + MemberDef *rmd; + for (msdi.toFirst();(rmd=msdi.current());++msdi) { - mdef->addSourceReferencedBy(rmd); + if (defDict==0 || defDict->find(rmd->name())==0) + { + mdef->addSourceReferencedBy(rmd); + } } } } @@ -3350,7 +3427,7 @@ static void transferRelatedFunctionDocumentation() { // find match between function declaration and definition for // related functions - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -3361,17 +3438,19 @@ static void transferRelatedFunctionDocumentation() { //printf(" Function `%s'\n",md->name().data()); MemberName *rmn; - if ((rmn=Doxygen::memberNameSDict[md->name()])) // check if there is a member with the same name + if ((rmn=Doxygen::memberNameSDict->find(md->name()))) // check if there is a member with the same name { //printf(" Member name found\n"); MemberDef *rmd; MemberNameIterator rmni(*rmn); for (rmni.toFirst();(rmd=rmni.current());++rmni) // for each member with the same name { + LockingPtr<ArgumentList> mdAl = md->argumentList(); + LockingPtr<ArgumentList> rmdAl = rmd->argumentList(); //printf(" Member found: related=`%d'\n",rmd->isRelated()); if (rmd->isRelated() && // related function - matchArguments2( md->getOuterScope(), md->getFileDef(), md->argumentList(), - rmd->getOuterScope(),rmd->getFileDef(),rmd->argumentList(), + matchArguments2( md->getOuterScope(), md->getFileDef(), mdAl.pointer(), + rmd->getOuterScope(),rmd->getFileDef(),rmdAl.pointer(), TRUE ) ) @@ -3555,7 +3634,7 @@ static void findUsedClassesForClass(EntryNav *rootNav, found=TRUE; Debug::print(Debug::Classes,0," New used class `%s'\n", usedName.data()); - ClassDef *usedCd = Doxygen::hiddenClasses.find(usedName); + ClassDef *usedCd = Doxygen::hiddenClasses->find(usedName); if (usedCd==0) { usedCd = new ClassDef( @@ -3563,7 +3642,7 @@ static void findUsedClassesForClass(EntryNav *rootNav, usedName,ClassDef::Class); //printf("making %s a template argument!!!\n",usedCd->name().data()); usedCd->makeTemplateArgument(); - Doxygen::hiddenClasses.append(usedName,usedCd); + Doxygen::hiddenClasses->append(usedName,usedCd); } if (usedCd) { @@ -3598,7 +3677,7 @@ static void findUsedClassesForClass(EntryNav *rootNav, } if (!found && !type.isEmpty()) // used class is not documented in any scope { - ClassDef *usedCd = Doxygen::hiddenClasses.find(type); + ClassDef *usedCd = Doxygen::hiddenClasses->find(type); if (usedCd==0 && !Config_getBool("HIDE_UNDOC_RELATIONS")) { if (type.right(2)=="(*") // type is a function pointer @@ -3609,7 +3688,7 @@ static void findUsedClassesForClass(EntryNav *rootNav, usedCd = new ClassDef( masterCd->getDefFileName(),masterCd->getDefLine(), type,ClassDef::Class); - Doxygen::hiddenClasses.append(type,usedCd); + Doxygen::hiddenClasses->append(type,usedCd); } if (usedCd) { @@ -3719,7 +3798,7 @@ static bool findTemplateInstanceRelation(Entry *root, if (freshInstance) { Debug::print(Debug::Classes,0," found fresh instance '%s'!\n",instanceClass->name().data()); - Doxygen::classSDict.append(instanceClass->name(),instanceClass); + Doxygen::classSDict->append(instanceClass->name(),instanceClass); instanceClass->setTemplateBaseClassNames(templateNames); // search for new template instances caused by base classes of @@ -4037,23 +4116,23 @@ static bool findClassRelation( baseClass=0; if (isATemplateArgument) { - baseClass=Doxygen::hiddenClasses.find(baseClassName); + baseClass=Doxygen::hiddenClasses->find(baseClassName); if (baseClass==0) { baseClass=new ClassDef(root->fileName,root->startLine, baseClassName,ClassDef::Class); - Doxygen::hiddenClasses.append(baseClassName,baseClass); + Doxygen::hiddenClasses->append(baseClassName,baseClass); if (isArtificial) baseClass->setClassIsArtificial(); } } else { - baseClass=Doxygen::classSDict.find(baseClassName); + baseClass=Doxygen::classSDict->find(baseClassName); if (baseClass==0) { baseClass=new ClassDef(root->fileName,root->startLine, baseClassName,ClassDef::Class); - Doxygen::classSDict.append(baseClassName,baseClass); + Doxygen::classSDict->append(baseClassName,baseClass); if (isArtificial) baseClass->setClassIsArtificial(); } } @@ -4153,7 +4232,7 @@ static void findClassEntries(EntryNav *rootNav) */ static void findInheritedTemplateInstances() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; QDictIterator<EntryNav> edi(classEntries); EntryNav *rootNav; @@ -4176,7 +4255,7 @@ static void findInheritedTemplateInstances() static void findUsedTemplateInstances() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; QDictIterator<EntryNav> edi(classEntries); EntryNav *rootNav; @@ -4198,7 +4277,7 @@ static void findUsedTemplateInstances() static void computeClassRelations() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; QDictIterator<EntryNav> edi(classEntries); EntryNav *rootNav; @@ -4321,13 +4400,13 @@ static void computeTemplateClassRelations() static void computeMemberReferences() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) { cd->computeAnchors(); } - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -4336,15 +4415,15 @@ static void computeMemberReferences() fd->computeAnchors(); fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; for (nli.toFirst();(nd=nli.current());++nli) { nd->computeAnchors(); } - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -4356,7 +4435,7 @@ static void computeMemberReferences() static void addListReferences() { - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -4367,7 +4446,7 @@ static void addListReferences() md->visited=FALSE; } } - MemberNameSDict::Iterator fnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); for (fnli.toFirst();(mn=fnli.current());++fnli) { MemberNameIterator mni(*mn); @@ -4378,13 +4457,13 @@ static void addListReferences() } } - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) { cd->addListReferences(); } - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -4393,15 +4472,15 @@ static void addListReferences() fd->addListReferences(); fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; for (nli.toFirst();(nd=nli.current());++nli) { nd->addListReferences(); } - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -4416,9 +4495,12 @@ static void addListReferences() { name = pd->getGroupDef()->getOutputFileBase().copy(); } - addRefItem(pd->xrefListItems(), - theTranslator->trPage(TRUE,TRUE), - name,pd->title()); + { + LockingPtr< QList<ListItemInfo> > xrefItems = pd->xrefListItems(); + addRefItem(xrefItems.pointer(), + theTranslator->trPage(TRUE,TRUE), + name,pd->title()); + } } } @@ -4458,22 +4540,23 @@ static void addMemberDocs(EntryNav *rootNav, // TODO determine scope based on root not md Definition *rscope = md->getOuterScope(); + LockingPtr<ArgumentList> mdAl = md->argumentList(); if (al) { //printf("merging arguments (1) docs=%d\n",root->doc.isEmpty()); - mergeArguments(md->argumentList(),al,!root->doc.isEmpty()); + mergeArguments(mdAl.pointer(),al,!root->doc.isEmpty()); } else { if ( - matchArguments2( md->getOuterScope(), md->getFileDef(), md->argumentList(), + matchArguments2( md->getOuterScope(), md->getFileDef(), mdAl.pointer(), rscope,rfd,root->argList, TRUE ) ) { //printf("merging arguments (2)\n"); - mergeArguments(md->argumentList(),root->argList,!root->doc.isEmpty()); + mergeArguments(mdAl.pointer(),root->argList,!root->doc.isEmpty()); } } if (over_load) // the \overload keyword was used @@ -4614,10 +4697,10 @@ static bool findGlobalMember(EntryNav *rootNav, QCString n=name; if (n.isEmpty()) return FALSE; if (n.find("::")!=-1) return FALSE; // skip undefined class members - MemberName *mn=Doxygen::functionNameSDict[n+tempArg]; // look in function dictionary + MemberName *mn=Doxygen::functionNameSDict->find(n+tempArg); // look in function dictionary if (mn==0) { - mn=Doxygen::functionNameSDict[n]; // try without template arguments + mn=Doxygen::functionNameSDict->find(n); // try without template arguments } if (mn) // function name defined { @@ -4653,12 +4736,13 @@ static bool findGlobalMember(EntryNav *rootNav, QCString nsName = nd ? nd->name().data() : ""; NamespaceDef *rnd = 0; - if (!namespaceName.isEmpty()) rnd = Doxygen::namespaceSDict[namespaceName]; + if (!namespaceName.isEmpty()) rnd = Doxygen::namespaceSDict->find(namespaceName); + LockingPtr<ArgumentList> mdAl = md->argumentList(); bool matching= - (md->argumentList()==0 && root->argList->count()==0) || + (mdAl==0 && root->argList->count()==0) || md->isVariable() || md->isTypedef() || /* in case of function pointers */ - matchArguments2(md->getOuterScope(),md->getFileDef(),md->argumentList(), + matchArguments2(md->getOuterScope(),md->getFileDef(),mdAl.pointer(), rnd ? rnd : Doxygen::globalScope,fd,root->argList, FALSE); @@ -4967,7 +5051,7 @@ static void findMember(EntryNav *rootNav, { QCString joinedName = rootNav->parent()->name()+"::"+scopeName; if (!scopeName.isEmpty() && - (getClass(joinedName) || Doxygen::namespaceSDict[joinedName])) + (getClass(joinedName) || Doxygen::namespaceSDict->find(joinedName))) { scopeName = joinedName; } @@ -4990,7 +5074,7 @@ static void findMember(EntryNav *rootNav, for (nsdi.toFirst();(fnd=nsdi.current());++nsdi) { joinedName = fnd->name()+"::"+scopeName; - if (Doxygen::namespaceSDict[joinedName]) + if (Doxygen::namespaceSDict->find(joinedName)) { scopeName=joinedName; break; @@ -5151,11 +5235,11 @@ static void findMember(EntryNav *rootNav, } if (!funcTempList.isEmpty()) // try with member specialization { - mn=Doxygen::memberNameSDict[funcName+funcTempList]; + mn=Doxygen::memberNameSDict->find(funcName+funcTempList); } if (mn==0) // try without specialization { - mn=Doxygen::memberNameSDict[funcName]; + mn=Doxygen::memberNameSDict->find(funcName); } if (!isRelated && mn) // function name already found { @@ -5200,9 +5284,10 @@ static void findMember(EntryNav *rootNav, // get the template parameter lists found at the member declaration QList<ArgumentList> declTemplArgs; cd->getTemplateParameterLists(declTemplArgs); - if (md->templateArguments()) + LockingPtr<ArgumentList> templAl = md->templateArguments(); + if (templAl!=0) { - declTemplArgs.append(md->templateArguments()); + declTemplArgs.append(templAl.pointer()); } // get the template parameter lists found at the member definition @@ -5216,9 +5301,10 @@ static void findMember(EntryNav *rootNav, /* substitute the occurrences of class template names in the * argument list before matching */ + LockingPtr<ArgumentList> mdAl = md->argumentList(); if (declTemplArgs.count()>0 && defTemplArgs && declTemplArgs.count()==defTemplArgs->count() && - md->argumentList() + mdAl.pointer() ) { /* the function definition has template arguments @@ -5228,13 +5314,13 @@ static void findMember(EntryNav *rootNav, */ argList = new ArgumentList; substituteTemplatesInArgList(declTemplArgs,*defTemplArgs, - md->argumentList(),argList); + mdAl.pointer(),argList); substDone=TRUE; } else /* no template arguments, compare argument lists directly */ { - argList = md->argumentList(); + argList = mdAl.pointer(); } Debug::print(Debug::FindMembers,0, @@ -5245,7 +5331,7 @@ static void findMember(EntryNav *rootNav, bool matching= md->isVariable() || md->isTypedef() || // needed for function pointers - (md->argumentList()==0 && root->argList->count()==0) || + (mdAl.pointer()==0 && root->argList->count()==0) || matchArguments2( md->getClassDef(),md->getFileDef(),argList, cd,fd,root->argList, @@ -5303,8 +5389,9 @@ static void findMember(EntryNav *rootNav, //printf("cd->name()==%s className=%s\n",cd->name().data(),className.data()); if (cd!=0 && rightScopeMatch(cd->name(),className)) { - if (root->tArgLists && md->templateArguments() && - root->tArgLists->getLast()->count()<=md->templateArguments()->count()) + LockingPtr<ArgumentList> templAl = md->templateArguments(); + if (root->tArgLists && templAl!=0 && + root->tArgLists->getLast()->count()<=templAl->count()) { addMethodToClass(rootNav,cd,md->name(),isFriend); return; @@ -5340,9 +5427,10 @@ static void findMember(EntryNav *rootNav, ClassDef *cd=md->getClassDef(); if (cd!=0 && rightScopeMatch(cd->name(),className)) { - if (md->templateArguments()) + LockingPtr<ArgumentList> templAl = md->templateArguments(); + if (templAl!=0) { - warn_cont(" template %s\n",tempArgListToString(md->templateArguments()).data()); + warn_cont(" template %s\n",tempArgListToString(templAl.pointer()).data()); } warn_cont(" "); if (md->typeString()) @@ -5481,7 +5569,7 @@ static void findMember(EntryNav *rootNav, bool newMemberName=FALSE; bool isDefine=FALSE; { - MemberName *mn = Doxygen::functionNameSDict[funcName]; + MemberName *mn = Doxygen::functionNameSDict->find(funcName); if (mn) { MemberDef *md = mn->first(); @@ -5495,7 +5583,7 @@ static void findMember(EntryNav *rootNav, FileDef *fd=rootNav->fileDef(); - if ((mn=Doxygen::memberNameSDict[funcName])==0) + if ((mn=Doxygen::memberNameSDict->find(funcName))==0) { mn=new MemberName(funcName); newMemberName=TRUE; // we create a new member name @@ -5505,9 +5593,10 @@ static void findMember(EntryNav *rootNav, MemberDef *rmd=mn->first(); while (rmd && newMember) // see if we got another member with matching arguments { + LockingPtr<ArgumentList> rmdAl = rmd->argumentList(); newMember=newMember && - !matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmd->argumentList(), + !matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmdAl.pointer(), cd,fd,root->argList, TRUE); if (newMember) rmd=mn->next(); @@ -5554,15 +5643,16 @@ static void findMember(EntryNav *rootNav, bool found=FALSE; if (root->bodyLine==-1) { - MemberName *rmn=Doxygen::functionNameSDict[funcName]; + MemberName *rmn=Doxygen::functionNameSDict->find(funcName); if (rmn) { MemberDef *rmd=rmn->first(); while (rmd && !found) // see if we got another member with matching arguments { + LockingPtr<ArgumentList> rmdAl = rmd->argumentList(); // check for matching argument lists if ( - matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmd->argumentList(), + matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmdAl.pointer(), cd,fd,root->argList, TRUE) ) @@ -5614,7 +5704,7 @@ static void findMember(EntryNav *rootNav, { //Doxygen::memberNameList.append(mn); //Doxygen::memberNameDict.insert(funcName,mn); - Doxygen::memberNameSDict.append(funcName,mn); + Doxygen::memberNameSDict->append(funcName,mn); } } if (root->relatesDup) @@ -5672,7 +5762,7 @@ localObjCMethod: cd->insertMember(md); cd->insertUsedFile(root->fileName); md->setRefItems(root->sli); - if ((mn=Doxygen::memberNameSDict[root->name])) + if ((mn=Doxygen::memberNameSDict->find(root->name))) { mn->append(md); } @@ -5680,7 +5770,7 @@ localObjCMethod: { mn = new MemberName(root->name); mn->append(md); - Doxygen::memberNameSDict.append(root->name,mn); + Doxygen::memberNameSDict->append(root->name,mn); } } else @@ -5953,18 +6043,18 @@ static void findEnums(EntryNav *rootNav) { //printf("Enum `%s'::`%s'\n",cd->name(),name.data()); fd=0; - mnsd=&Doxygen::memberNameSDict; + mnsd=Doxygen::memberNameSDict; isGlobal=FALSE; } else if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') // found enum inside namespace { - mnsd=&Doxygen::functionNameSDict; + mnsd=Doxygen::functionNameSDict; isGlobal=TRUE; } else // found a global enum { fd=rootNav->fileDef(); - mnsd=&Doxygen::functionNameSDict; + mnsd=Doxygen::functionNameSDict; isGlobal=TRUE; } @@ -6001,8 +6091,8 @@ static void findEnums(EntryNav *rootNav) } //printf("definition=%s\n",md->definition()); defSet=TRUE; - nd->insertMember(md); md->setNamespace(nd); + nd->insertMember(md); } // even if we have already added the enum to a namespace, we still @@ -6017,8 +6107,8 @@ static void findEnums(EntryNav *rootNav) } if (fd) { - fd->insertMember(md); md->setFileDef(fd); + fd->insertMember(md); } } else if (cd) @@ -6064,7 +6154,7 @@ static void findEnums(EntryNav *rootNav) { //printf("e->name=%s isRelated=%d\n",e->name.data(),isRelated); MemberName *fmn=0; - MemberNameSDict *emnsd = isRelated ? &Doxygen::functionNameSDict : mnsd; + MemberNameSDict *emnsd = isRelated ? Doxygen::functionNameSDict : mnsd; if (!e->name().isEmpty() && (fmn=(*emnsd)[e->name()])) // get list of members with the same name as the field { @@ -6173,7 +6263,7 @@ static void findEnumDocumentation(EntryNav *rootNav) { //printf("Enum: scope=`%s' name=`%s'\n",cd->name(),name.data()); QCString className=cd->name().copy(); - MemberName *mn=Doxygen::memberNameSDict[name]; + MemberName *mn=Doxygen::memberNameSDict->find(name); if (mn) { MemberNameIterator mni(*mn); @@ -6227,7 +6317,7 @@ static void findEnumDocumentation(EntryNav *rootNav) else // enum outside class { //printf("Enum outside class: %s grpId=%d\n",name.data(),root->mGrpId); - MemberName *mn=Doxygen::functionNameSDict[name]; + MemberName *mn=Doxygen::functionNameSDict->find(name); if (mn) { MemberNameIterator mni(*mn); @@ -6284,9 +6374,9 @@ static void findDEV(const MemberNameSDict &mnsd) { if (md->isEnumerate()) // member is an enum { - MemberList *fmdl = md->enumFieldList(); + LockingPtr<MemberList> fmdl = md->enumFieldList(); int documentedEnumValues=0; - if (fmdl) // enum has values + if (fmdl!=0) // enum has values { MemberListIterator fmni(*fmdl); MemberDef *fmd; @@ -6307,8 +6397,8 @@ static void findDEV(const MemberNameSDict &mnsd) // values. static void findDocumentedEnumValues() { - findDEV(Doxygen::memberNameSDict); - findDEV(Doxygen::functionNameSDict); + findDEV(*Doxygen::memberNameSDict); + findDEV(*Doxygen::functionNameSDict); } @@ -6319,7 +6409,7 @@ static void findDocumentedEnumValues() static void computeMemberRelations() { - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn; for ( ; (mn=mnli.current()) ; ++mnli ) // for each member name { @@ -6343,9 +6433,11 @@ static void computeMemberRelations() // argListToString(bmd->argumentList()).data(), // argListToString(md->argumentList()).data() // ); + LockingPtr<ArgumentList> bmdAl = bmd->argumentList(); + LockingPtr<ArgumentList> mdAl = md->argumentList(); if ( - matchArguments2(bmd->getOuterScope(),bmd->getFileDef(),bmd->argumentList(), - md->getOuterScope(), md->getFileDef(), md->argumentList(), + matchArguments2(bmd->getOuterScope(),bmd->getFileDef(),bmdAl.pointer(), + md->getOuterScope(), md->getFileDef(), mdAl.pointer(), TRUE ) ) @@ -6380,7 +6472,7 @@ static void computeMemberRelations() //static void computeClassImplUsageRelations() //{ // ClassDef *cd; -// ClassSDict::Iterator cli(Doxygen::classSDict); +// ClassSDict::Iterator cli(*Doxygen::classSDict); // for (;(cd=cli.current());++cli) // { // cd->determineImplUsageRelation(); @@ -6391,7 +6483,7 @@ static void computeMemberRelations() static void createTemplateInstanceMembers() { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; // for each class for (cli.toFirst();(cd=cli.current());++cli) @@ -6419,14 +6511,14 @@ static void buildCompleteMemberLists() { ClassDef *cd; // merge members of categories into the class they extend - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();(cd=cli.current());++cli) { int i=cd->name().find('('); if (i!=-1) // it is an Objective-C category { QCString baseName=cd->name().left(i); - ClassDef *baseClass=Doxygen::classSDict.find(baseName); + ClassDef *baseClass=Doxygen::classSDict->find(baseName); if (baseClass) { //printf("*** merging members of category %s into %s\n", @@ -6458,9 +6550,9 @@ static void buildCompleteMemberLists() static void generateFileSources() { if (documentedHtmlFiles==0) return; - if (Doxygen::inputNameList.count()>0) + if (Doxygen::inputNameList->count()>0) { - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -6490,9 +6582,9 @@ static void generateFileDocs() { if (documentedHtmlFiles==0) return; - if (Doxygen::inputNameList.count()>0) + if (Doxygen::inputNameList->count()>0) { - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -6516,7 +6608,7 @@ static void generateFileDocs() static void addSourceReferences() { // add source references for class definitions - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) { @@ -6527,7 +6619,7 @@ static void addSourceReferences() } } // add source references for namespace definitions - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; for (nli.toFirst();(nd=nli.current());++nli) { @@ -6539,7 +6631,7 @@ static void addSourceReferences() } // add source references for member names - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -6560,7 +6652,7 @@ static void addSourceReferences() } } } - MemberNameSDict::Iterator fnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); for (fnli.toFirst();(mn=fnli.current());++fnli) { MemberNameIterator mni(*mn); @@ -6647,15 +6739,15 @@ static void generateClassDocs() msg("Generating example index...\n"); } - generateClassList(Doxygen::classSDict); - generateClassList(Doxygen::hiddenClasses); + generateClassList(*Doxygen::classSDict); + generateClassList(*Doxygen::hiddenClasses); } //---------------------------------------------------------------------------- static void inheritDocumentation() { - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn; //int count=0; for (;(mn=mnli.current());++mnli) @@ -6693,7 +6785,7 @@ static void inheritDocumentation() static void combineUsingRelations() { // for each file - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -6715,7 +6807,7 @@ static void combineUsingRelations() } // for each namespace - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst() ; (nd=nli.current()) ; ++nli ) { @@ -6732,14 +6824,14 @@ static void combineUsingRelations() static void addMembersToMemberGroup() { // for each class - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for ( ; (cd=cli.current()) ; ++cli ) { cd->addMembersToMemberGroup(); } // for each file - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -6748,17 +6840,17 @@ static void addMembersToMemberGroup() fd->addMembersToMemberGroup(); fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } // for each namespace - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for ( ; (nd=nli.current()) ; ++nli ) { nd->addMembersToMemberGroup(); } // for each group - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -6771,14 +6863,14 @@ static void addMembersToMemberGroup() static void distributeMemberGroupDocumentation() { // for each class - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for ( ; (cd=cli.current()) ; ++cli ) { cd->distributeMemberGroupDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -6787,17 +6879,17 @@ static void distributeMemberGroupDocumentation() fd->distributeMemberGroupDocumentation(); fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } // for each namespace - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for ( ; (nd=nli.current()) ; ++nli ) { nd->distributeMemberGroupDocumentation(); } // for each group - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -6810,14 +6902,14 @@ static void distributeMemberGroupDocumentation() static void findSectionsInDocumentation() { // for each class - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for ( ; (cd=cli.current()) ; ++cli ) { cd->findSectionsInDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -6826,17 +6918,17 @@ static void findSectionsInDocumentation() fd->findSectionsInDocumentation(); fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } // for each namespace - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for ( ; (nd=nli.current()) ; ++nli ) { nd->findSectionsInDocumentation(); } // for each group - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -6869,7 +6961,7 @@ static void flushCachedTemplateRelations() } // remove all cached typedef resolutions whose target is a // template class as this may now be a template instance - MemberNameSDict::Iterator fnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); MemberName *fn; for (;(fn=fnli.current());++fnli) // for each global function name { @@ -6884,7 +6976,7 @@ static void flushCachedTemplateRelations() } } } - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); for (;(fn=mnli.current());++mnli) // for each class method name { MemberNameIterator mni(*fn); @@ -6925,7 +7017,7 @@ static void findDefineDocumentation(EntryNav *rootNav) md->setFileDef(rootNav->parent()->fileDef()); //printf("Adding member=%s\n",md->name().data()); MemberName *mn; - if ((mn=Doxygen::functionNameSDict[root->name])) + if ((mn=Doxygen::functionNameSDict->find(root->name))) { mn->append(md); } @@ -6933,12 +7025,10 @@ static void findDefineDocumentation(EntryNav *rootNav) { mn = new MemberName(root->name); mn->append(md); - //Doxygen::functionNameDict.insert(root->name,mn); - //Doxygen::functionNameList.append(mn); - Doxygen::functionNameSDict.append(root->name,mn); + Doxygen::functionNameSDict->append(root->name,mn); } } - MemberName *mn=Doxygen::functionNameSDict[root->name]; + MemberName *mn=Doxygen::functionNameSDict->find(root->name); if (mn) { int count=0; @@ -7067,7 +7157,7 @@ static void findDirDocumentation(EntryNav *rootNav) normalizedName+='/'; } DirDef *dir,*matchingDir=0; - SDict<DirDef>::Iterator sdi(Doxygen::directories); + SDict<DirDef>::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { //printf("Dir: %s<->%s\n",dir->name().data(),normalizedName.data()); @@ -7373,6 +7463,7 @@ static void generateExampleDocs() for (pdi.toFirst();(pd=pdi.current());++pdi) { msg("Generating docs for example %s...\n",pd->name().data()); + resetCCodeParserState(); QCString n=pd->getOutputFileBase(); startFile(*outputList,n,n,pd->name()); startTitle(*outputList,n); @@ -7397,7 +7488,7 @@ static void generateExampleDocs() static void generateGroupDocs() { - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -7432,7 +7523,7 @@ static void generateNamespaceDocs() { writeNamespaceIndex(*outputList); - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; // for each namespace... for (;(nd=nli.current());++nli) @@ -8284,10 +8375,9 @@ void initDoxygen() setlocale(LC_ALL,""); setlocale(LC_NUMERIC,"C"); #endif - Doxygen::symbolMap = new QDict<DefinitionIntf>(1000); - //Doxygen::symbolMap->setAutoDelete(TRUE); - Doxygen::globalScope = new NamespaceDef("<globalScope>",1,"<globalScope>"); + //Doxygen::symbolMap->setAutoDelete(TRUE); + Doxygen::runningTime.start(); initPreprocessor(); @@ -8297,20 +8387,10 @@ void initDoxygen() // register any additional parsers here... - Doxygen::sectionDict.setAutoDelete(TRUE); - Doxygen::inputNameList.setAutoDelete(TRUE); - Doxygen::memberNameSDict.setAutoDelete(TRUE); - Doxygen::functionNameSDict.setAutoDelete(TRUE); - Doxygen::hiddenClasses.setAutoDelete(TRUE); - Doxygen::classSDict.setAutoDelete(TRUE); - Doxygen::pageSDict->setAutoDelete(TRUE); - Doxygen::exampleSDict->setAutoDelete(TRUE); - excludeNameDict.setAutoDelete(TRUE); - Doxygen::memGrpInfoDict.setAutoDelete(TRUE); - Doxygen::tagDestinationDict.setAutoDelete(TRUE); - Doxygen::lookupCache.setAutoDelete(TRUE); - Doxygen::directories.setAutoDelete(TRUE); - Doxygen::dirRelations.setAutoDelete(TRUE); + + initClassMemberIndices(); + initNamespaceMemberIndices(); + initFileMemberIndices(); } void cleanUpDoxygen() @@ -8327,30 +8407,39 @@ void cleanUpDoxygen() delete Doxygen::xrefLists; delete Doxygen::parserManager; cleanUpPreprocessor(); - Config::deleteInstance(); - QTextCodec::deleteAllCodecs(); delete theTranslator; delete outputList; Mappers::freeMappers(); codeFreeScanner(); - // iterate through Doxygen::symbolMap and delete all - // DefinitionList objects, since they have no owner - QDictIterator<DefinitionIntf> dli(*Doxygen::symbolMap); - DefinitionIntf *di; - for (dli.toFirst();(di=dli.current());) + if (Doxygen::symbolMap) { - if (di->definitionType()==DefinitionIntf::TypeSymbolList) + // iterate through Doxygen::symbolMap and delete all + // DefinitionList objects, since they have no owner + QDictIterator<DefinitionIntf> dli(*Doxygen::symbolMap); + DefinitionIntf *di; + for (dli.toFirst();(di=dli.current());) { - DefinitionIntf *tmp = Doxygen::symbolMap->take(dli.currentKey()); - delete (DefinitionList *)tmp; - } - else - { - ++dli; - } - } + if (di->definitionType()==DefinitionIntf::TypeSymbolList) + { + DefinitionIntf *tmp = Doxygen::symbolMap->take(dli.currentKey()); + delete (DefinitionList *)tmp; + } + else + { + ++dli; + } + } + } + delete Doxygen::inputNameList; + delete Doxygen::memberNameSDict; + delete Doxygen::functionNameSDict; + delete Doxygen::groupSDict; + delete Doxygen::classSDict; + delete Doxygen::hiddenClasses; + delete Doxygen::namespaceSDict; + delete Doxygen::directories; //delete Doxygen::symbolMap; <- we cannot do this unless all static lists // (such as Doxygen::namespaceSDict) @@ -8676,12 +8765,85 @@ void checkConfiguration() void parseInput() { - Doxygen::inputNameDict = new FileNameDict(10007); - Doxygen::includeNameDict = new FileNameDict(10007); - Doxygen::exampleNameDict = new FileNameDict(1009); + /************************************************************************** + * Make sure the output directory exists + **************************************************************************/ + QCString &outputDirectory = Config_getString("OUTPUT_DIRECTORY"); + if (outputDirectory.isEmpty()) + { + outputDirectory=QDir::currentDirPath(); + } + else + { + QDir dir(outputDirectory); + if (!dir.exists()) + { + dir.setPath(QDir::currentDirPath()); + if (!dir.mkdir(outputDirectory)) + { + err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not " + "exist and cannot be created\n",outputDirectory.data()); + cleanUpDoxygen(); + exit(1); + } + else if (!Config_getBool("QUIET")) + { + err("Notice: Output directory `%s' does not exist. " + "I have created it for you.\n", outputDirectory.data()); + } + dir.cd(outputDirectory); + } + outputDirectory=dir.absPath(); + } + + /************************************************************************** + * Initialize global lists and dictionaries + **************************************************************************/ + + Doxygen::symbolMap = new QDict<DefinitionIntf>(1000); + Doxygen::symbolCache = new ObjCache(15); // 15 -> room for 32768 elements, + // ~1.0 MByte "overhead" + Doxygen::symbolStorage = new Store; + + if (Doxygen::symbolStorage->open(outputDirectory+"/doxygen_objdb.tmp")==-1) + { + err("Failed to open temporary file %s\n",(outputDirectory+"/doxygen_objdb.tmp").data()); + exit(1); + } + + Doxygen::inputNameList = new FileNameList; + Doxygen::inputNameList->setAutoDelete(TRUE); + Doxygen::memberNameSDict = new MemberNameSDict(10000); + Doxygen::memberNameSDict->setAutoDelete(TRUE); + Doxygen::functionNameSDict = new MemberNameSDict(10000); + Doxygen::functionNameSDict->setAutoDelete(TRUE); + Doxygen::groupSDict = new GroupSDict(17); + Doxygen::groupSDict->setAutoDelete(TRUE); + Doxygen::globalScope = new NamespaceDef("<globalScope>",1,"<globalScope>"); + Doxygen::namespaceSDict = new NamespaceSDict(20); + Doxygen::namespaceSDict->setAutoDelete(TRUE); + Doxygen::classSDict = new ClassSDict(1009); + Doxygen::classSDict->setAutoDelete(TRUE); + Doxygen::hiddenClasses = new ClassSDict(257); + Doxygen::hiddenClasses->setAutoDelete(TRUE); + Doxygen::directories = new DirSDict(17); + Doxygen::directories->setAutoDelete(TRUE); + Doxygen::pageSDict = new PageSDict(1009); // all doc pages + Doxygen::pageSDict->setAutoDelete(TRUE); + Doxygen::exampleSDict = new PageSDict(1009); // all examples + Doxygen::exampleSDict->setAutoDelete(TRUE); + Doxygen::inputNameDict = new FileNameDict(10007); + Doxygen::includeNameDict = new FileNameDict(10007); + Doxygen::exampleNameDict = new FileNameDict(1009); Doxygen::exampleNameDict->setAutoDelete(TRUE); - Doxygen::imageNameDict = new FileNameDict(257); - Doxygen::dotFileNameDict = new FileNameDict(257); + Doxygen::imageNameDict = new FileNameDict(257); + Doxygen::dotFileNameDict = new FileNameDict(257); + Doxygen::sectionDict.setAutoDelete(TRUE); + Doxygen::memGrpInfoDict.setAutoDelete(TRUE); + Doxygen::tagDestinationDict.setAutoDelete(TRUE); + Doxygen::lookupCache.setAutoDelete(TRUE); + Doxygen::dirRelations.setAutoDelete(TRUE); + excludeNameDict.setAutoDelete(TRUE); /************************************************************************** * Initialize some global constants @@ -8788,7 +8950,7 @@ void parseInput() inputSize+=readFileOrDirectory( path, - &Doxygen::inputNameList, + Doxygen::inputNameList, Doxygen::inputNameDict, &excludeNameDict, &Config_getList("FILE_PATTERNS"), @@ -8820,34 +8982,6 @@ void parseInput() * Check/create output directorties * **************************************************************************/ - QCString &outputDirectory = Config_getString("OUTPUT_DIRECTORY"); - if (outputDirectory.isEmpty()) - { - outputDirectory=QDir::currentDirPath(); - } - else - { - QDir dir(outputDirectory); - if (!dir.exists()) - { - dir.setPath(QDir::currentDirPath()); - if (!dir.mkdir(outputDirectory)) - { - err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not " - "exist and cannot be created\n",outputDirectory.data()); - cleanUpDoxygen(); - exit(1); - } - else if (!Config_getBool("QUIET")) - { - err("Notice: Output directory `%s' does not exist. " - "I have created it for you.\n", outputDirectory.data()); - } - dir.cd(outputDirectory); - } - outputDirectory=dir.absPath(); - } - QCString &htmlOutput = Config_getString("HTML_OUTPUT"); bool &generateHtml = Config_getBool("GENERATE_HTML"); if (htmlOutput.isEmpty() && generateHtml) @@ -8949,10 +9083,11 @@ void parseInput() * Handle Tag Files * **************************************************************************/ - g_storage.setName(outputDirectory+"/doxygen_entrydb.tmp"); - if (!g_storage.open(IO_WriteOnly)) + g_storage = new FileStorage; + g_storage->setName(outputDirectory+"/doxygen_entrydb.tmp"); + if (!g_storage->open(IO_WriteOnly)) { - err("Failed to create temporary storage file %s/doxygen_entrydb.tmp", + err("Failed to create temporary storage file %s/doxygen_entrydb.tmp\n", outputDirectory.data()); exit(1); } @@ -8975,8 +9110,8 @@ void parseInput() **************************************************************************/ parseFiles(root,rootNav); - g_storage.close(); - if (!g_storage.open(IO_ReadOnly)) + g_storage->close(); + if (!g_storage->open(IO_ReadOnly)) { err("Failed to open temporary storage file %s/doxygen_entrydb.tmp for reading", outputDirectory.data()); @@ -9014,7 +9149,6 @@ void parseInput() buildNamespaceList(rootNav); findUsingDirectives(rootNav); - msg("Building file list...\n"); buildFileList(rootNav); //generateFileTree(); @@ -9101,14 +9235,16 @@ void parseInput() findGroupScope(rootNav); msg("Sorting lists...\n"); - Doxygen::memberNameSDict.sort(); - Doxygen::functionNameSDict.sort(); - Doxygen::hiddenClasses.sort(); - Doxygen::classSDict.sort(); + Doxygen::memberNameSDict->sort(); + Doxygen::functionNameSDict->sort(); + Doxygen::hiddenClasses->sort(); + Doxygen::classSDict->sort(); msg("Freeing entry tree\n"); delete rootNav; - g_storage.close(); + g_storage->close(); + delete g_storage; + g_storage=0; QDir thisDir; thisDir.remove(outputDirectory+"/doxygen_entrydb.tmp"); @@ -9143,7 +9279,7 @@ void parseInput() // compute the shortest possible names of all files // without loosing the uniqueness of the file names. msg("Generating disk names...\n"); - Doxygen::inputNameList.generateDiskNames(); + Doxygen::inputNameList->generateDiskNames(); msg("Adding source references...\n"); addSourceReferences(); @@ -9445,7 +9581,23 @@ void generateOutput() Doxygen::sysElapsedTime ); } + + /************************************************************************** + * Start cleaning up * + **************************************************************************/ + + //Doxygen::symbolCache->printStats(); + //Doxygen::symbolStorage->printStats(); cleanUpDoxygen(); + finializeDocParser(); + Doxygen::symbolStorage->close(); + QDir thisDir; + thisDir.remove(Config_getString("OUTPUT_DIRECTORY")+"/doxygen_objdb.tmp"); + Config::deleteInstance(); + QTextCodec::deleteAllCodecs(); + delete Doxygen::symbolCache; + delete Doxygen::symbolMap; + delete Doxygen::symbolStorage; } diff --git a/src/doxygen.h b/src/doxygen.h index 88df1e5..43ee18b 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -43,6 +43,8 @@ class PageDef; class SearchIndex; class DirDef; class ParserManager; +class ObjCache; +class Store; typedef QList<QCString> StringList; typedef QDict<FileDef> FileDict; @@ -73,8 +75,8 @@ extern QCString spaces; class Doxygen { public: - static ClassSDict classSDict; - static ClassSDict hiddenClasses; + static ClassSDict *classSDict; + static ClassSDict *hiddenClasses; static PageSDict *exampleSDict; static PageSDict *pageSDict; static PageDef *mainPage; @@ -82,20 +84,17 @@ class Doxygen static FileNameDict *includeNameDict; static FileNameDict *exampleNameDict; static FileNameDict *inputNameDict; - static FileNameList inputNameList; + static FileNameList *inputNameList; static FileNameDict *imageNameDict; static FileNameDict *dotFileNameDict; static QStrList tagfileList; - static MemberNameSDict memberNameSDict; - static MemberNameSDict functionNameSDict; - static FileList fileList; - static FileDict fileDict; - static ClassDef unrelatedClass; + static MemberNameSDict *memberNameSDict; + static MemberNameSDict *functionNameSDict; static QTextStream tagFile; static SectionDict sectionDict; static StringDict namespaceAliasDict; - static GroupSDict groupSDict; - static NamespaceSDict namespaceSDict; + static GroupSDict *groupSDict; + static NamespaceSDict *namespaceSDict; static FormulaList formulaList; static FormulaDict formulaDict; static FormulaDict formulaNameDict; @@ -114,10 +113,12 @@ class Doxygen static bool outputToWizard; static QDict<int> *htmlDirMap; static QCache<LookupInfo> lookupCache; - static DirSDict directories; + static DirSDict *directories; static SDict<DirRelation> dirRelations; static ParserManager *parserManager; static bool suppressDocWarnings; + static ObjCache *symbolCache; + static Store *symbolStorage; }; void initDoxygen(); diff --git a/src/entry.cpp b/src/entry.cpp index 32e8027..34d7241 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -15,8 +15,10 @@ * */ +#include <stdlib.h> #include <qfile.h> #include "entry.h" +#include "marshal.h" #include "util.h" #include "section.h" @@ -61,10 +63,10 @@ Entry::Entry(const Entry &e) m_parent = e.m_parent; type = e.type.copy(); name = e.name.copy(); - args = e.args.copy(); + args = e.args; bitfields = e.bitfields.copy(); exception = e.exception.copy(); - program = e.program.copy(); + program = e.program; includeFile = e.includeFile.copy(); includeName = e.includeFile.copy(); doc = e.doc.copy(); @@ -261,7 +263,7 @@ int Entry::getSize() return sizeof(Entry); } -void Entry::createSubtreeIndex(EntryNav *nav,QFile &storage,FileDef *fd) +void Entry::createSubtreeIndex(EntryNav *nav,FileStorage *storage,FileDef *fd) { EntryNav *childNav = new EntryNav(nav,this); nav->addChild(childNav); @@ -281,7 +283,7 @@ void Entry::createSubtreeIndex(EntryNav *nav,QFile &storage,FileDef *fd) } } -void Entry::createNavigationIndex(EntryNav *rootNav,QFile &storage,FileDef *fd) +void Entry::createNavigationIndex(EntryNav *rootNav,FileStorage *storage,FileDef *fd) { //printf("createNavigationIndex(%p) sublist=%p\n",this,m_sublist); if (m_sublist) @@ -333,323 +335,9 @@ void Entry::addSpecialListItem(const char *listName,int itemId) //------------------------------------------------------------------ -#define NULL_LIST 0xffffffff - -void marshalInt(QFile &f,int v) -{ - uchar b[4]; - b[0]=((uint)v)>>24; - b[1]=(((uint)v)>>16)&0xff; - b[2]=(((uint)v)>>8)&0xff; - b[3]=v&0xff; - f.writeBlock((const char *)b,4); -} - -void marshalUInt(QFile &f,uint v) -{ - uchar b[4]; - b[0]=v>>24; - b[1]=(v>>16)&0xff; - b[2]=(v>>8)&0xff; - b[3]=v&0xff; - f.writeBlock((const char *)b,4); -} - -void marshalBool(QFile &f,bool b) -{ - char c = b; - f.writeBlock(&c,sizeof(char)); -} - -void marshalQCString(QFile &f,const QCString &s) -{ - uint l=s.length(); - marshalUInt(f,l); - if (l>0) f.writeBlock(s.data(),l); -} - -void marshalArgumentList(QFile &f,ArgumentList *argList) -{ - if (argList==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,argList->count()); - ArgumentListIterator ali(*argList); - Argument *a; - for (ali.toFirst();(a=ali.current());++ali) - { - marshalQCString(f,a->attrib); - marshalQCString(f,a->type); - marshalQCString(f,a->canType); - marshalQCString(f,a->name); - marshalQCString(f,a->array); - marshalQCString(f,a->defval); - marshalQCString(f,a->docs); - } - marshalBool(f,argList->constSpecifier); - marshalBool(f,argList->volatileSpecifier); - marshalBool(f,argList->pureSpecifier); - } -} - -void marshalArgumentLists(QFile &f,QList<ArgumentList> *argLists) -{ - if (argLists==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,argLists->count()); - QListIterator<ArgumentList> ali(*argLists); - ArgumentList *al; - for (ali.toFirst();(al=ali.current());++ali) - { - marshalArgumentList(f,al); - } - } -} - -void marshalBaseInfoList(QFile &f, QList<BaseInfo> *baseList) -{ - if (baseList==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,baseList->count()); - QListIterator<BaseInfo> bli(*baseList); - BaseInfo *bi; - for (bli.toFirst();(bi=bli.current());++bli) - { - marshalQCString(f,bi->name); - marshalInt(f,(int)bi->prot); - marshalInt(f,(int)bi->virt); - } - } -} - -void marshalGroupingList(QFile &f, QList<Grouping> *groups) -{ - if (groups==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,groups->count()); - QListIterator<Grouping> gli(*groups); - Grouping *g; - for (gli.toFirst();(g=gli.current());++gli) - { - marshalQCString(f,g->groupname); - marshalInt(f,(int)g->pri); - } - } -} - -void marshalSectionInfoList(QFile &f, QList<SectionInfo> *anchors) -{ - if (anchors==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,anchors->count()); - QListIterator<SectionInfo> sli(*anchors); - SectionInfo *si; - for (sli.toFirst();(si=sli.current());++sli) - { - marshalQCString(f,si->label); - marshalQCString(f,si->title); - marshalQCString(f,si->ref); - marshalInt(f,(int)si->type); - marshalQCString(f,si->fileName); - } - } -} - -void marshalItemInfoList(QFile &f, QList<ListItemInfo> *sli) -{ - if (sli==0) - { - marshalUInt(f,NULL_LIST); // null pointer representation - } - else - { - marshalUInt(f,sli->count()); - QListIterator<ListItemInfo> liii(*sli); - ListItemInfo *lii; - for (liii.toFirst();(lii=liii.current());++liii) - { - marshalQCString(f,lii->type); - marshalInt(f,lii->itemId); - } - } -} - -//------------------------------------------------------------------ - -int unmarshalInt(QFile &f) -{ - uchar b[4]; - f.readBlock((char *)b,4); - int result=(int)((((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]); - //printf("unmarshalInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); - return result; -} - -uint unmarshalUInt(QFile &f) -{ - uchar b[4]; - f.readBlock((char *)b,4); - uint result=(((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]; - //printf("unmarshalUInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); - return result; -} - -bool unmarshalBool(QFile &f) -{ - char result; - f.readBlock(&result,sizeof(result)); - //printf("unmarshalBool: %x offset=%llx\n",result,f.pos()); - return result; -} - -QCString unmarshalQCString(QFile &f) -{ - uint len = unmarshalUInt(f); - //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos()); - QCString result(len+1); - result.at(len)='\0'; - if (len>0) - { - f.readBlock(result.data(),len); - } - //printf("unmarshalQCString: result=%s\n",result.data()); - return result; -} - -ArgumentList *unmarshalArgumentList(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - ArgumentList *result = new ArgumentList; - result->setAutoDelete(TRUE); - //printf("unmarshalArgumentList: %d\n",count); - for (i=0;i<count;i++) - { - Argument *a = new Argument; - a->attrib = unmarshalQCString(f); - a->type = unmarshalQCString(f); - a->canType = unmarshalQCString(f); - a->name = unmarshalQCString(f); - a->array = unmarshalQCString(f); - a->defval = unmarshalQCString(f); - a->docs = unmarshalQCString(f); - result->append(a); - } - result->constSpecifier = unmarshalBool(f); - result->volatileSpecifier = unmarshalBool(f); - result->pureSpecifier = unmarshalBool(f); - return result; -} - -QList<ArgumentList> *unmarshalArgumentLists(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - QList<ArgumentList> *result = new QList<ArgumentList>; - result->setAutoDelete(TRUE); - //printf("unmarshalArgumentLists: %d\n",count); - for (i=0;i<count;i++) - { - result->append(unmarshalArgumentList(f)); - } - return result; -} - -QList<BaseInfo> *unmarshalBaseInfoList(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - QList<BaseInfo> *result = new QList<BaseInfo>; - result->setAutoDelete(TRUE); - for (i=0;i<count;i++) - { - QCString name = unmarshalQCString(f); - Protection prot = (Protection)unmarshalInt(f); - Specifier virt = (Specifier)unmarshalInt(f); - result->append(new BaseInfo(name,prot,virt)); - } - return result; -} - -QList<Grouping> *unmarshalGroupingList(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - QList<Grouping> *result = new QList<Grouping>; - result->setAutoDelete(TRUE); - for (i=0;i<count;i++) - { - QCString name = unmarshalQCString(f); - Grouping::GroupPri_t prio = (Grouping::GroupPri_t)unmarshalInt(f); - result->append(new Grouping(name,prio)); - } - return result; -} - -QList<SectionInfo> *unmarshalSectionInfoList(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - QList<SectionInfo> *result = new QList<SectionInfo>; - result->setAutoDelete(TRUE); - for (i=0;i<count;i++) - { - QCString label = unmarshalQCString(f); - QCString title = unmarshalQCString(f); - QCString ref = unmarshalQCString(f); - SectionInfo::SectionType type = (SectionInfo::SectionType)unmarshalInt(f); - QCString fileName = unmarshalQCString(f); - result->append(new SectionInfo(fileName,label,title,type,ref)); - } - return result; -} - -QList<ListItemInfo> *unmarshalItemInfoList(QFile &f) -{ - uint i; - uint count = unmarshalUInt(f); - if (count==NULL_LIST) return 0; // null list - QList<ListItemInfo> *result = new QList<ListItemInfo>; - result->setAutoDelete(TRUE); - for (i=0;i<count;i++) - { - ListItemInfo *lii = new ListItemInfo; - lii->type = unmarshalQCString(f); - lii->itemId = unmarshalInt(f); - result->append(lii); - } - return result; -} - -//------------------------------------------------------------------ - #define HEADER ('D'<<24)+('O'<<16)+('X'<<8)+'!' -bool saveEntry(Entry *e,QFile &f) +static bool saveEntry(Entry *e,FileStorage *f) { marshalUInt(f,HEADER); marshalInt(f,(int)e->protection); @@ -667,8 +355,8 @@ bool saveEntry(Entry *e,QFile &f) marshalQCString(f,e->bitfields); marshalArgumentList(f,e->argList); marshalArgumentLists(f,e->tArgLists); - marshalQCString(f,e->program); - marshalQCString(f,e->initializer); + marshalQGString(f,e->program); + marshalQGString(f,e->initializer); marshalQCString(f,e->includeFile); marshalQCString(f,e->includeName); marshalQCString(f,e->doc); @@ -701,7 +389,7 @@ bool saveEntry(Entry *e,QFile &f) return TRUE; } -bool loadEntry(Entry *e,QFile &f) +static bool loadEntry(Entry *e,FileStorage *f) { uint header=unmarshalUInt(f); if (header!=HEADER) @@ -725,8 +413,8 @@ bool loadEntry(Entry *e,QFile &f) delete e->argList; e->argList = unmarshalArgumentList(f); e->tArgLists = unmarshalArgumentLists(f); - e->program = unmarshalQCString(f); - e->initializer = unmarshalQCString(f); + e->program = unmarshalQGString(f); + e->initializer = unmarshalQGString(f); e->includeFile = unmarshalQCString(f); e->includeName = unmarshalQCString(f); e->doc = unmarshalQCString(f); @@ -805,7 +493,7 @@ void EntryNav::addChild(EntryNav *e) m_subList->append(e); } -bool EntryNav::loadEntry(QFile &storage) +bool EntryNav::loadEntry(FileStorage *storage) { if (m_noLoad) { @@ -829,7 +517,7 @@ bool EntryNav::loadEntry(QFile &storage) //} //m_info->parent = 0; //printf("load entry: seek to %llx\n",m_offset); - if (!storage.seek(m_offset)) + if (!storage->seek(m_offset)) { //printf("seek failed!\n"); return FALSE; @@ -837,9 +525,9 @@ bool EntryNav::loadEntry(QFile &storage) return ::loadEntry(m_info,storage); } -bool EntryNav::saveEntry(Entry *e,QFile &storage) +bool EntryNav::saveEntry(Entry *e,FileStorage *storage) { - m_offset = storage.pos(); + m_offset = storage->pos(); //printf("EntryNav::saveEntry offset=%llx\n",m_offset); return ::saveEntry(e,storage); } diff --git a/src/entry.h b/src/entry.h index 7cf6615..50100ae 100644 --- a/src/entry.h +++ b/src/entry.h @@ -21,10 +21,13 @@ #include "qtbc.h" #include <qlist.h> +#include <qgstring.h> + struct SectionInfo; class QFile; class EntryNav; class FileDef; +class FileStorage; enum Protection { Public, Protected, Private, Package } ; enum Specifier { Normal, Virtual, Pure } ; @@ -262,7 +265,7 @@ class Entry ~Entry(); int getSize(); void addSpecialListItem(const char *listName,int index); - void createNavigationIndex(EntryNav *rootNav,QFile &storage,FileDef *fd); + void createNavigationIndex(EntryNav *rootNav,FileStorage *storage,FileDef *fd); // while parsing a file these function can be used to navigate/build the tree void setParent(Entry *parent) { m_parent = parent; } @@ -300,8 +303,8 @@ class Entry QCString bitfields; //!< member's bit fields ArgumentList *argList; //!< member arguments as a list QList<ArgumentList> *tArgLists; //!< template argument declarations - QCString program; //!< the program text - QCString initializer; //!< initial value (for variables) + QGString program; //!< the program text + QGString initializer; //!< initial value (for variables) QCString includeFile; //!< include file (2 arg of \\class, must be unique) QCString includeName; //!< include name (3 arg of \\class) QCString doc; //!< documentation block (partly parsed) @@ -361,7 +364,7 @@ class Entry } private: - void createSubtreeIndex(EntryNav *nav,QFile &storage,FileDef *fd); + void createSubtreeIndex(EntryNav *nav,FileStorage *storage,FileDef *fd); Entry *m_parent; //!< parent node in the tree QList<Entry> *m_sublist; //!< entries that are children of this one Entry &operator=(const Entry &); @@ -373,8 +376,8 @@ class EntryNav EntryNav(EntryNav *parent,Entry *e); ~EntryNav(); void addChild(EntryNav *); - bool loadEntry(QFile &storage); - bool saveEntry(Entry *e,QFile &storage); + bool loadEntry(FileStorage *storage); + bool saveEntry(Entry *e,FileStorage *storage); void setEntry(Entry *e); void releaseEntry(); void changeSection(int section) { m_section = section; } diff --git a/src/filedef.cpp b/src/filedef.cpp index dfa5cc4..c43cd72 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -58,8 +58,6 @@ class DevNullCodeDocInterface : public CodeOutputInterface virtual void linkableSymbol(int, const char *,Definition *,Definition *) {} }; - - /*! create a new file definition, where \a p is the file path, \a nm the file name, and \a ref is an HTML anchor name if the file was read from a tag file or 0 otherwise @@ -84,23 +82,6 @@ FileDef::FileDef(const char *p,const char *nm, srcMemberDict = 0; usingDirList = 0; usingDeclList = 0; - -#if 0 - allMemberList = 0; - decDefineMembers = 0; - decProtoMembers = 0; - decTypedefMembers = 0; - decEnumMembers = 0; - decFuncMembers = 0; - decVarMembers = 0; - docDefineMembers = 0; - docProtoMembers = 0; - docTypedefMembers = 0; - docEnumMembers = 0; - docFuncMembers = 0; - docVarMembers = 0; -#endif - package = 0; isSource = FALSE; docname = nm; @@ -128,22 +109,6 @@ FileDef::~FileDef() delete usingDirList; delete usingDeclList; delete memberGroupSDict; - -#if 0 - delete allMemberList; - delete decDefineMembers; - delete decProtoMembers; - delete decTypedefMembers; - delete decEnumMembers; - delete decFuncMembers; - delete decVarMembers; - delete docDefineMembers; - delete docProtoMembers; - delete docTypedefMembers; - delete docEnumMembers; - delete docFuncMembers; - delete docVarMembers; -#endif } /*! Compute the HTML anchor names for all members in the class */ @@ -535,17 +500,11 @@ void FileDef::writeDocumentation(OutputList &ol) //allMemberList.writeDeclarations(ol,0,0,this,0,0,0); writeMemberDeclarations(ol,MemberList::decDefineMembers,theTranslator->trDefines()); - //if (decDefineMembers) decDefineMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trDefines(),0); writeMemberDeclarations(ol,MemberList::decProtoMembers,theTranslator->trFuncProtos()); - //if (decProtoMembers) decProtoMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trFuncProtos(),0); writeMemberDeclarations(ol,MemberList::decTypedefMembers,theTranslator->trTypedefs()); - //if (decTypedefMembers) decTypedefMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trTypedefs(),0); writeMemberDeclarations(ol,MemberList::decEnumMembers,theTranslator->trEnumerations()); - //if (decEnumMembers) decEnumMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trEnumerations(),0); writeMemberDeclarations(ol,MemberList::decFuncMembers,theTranslator->trFunctions()); - //if (decFuncMembers) decFuncMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trFunctions(),0); writeMemberDeclarations(ol,MemberList::decVarMembers,theTranslator->trVariables()); - //if (decVarMembers) decVarMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trVariables(),0); ol.endMemberSections(); if (!Config_getBool("DETAILS_AT_TOP")) @@ -587,46 +546,11 @@ void FileDef::writeMemberDocumentation(OutputList &ol) } writeMemberDocumentation(ol,MemberList::docDefineMembers,theTranslator->trDefineDocumentation()); - //if (docDefineMembers) - //{ - // docDefineMembers->writeDocumentation(ol,name(),this, - // theTranslator->trDefineDocumentation()); - //} - writeMemberDocumentation(ol,MemberList::docProtoMembers,theTranslator->trFunctionPrototypeDocumentation()); - //if (docProtoMembers) - //{ - // docProtoMembers->writeDocumentation(ol,name(),this, - // theTranslator->trFunctionPrototypeDocumentation()); - //} - writeMemberDocumentation(ol,MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()); - //if (docTypedefMembers) - //{ - // docTypedefMembers->writeDocumentation(ol,name(),this, - // theTranslator->trTypedefDocumentation()); - //} - writeMemberDocumentation(ol,MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); - //if (docEnumMembers) - //{ - // docEnumMembers->writeDocumentation(ol,name(),this, - // theTranslator->trEnumerationTypeDocumentation()); - //} - writeMemberDocumentation(ol,MemberList::docFuncMembers,theTranslator->trFunctionDocumentation()); - //if (docFuncMembers) - //{ - // docFuncMembers->writeDocumentation(ol,name(),this, - // theTranslator->trFunctionDocumentation()); - //} - writeMemberDocumentation(ol,MemberList::docVarMembers,theTranslator->trVariableDocumentation()); - //if (docVarMembers) - //{ - // docVarMembers->writeDocumentation(ol,name(),this, - // theTranslator->trVariableDocumentation()); - //} if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -648,14 +572,6 @@ void FileDef::writeMemberPages(OutputList &ol) ml->writeDocumentationPage(ol,name(),this); } } -#if 0 - if (docDefineMembers) docDefineMembers->writeDocumentationPage(ol,name(),this); - if (docProtoMembers) docProtoMembers->writeDocumentationPage(ol,name(),this); - if (docTypedefMembers) docTypedefMembers->writeDocumentationPage(ol,name(),this); - if (docEnumMembers) docEnumMembers->writeDocumentationPage(ol,name(),this); - if (docFuncMembers) docFuncMembers->writeDocumentationPage(ol,name(),this); - if (docVarMembers) docVarMembers->writeDocumentationPage(ol,name(),this); -#endif ol.popGeneratorState(); } @@ -773,14 +689,6 @@ void FileDef::addMembersToMemberGroup() ::addMembersToMemberGroup(ml,&memberGroupSDict,this); } } -#if 0 - ::addMembersToMemberGroup(decDefineMembers, &memberGroupSDict,this); - ::addMembersToMemberGroup(decProtoMembers, &memberGroupSDict,this); - ::addMembersToMemberGroup(decTypedefMembers, &memberGroupSDict,this); - ::addMembersToMemberGroup(decEnumMembers, &memberGroupSDict,this); - ::addMembersToMemberGroup(decFuncMembers, &memberGroupSDict,this); - ::addMembersToMemberGroup(decVarMembers, &memberGroupSDict,this); -#endif } /*! Adds member definition \a md to the list of all members of this file */ @@ -789,75 +697,46 @@ void FileDef::insertMember(MemberDef *md) //printf("%s:FileDef::insertMember(%s (=%p) list has %d elements)\n", // name().data(),md->name().data(),md,allMemberList.count()); MemberList *allMemberList = getMemberList(MemberList::allMembersList); - if (allMemberList && allMemberList->findRef(md)!=-1) + if (allMemberList && allMemberList->findRef(md)!=-1) // TODO optimize the findRef! { return; } if (allMemberList==0) { - allMemberList = new MemberList(MemberList::allMembersList); + allMemberList = new MemberList(MemberList::allMembersList);; m_memberLists.append(allMemberList); } allMemberList->append(md); + ::addFileMemberNameToIndex(md); switch (md->memberType()) { case MemberDef::Variable: case MemberDef::Property: addMemberToList(MemberList::decVarMembers,md); - //if (decVarMembers==0) decVarMembers = new MemberList; - //if (sortBriefDocs) decVarMembers->inSort(md); else decVarMembers->append(md); addMemberToList(MemberList::docVarMembers,md); - //if (docVarMembers==0) docVarMembers = new MemberList; - //if (sortMemberDocs) docVarMembers->inSort(md); else docVarMembers->append(md); - //docVarMembers->setInFile(TRUE); break; case MemberDef::Function: addMemberToList(MemberList::decFuncMembers,md); - //if (decFuncMembers==0) decFuncMembers = new MemberList; - //if (sortBriefDocs) decFuncMembers->inSort(md); else decFuncMembers->append(md); addMemberToList(MemberList::docFuncMembers,md); - //if (docFuncMembers==0) docFuncMembers = new MemberList; - //if (sortMemberDocs) docFuncMembers->inSort(md); else docFuncMembers->append(md); - //docFuncMembers->setInFile(TRUE); break; case MemberDef::Typedef: addMemberToList(MemberList::decTypedefMembers,md); - //if (decTypedefMembers==0) decTypedefMembers = new MemberList; - //if (sortBriefDocs) decTypedefMembers->inSort(md); else decTypedefMembers->append(md); addMemberToList(MemberList::docTypedefMembers,md); - //if (docTypedefMembers==0) docTypedefMembers = new MemberList; - //if (sortMemberDocs) docTypedefMembers->inSort(md); else docTypedefMembers->append(md); - //docTypedefMembers->setInFile(TRUE); break; case MemberDef::Enumeration: addMemberToList(MemberList::decEnumMembers,md); - //if (decEnumMembers==0) decEnumMembers = new MemberList; - //if (sortBriefDocs) decEnumMembers->inSort(md); else decEnumMembers->append(md); addMemberToList(MemberList::docEnumMembers,md); - //if (docEnumMembers==0) docEnumMembers = new MemberList; - //if (sortMemberDocs) docEnumMembers->inSort(md); else docEnumMembers->append(md); - //docEnumMembers->setInFile(TRUE); break; case MemberDef::EnumValue: // enum values are shown inside their enums break; case MemberDef::Prototype: addMemberToList(MemberList::decProtoMembers,md); - //if (decProtoMembers==0) decProtoMembers = new MemberList; - //if (sortBriefDocs) decProtoMembers->inSort(md); else decProtoMembers->append(md); addMemberToList(MemberList::docProtoMembers,md); - //if (docProtoMembers==0) docProtoMembers = new MemberList; - //if (sortMemberDocs) docProtoMembers->inSort(md); else docProtoMembers->append(md); - //docProtoMembers->setInFile(TRUE); break; case MemberDef::Define: addMemberToList(MemberList::decDefineMembers,md); - //if (decDefineMembers==0) decDefineMembers = new MemberList; - //if (sortBriefDocs) decDefineMembers->inSort(md); else decDefineMembers->append(md); addMemberToList(MemberList::docDefineMembers,md); - //if (docDefineMembers==0) docDefineMembers = new MemberList; - //if (sortMemberDocs) docDefineMembers->inSort(md); else docDefineMembers->append(md); - //docDefineMembers->setInFile(TRUE); break; default: err("FileDef::insertMembers(): " @@ -1074,10 +953,13 @@ bool FileDef::generateSourceFile() const void FileDef::addListReferences() { - addRefItem(xrefListItems(), - theTranslator->trFile(TRUE,TRUE), - getOutputFileBase(),name() - ); + { + LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); + addRefItem(xrefItems.pointer(), + theTranslator->trFile(TRUE,TRUE), + getOutputFileBase(),name() + ); + } if (memberGroupSDict) { MemberGroupSDict::Iterator mgli(*memberGroupSDict); @@ -1096,15 +978,6 @@ void FileDef::addListReferences() ml->addListReferences(this); } } - -#if 0 - if (docDefineMembers) docDefineMembers->addListReferences(this); - if (docProtoMembers) docProtoMembers->addListReferences(this); - if (docTypedefMembers) docTypedefMembers->addListReferences(this); - if (docEnumMembers) docEnumMembers->addListReferences(this); - if (docFuncMembers) docFuncMembers->addListReferences(this); - if (docVarMembers) docVarMembers->addListReferences(this); -#endif } //------------------------------------------------------------------- @@ -1316,7 +1189,7 @@ static void addDirsAsGroups(Directory *root,GroupDef *parent,int level) } else { - Doxygen::groupSDict.append(root->path(),gd); + Doxygen::groupSDict->append(root->path(),gd); } } QListIterator<DirEntry> dli(root->children()); @@ -1336,7 +1209,7 @@ void generateFileTree() Directory *root=new Directory(0,"root"); root->setLast(TRUE); - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { diff --git a/src/filedef.h b/src/filedef.h index 1b194f8..c794b70 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -170,31 +170,8 @@ class FileDef : public Definition void addListReferences(); bool isDocumentationFile() const; - - //void generateXML(QTextStream &t); - //void generateXMLSection(QTextStream &t,MemberList *ml,const char *type); - MemberList *getMemberList(MemberList::ListType lt) const; const QList<MemberList> &getMemberLists() const { return m_memberLists; } -#if 0 - MemberList *allMemberList; - - // members in the declaration part of the documentation - MemberList *decDefineMembers; - MemberList *decProtoMembers; - MemberList *decTypedefMembers; - MemberList *decEnumMembers; - MemberList *decFuncMembers; - MemberList *decVarMembers; - - // members in the detailed part of the documentation - MemberList *docDefineMembers; - MemberList *docProtoMembers; - MemberList *docTypedefMembers; - MemberList *docEnumMembers; - MemberList *docFuncMembers; - MemberList *docVarMembers; -#endif /* user defined member groups */ MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 993b213..13a5681 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -244,10 +244,13 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly) // both inside a file => definition and declaration do not have to be in the same file (srcMd->getOuterScope()->definitionType()==Definition::TypeFile && md->getOuterScope()->definitionType()==Definition::TypeFile); + + LockingPtr<ArgumentList> srcMdAl = srcMd->argumentList(); + LockingPtr<ArgumentList> mdAl = md->argumentList(); if (srcMd->isFunction() && md->isFunction() && - matchArguments2(srcMd->getOuterScope(),srcMd->getFileDef(),srcMd->argumentList(), - md->getOuterScope(),md->getFileDef(),md->argumentList(), + matchArguments2(srcMd->getOuterScope(),srcMd->getFileDef(),srcMdAl.pointer(), + md->getOuterScope(),md->getFileDef(),mdAl.pointer(), TRUE ) && sameScope @@ -467,7 +470,8 @@ void GroupDef::addGroup(const GroupDef *def) bool GroupDef::isASubGroup() const { - return partOfGroups() && partOfGroups()->count()!=0; + LockingPtr<GroupList> groups = partOfGroups(); + return groups!=0 && groups->count()!=0; } int GroupDef::countMembers() const @@ -890,7 +894,7 @@ void addClassToGroups(Entry *root,ClassDef *cd) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { gd->addClass(cd); cd->makePartOfGroup(gd); @@ -908,7 +912,7 @@ void addNamespaceToGroups(Entry *root,NamespaceDef *nd) { GroupDef *gd=0; //printf("group `%s'\n",s->data()); - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { gd->addNamespace(nd); nd->makePartOfGroup(gd); @@ -926,7 +930,7 @@ void addDirToGroups(Entry *root,DirDef *dd) { GroupDef *gd=0; //printf("group `%s'\n",g->groupname.data()); - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { gd->addDir(dd); dd->makePartOfGroup(gd); @@ -944,7 +948,7 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]) && + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname)) && !gd->containsGroup(subGroup) ) { gd->addGroup(subGroup); @@ -973,7 +977,7 @@ void addMemberToGroups(Entry *root,MemberDef *md) { GroupDef *gd=0; if (!g->groupname.isEmpty() && - (gd=Doxygen::groupSDict[g->groupname]) && + (gd=Doxygen::groupSDict->find(g->groupname)) && g->pri >= pri) { if (fgd && gd!=fgd && g->pri==pri) @@ -1067,7 +1071,7 @@ void addExampleToGroups(Entry *root,PageDef *eg) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { gd->addExample(eg); eg->makePartOfGroup(gd); @@ -1090,10 +1094,13 @@ QCString GroupDef::getOutputFileBase() const void GroupDef::addListReferences() { - addRefItem(xrefListItems(), + { + LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); + addRefItem(xrefItems.pointer(), theTranslator->trGroup(TRUE,TRUE), getOutputFileBase(),name() ); + } MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 7907c94..e96d1a8 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -755,10 +755,9 @@ void HtmlGenerator::writeString(const char *text) t << text; } -void HtmlGenerator::writeIndexItem(const char *ref,const char *f, - const char *name) +void HtmlGenerator::startIndexItem(const char *ref,const char *f) { - //printf("HtmlGenerator::writeIndexItem(%s,%s,%s)\n",ref,f,name); + //printf("HtmlGenerator::startIndexItem(%s,%s,%s)\n",ref,f,name); QCString *dest; t << "<li>"; if (ref || f) @@ -785,7 +784,11 @@ void HtmlGenerator::writeIndexItem(const char *ref,const char *f, { t << "<b>"; } - docify(name); +} + +void HtmlGenerator::endIndexItem(const char *ref,const char *f) +{ + //printf("HtmlGenerator::endIndexItem(%s,%s,%s)\n",ref,f,name); if (ref || f) { t << "</a>" << endl; diff --git a/src/htmlgen.h b/src/htmlgen.h index c9e3a62..88a8841 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -72,7 +72,8 @@ class HtmlGenerator : public OutputGenerator void endIndexValue(const char *,bool); void startItemList() { t << "<ul>" << endl; } void endItemList() { t << "</ul>" << endl; } - void writeIndexItem(const char *ref,const char *file,const char *name); + void startIndexItem(const char *ref,const char *file); + void endIndexItem(const char *ref,const char *file); void docify(const char *text); void codify(const char *text); void writeObjectLink(const char *ref,const char *file, diff --git a/src/index.cpp b/src/index.cpp index 8e878cd..49a8609 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -74,19 +74,6 @@ void countDataStructures() documentedGroups = countGroups(); documentedNamespaces = countNamespaces(); documentedDirs = countDirs(); - int i; - for (i=0;i<(int)CMHL_Total;i++) - { - documentedClassMembers[i] = countClassMembers(i); - } - for (i=0;i<(int)FMHL_Total;i++) - { - documentedFileMembers[i] = countFileMembers(i); - } - for (i=0;i<(int)NMHL_Total;i++) - { - documentedNamespaceMembers[i] = countNamespaceMembers(i); - } } static void startIndexHierarchy(OutputList &ol,int level) @@ -117,9 +104,25 @@ static void endIndexHierarchy(OutputList &ol,int level) //---------------------------------------------------------------------------- -static bool g_memberIndexLetterUsed[CMHL_Total][256]; -static bool g_fileIndexLetterUsed[FMHL_Total][256]; -static bool g_namespaceIndexLetterUsed[NMHL_Total][256]; +class MemberIndexList : public QList<MemberDef> +{ + public: + MemberIndexList() : QList<MemberDef>() {} + ~MemberIndexList() {} + int compareItems(GCI item1, GCI item2) + { + MemberDef *md1=(MemberDef *)item1; + MemberDef *md2=(MemberDef *)item2; + return stricmp(md1->name(),md2->name()); + } +}; + +#define MEMBER_INDEX_ENTRIES 128 + +static MemberIndexList g_memberIndexLetterUsed[CMHL_Total][MEMBER_INDEX_ENTRIES]; +static MemberIndexList g_fileIndexLetterUsed[FMHL_Total][MEMBER_INDEX_ENTRIES]; +static MemberIndexList g_namespaceIndexLetterUsed[NMHL_Total][MEMBER_INDEX_ENTRIES]; + static bool g_classIndexLetterUsed[CHL_Total][256]; const int maxItemsBeforeQuickIndex = MAX_ITEMS_BEFORE_QUICK_INDEX; @@ -329,7 +332,9 @@ void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level) if (cd->isLinkable()) { //printf("Writing class %s\n",cd->displayName().data()); - ol.writeIndexItem(cd->getReference(),cd->getOutputFileBase(),cd->displayName()); + ol.startIndexItem(cd->getReference(),cd->getOutputFileBase()); + ol.parseText(cd->displayName()); + ol.endIndexItem(cd->getReference(),cd->getOutputFileBase()); if (cd->isReference()) { ol.startTypewriter(); @@ -347,7 +352,9 @@ void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level) } else { - ol.writeIndexItem(0,0,cd->name()); + ol.startIndexItem(0,0); + ol.parseText(cd->name()); + ol.endIndexItem(0,0); if (hasHtmlHelp) { htmlHelp->addContentsItem(hasChildren,cd->displayName(),0); @@ -548,7 +555,9 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started) { //printf("Writing class %s isLinkable()=%d isLinkableInProject()=%d cd->templateMaster()=%p\n", // cd->displayName().data(),cd->isLinkable(),cd->isLinkableInProject(),cd->templateMaster()); - ol.writeIndexItem(cd->getReference(),cd->getOutputFileBase(),cd->displayName()); + ol.startIndexItem(cd->getReference(),cd->getOutputFileBase()); + ol.parseText(cd->displayName()); + ol.endIndexItem(cd->getReference(),cd->getOutputFileBase()); if (cd->isReference()) { ol.startTypewriter(); @@ -566,7 +575,9 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started) } else { - ol.writeIndexItem(0,0,cd->displayName()); + ol.startIndexItem(0,0); + ol.parseText(cd->displayName()); + ol.endIndexItem(0,0); if (hasHtmlHelp) { htmlHelp->addContentsItem(hasChildren,cd->displayName(),0); @@ -602,12 +613,12 @@ void writeClassHierarchy(OutputList &ol) ftvHelp = FTVHelp::getInstance(); } - initClassHierarchy(&Doxygen::classSDict); - initClassHierarchy(&Doxygen::hiddenClasses); + initClassHierarchy(Doxygen::classSDict); + initClassHierarchy(Doxygen::hiddenClasses); bool started=FALSE; - writeClassTreeForList(ol,&Doxygen::classSDict,started); - writeClassTreeForList(ol,&Doxygen::hiddenClasses,started); + writeClassTreeForList(ol,Doxygen::classSDict,started); + writeClassTreeForList(ol,Doxygen::hiddenClasses,started); if (started) { endIndexHierarchy(ol,0); @@ -642,10 +653,10 @@ static int countClassesInTreeList(const ClassSDict &cl) int countClassHierarchy() { int count=0; - initClassHierarchy(&Doxygen::classSDict); - initClassHierarchy(&Doxygen::hiddenClasses); - count+=countClassesInTreeList(Doxygen::classSDict); - count+=countClassesInTreeList(Doxygen::hiddenClasses); + initClassHierarchy(Doxygen::classSDict); + initClassHierarchy(Doxygen::hiddenClasses); + count+=countClassesInTreeList(*Doxygen::classSDict); + count+=countClassesInTreeList(*Doxygen::hiddenClasses); return count; } @@ -751,7 +762,7 @@ void countFiles(int &htmlFiles,int &files) { htmlFiles=0; files=0; - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -821,7 +832,7 @@ void writeFileIndex(OutputList &ol) 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(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -845,7 +856,7 @@ void writeFileIndex(OutputList &ol) } fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } } @@ -857,7 +868,7 @@ void writeFileIndex(OutputList &ol) } else { - fl = Doxygen::inputNameList.first(); + fl = Doxygen::inputNameList->first(); } while (fl) { @@ -953,7 +964,7 @@ void writeFileIndex(OutputList &ol) } else { - fl=Doxygen::inputNameList.next(); + fl=Doxygen::inputNameList->next(); } } ol.endIndexList(); @@ -973,7 +984,7 @@ void writeFileIndex(OutputList &ol) int countNamespaces() { int count=0; - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (;(nd=nli.current());++nli) { @@ -1038,7 +1049,7 @@ void writeNamespaceIndex(OutputList &ol) bool first=TRUE; - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { @@ -1101,7 +1112,7 @@ int countAnnotatedClasses() { int count=0; //ClassDef *cd=Doxygen::classList.first(); - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (;(cd=cli.current());++cli) { @@ -1122,7 +1133,7 @@ void writeAnnotatedClassList(OutputList &ol) bool hasHtmlHelp = generateHtml && Config_getBool("GENERATE_HTMLHELP"); bool hasFtvHelp = generateHtml && Config_getBool("GENERATE_TREEVIEW"); ol.startIndexList(); - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; // clear index @@ -1236,7 +1247,7 @@ void writeAlphabeticalClassList(OutputList &ol) memset (indexLetterUsed, 0, sizeof (indexLetterUsed)); // first count the number of headers - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; uint startLetter=0; int headerItems=0; @@ -1506,15 +1517,130 @@ void writeAnnotatedIndex(OutputList &ol) } //---------------------------------------------------------------------------- +static void writeClassLinkForMember(OutputList &ol,MemberDef *md,const char *separator, + QCString &prevClassName) +{ + ClassDef *cd=md->getClassDef(); + if ( cd && prevClassName!=cd->displayName()) + { + ol.docify(separator); + ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), + cd->displayName()); + ol.writeString("\n"); + prevClassName = cd->displayName(); + } +} -void writeMemberList(OutputList &ol,bool useSections, - ClassMemberHighlight filter,char sectionFilter) +static void writeFileLinkForMember(OutputList &ol,MemberDef *md,const char *separator, + QCString &prevFileName) { + FileDef *fd=md->getFileDef(); + if (fd && prevFileName!=fd->name()) + { + ol.docify(separator); + ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), + fd->name()); + ol.writeString("\n"); + prevFileName = fd->name(); + } +} + +static void writeNamespaceLinkForMember(OutputList &ol,MemberDef *md,const char *separator, + QCString &prevNamespaceName) +{ + NamespaceDef *nd=md->getNamespaceDef(); + if (nd && prevNamespaceName!=nd->name()) + { + ol.docify(separator); + ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), + nd->name()); + ol.writeString("\n"); + prevNamespaceName = nd->name(); + } +} + +typedef void (*writeLinkForMember_t)(OutputList &ol,MemberDef *md,const char *separator, + QCString &prevNamespaceName); + +static void writeMemberList(OutputList &ol,bool useSections,int page, + MemberIndexList memberLists[MEMBER_INDEX_ENTRIES], + DefinitionIntf::DefType type) +{ + int pi; + int startIndex = page==-1 ? 0 : page; + int endIndex = page==-1 ? MEMBER_INDEX_ENTRIES-1 : page; + ASSERT((int)type<3); + static writeLinkForMember_t writeLinkForMemberMap[3] = + { + &writeClassLinkForMember, + &writeFileLinkForMember, + &writeNamespaceLinkForMember + }; + QCString prevName; + QCString prevDefName; + bool first=TRUE; + bool firstSection=TRUE; + for (pi=startIndex; pi<=endIndex; pi++) // page==-1 => pi=[0..127], page!=-1 => pi=page + { + MemberIndexList *ml = &memberLists[pi]; + if (ml->count()==0) continue; + ml->sort(); + QListIterator<MemberDef> mli(*ml); + MemberDef *md; + for (mli.toFirst();(md=mli.current());++mli) + { + char *sep; + bool isFunc=!md->isObjCMethod() && + (md->isFunction() || md->isSlot() || md->isSignal()); + QCString name=md->name(); + if (name!=prevName) // same entry + { + if ((prevName.isEmpty() || tolower(name.at(0))!=tolower(prevName.at(0))) && useSections) // new section + { + if (!firstSection) ol.endItemList(); + char cs[2]; + cs[0]=tolower(name.at(0));cs[1]='\0'; + QCString anchor=(QCString)"index_"+cs; + QCString title=(QCString)"- "+cs+" -"; + ol.startSection(anchor,title,SectionInfo::Subsection); + ol.docify(title); + ol.endSection(anchor,SectionInfo::Subsection); + ol.startItemList(); + firstSection=FALSE; + } + else if (!useSections && first) + { + ol.startItemList(); + first=FALSE; + } + + // member name + ol.writeListItem(); + ol.docify(name); + if (isFunc) ol.docify("()"); + ol.writeString("\n"); + + // link to class + prevDefName=""; + sep = ": "; + prevName = name; + } + else // same entry + { + sep = ", "; + // link to class for other members with the same name + } + writeLinkForMemberMap[(int)type](ol,md,sep,prevDefName); + } + } + ol.endItemList(); + +#if 0 bool first = TRUE; char lastChar = 0; static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -1608,16 +1734,98 @@ void writeMemberList(OutputList &ol,bool useSections, } } ol.endItemList(); +#endif } //---------------------------------------------------------------------------- +void initClassMemberIndices() +{ + int i=0; + int j=0; + for (j=0;j<CMHL_Total;j++) + { + documentedClassMembers[j]=0; + for (i=0;i<MEMBER_INDEX_ENTRIES;i++) + { + g_memberIndexLetterUsed[j][i].clear(); + } + } +} + +void addClassMemberNameToIndex(MemberDef *md) +{ + static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); + ClassDef *cd; + if (md->isLinkableInProject() && + (cd=md->getClassDef()) && + cd->isLinkableInProject() && + cd->templateMaster()==0) + { + QCString n = md->name(); + int letter = tolower(n.at(0)) & 0x7f; + if (!n.isEmpty()) + { + bool isFriendToHide = hideFriendCompounds && + (QCString(md->typeString())=="friend class" || + QCString(md->typeString())=="friend struct" || + QCString(md->typeString())=="friend union"); + if (!(md->isFriend() && isFriendToHide)) + { + g_memberIndexLetterUsed[CMHL_All][letter].append(md); + documentedClassMembers[CMHL_All]++; + } + if (md->isFunction() || md->isSlot() || md->isSignal()) + { + g_memberIndexLetterUsed[CMHL_Functions][letter].append(md); + documentedClassMembers[CMHL_Functions]++; + } + else if (md->isVariable()) + { + g_memberIndexLetterUsed[CMHL_Variables][letter].append(md); + documentedClassMembers[CMHL_Variables]++; + } + else if (md->isTypedef()) + { + g_memberIndexLetterUsed[CMHL_Typedefs][letter].append(md); + documentedClassMembers[CMHL_Typedefs]++; + } + else if (md->isEnumerate()) + { + g_memberIndexLetterUsed[CMHL_Enums][letter].append(md); + documentedClassMembers[CMHL_Enums]++; + } + else if (md->isEnumValue()) + { + g_memberIndexLetterUsed[CMHL_EnumValues][letter].append(md); + documentedClassMembers[CMHL_EnumValues]++; + } + else if (md->isProperty()) + { + g_memberIndexLetterUsed[CMHL_Properties][letter].append(md); + documentedClassMembers[CMHL_Properties]++; + } + else if (md->isEvent()) + { + g_memberIndexLetterUsed[CMHL_Events][letter].append(md); + documentedClassMembers[CMHL_Events]++; + } + else if (md->isRelated() || (md->isFriend() && !isFriendToHide)) + { + g_memberIndexLetterUsed[CMHL_Related][letter].append(md); + documentedClassMembers[CMHL_Related]++; + } + } + } +} + +#if 0 int countClassMembers(int filter) { static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); int i=0;for (i=0;i<256;i++) g_memberIndexLetterUsed[filter][i]=FALSE; int count=0; - MemberNameSDict::Iterator mnli(Doxygen::memberNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -1659,10 +1867,211 @@ int countClassMembers(int filter) } return count; } +#endif + +//---------------------------------------------------------------------------- + +void initNamespaceMemberIndices() +{ + int i=0; + int j=0; + for (j=0;j<NMHL_Total;j++) + { + documentedNamespaceMembers[j]=0; + for (i=0;i<MEMBER_INDEX_ENTRIES;i++) + { + g_namespaceIndexLetterUsed[j][i].clear(); + } + } +} + +void addNamespaceMemberNameToIndex(MemberDef *md) +{ + NamespaceDef *nd=md->getNamespaceDef(); + if (nd && nd->isLinkableInProject() && md->isLinkableInProject()) + { + QCString n = md->name(); + int letter = tolower(n.at(0)); + if (!n.isEmpty()) + { + g_namespaceIndexLetterUsed[NMHL_All][letter].append(md); + documentedNamespaceMembers[NMHL_All]++; + + if (md->isFunction()) + { + g_namespaceIndexLetterUsed[NMHL_Functions][letter].append(md); + documentedNamespaceMembers[NMHL_Functions]++; + } + else if (md->isVariable()) + { + g_namespaceIndexLetterUsed[NMHL_Variables][letter].append(md); + documentedNamespaceMembers[NMHL_Variables]++; + } + else if (md->isTypedef()) + { + g_namespaceIndexLetterUsed[NMHL_Typedefs][letter].append(md); + documentedNamespaceMembers[NMHL_Typedefs]++; + } + else if (md->isEnumerate()) + { + g_namespaceIndexLetterUsed[NMHL_Enums][letter].append(md); + documentedNamespaceMembers[NMHL_Enums]++; + } + else if (md->isEnumValue()) + { + g_namespaceIndexLetterUsed[NMHL_EnumValues][letter].append(md); + documentedNamespaceMembers[NMHL_EnumValues]++; + } + } + } +} + +#if 0 +int countNamespaceMembers(int filter) +{ + int i=0;for (i=0;i<256;i++) g_namespaceIndexLetterUsed[filter][i]=FALSE; + int count=0; + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); + MemberName *mn=0; + for (mnli.toFirst();(mn=mnli.current());++mnli) + { + MemberDef *md=mn->first(); + bool found=FALSE; + while (md && !found) + { + NamespaceDef *nd=md->getNamespaceDef(); + if (nd && nd->isLinkableInProject() && md->isLinkableInProject() && + ( filter==NMHL_All || + (filter==NMHL_Functions && md->isFunction()) || + (filter==NMHL_Variables && md->isVariable()) || + (filter==NMHL_Typedefs && md->isTypedef()) || + (filter==NMHL_Enums && md->isEnumerate()) || + (filter==NMHL_EnumValues && md->isEnumValue()) + ) + ) + { + QCString n = mn->memberName(); + if (!n.isEmpty()) g_namespaceIndexLetterUsed[filter][tolower(n.at(0))]=TRUE; + found=TRUE; + } + else + md=mn->next(); + } + if (found) count++; + } + return count; +} +#endif //---------------------------------------------------------------------------- -void writeQuickMemberIndex(OutputList &ol,bool *charUsed,int page, +void initFileMemberIndices() +{ + int i=0; + int j=0; + for (j=0;j<NMHL_Total;j++) + { + documentedFileMembers[j]=0; + for (i=0;i<MEMBER_INDEX_ENTRIES;i++) + { + g_fileIndexLetterUsed[j][i].clear(); + } + } +} + +void addFileMemberNameToIndex(MemberDef *md) +{ + FileDef *fd=md->getFileDef(); + if (fd && fd->isLinkableInProject() && md->isLinkableInProject()) + { + QCString n = md->name(); + int letter = tolower(n.at(0)); + if (!n.isEmpty()) + { + g_fileIndexLetterUsed[FMHL_All][letter].append(md); + documentedFileMembers[FMHL_All]++; + + if (md->isFunction()) + { + g_fileIndexLetterUsed[FMHL_Functions][letter].append(md); + documentedFileMembers[FMHL_Functions]++; + } + else if (md->isVariable()) + { + g_fileIndexLetterUsed[FMHL_Variables][letter].append(md); + documentedFileMembers[FMHL_Variables]++; + } + else if (md->isTypedef()) + { + g_fileIndexLetterUsed[FMHL_Typedefs][letter].append(md); + documentedFileMembers[FMHL_Typedefs]++; + } + else if (md->isEnumerate()) + { + g_fileIndexLetterUsed[FMHL_Enums][letter].append(md); + documentedFileMembers[FMHL_Enums]++; + } + else if (md->isEnumValue()) + { + g_fileIndexLetterUsed[FMHL_EnumValues][letter].append(md); + documentedFileMembers[FMHL_EnumValues]++; + } + else if (md->isDefine()) + { + g_fileIndexLetterUsed[FMHL_Defines][letter].append(md); + documentedFileMembers[FMHL_Defines]++; + } + } + } +} + +#if 0 +int countFileMembers(int filter) +{ + int i=0;for (i=0;i<256;i++) g_fileIndexLetterUsed[filter][i]=FALSE; + int count=0; + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); + MemberName *mn=0; + for (mnli.toFirst();(mn=mnli.current());++mnli) + { + MemberDef *md=mn->first(); + FileDef *fd; + bool found=FALSE; + while (md && !found) + { + if (md->isLinkableInProject() && + (fd=md->getFileDef()) && + fd->isLinkableInProject() && + ( filter==FMHL_All || + (filter==FMHL_Functions && md->isFunction()) || + (filter==FMHL_Variables && md->isVariable()) || + (filter==FMHL_Typedefs && md->isTypedef()) || + (filter==FMHL_Enums && md->isEnumerate()) || + (filter==FMHL_EnumValues && md->isEnumValue()) || + (filter==FMHL_Defines && md->isDefine()) + ) + ) + { + QCString n = mn->memberName(); + if (!n.isEmpty()) + { + g_fileIndexLetterUsed[filter][tolower(n.at(0))]=TRUE; + } + found=TRUE; + } + else + md=mn->next(); + } + if (found) count++; + } + return count; +} +#endif + +//---------------------------------------------------------------------------- + +void writeQuickMemberIndex(OutputList &ol, + MemberIndexList charUsed[MEMBER_INDEX_ENTRIES],int page, QCString fullName,bool multiPage) { bool first=TRUE; @@ -1671,7 +2080,7 @@ void writeQuickMemberIndex(OutputList &ol,bool *charUsed,int page, for (i=33;i<127;i++) { char is[2];is[0]=(char)i;is[1]='\0'; - if (charUsed[i]) + if (charUsed[i].count()>0) { QCString anchor; QCString extension=Doxygen::htmlFileExtension; @@ -1734,7 +2143,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h bool first=TRUE; for (page=0;page<numPages;page++) { - if (!multiPageIndex || g_memberIndexLetterUsed[hl][page]) + if (!multiPageIndex || g_memberIndexLetterUsed[hl][page].count()>0) { QCString fileName = cmhlInfo[hl].fname; if (multiPageIndex && !first) @@ -1786,7 +2195,10 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h ol.writeString(" "); } ol.newParagraph(); - writeMemberList(ol,quickIndex,hl,page); + writeMemberList(ol,quickIndex, + multiPageIndex?page:-1, + g_memberIndexLetterUsed[hl], + Definition::TypeClass); endFile(ol); first=FALSE; } @@ -1828,6 +2240,7 @@ void writeClassMemberIndex(OutputList &ol) //---------------------------------------------------------------------------- +#if 0 static void writeFileMemberList(OutputList &ol, bool useSections, FileMemberHighlight filter, @@ -1835,7 +2248,7 @@ static void writeFileMemberList(OutputList &ol, { char lastChar=0; bool first=TRUE; - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -1933,7 +2346,7 @@ void writeNamespaceMemberList(OutputList &ol,bool useSections, { char lastChar=0; bool first=TRUE; - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); + MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn=0; for (mnli.toFirst();(mn=mnli.current());++mnli) { @@ -2016,88 +2429,10 @@ void writeNamespaceMemberList(OutputList &ol,bool useSections, } if (!first) ol.endItemList(); } +#endif //---------------------------------------------------------------------------- -int countNamespaceMembers(int filter) -{ - int i=0;for (i=0;i<256;i++) g_namespaceIndexLetterUsed[filter][i]=FALSE; - int count=0; - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); - MemberName *mn=0; - for (mnli.toFirst();(mn=mnli.current());++mnli) - { - MemberDef *md=mn->first(); - bool found=FALSE; - while (md && !found) - { - NamespaceDef *nd=md->getNamespaceDef(); - if (nd && nd->isLinkableInProject() && md->isLinkableInProject() && - ( filter==NMHL_All || - (filter==NMHL_Functions && md->isFunction()) || - (filter==NMHL_Variables && md->isVariable()) || - (filter==NMHL_Typedefs && md->isTypedef()) || - (filter==NMHL_Enums && md->isEnumerate()) || - (filter==NMHL_EnumValues && md->isEnumValue()) - ) - ) - { - QCString n = mn->memberName(); - if (!n.isEmpty()) g_namespaceIndexLetterUsed[filter][tolower(n.at(0))]=TRUE; - found=TRUE; - } - else - md=mn->next(); - } - if (found) count++; - } - return count; -} - -//---------------------------------------------------------------------------- - -int countFileMembers(int filter) -{ - int i=0;for (i=0;i<256;i++) g_fileIndexLetterUsed[filter][i]=FALSE; - int count=0; - MemberNameSDict::Iterator mnli(Doxygen::functionNameSDict); - MemberName *mn=0; - for (mnli.toFirst();(mn=mnli.current());++mnli) - { - MemberDef *md=mn->first(); - FileDef *fd; - bool found=FALSE; - while (md && !found) - { - if (md->isLinkableInProject() && - (fd=md->getFileDef()) && - fd->isLinkableInProject() && - ( filter==FMHL_All || - (filter==FMHL_Functions && md->isFunction()) || - (filter==FMHL_Variables && md->isVariable()) || - (filter==FMHL_Typedefs && md->isTypedef()) || - (filter==FMHL_Enums && md->isEnumerate()) || - (filter==FMHL_EnumValues && md->isEnumValue()) || - (filter==FMHL_Defines && md->isDefine()) - ) - ) - { - QCString n = mn->memberName(); - if (!n.isEmpty()) - { - g_fileIndexLetterUsed[filter][tolower(n.at(0))]=TRUE; - } - found=TRUE; - } - else - md=mn->next(); - } - if (found) count++; - } - return count; -} - -//---------------------------------------------------------------------------- static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) { @@ -2137,7 +2472,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) bool first=TRUE; for (page=0;page<numPages;page++) { - if (!multiPageIndex || g_fileIndexLetterUsed[hl][page]) + if (!multiPageIndex || g_fileIndexLetterUsed[hl][page].count()>0) { QCString fileName = fmhlInfo[hl].fname; if (multiPageIndex && !first) @@ -2188,7 +2523,11 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) ol.writeString(" "); } ol.newParagraph(); - writeFileMemberList(ol,quickIndex,hl,page); + //writeFileMemberList(ol,quickIndex,hl,page); + writeMemberList(ol,quickIndex, + multiPageIndex?page:-1, + g_fileIndexLetterUsed[hl], + Definition::TypeFile); endFile(ol); first=FALSE; } @@ -2266,7 +2605,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, bool first=TRUE; for (page=0;page<numPages;page++) { - if (!multiPageIndex || g_namespaceIndexLetterUsed[hl][page]) + if (!multiPageIndex || g_namespaceIndexLetterUsed[hl][page].count()>0) { QCString fileName = nmhlInfo[hl].fname; if (multiPageIndex && !first) @@ -2315,7 +2654,11 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, } ol.newParagraph(); - writeNamespaceMemberList(ol,quickIndex,hl,page); + //writeNamespaceMemberList(ol,quickIndex,hl,page); + writeMemberList(ol,quickIndex, + multiPageIndex?page:-1, + g_namespaceIndexLetterUsed[hl], + Definition::TypeNamespace); endFile(ol); } } @@ -2547,7 +2890,9 @@ void writePageIndex(OutputList &ol) bool hasSubPages = pd->hasSubPages(); - ol.writeIndexItem(pd->getReference(),pd->getOutputFileBase(),pageTitle); + ol.startIndexItem(pd->getReference(),pd->getOutputFileBase()); + ol.parseText(pageTitle); + ol.endIndexItem(pd->getReference(),pd->getOutputFileBase()); if (pd->isReference()) { ol.startTypewriter(); @@ -2584,7 +2929,7 @@ void writePageIndex(OutputList &ol) int countGroups() { int count=0; - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -2602,7 +2947,7 @@ int countGroups() int countDirs() { int count=0; - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; for (dli.toFirst();(dd=dli.current());++dli) { @@ -2757,7 +3102,9 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) //parseText(ol,gd->groupTitle()); //ol.endTextLink(); - ol.writeIndexItem(gd->getReference(),gd->getOutputFileBase(),gd->groupTitle()); + ol.startIndexItem(gd->getReference(),gd->getOutputFileBase()); + ol.parseText(gd->groupTitle()); + ol.endIndexItem(gd->getReference(),gd->getOutputFileBase()); if (gd->isReference()) { ol.startTypewriter(); @@ -3033,7 +3380,7 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) void writeGroupHierarchy(OutputList &ol) { startIndexHierarchy(ol,0); - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { @@ -3085,8 +3432,9 @@ void writeDirTreeNode(OutputList &ol, DirDef *dd,int level) ftvHelp->incContentsDepth(); } - ol.writeIndexItem(dd->getReference(),dd->getOutputFileBase(), - dd->shortName()); + ol.startIndexItem(dd->getReference(),dd->getOutputFileBase()); + ol.parseText(dd->shortName()); + ol.endIndexItem(dd->getReference(),dd->getOutputFileBase()); if (dd->isReference()) { ol.startTypewriter(); @@ -3132,7 +3480,7 @@ void writeDirTreeNode(OutputList &ol, DirDef *dd,int level) void writeDirHierarchy(OutputList &ol) { startIndexHierarchy(ol,0); - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; for (dli.toFirst();(dd=dli.current());++dli) { diff --git a/src/index.h b/src/index.h index 7e30e0a..90dc11f 100644 --- a/src/index.h +++ b/src/index.h @@ -21,6 +21,8 @@ #include "qtbc.h" #include <qfile.h> +class MemberDef; + enum IndexSections { isTitlePageStart, @@ -166,4 +168,11 @@ void startFile(OutputList &ol,const char *name,const char *manName, const char *title,HighlightedItem hli=HLI_None); void endFile(OutputList &ol,bool external=FALSE); +void initClassMemberIndices(); +void initFileMemberIndices(); +void initNamespaceMemberIndices(); +void addClassMemberNameToIndex(MemberDef *md); +void addFileMemberNameToIndex(MemberDef *md); +void addNamespaceMemberNameToIndex(MemberDef *md); + #endif diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 0e61bd0..df39700 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -520,7 +520,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; case isModuleDocumentation: { - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; bool found=FALSE; for (gli.toFirst();(gd=gli.current()) && !found;++gli) @@ -536,7 +536,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; case isDirDocumentation: { - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; bool found=FALSE; for (dli.toFirst();(dd=dli.current()) && !found;++dli) @@ -552,7 +552,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; case isNamespaceDocumentation: { - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; bool found=FALSE; for (nli.toFirst();(nd=nli.current()) && !found;++nli) @@ -568,7 +568,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; case isClassDocumentation: { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) @@ -585,7 +585,7 @@ void LatexGenerator::startIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -603,7 +603,7 @@ void LatexGenerator::startIndexSection(IndexSections is) } fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } } break; @@ -670,7 +670,7 @@ void LatexGenerator::endIndexSection(IndexSections is) break; case isModuleDocumentation: { - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; bool found=FALSE; for (gli.toFirst();(gd=gli.current()) && !found;++gli) @@ -693,7 +693,7 @@ void LatexGenerator::endIndexSection(IndexSections is) break; case isDirDocumentation: { - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; bool found=FALSE; for (dli.toFirst();(dd=dli.current()) && !found;++dli) @@ -716,7 +716,7 @@ void LatexGenerator::endIndexSection(IndexSections is) break; case isNamespaceDocumentation: { - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; bool found=FALSE; for (nli.toFirst();(nd=nli.current()) && !found;++nli) @@ -740,7 +740,7 @@ void LatexGenerator::endIndexSection(IndexSections is) break; case isClassDocumentation: { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) @@ -764,7 +764,7 @@ void LatexGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -785,7 +785,7 @@ void LatexGenerator::endIndexSection(IndexSections is) } fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } } break; @@ -870,18 +870,21 @@ void LatexGenerator::writeString(const char *text) t << text; } -void LatexGenerator::writeIndexItem(const char *ref,const char *fn, - const char *name) +void LatexGenerator::startIndexItem(const char *ref,const char *fn) { t << "\\item "; if (!ref && fn) { t << "\\contentsline{section}{"; - docify(name); + } +} + +void LatexGenerator::endIndexItem(const char *ref,const char *fn) +{ + if (!ref && fn) + { t << "}{\\pageref{" << fn << "}}{}" << endl; } - else - docify(name); } //void LatexGenerator::writeIndexFileItem(const char *,const char *text) @@ -999,7 +1002,7 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, } else { - t << "\\bf{"; + t << "{\\bf"; docify(text); t << "}"; } @@ -1007,7 +1010,7 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, void LatexGenerator::startPageRef() { - t << " \\doxyref{"; + t << " \\doxyref{}{"; } void LatexGenerator::endPageRef(const char *clname, const char *anchor) diff --git a/src/latexgen.h b/src/latexgen.h index 23f87ce..2a502e4 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -70,7 +70,8 @@ class LatexGenerator : public OutputGenerator void endIndexValue(const char *,bool); void startItemList() { t << "\\begin{CompactItemize}" << endl; } void endItemList() { t << "\\end{CompactItemize}" << endl; } - void writeIndexItem(const char *ref,const char *file,const char *name); + void startIndexItem(const char *ref,const char *file); + void endIndexItem(const char *ref,const char *file); void docify(const char *text); void codify(const char *text); void writeObjectLink(const char *ref,const char *file, diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index 62b8d33..957e056 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -60,15 +60,18 @@ HEADERS = bufstr.h \ language.h \ latexdocvisitor.h \ latexgen.h \ + lockingptr.h \ logos.h \ mandocvisitor.h \ mangen.h \ + marshal.h \ memberdef.h \ membergroup.h \ memberlist.h \ membername.h \ message.h \ namespacedef.h \ + objcache.h \ outputgen.h \ outputlist.h \ pagedef.h \ @@ -88,6 +91,7 @@ HEADERS = bufstr.h \ search_php.h \ section.h \ sortdict.h \ + store.h \ tagreader.h \ translator.h \ translator_adapter.h \ @@ -167,12 +171,14 @@ SOURCES = ce_lex.cpp \ logos.cpp \ mandocvisitor.cpp \ mangen.cpp \ + marshal.cpp \ memberdef.cpp \ membergroup.cpp \ memberlist.cpp \ membername.cpp \ message.cpp \ namespacedef.cpp \ + objcache.cpp \ outputgen.cpp \ outputlist.cpp \ pagedef.cpp \ @@ -187,6 +193,7 @@ SOURCES = ce_lex.cpp \ rtfstyle.cpp \ scanner.cpp \ searchindex.cpp \ + store.cpp \ tagreader.cpp \ translator.cpp \ util.cpp \ diff --git a/src/lockingptr.h b/src/lockingptr.h new file mode 100644 index 0000000..e981056 --- /dev/null +++ b/src/lockingptr.h @@ -0,0 +1,165 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2006 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef LOCKINGPTR_H +#define LOCKINGPTR_H + +/*! @brief Abstract interface for lockable objects. + * + * By implementing this interface, a smart pointer can be created which + * will lock this object. This is used to prevent that an internal pointer + * owned by a lockable object would become invalid when the object is removed from + * memory, leaving the client with an invalid pointer. By letting the client use + * a smart pointer instead of the real object the object will be locked into + * memory until the pointer is no longer used, at which point the owner object will be + * unlock and can be removed from memory. + */ +class LockableObj +{ + public: + LockableObj() : m_lockCount(0) {} + virtual ~LockableObj() {} + + /*! Returns TRUE if the object is currently locked. */ + bool isLocked() const { return m_lockCount>0; } + +#ifndef _WIN32 + protected: +#endif + /*! Called when the object is locked. */ + virtual void lock() const = 0; + + /*! Called when the object is unlocked. */ + virtual void unlock() const = 0; + +#ifndef _WIN32 // HACK: VC++ 6.0 does not understand friend template classes. + private: + template<class T> friend class LockingPtr; +#endif + + int m_lockCount; +}; + +/*! @brief Smart pointer which keeps a lock on the owner of the pointer. + * + * With the pointer an owner object derived from LockableObj is associated. + * As long as the smart object exists it will keep a lock on the obj by calling + * LockableObj::lock(). Smart pointers can be copied and passed by value. As + * soon as there or no more smart pointer references to the object, + * LockableObj::unlock() will be called automatically. + */ +template<class T> class LockingPtr +{ + LockableObj *m_owner; + const T *m_ptr; + + public: + /*! Creates a smart pointer for pointer \a p owned by object \a o. + */ + LockingPtr(const LockableObj *o,const T* p) + { + if (o->m_lockCount==0) o->lock(); + m_owner = (LockableObj *)o; + m_owner->m_lockCount++; + m_ptr = p; + } + + /*! Copies the smart pointer \a lp + */ + LockingPtr(const LockingPtr &lp) + { + m_ptr = lp.m_ptr; + m_owner = lp.m_owner; + m_owner->m_lockCount++; + } + + /*! Assigns the smart pointer \a lp + */ + LockingPtr &operator=(const LockingPtr &lp) + { + m_owner->m_lockCount--; + if (m_owner->m_lockCount==0) // no more references + { + m_owner->unlock(); + } + m_ptr = lp.m_ptr; + m_owner = lp.m_owner; + m_owner->m_lockCount++; + return *this; + } + + /*! Destroys the smart pointer, will unlock the owner. + */ + ~LockingPtr() + { + m_owner->m_lockCount--; + if (m_owner->m_lockCount==0) // no more references + { + m_owner->unlock(); + } + } + + bool isNull() const + { + return m_ptr==0; + } + + bool operator!() const + { + return !m_ptr; + } + + bool operator==(T *p) const + { + return m_ptr==p; + } + + bool operator==(const LockingPtr &lp) const + { + return m_ptr==lp.m_ptr; + } + + bool operator!=(T *p) const + { + return m_ptr!=p; + } + + bool operator!=(const LockingPtr &lp) const + { + return m_ptr!=lp.m_ptr; + } + + /*! Dereference operator */ + const T& operator* () const + { + return *m_ptr; + } + + T* pointer() const + { + return (T*)m_ptr; + } + + /*! Pointer operator */ + T* operator-> () const + { + return (T*)m_ptr; + } +}; + +#endif // LOCKINGPTR_H + diff --git a/src/mangen.cpp b/src/mangen.cpp index 278c267..6eeb184 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -184,8 +184,11 @@ void ManGenerator::writeString(const char *text) docify(text); } -void ManGenerator::writeIndexItem(const char *,const char *, - const char *) +void ManGenerator::startIndexItem(const char *,const char *) +{ +} + +void ManGenerator::endIndexItem(const char *,const char *) { } diff --git a/src/mangen.h b/src/mangen.h index 738fd65..9908977 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -74,7 +74,8 @@ class ManGenerator : public OutputGenerator //void startAlphabeticalIndexList() {} //void endAlphabeticalIndexList() {} //void writeIndexHeading(const char *) {} - void writeIndexItem(const char *ref,const char *file,const char *name); + void startIndexItem(const char *ref,const char *file); + void endIndexItem(const char *ref,const char *file); void docify(const char *text); void codify(const char *text); void writeObjectLink(const char *ref,const char *file, diff --git a/src/marshal.cpp b/src/marshal.cpp new file mode 100644 index 0000000..a625369 --- /dev/null +++ b/src/marshal.cpp @@ -0,0 +1,639 @@ +#include <qfile.h> +#include <assert.h> + +#include "sortdict.h" +#include "marshal.h" +#include "entry.h" +#include "section.h" +#include "memberlist.h" +#include "definition.h" +#include "groupdef.h" +#include "example.h" + + +void marshalInt(StorageIntf *s,int v) +{ + uchar b[4]; + b[0]=((uint)v)>>24; + b[1]=(((uint)v)>>16)&0xff; + b[2]=(((uint)v)>>8)&0xff; + b[3]=v&0xff; + s->write((const char *)b,4); +} + +void marshalUInt(StorageIntf *s,uint v) +{ + uchar b[4]; + b[0]=v>>24; + b[1]=(v>>16)&0xff; + b[2]=(v>>8)&0xff; + b[3]=v&0xff; + s->write((const char *)b,4); +} + +void marshalBool(StorageIntf *s,bool b) +{ + char c = b; + s->write(&c,sizeof(char)); +} + +void marshalQCString(StorageIntf *s,const QCString &str) +{ + uint l=str.length(); + marshalUInt(s,l); + if (l>0) s->write(str.data(),l); +} + +void marshalQGString(StorageIntf *s,const QGString &str) +{ + uint l=str.length(); + marshalUInt(s,l); + if (l>0) s->write(str.data(),l); +} + +void marshalArgumentList(StorageIntf *s,ArgumentList *argList) +{ + if (argList==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,argList->count()); + if (argList->count()>0) + { + ArgumentListIterator ali(*argList); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) + { + marshalQCString(s,a->attrib); + marshalQCString(s,a->type); + marshalQCString(s,a->canType); + marshalQCString(s,a->name); + marshalQCString(s,a->array); + marshalQCString(s,a->defval); + marshalQCString(s,a->docs); + } + } + marshalBool(s,argList->constSpecifier); + marshalBool(s,argList->volatileSpecifier); + marshalBool(s,argList->pureSpecifier); + } +} + +void marshalArgumentLists(StorageIntf *s,QList<ArgumentList> *argLists) +{ + if (argLists==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,argLists->count()); + QListIterator<ArgumentList> ali(*argLists); + ArgumentList *al; + for (ali.toFirst();(al=ali.current());++ali) + { + marshalArgumentList(s,al); + } + } +} + +void marshalBaseInfoList(StorageIntf *s, QList<BaseInfo> *baseList) +{ + if (baseList==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,baseList->count()); + QListIterator<BaseInfo> bli(*baseList); + BaseInfo *bi; + for (bli.toFirst();(bi=bli.current());++bli) + { + marshalQCString(s,bi->name); + marshalInt(s,(int)bi->prot); + marshalInt(s,(int)bi->virt); + } + } +} + +void marshalGroupingList(StorageIntf *s, QList<Grouping> *groups) +{ + if (groups==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,groups->count()); + QListIterator<Grouping> gli(*groups); + Grouping *g; + for (gli.toFirst();(g=gli.current());++gli) + { + marshalQCString(s,g->groupname); + marshalInt(s,(int)g->pri); + } + } +} + +void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors) +{ + if (anchors==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,anchors->count()); + QListIterator<SectionInfo> sli(*anchors); + SectionInfo *si; + for (sli.toFirst();(si=sli.current());++sli) + { + marshalQCString(s,si->label); + marshalQCString(s,si->title); + marshalQCString(s,si->ref); + marshalInt(s,(int)si->type); + marshalQCString(s,si->fileName); + } + } +} + +void marshalItemInfoList(StorageIntf *s, QList<ListItemInfo> *sli) +{ + if (sli==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,sli->count()); + QListIterator<ListItemInfo> liii(*sli); + ListItemInfo *lii; + for (liii.toFirst();(lii=liii.current());++liii) + { + marshalQCString(s,lii->type); + marshalInt(s,lii->itemId); + } + } +} + +void marshalObjPointer(StorageIntf *s,void *obj) +{ + char *b = (char *)&obj; + s->write(b,sizeof(void *)); +} + +void marshalSectionDict(StorageIntf *s,SectionDict *sections) +{ + if (sections==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,sections->count()); + QDictIterator<SectionInfo> sli(*sections); + SectionInfo *si; + for (sli.toFirst();(si=sli.current());++sli) + { + marshalQCString(s,sli.currentKey()); + marshalObjPointer(s,si); + } + } +} + +void marshalMemberSDict(StorageIntf *s,MemberSDict *memberSDict) +{ + if (memberSDict==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,memberSDict->count()); + //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); + SDict<MemberDef>::IteratorDict mdi(*memberSDict); + MemberDef *md; + int count=0; + for (mdi.toFirst();(md=mdi.current());++mdi) + { + //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); + marshalQCString(s,mdi.currentKey()); + marshalObjPointer(s,md); + count++; + } + assert(count==memberSDict->count()); + } +} + +void marshalDocInfo(StorageIntf *s,DocInfo *docInfo) +{ + if (docInfo==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,1); + marshalQCString(s,docInfo->doc); + marshalInt(s,docInfo->line); + marshalQCString(s,docInfo->file); + } +} + +void marshalBodyInfo(StorageIntf *s,BodyInfo *bodyInfo) +{ + if (bodyInfo==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,1); + marshalInt(s,bodyInfo->startLine); + marshalInt(s,bodyInfo->endLine); + marshalObjPointer(s,bodyInfo->fileDef); + } +} + +void marshalGroupList(StorageIntf *s,GroupList *groupList) +{ + if (groupList==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,groupList->count()); + QListIterator<GroupDef> gli(*groupList); + GroupDef *gd=0; + for (gli.toFirst();(gd=gli.current());++gli) + { + marshalObjPointer(s,gd); + } + } +} + +void marshalMemberList(StorageIntf *s,MemberList *ml) +{ + if (ml==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,1); // not a null pointer + ml->marshal(s); + } +} + +void marshalExampleSDict(StorageIntf *s,ExampleSDict *ed) +{ + if (ed==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,ed->count()); + //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); + SDict<Example>::IteratorDict edi(*ed); + Example *e; + for (edi.toFirst();(e=edi.current());++edi) + { + //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); + marshalQCString(s,edi.currentKey()); + marshalQCString(s,e->anchor); + marshalQCString(s,e->name); + marshalQCString(s,e->file); + } + } +} + +void marshalMemberLists(StorageIntf *s,SDict<MemberList> *mls) +{ + if (mls==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,mls->count()); + //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); + SDict<MemberList>::IteratorDict mli(*mls); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); + marshalQCString(s,mli.currentKey()); + marshalObjPointer(s,ml); // assume we are not owner of the list + } + } +} + +//------------------------------------------------------------------ + +int unmarshalInt(StorageIntf *s) +{ + uchar b[4]; + s->read((char *)b,4); + int result=(int)((((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]); + //printf("unmarshalInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); + return result; +} + +uint unmarshalUInt(StorageIntf *s) +{ + uchar b[4]; + s->read((char *)b,4); + uint result=(((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]; + //printf("unmarshalUInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); + return result; +} + +bool unmarshalBool(StorageIntf *s) +{ + char result; + s->read(&result,sizeof(result)); + //printf("unmarshalBool: %x offset=%llx\n",result,f.pos()); + return result; +} + +QCString unmarshalQCString(StorageIntf *s) +{ + uint len = unmarshalUInt(s); + //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos()); + QCString result(len+1); + result.at(len)='\0'; + if (len>0) + { + s->read(result.data(),len); + } + //printf("unmarshalQCString: result=%s\n",result.data()); + return result; +} + +QGString unmarshalQGString(StorageIntf *s) +{ + uint len = unmarshalUInt(s); + //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos()); + QGString result(len+1); + result.at(len)='\0'; + if (len>0) + { + s->read(result.data(),len); + } + //printf("unmarshalQCString: result=%s\n",result.data()); + return result; +} + +ArgumentList *unmarshalArgumentList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + ArgumentList *result = new ArgumentList; + assert(count<1000000); + //printf("unmarshalArgumentList: %d\n",count); + for (i=0;i<count;i++) + { + Argument *a = new Argument; + a->attrib = unmarshalQCString(s); + a->type = unmarshalQCString(s); + a->canType = unmarshalQCString(s); + a->name = unmarshalQCString(s); + a->array = unmarshalQCString(s); + a->defval = unmarshalQCString(s); + a->docs = unmarshalQCString(s); + result->append(a); + } + result->constSpecifier = unmarshalBool(s); + result->volatileSpecifier = unmarshalBool(s); + result->pureSpecifier = unmarshalBool(s); + return result; +} + +QList<ArgumentList> *unmarshalArgumentLists(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + QList<ArgumentList> *result = new QList<ArgumentList>; + result->setAutoDelete(TRUE); + assert(count<1000000); + //printf("unmarshalArgumentLists: %d\n",count); + for (i=0;i<count;i++) + { + result->append(unmarshalArgumentList(s)); + } + return result; +} + +QList<BaseInfo> *unmarshalBaseInfoList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + QList<BaseInfo> *result = new QList<BaseInfo>; + result->setAutoDelete(TRUE); + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString name = unmarshalQCString(s); + Protection prot = (Protection)unmarshalInt(s); + Specifier virt = (Specifier)unmarshalInt(s); + result->append(new BaseInfo(name,prot,virt)); + } + return result; +} + +QList<Grouping> *unmarshalGroupingList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + QList<Grouping> *result = new QList<Grouping>; + result->setAutoDelete(TRUE); + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString name = unmarshalQCString(s); + Grouping::GroupPri_t prio = (Grouping::GroupPri_t)unmarshalInt(s); + result->append(new Grouping(name,prio)); + } + return result; +} + +QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + QList<SectionInfo> *result = new QList<SectionInfo>; + result->setAutoDelete(TRUE); + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString label = unmarshalQCString(s); + QCString title = unmarshalQCString(s); + QCString ref = unmarshalQCString(s); + SectionInfo::SectionType type = (SectionInfo::SectionType)unmarshalInt(s); + QCString fileName = unmarshalQCString(s); + result->append(new SectionInfo(fileName,label,title,type,ref)); + } + return result; +} + +QList<ListItemInfo> *unmarshalItemInfoList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + QList<ListItemInfo> *result = new QList<ListItemInfo>; + result->setAutoDelete(TRUE); + assert(count<1000000); + for (i=0;i<count;i++) + { + ListItemInfo *lii = new ListItemInfo; + lii->type = unmarshalQCString(s); + lii->itemId = unmarshalInt(s); + result->append(lii); + } + return result; +} + +void *unmarshalObjPointer(StorageIntf *s) +{ + void *result; + s->read((char *)&result,sizeof(void*)); + return result; +} + +SectionDict *unmarshalSectionDict(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + //printf("unmarshalSectionDict count=%d\n",count); + if (count==NULL_LIST) return 0; // null list + SectionDict *result = new SectionDict(17); + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString key = unmarshalQCString(s); + SectionInfo *si = (SectionInfo *)unmarshalObjPointer(s); + //printf(" unmarshalSectionDict i=%d key=%s si=%s\n",count,key.data(),si->label.data()); + result->insert(key,si); + } + return result; +} + +MemberSDict *unmarshalMemberSDict(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + //printf("--- unmarshalMemberSDict count=%d\n",count); + if (count==NULL_LIST) + { + //printf("--- end unmarshalMemberSDict\n"); + return 0; // null list + } + MemberSDict *result = new MemberSDict; + assert(count<1000000); + //printf("Reading %d key-value pairs\n",count); + for (i=0;i<count;i++) + { + //printf(" unmarshaling pair %d\n",i); + QCString key = unmarshalQCString(s); + //printf(" unmarshaling key %s\n",key.data()); + MemberDef *md = (MemberDef *)unmarshalObjPointer(s); + //printf(" unmarshalMemberSDict i=%d key=%s md=%p\n",i,key.data(),md); + result->inSort(key,md); // note: this can lead to unmarshalling another object! + } + //printf("--- end unmarshalMemberSDict\n"); + return result; +} + +DocInfo *unmarshalDocInfo(StorageIntf *s) +{ + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; + DocInfo *result = new DocInfo; + result->doc = unmarshalQCString(s); + result->line = unmarshalInt(s); + result->file = unmarshalQCString(s); + return result; +} + +BodyInfo *unmarshalBodyInfo(StorageIntf *s) +{ + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; + BodyInfo *result = new BodyInfo; + result->startLine = unmarshalInt(s); + result->endLine = unmarshalInt(s); + result->fileDef = (FileDef*)unmarshalObjPointer(s); + return result; +} + +GroupList *unmarshalGroupList(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; // null list + assert(count<1000000); + GroupList *result = new GroupList; + for (i=0;i<count;i++) + { + GroupDef *gd = (GroupDef *)unmarshalObjPointer(s); + result->append(gd); + } + return result; +} + +MemberList *unmarshalMemberList(StorageIntf *s) +{ + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; + MemberList *ml = new MemberList; + ml->unmarshal(s); + return ml; +} + +ExampleSDict *unmarshalExampleSDict(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; + ExampleSDict *result = new ExampleSDict; + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString key = unmarshalQCString(s); + Example *e = new Example; + marshalQCString(s,e->anchor); + marshalQCString(s,e->name); + marshalQCString(s,e->file); + result->inSort(key,e); + } + return result; +} + +SDict<MemberList> *unmarshalMemberLists(StorageIntf *s) +{ + uint i; + uint count = unmarshalUInt(s); + if (count==NULL_LIST) return 0; + SDict<MemberList> *result = new SDict<MemberList>(7); + assert(count<1000000); + for (i=0;i<count;i++) + { + QCString key = unmarshalQCString(s); + MemberList *ml = (MemberList *)unmarshalObjPointer(s); + result->append(key,ml); + } + return result; +} + + diff --git a/src/marshal.h b/src/marshal.h new file mode 100644 index 0000000..dd751fa --- /dev/null +++ b/src/marshal.h @@ -0,0 +1,81 @@ +#ifndef MARSHAL_H +#define MARSHAL_H + +#include <qlist.h> +#include <qfile.h> +#include "sortdict.h" +#include "store.h" + +class ArgumentList; +class BaseInfo; +class Grouping; +class SectionInfo; +class ListItemInfo; +class QCString; +class QGString; +class SectionDict; +class MemberSDict; +class GroupList; +class BodyInfo; +class DocInfo; +class MemberList; +class ExampleSDict; + +#define NULL_LIST 0xffffffff + +class FileStorage : public QFile, public StorageIntf +{ + public: + FileStorage() : QFile() {} + FileStorage( const QString &name) : QFile(name) {} + int read(char *buf,uint size) { return QFile::readBlock(buf,size); } + int write(const char *buf,uint size) { return QFile::writeBlock(buf,size); } +}; + +//----- marshaling function: datatype -> byte stream -------------------- + +void marshalInt(StorageIntf *s,int v); +void marshalUInt(StorageIntf *s,uint v); +void marshalBool(StorageIntf *s,bool b); +void marshalQCString(StorageIntf *s,const QCString &str); +void marshalQGString(StorageIntf *s,const QGString &str); +void marshalArgumentList(StorageIntf *s,ArgumentList *argList); +void marshalArgumentLists(StorageIntf *s,QList<ArgumentList> *argLists); +void marshalBaseInfoList(StorageIntf *s, QList<BaseInfo> *baseList); +void marshalGroupingList(StorageIntf *s, QList<Grouping> *groups); +void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors); +void marshalItemInfoList(StorageIntf *s, QList<ListItemInfo> *sli); +void marshalObjPointer(StorageIntf *s,void *obj); +void marshalSectionDict(StorageIntf *s,SectionDict *sections); +void marshalMemberSDict(StorageIntf *s,MemberSDict *memberSDict); +void marshalDocInfo(StorageIntf *s,DocInfo *docInfo); +void marshalBodyInfo(StorageIntf *s,BodyInfo *bodyInfo); +void marshalGroupList(StorageIntf *s,GroupList *groupList); +void marshalMemberList(StorageIntf *s,MemberList *ml); +void marshalExampleSDict(StorageIntf *s,ExampleSDict *ed); +void marshalMemberLists(StorageIntf *s,SDict<MemberList> *mls); + +//----- unmarshaling function: byte stream -> datatype ------------------ + +int unmarshalInt(StorageIntf *s); +uint unmarshalUInt(StorageIntf *s); +bool unmarshalBool(StorageIntf *s); +QCString unmarshalQCString(StorageIntf *s); +QGString unmarshalQGString(StorageIntf *s); +ArgumentList * unmarshalArgumentList(StorageIntf *s); +QList<ArgumentList> *unmarshalArgumentLists(StorageIntf *s); +QList<BaseInfo> * unmarshalBaseInfoList(StorageIntf *s); +QList<Grouping> * unmarshalGroupingList(StorageIntf *s); +QList<SectionInfo> * unmarshalSectionInfoList(StorageIntf *s); +QList<ListItemInfo> *unmarshalItemInfoList(StorageIntf *s); +void * unmarshalObjPointer(StorageIntf *s); +SectionDict * unmarshalSectionDict(StorageIntf *s); +MemberSDict * unmarshalMemberSDict(StorageIntf *s); +DocInfo * unmarshalDocInfo(StorageIntf *s); +BodyInfo * unmarshalBodyInfo(StorageIntf *s); +GroupList * unmarshalGroupList(StorageIntf *s); +MemberList * unmarshalMemberList(StorageIntf *s); +ExampleSDict * unmarshalExampleSDict(StorageIntf *s); +SDict<MemberList> * unmarshalMemberLists(StorageIntf *s); + +#endif diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 3759a65..9ae8123 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -17,6 +17,7 @@ #include <stdio.h> #include <qregexp.h> +#include <assert.h> #include <md5.h> #include "memberdef.h" #include "membername.h" @@ -35,6 +36,10 @@ #include "dot.h" #include "searchindex.h" #include "parserintf.h" +#include "marshal.h" + +#define START_MARKER 0x4D454D5B // MEM[ +#define END_MARKER 0x4D454D5D // MEM] //----------------------------------------------------------------------------- @@ -79,7 +84,7 @@ static QCString addTemplateNames(const QCString &s,const QCString &n,const QCStr static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, const QCString & /*scopeName*/,MemberDef *md) { - ArgumentList *defArgList=(md->isDocsForDefinition() && !md->isProperty()) ? + LockingPtr<ArgumentList> defArgList=(md->isDocsForDefinition() && !md->isProperty()) ? md->argumentList() : md->declArgumentList(); //printf("writeDefArgumentList `%s' isDocsForDefinition()=%d\n",md->name().data(),md->isDocsForDefinition()); if (defArgList==0) @@ -285,6 +290,262 @@ static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) } //----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +class MemberDefImpl +{ + public: + MemberDefImpl(); + ~MemberDefImpl(); + void init(Definition *def,const char *t,const char *a,const char *e, + Protection p,Specifier v,bool s,bool r,MemberDef::MemberType mt, + const ArgumentList *tal,const ArgumentList *al + ); + + ClassDef *classDef; // member of or related to + FileDef *fileDef; // member of file definition + NamespaceDef *nspace; // the namespace this member is in. + + MemberDef *enumScope; // the enclosing scope, if this is an enum field + MemberDef *annEnumType; // the annonymous enum that is the type of this member + MemberList *enumFields; // enumeration fields + + MemberDef *redefines; // the members that this member redefines + MemberList *redefinedBy; // the list of members that redefine this one + + MemberDef *memDef; // member definition for this declaration + MemberDef *memDec; // member declaration for this definition + ClassDef *relatedAlso; // points to class marked by relatedAlso + + ExampleSDict *exampleSDict; // a dictionary of all examples for quick access + + QCString type; // return type + QCString args; // function arguments/variable array specifiers + QCString def; // member definition in code (fully qualified name) + QCString anc; // HTML anchor name + Specifier virt; // normal/virtual/pure virtual + Protection prot; // protection type [Public/Protected/Private] + QCString decl; // member declaration in class + + QCString bitfields; // struct member bitfields + QCString read; // property read accessor + QCString write; // property write accessor + QCString exception; // exceptions that can be thrown + QCString initializer; // initializer + int initLines; // number of lines in the initializer + + int memSpec; // The specifiers present for this member + MemberDef::MemberType mtype; // returns the kind of member + int maxInitLines; // when the initializer will be displayed + int userInitLines; // result of explicit \hideinitializer or \showinitializer + MemberDef *annMemb; + + ArgumentList *defArgList; // argument list of this member definition + ArgumentList *declArgList; // argument list of this member declaration + + ArgumentList *tArgList; // template argument list of function template + MemberDef *templateMaster; + QList<ArgumentList> *defTmpArgLists; // lists of template argument lists + // (for template functions in nested template classes) + + ClassDef *cachedAnonymousType; // if the member has an anonymous compound + // as its type then this is computed by + // getClassDefOfAnonymousType() and + // cached here. + SDict<MemberList> *classSectionSDict; // not accessible + + MemberDef *groupAlias; // Member containing the definition + int grpId; // group id + MemberGroup *memberGroup; // group's member definition + GroupDef *group; // group in which this member is in + Grouping::GroupPri_t grouppri; // priority of this definition + QCString groupFileName; // file where this grouping was defined + int groupStartLine; // line " " " " " + MemberDef *groupMember; + + bool isTypedefValCached; + ClassDef *cachedTypedefValue; + QCString cachedTypedefTemplSpec; + + // inbody documentation + int inbodyLine; + QCString inbodyFile; + QCString inbodyDocs; + + // documentation inheritance + MemberDef *docProvider; + + // to store the output file base from tag files + QCString explicitOutputFileBase; + + // objective-c + bool implOnly; // function found in implementation but not + // in the interface + bool hasDocumentedParams; + bool hasDocumentedReturnType; + bool isDMember; + bool related; // is this a member that is only related to a class + bool stat; // is it a static function? + bool proto; // is it a prototype; + bool docEnumValues; // is an enum with documented enum values. + bool annScope; // member is part of an annoymous scope + bool annUsed; + bool hasCallGraph; + bool hasCallerGraph; + bool explExt; // member was explicitly declared external + bool tspec; // member is a template specialization + bool groupHasDocs; // true if the entry that caused the grouping was documented + bool docsForDefinition; // TRUE => documentation block is put before + // definition. + // FALSE => block is put before declaration. +}; + +MemberDefImpl::MemberDefImpl() : + enumFields(0), + redefinedBy(0), + exampleSDict(0), + defArgList(0), + declArgList(0), + tArgList(0), + defTmpArgLists(0), + classSectionSDict(0) +{ +} + +MemberDefImpl::~MemberDefImpl() +{ + delete redefinedBy; + delete exampleSDict; + delete enumFields; + delete defArgList; + delete tArgList; + delete defTmpArgLists; + delete classSectionSDict; + delete declArgList; +} + +void MemberDefImpl::init(Definition *def, + const char *t,const char *a,const char *e, + Protection p,Specifier v,bool s,bool r,MemberDef::MemberType mt, + const ArgumentList *tal,const ArgumentList *al + ) +{ + classDef=0; + fileDef=0; + redefines=0; + relatedAlso=0; + redefinedBy=0; + nspace=0; + memDef=0; + memDec=0; + group=0; + grpId=-1; + exampleSDict=0; + enumFields=0; + enumScope=0; + defTmpArgLists=0; + hasCallGraph = FALSE; + hasCallerGraph = FALSE; + initLines=0; + type=t; + if (mt==MemberDef::Typedef) type.stripPrefix("typedef "); + type.stripPrefix("struct "); + type.stripPrefix("class " ); + type.stripPrefix("union " ); + type=removeRedundantWhiteSpace(type); + args=a; + args=removeRedundantWhiteSpace(args); + if (type.isEmpty()) decl=def->name()+args; else decl=type+" "+def->name()+args; + + memberGroup=0; + virt=v; + prot=p; + related=r; + stat=s; + mtype=mt; + exception=e; + proto=FALSE; + annScope=FALSE; + memSpec=0; + annMemb=0; + annUsed=FALSE; + annEnumType=0; + groupAlias=0; + explExt=FALSE; + tspec=FALSE; + cachedAnonymousType=0; + maxInitLines=Config_getInt("MAX_INITIALIZER_LINES"); + userInitLines=-1; + docEnumValues=FALSE; + // copy function template arguments (if any) + if (tal) + { + tArgList = new ArgumentList; + tArgList->setAutoDelete(TRUE); + ArgumentListIterator ali(*tal); + Argument *a; + for (;(a=ali.current());++ali) + { + tArgList->append(new Argument(*a)); + } + } + else + { + tArgList=0; + } + //printf("new member al=%p\n",al); + // copy function definition arguments (if any) + if (al) + { + defArgList = new ArgumentList; + defArgList->setAutoDelete(TRUE); + ArgumentListIterator ali(*al); + Argument *a; + for (;(a=ali.current());++ali) + { + //printf("copy argument %s (doc=%s)\n",a->name.data(),a->docs.data()); + defArgList->append(new Argument(*a)); + } + defArgList->constSpecifier = al->constSpecifier; + defArgList->volatileSpecifier = al->volatileSpecifier; + defArgList->pureSpecifier = al->pureSpecifier; + //printf("defArgList(%p)->constSpecifier=%d\n",defArgList,defArgList->constSpecifier); + } + else + { + defArgList=0; + } + // convert function declaration arguments (if any) + if (!args.isEmpty()) + { + declArgList = new ArgumentList; + stringToArgumentList(args,declArgList); + //printf("setDeclArgList %s to %p const=%d\n",args.data(), + // declArgList,declArgList->constSpecifier); + } + else + { + declArgList = 0; + } + templateMaster = 0; + classSectionSDict = 0; + docsForDefinition = TRUE; + isTypedefValCached = FALSE; + cachedTypedefValue = 0; + inbodyLine = -1; + implOnly=FALSE; + groupMember = 0; + hasDocumentedParams = FALSE; + hasDocumentedReturnType = FALSE; + docProvider = 0; + isDMember = def->getDefFileName().right(2).lower()==".d"; +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- /*! Creates a new member definition. * @@ -311,8 +572,12 @@ MemberDef::MemberDef(const char *df,int dl, const char *t,const char *na,const char *a,const char *e, Protection p,Specifier v,bool s,bool r,MemberType mt, const ArgumentList *tal,const ArgumentList *al - ) : Definition(df,dl,na) + ) : Definition(df,dl,removeRedundantWhiteSpace(na)) { + m_impl = new MemberDefImpl; + m_impl->init(this,t,a,e,p,v,s,r,mt,tal,al); + +#if 0 //printf("++++++ MemberDef(%s file=%s,line=%d static=%d) ++++++ \n", // na,df,dl,s); classDef=0; @@ -328,9 +593,6 @@ MemberDef::MemberDef(const char *df,int dl, exampleSDict=0; enumFields=0; enumScope=0; - enumDeclList=0; - //scopeTAL=0; - //membTAL=0; m_defTmpArgLists=0; m_hasCallGraph = FALSE; m_hasCallerGraph = FALSE; @@ -346,7 +608,6 @@ MemberDef::MemberDef(const char *df,int dl, args=removeRedundantWhiteSpace(args); if (type.isEmpty()) decl=name()+args; else decl=type+" "+name()+args; - //declLine=0; memberGroup=0; virt=v; prot=p; @@ -359,10 +620,7 @@ MemberDef::MemberDef(const char *df,int dl, memSpec=0; annMemb=0; annUsed=FALSE; - annShown=FALSE; annEnumType=0; - //indDepth=0; - section=0; groupAlias=0; explExt=FALSE; tspec=FALSE; @@ -432,71 +690,71 @@ MemberDef::MemberDef(const char *df,int dl, m_hasDocumentedReturnType = FALSE; m_docProvider = 0; m_isDMember = getDefFileName().right(2).lower()==".d"; +#endif } /*! Destroys the member definition. */ MemberDef::~MemberDef() { - delete redefinedBy; - delete exampleSDict; - delete enumFields; - delete defArgList; - delete tArgList; - delete m_defTmpArgLists; - delete classSectionSDict; - delete declArgList; + delete m_impl; } void MemberDef::setReimplements(MemberDef *md) { + makeResident(); //if (redefines==0) redefines = new MemberList; //if (redefines->find(md)==-1) redefines->inSort(md); - redefines = md; + m_impl->redefines = md; } void MemberDef::insertReimplementedBy(MemberDef *md) { - if (m_templateMaster) + makeResident(); + if (m_impl->templateMaster) { - m_templateMaster->insertReimplementedBy(md); + m_impl->templateMaster->insertReimplementedBy(md); } - if (redefinedBy==0) redefinedBy = new MemberList(MemberList::redefinedBy); - if (redefinedBy->findRef(md)==-1) + if (m_impl->redefinedBy==0) m_impl->redefinedBy = new MemberList(MemberList::redefinedBy); + if (m_impl->redefinedBy->findRef(md)==-1) { - redefinedBy->inSort(md); + m_impl->redefinedBy->inSort(md); } } MemberDef *MemberDef::reimplements() const { - return redefines; + makeResident(); + return m_impl->redefines; } -MemberList *MemberDef::reimplementedBy() const +LockingPtr<MemberList> MemberDef::reimplementedBy() const { - return redefinedBy; + makeResident(); + return LockingPtr<MemberList>(this,m_impl->redefinedBy); } void MemberDef::insertEnumField(MemberDef *md) { - if (enumFields==0) enumFields=new MemberList(MemberList::enumFields); - enumFields->append(md); + makeResident(); + if (m_impl->enumFields==0) m_impl->enumFields=new MemberList(MemberList::enumFields); + m_impl->enumFields->append(md); } bool MemberDef::addExample(const char *anchor,const char *nameStr, const char *file) { + makeResident(); //printf("%s::addExample(%s,%s,%s)\n",name().data(),anchor,nameStr,file); - if (exampleSDict==0) exampleSDict = new ExampleSDict; - if (exampleSDict->find(nameStr)==0) + if (m_impl->exampleSDict==0) m_impl->exampleSDict = new ExampleSDict; + if (m_impl->exampleSDict->find(nameStr)==0) { //printf("Add reference to example %s to member %s\n",nameStr,name.data()); Example *e=new Example; e->anchor=anchor; e->name=nameStr; e->file=file; - exampleSDict->inSort(nameStr,e); + m_impl->exampleSDict->inSort(nameStr,e); return TRUE; } return FALSE; @@ -504,39 +762,41 @@ bool MemberDef::addExample(const char *anchor,const char *nameStr, bool MemberDef::hasExamples() { - if (exampleSDict==0) + makeResident(); + if (m_impl->exampleSDict==0) return FALSE; else - return exampleSDict->count()>0; + return m_impl->exampleSDict->count()>0; } QCString MemberDef::getOutputFileBase() const { + makeResident(); static bool separateMemberPages = Config_getBool("SEPARATE_MEMBER_PAGES"); QCString baseName; - if (explicitOutputFileBase) + if (m_impl->explicitOutputFileBase) { - return explicitOutputFileBase; + return m_impl->explicitOutputFileBase; } - else if (m_templateMaster) + else if (m_impl->templateMaster) { - return m_templateMaster->getOutputFileBase(); + return m_impl->templateMaster->getOutputFileBase(); } - else if (group) + else if (m_impl->group) { - baseName=group->getOutputFileBase(); + baseName=m_impl->group->getOutputFileBase(); } - else if (classDef) + else if (m_impl->classDef) { - baseName=classDef->getOutputFileBase(); + baseName=m_impl->classDef->getOutputFileBase(); } - else if (nspace) + else if (m_impl->nspace) { - baseName=nspace->getOutputFileBase(); + baseName=m_impl->nspace->getOutputFileBase(); } - else if (fileDef) + else if (m_impl->fileDef) { - baseName=fileDef->getOutputFileBase(); + baseName=m_impl->fileDef->getOutputFileBase(); } if (baseName.isEmpty()) @@ -563,40 +823,42 @@ QCString MemberDef::getOutputFileBase() const QCString MemberDef::getReference() const { - if (m_templateMaster) + makeResident(); + if (m_impl->templateMaster) { - return m_templateMaster->getReference(); + return m_impl->templateMaster->getReference(); } - else if (group) + else if (m_impl->group) { - return group->getReference(); + return m_impl->group->getReference(); } - else if (classDef) + else if (m_impl->classDef) { - return classDef->getReference(); + return m_impl->classDef->getReference(); } - else if (nspace) + else if (m_impl->nspace) { - return nspace->getReference(); + return m_impl->nspace->getReference(); } - else if (fileDef) + else if (m_impl->fileDef) { - return fileDef->getReference(); + return m_impl->fileDef->getReference(); } return ""; } QCString MemberDef::anchor() const { - QCString result=anc; - if (groupAlias) return groupAlias->anchor(); - if (m_templateMaster) return m_templateMaster->anchor(); - if (enumScope) result.prepend(enumScope->anchor()); - if (group) + makeResident(); + QCString result=m_impl->anc; + if (m_impl->groupAlias) return m_impl->groupAlias->anchor(); + if (m_impl->templateMaster) return m_impl->templateMaster->anchor(); + if (m_impl->enumScope) result.prepend(m_impl->enumScope->anchor()); + if (m_impl->group) { - if (groupMember) + if (m_impl->groupMember) { - result=groupMember->anchor(); + result=m_impl->groupMember->anchor(); } else { @@ -610,10 +872,11 @@ bool MemberDef::isLinkableInProject() const { static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); static bool extractStatic = Config_getBool("EXTRACT_STATIC"); + makeResident(); //printf("MemberDef::isLinkableInProject(name=%s)\n",name().data()); - if (m_templateMaster) + if (m_impl->templateMaster) { - return m_templateMaster->isLinkableInProject(); + return m_impl->templateMaster->isLinkableInProject(); } if (name().isEmpty() || name().at(0)=='@') { @@ -625,32 +888,32 @@ bool MemberDef::isLinkableInProject() const //printf("no docs or reference\n"); return FALSE; // no documentation } - if (group && !group->isLinkableInProject()) + if (m_impl->group && !m_impl->group->isLinkableInProject()) { //printf("group but group not linkable!\n"); return FALSE; // group but group not linkable } - if (!group && classDef && !classDef->isLinkableInProject()) + if (!m_impl->group && m_impl->classDef && !m_impl->classDef->isLinkableInProject()) { //printf("in a class but class not linkable!\n"); return FALSE; // in class but class not linkable } - if (!group && nspace && !related && !nspace->isLinkableInProject()) + if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject()) { //printf("in a namespace but namespace not linkable!\n"); return FALSE; // in namespace but namespace not linkable } - if (!group && !nspace && !related && !classDef && fileDef && !fileDef->isLinkableInProject()) + if (!m_impl->group && !m_impl->nspace && !m_impl->related && !m_impl->classDef && m_impl->fileDef && !m_impl->fileDef->isLinkableInProject()) { //printf("in a file but file not linkable!\n"); return FALSE; // in file (and not in namespace) but file not linkable } - if (prot==Private && !extractPrivate && mtype!=Friend) + if (m_impl->prot==Private && !extractPrivate && m_impl->mtype!=Friend) { //printf("private and invisible!\n"); return FALSE; // hidden due to protection } - if (isStatic() && classDef==0 && !extractStatic) + if (isStatic() && m_impl->classDef==0 && !extractStatic) { //printf("static and invisible!\n"); return FALSE; // hidden due to staticness @@ -661,9 +924,10 @@ bool MemberDef::isLinkableInProject() const bool MemberDef::isLinkable() const { - if (m_templateMaster) + makeResident(); + if (m_impl->templateMaster) { - return m_templateMaster->isLinkable(); + return m_impl->templateMaster->isLinkable(); } else { @@ -676,25 +940,28 @@ void MemberDef::setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) { if (lists) { - if (m_defTmpArgLists) delete m_defTmpArgLists; - m_defTmpArgLists = copyArgumentLists(lists); + makeResident(); + if (m_impl->defTmpArgLists) delete m_impl->defTmpArgLists; + m_impl->defTmpArgLists = copyArgumentLists(lists); } } void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, FileDef *fd,GroupDef *gd,bool onlyText) { + makeResident(); + LockingPtr<MemberDef> lock(this,this); QCString sep = Config_getBool("OPTIMIZE_OUTPUT_JAVA") ? "." : "::"; QCString n = name(); - if (classDef && gd) n.prepend(classDef->name()+sep); - else if (nspace && (gd || fd)) n.prepend(nspace->name()+sep); + if (m_impl->classDef && gd) n.prepend(m_impl->classDef->name()+sep); + else if (m_impl->nspace && (gd || fd)) n.prepend(m_impl->nspace->name()+sep); if (isObjCMethod()) { if (isStatic()) ol.docify("+ "); else ol.docify("- "); } if (!onlyText) // write link { - if (mtype==EnumValue && getGroupDef()==0 && // enum value is not grouped + if (m_impl->mtype==EnumValue && getGroupDef()==0 && // enum value is not grouped getEnumScope() && getEnumScope()->getGroupDef()) // but its container is { GroupDef *enumValGroup = getEnumScope()->getGroupDef(); @@ -720,7 +987,9 @@ void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, */ ClassDef *MemberDef::getClassDefOfAnonymousType() { - if (cachedAnonymousType) return cachedAnonymousType; + makeResident(); + if (m_impl->cachedAnonymousType) return m_impl->cachedAnonymousType; + LockingPtr<MemberDef> lock(this,this); QCString cname; if (getClassDef()!=0) @@ -731,7 +1000,7 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() { cname=getNamespaceDef()->name().copy(); } - QCString ltype(type); + QCString ltype(m_impl->type); // strip `static' keyword from ltype //if (ltype.left(7)=="static ") ltype=ltype.right(ltype.length()-7); // strip `friend' keyword from ltype @@ -766,7 +1035,7 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() annoClassDef=getClass(ts); } } - cachedAnonymousType = annoClassDef; + m_impl->cachedAnonymousType = annoClassDef; return annoClassDef; } @@ -775,95 +1044,97 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() */ bool MemberDef::isBriefSectionVisible() const { - static bool extractStatic = Config_getBool("EXTRACT_STATIC"); - static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); - static bool briefMemberDesc = Config_getBool("BRIEF_MEMBER_DESC"); - static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); - static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); - static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); - - //printf("Member %s grpId=%d docs=%s file=%s args=%s\n", - // name().data(), - // 0,"", //grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), - // "", //getFileDef()->name().data(), - // argsString()); - - MemberGroupInfo *info = Doxygen::memGrpInfoDict[grpId]; - //QCString *pMemGrp = Doxygen::memberDocDict[grpId]; - bool hasDocs = hasDocumentation() || - // part of a documented member group - (grpId!=-1 && info && !info->doc.isEmpty()); - - // only include static members with file/namespace scope if - // explicitly enabled in the config file - bool visibleIfStatic = !(getClassDef()==0 && - isStatic() && - !extractStatic - ); - - // only include members is the are documented or - // HIDE_UNDOC_MEMBERS is NO in the config file - bool visibleIfDocumented = (!hideUndocMembers || - hasDocs || - isDocumentedFriendClass() - ); + static bool extractStatic = Config_getBool("EXTRACT_STATIC"); + static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); + static bool briefMemberDesc = Config_getBool("BRIEF_MEMBER_DESC"); + static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); + static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); + static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); + + //printf("Member %s grpId=%d docs=%s file=%s args=%s\n", + // name().data(), + // 0,"", //grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), + // "", //getFileDef()->name().data(), + // argsString()); + + makeResident(); + LockingPtr<MemberDef> lock(this,this); + MemberGroupInfo *info = Doxygen::memGrpInfoDict[m_impl->grpId]; + //QCString *pMemGrp = Doxygen::memberDocDict[grpId]; + bool hasDocs = hasDocumentation() || + // part of a documented member group + (m_impl->grpId!=-1 && info && !info->doc.isEmpty()); + + // only include static members with file/namespace scope if + // explicitly enabled in the config file + bool visibleIfStatic = !(getClassDef()==0 && + isStatic() && + !extractStatic + ); - // hide members with no detailed description and brief descriptions - // explicitly disabled. - bool visibleIfEnabled = !(hideUndocMembers && - documentation().isEmpty() && - !briefMemberDesc && - !repeatBrief + // only include members is the are documented or + // HIDE_UNDOC_MEMBERS is NO in the config file + bool visibleIfDocumented = (!hideUndocMembers || + hasDocs || + isDocumentedFriendClass() ); - // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true - bool visibleIfFriendCompound = !(hideFriendCompounds && - isFriend() && - (type=="friend class" || - type=="friend struct" || - type=="friend union" - ) - ); - - // only include members that are non-private unless EXTRACT_PRIVATE is - // set to YES or the member is part of a group - bool visibleIfPrivate = (protection()!=Private || - extractPrivate || - mtype==Friend - ); - - // hide member if it overrides a member in a superclass and has no - // documentation of its own - //bool visibleIfDocVirtual = !reimplements() || - // !Config_getBool("INHERIT_DOCS") || - // hasDocs; - - // true if this member is a constructor or destructor - bool cOrDTor = isConstructor() || isDestructor(); - - // hide default constructors or destructors (no args) without - // documentation - bool visibleIfNotDefaultCDTor = !(cOrDTor && - defArgList && - (defArgList->isEmpty() || - defArgList->first()->type == "void" - ) && - !hasDocs - ); - - //printf("visibleIfStatic=%d visibleIfDocumented=%d visibleIfEnabled=%d" - // "visibleIfPrivate=%d visibleIfDocVirtual=%d visibltIfNotDefaultCDTor=%d " - // "visibleIfFriendCompound=%d\n",visibleIfStatic,visibleIfDocumented, - // visibleIfEnabled,visibleIfPrivate,visibleIfDocVirtual,visibleIfNotDefaultCDTor, - // visibleIfFriendCompound); - - bool visible = visibleIfStatic && visibleIfDocumented && - visibleIfEnabled && visibleIfPrivate && - /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && - visibleIfFriendCompound && - !annScope; - //printf("MemberDef::isBriefSectionVisible() %d\n",visible); - return visible; + // hide members with no detailed description and brief descriptions + // explicitly disabled. + bool visibleIfEnabled = !(hideUndocMembers && + documentation().isEmpty() && + !briefMemberDesc && + !repeatBrief + ); + + // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true + bool visibleIfFriendCompound = !(hideFriendCompounds && + isFriend() && + (m_impl->type=="friend class" || + m_impl->type=="friend struct" || + m_impl->type=="friend union" + ) + ); + + // only include members that are non-private unless EXTRACT_PRIVATE is + // set to YES or the member is part of a group + bool visibleIfPrivate = (protection()!=Private || + extractPrivate || + m_impl->mtype==Friend + ); + + // hide member if it overrides a member in a superclass and has no + // documentation of its own + //bool visibleIfDocVirtual = !reimplements() || + // !Config_getBool("INHERIT_DOCS") || + // hasDocs; + + // true if this member is a constructor or destructor + bool cOrDTor = isConstructor() || isDestructor(); + + // hide default constructors or destructors (no args) without + // documentation + bool visibleIfNotDefaultCDTor = !(cOrDTor && + m_impl->defArgList && + (m_impl->defArgList->isEmpty() || + m_impl->defArgList->first()->type == "void" + ) && + !hasDocs + ); + + //printf("visibleIfStatic=%d visibleIfDocumented=%d visibleIfEnabled=%d" + // "visibleIfPrivate=%d visibleIfDocVirtual=%d visibltIfNotDefaultCDTor=%d " + // "visibleIfFriendCompound=%d\n",visibleIfStatic,visibleIfDocumented, + // visibleIfEnabled,visibleIfPrivate,visibleIfDocVirtual,visibleIfNotDefaultCDTor, + // visibleIfFriendCompound); + + bool visible = visibleIfStatic && visibleIfDocumented && + visibleIfEnabled && visibleIfPrivate && + /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && + visibleIfFriendCompound && + !m_impl->annScope; + //printf("MemberDef::isBriefSectionVisible() %d\n",visible); + return visible; } @@ -876,7 +1147,9 @@ void MemberDef::writeDeclaration(OutputList &ol, // hide enum value, since they appear already as part of the enum, unless they // are explicitly grouped. - if (!inGroup && mtype==EnumValue) return; + makeResident(); + if (!inGroup && m_impl->mtype==EnumValue) return; + LockingPtr<MemberDef> lock(this,this); // hide members whose brief section should not be visible //if (!isBriefSectionVisible()) return; @@ -889,7 +1162,7 @@ void MemberDef::writeDeclaration(OutputList &ol, if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { Doxygen::tagFile << " <member kind=\""; - switch (mtype) + switch (m_impl->mtype) { case Define: Doxygen::tagFile << "define"; break; case EnumValue: Doxygen::tagFile << "enumvalue"; break; @@ -905,18 +1178,18 @@ void MemberDef::writeDeclaration(OutputList &ol, case DCOP: Doxygen::tagFile << "dcop"; break; case Slot: Doxygen::tagFile << "slot"; break; } - if (prot!=Public) + if (m_impl->prot!=Public) { Doxygen::tagFile << "\" protection=\""; - if (prot==Protected) Doxygen::tagFile << "protected"; - else if (prot==Package) Doxygen::tagFile << "package"; - else /* Private */ Doxygen::tagFile << "private"; + if (m_impl->prot==Protected) Doxygen::tagFile << "protected"; + else if (m_impl->prot==Package) Doxygen::tagFile << "package"; + else /* Private */ Doxygen::tagFile << "private"; } - if (virt!=Normal) + if (m_impl->virt!=Normal) { Doxygen::tagFile << "\" virtualness=\""; - if (virt==Virtual) Doxygen::tagFile << "virtual"; - else /* Pure */ Doxygen::tagFile << "pure"; + if (m_impl->virt==Virtual) Doxygen::tagFile << "virtual"; + else /* Pure */ Doxygen::tagFile << "pure"; } if (isStatic()) { @@ -955,13 +1228,13 @@ void MemberDef::writeDeclaration(OutputList &ol, ClassDef *annoClassDef=getClassDefOfAnonymousType(); // start a new member declaration - bool isAnonymous = annoClassDef || annMemb || annEnumType; + bool isAnonymous = annoClassDef || m_impl->annMemb || m_impl->annEnumType; ///printf("startMemberItem for %s\n",name().data()); - ol.startMemberItem( isAnonymous ? 1 : tArgList ? 3 : 0); + ol.startMemberItem( isAnonymous ? 1 : m_impl->tArgList ? 3 : 0); // If there is no detailed description we need to write the anchor here. bool detailsVisible = isDetailedSectionLinkable(); - if (!detailsVisible && !annMemb) + if (!detailsVisible && !m_impl->annMemb) { QCString doxyName=name().copy(); if (!cname.isEmpty()) doxyName.prepend(cname+"::"); @@ -975,7 +1248,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.popGeneratorState(); } - if (annoClassDef || annMemb) + if (annoClassDef || m_impl->annMemb) { int j; for (j=0;j<s_indentLevel;j++) @@ -985,16 +1258,16 @@ void MemberDef::writeDeclaration(OutputList &ol, } // *** write template lists - if (tArgList) + if (m_impl->tArgList) { if (!isAnonymous) ol.startMemberTemplateParams(); - writeTemplatePrefix(ol,tArgList); + writeTemplatePrefix(ol,m_impl->tArgList); if (!isAnonymous) ol.endMemberTemplateParams(); } // *** write type - QCString ltype(type); - if (mtype==Typedef) ltype.prepend("typedef "); + QCString ltype(m_impl->type); + if (m_impl->mtype==Typedef) ltype.prepend("typedef "); // strip `friend' keyword from ltype ltype.stripPrefix("friend "); static QRegExp r("@[0-9]+"); @@ -1011,7 +1284,7 @@ void MemberDef::writeDeclaration(OutputList &ol, int ir=i+l; //printf("<<<<<<<<<<<<<<\n"); ol.startAnonTypeScope(s_indentLevel++); - annoClassDef->writeDeclaration(ol,annMemb,inGroup); + annoClassDef->writeDeclaration(ol,m_impl->annMemb,inGroup); //printf(">>>>>>>>>>>>>> startMemberItem(2)\n"); ol.startMemberItem(2); int j; @@ -1035,7 +1308,7 @@ void MemberDef::writeDeclaration(OutputList &ol, linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),ltype.left(i),TRUE); getAnonymousEnumType()->writeEnumDeclaration(ol,cd,nd,fd,gd); //ol+=*getAnonymousEnumType()->enumDecl(); - linkifyText(TextGeneratorOLImpl(ol),d,fileDef,name(),ltype.right(ltype.length()-i-l),TRUE); + linkifyText(TextGeneratorOLImpl(ol),d,m_impl->fileDef,name(),ltype.right(ltype.length()-i-l),TRUE); } else { @@ -1068,7 +1341,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.enable(OutputGenerator::Html); } - if (annMemb) + if (m_impl->annMemb) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1077,7 +1350,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } else { - ol.insertMemberAlign(tArgList!=0); + ol.insertMemberAlign(m_impl->tArgList!=0); } // *** write name @@ -1086,26 +1359,27 @@ void MemberDef::writeDeclaration(OutputList &ol, //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable()); if (!(name().isEmpty() || name().at(0)=='@') && // name valid (hasDocumentation() || isReference()) && // has docs - !(prot==Private && !Config_getBool("EXTRACT_PRIVATE") && mtype!=Friend) && // hidden due to protection - !(isStatic() && classDef==0 && !Config_getBool("EXTRACT_STATIC")) // hidden due to static-ness + !(m_impl->prot==Private && !Config_getBool("EXTRACT_PRIVATE") && m_impl->mtype!=Friend) && // hidden due to protection + !(isStatic() && m_impl->classDef==0 && !Config_getBool("EXTRACT_STATIC")) // hidden due to static-ness ) { - if (annMemb) + if (m_impl->annMemb) { //printf("anchor=%s ann_anchor=%s\n",anchor(),annMemb->anchor()); - annMemb->writeLink(ol, - annMemb->getClassDef(), - annMemb->getNamespaceDef(), - annMemb->getFileDef(), - annMemb->getGroupDef() + m_impl->annMemb->writeLink(ol, + m_impl->annMemb->getClassDef(), + m_impl->annMemb->getNamespaceDef(), + m_impl->annMemb->getFileDef(), + m_impl->annMemb->getGroupDef() ); - annMemb->annUsed=annUsed=TRUE; + m_impl->annMemb->setAnonymousUsed(); + setAnonymousUsed(); } else { //printf("writeLink %s->%d\n",name.data(),hasDocumentation()); ClassDef *rcd = cd; - if (isReference() && classDef) rcd = classDef; + if (isReference() && m_impl->classDef) rcd = m_impl->classDef; writeLink(ol,rcd,nd,fd,gd); } } @@ -1119,9 +1393,13 @@ void MemberDef::writeDeclaration(OutputList &ol, // there is a brief member description and brief member // descriptions are enabled or there is no detailed description. { - if (annMemb) annMemb->annUsed=annUsed=TRUE; + if (m_impl->annMemb) + { + m_impl->annMemb->setAnonymousUsed(); + setAnonymousUsed(); + } ClassDef *rcd = cd; - if (isReference() && classDef) rcd = classDef; + if (isReference() && m_impl->classDef) rcd = m_impl->classDef; writeLink(ol,rcd,nd,fd,gd,TRUE); } } @@ -1142,9 +1420,9 @@ void MemberDef::writeDeclaration(OutputList &ol, } // *** write bitfields - if (!bitfields.isEmpty()) // add bitfields + if (!m_impl->bitfields.isEmpty()) // add bitfields { - linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),bitfields.simplifyWhiteSpace()); + linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),m_impl->bitfields.simplifyWhiteSpace()); } else if (hasOneLineInitializer() //!init.isEmpty() && initLines==0 && // one line initializer @@ -1154,12 +1432,12 @@ void MemberDef::writeDeclaration(OutputList &ol, if (!isDefine()) { ol.writeString(" = "); - linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),init.simplifyWhiteSpace()); + linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),m_impl->initializer.simplifyWhiteSpace()); } else { ol.writeNonBreakableSpace(3); - linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),init); + linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),name(),m_impl->initializer); } } @@ -1189,7 +1467,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.endTypewriter(); } - if (!detailsVisible && !annMemb) + if (!detailsVisible && !m_impl->annMemb) { ol.endDoxyAnchor(cfname,anchor()); } @@ -1213,7 +1491,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.disableAllBut(OutputGenerator::Html); //ol.endEmphasis(); ol.docify(" "); - if (group!=0 && gd==0) // forward link to the group + if (m_impl->group!=0 && gd==0) // forward link to the group { ol.startTextLink(getOutputFileBase(),anchor()); } @@ -1241,6 +1519,7 @@ bool MemberDef::isDetailedSectionLinkable() const static bool extractStatic = Config_getBool("EXTRACT_STATIC"); static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); + makeResident(); // the member has details documentation for any of the following reasons bool docFilter = // treat everything as documented @@ -1250,9 +1529,9 @@ bool MemberDef::isDetailedSectionLinkable() const // has inbody docs !inbodyDocumentation().isEmpty() || // is an enum with values that are documented - (mtype==Enumeration && docEnumValues) || + (m_impl->mtype==Enumeration && m_impl->docEnumValues) || // is documented enum value - (mtype==EnumValue && !briefDescription().isEmpty()) || + (m_impl->mtype==EnumValue && !briefDescription().isEmpty()) || // has brief description that is part of the detailed description (!briefDescription().isEmpty() && // has brief docs (alwaysDetailedSec && // they or visible in @@ -1264,7 +1543,7 @@ bool MemberDef::isDetailedSectionLinkable() const //(initLines>0 && initLines<maxInitLines) || (hasMultiLineInitializer() && !hideUndocMembers) || // has one or more documented arguments - (defArgList!=0 && defArgList->hasDocumentation()); + (m_impl->defArgList!=0 && m_impl->defArgList->hasDocumentation()); // this is not a global static or global statics should be extracted bool staticFilter = getClassDef()!=0 || !isStatic() || extractStatic; @@ -1272,7 +1551,7 @@ bool MemberDef::isDetailedSectionLinkable() const // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group bool privateFilter = (protection()!=Private || extractPrivate || - mtype==Friend + m_impl->mtype==Friend ); // member is part of an anonymous scope that is the type of @@ -1284,9 +1563,9 @@ bool MemberDef::isDetailedSectionLinkable() const // is true bool friendCompoundFilter = !(Config_getBool("HIDE_FRIEND_COMPOUNDS") && isFriend() && - (type=="friend class" || - type=="friend struct" || - type=="friend union" + (m_impl->type=="friend class" || + m_impl->type=="friend struct" || + m_impl->type=="friend union" ) ); @@ -1323,6 +1602,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if ( !hasDocs ) return; if (isEnumValue() && !showEnumValues) return; + makeResident(); + LockingPtr<MemberDef> lock(this,this); + QCString scopeName = scName; QCString memAnchor = anchor(); QCString ciname = container->name(); @@ -1439,10 +1721,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!Config_getBool("HIDE_SCOPE_NAMES")) { bool first=TRUE; - if (m_defTmpArgLists) + if (m_impl->defTmpArgLists) // definition has explicit template parameter declarations { - QListIterator<ArgumentList> ali(*m_defTmpArgLists); + QListIterator<ArgumentList> ali(*m_impl->defTmpArgLists); ArgumentList *tal; for (ali.toFirst();(tal=ali.current());++ali) { @@ -1476,10 +1758,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } } } - if (tArgList) // function template prefix + if (m_impl->tArgList) // function template prefix { ol.startMemberDocPrefixItem(); - writeTemplatePrefix(ol,tArgList); + writeTemplatePrefix(ol,m_impl->tArgList); ol.endMemberDocPrefixItem(); } } @@ -1527,12 +1809,12 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!isDefine()) { ol.docify(" = "); - linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),name(),init.simplifyWhiteSpace()); + linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),name(),m_impl->initializer.simplifyWhiteSpace()); } else { ol.writeNonBreakableSpace(3); - linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),name(),init); + linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),name(),m_impl->initializer); } } if (excpString()) // add exception list @@ -1543,13 +1825,13 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } Specifier lvirt=virtualness(); - + if (!isObjCMethod() && (protection()!=Public || lvirt!=Normal || isFriend() || isRelated() || isExplicit() || isMutable() || (isInline() && Config_getBool("INLINE_INFO")) || isSignal() || isSlot() || - isStatic() || (classDef && classDef!=container) || + isStatic() || (m_impl->classDef && m_impl->classDef!=container) || isSettable() || isGettable() || isReadable() || isWritable() || isFinal() || isAbstract() ) @@ -1583,7 +1865,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (isSignal()) sl.append("signal"); if (isSlot()) sl.append("slot"); } - if (classDef && classDef!=container) sl.append("inherited"); + if (m_impl->classDef && m_impl->classDef!=container) sl.append("inherited"); const char *s=sl.first(); while (s) { @@ -1628,7 +1910,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { //printf("md=%s initLines=%d init=`%s'\n",name().data(),initLines,init.data()); ol.startBold(); - if (mtype==Define) + if (m_impl->mtype==Define) ol.parseText(theTranslator->trDefineValue()); else ol.parseText(theTranslator->trInitialValue()); @@ -1636,16 +1918,19 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension()); pIntf->resetCodeParserState(); ol.startCodeFragment(); - pIntf->parseCode(ol,scopeName,init,FALSE,0); + pIntf->parseCode(ol,scopeName,m_impl->initializer,FALSE,0); ol.endCodeFragment(); } - QCString brief = m_templateMaster ? - m_templateMaster->briefDescription() : briefDescription(); - QCString detailed = m_templateMaster ? - m_templateMaster->documentation() : documentation(); - ArgumentList *docArgList = m_templateMaster ? - m_templateMaster->defArgList : defArgList; + QCString brief = briefDescription(); + QCString detailed = documentation(); + LockingPtr<ArgumentList> docArgList = LockingPtr<ArgumentList>(this,m_impl->defArgList); + if (m_impl->templateMaster) + { + brief = m_impl->templateMaster->briefDescription(); + detailed = m_impl->templateMaster->documentation(); + docArgList = m_impl->templateMaster->argumentList(); + } /* write brief description */ if (!brief.isEmpty() && @@ -1662,19 +1947,19 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!detailed.isEmpty()) { ol.parseDoc(docFile(),docLine(),getOuterScope()?getOuterScope():container,this,detailed+"\n",TRUE,FALSE); - if (!m_inbodyDocs.isEmpty()) + if (!m_impl->inbodyDocs.isEmpty()) { ol.newParagraph(); - ol.parseDoc(inbodyFile(),inbodyLine(),getOuterScope()?getOuterScope():container,this,m_inbodyDocs+"\n",TRUE,FALSE); + ol.parseDoc(inbodyFile(),inbodyLine(),getOuterScope()?getOuterScope():container,this,m_impl->inbodyDocs+"\n",TRUE,FALSE); } } else if (!brief.isEmpty() && (Config_getBool("REPEAT_BRIEF") || !Config_getBool("BRIEF_MEMBER_DESC"))) { - if (!m_inbodyDocs.isEmpty()) + if (!m_impl->inbodyDocs.isEmpty()) { ol.newParagraph(); - ol.parseDoc(inbodyFile(),inbodyLine(),getOuterScope()?getOuterScope():container,this,m_inbodyDocs+"\n",TRUE,FALSE); + ol.parseDoc(inbodyFile(),inbodyLine(),getOuterScope()?getOuterScope():container,this,m_impl->inbodyDocs+"\n",TRUE,FALSE); } } @@ -1682,7 +1967,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //printf("***** defArgList=%p name=%s docs=%s hasDocs=%d\n", // defArgList, // defArgList?defArgList->hasDocumentation():-1); - if (docArgList && docArgList->hasDocumentation()) + if (docArgList!=0 && docArgList->hasDocumentation()) { //printf("***** argumentList is documented\n"); ol.startParamList(BaseOutputDocInterface::Param,theTranslator->trParameters()+": "); @@ -1716,8 +2001,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (isEnumerate()) { bool first=TRUE; - MemberList *fmdl=enumFieldList(); - if (fmdl) + LockingPtr<MemberList> fmdl=enumFieldList(); + if (fmdl!=0) { MemberDef *fmd=fmdl->first(); while (fmd) @@ -1842,8 +2127,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //ol.writeString("."); } - MemberList *bml=reimplementedBy(); - if (bml) + LockingPtr<MemberList> bml=reimplementedBy(); + if (bml!=0) { MemberListIterator mli(*bml); MemberDef *bmd=0; @@ -1867,7 +2152,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.enable(OutputGenerator::RTF); QCString reimplInLine; - if (virt==Pure || (classDef && classDef->compoundType()==ClassDef::Interface)) + if (m_impl->virt==Pure || (m_impl->classDef && m_impl->classDef->compoundType()==ClassDef::Interface)) { reimplInLine = theTranslator->trImplementedInList(count); } @@ -1920,7 +2205,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { ol.startSimpleSect(BaseOutputDocInterface::Examples,0,0,theTranslator->trExamples()+": "); ol.writeDescItem(); - writeExample(ol,getExamples()); + writeExample(ol,m_impl->exampleSDict); //ol.endDescItem(); ol.endSimpleSect(); } @@ -1932,11 +2217,11 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, writeInlineCode(ol,cname); // write call graph - if ((m_hasCallGraph || Config_getBool("CALL_GRAPH")) + if ((m_impl->hasCallGraph || Config_getBool("CALL_GRAPH")) && isFunction() && Config_getBool("HAVE_DOT") ) { - DotCallGraph callGraph(this,Config_getInt("MAX_DOT_GRAPH_DEPTH"), false); + DotCallGraph callGraph(this,Config_getInt("MAX_DOT_GRAPH_DEPTH"), FALSE); if (!callGraph.isTrivial()) { msg("Generating call graph for function %s\n",qualifiedName().data()); @@ -1948,7 +2233,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.enableAll(); } } - if ((m_hasCallerGraph || Config_getBool("CALLER_GRAPH")) + if ((m_impl->hasCallerGraph || Config_getBool("CALLER_GRAPH")) && isFunction() && Config_getBool("HAVE_DOT") ) { @@ -1996,7 +2281,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, QCString MemberDef::memberTypeName() const { - switch (mtype) + makeResident(); + switch (m_impl->mtype) { case Define: return "define"; case Function: return "function"; @@ -2017,7 +2303,8 @@ QCString MemberDef::memberTypeName() const void MemberDef::warnIfUndocumented() { - if (memberGroup) return; + makeResident(); + if (m_impl->memberGroup) return; ClassDef *cd = getClassDef(); NamespaceDef *nd = getNamespaceDef(); FileDef *fd = getFileDef(); @@ -2041,7 +2328,7 @@ void MemberDef::warnIfUndocumented() if ((!hasUserDocumentation() && !extractAll) && !isFriendClass() && name().find('@')==-1 && d->name().find('@')==-1 && - (prot!=Private || Config_getBool("EXTRACT_PRIVATE")) + (m_impl->prot!=Private || Config_getBool("EXTRACT_PRIVATE")) ) { warn_undoc(getDefFileName(),getDefLine(),"Warning: Member %s%s (%s) of %s %s is not documented.", @@ -2050,21 +2337,18 @@ void MemberDef::warnIfUndocumented() } -//void MemberDef::setEnumDecl(OutputList &ed) -//{ -// enumDeclList=new OutputList(&ed); -// *enumDeclList+=ed; -//} bool MemberDef::isFriendClass() const { + makeResident(); return (isFriend() && - (type=="friend class" || type=="friend struct" || - type=="friend union")); + (m_impl->type=="friend class" || m_impl->type=="friend struct" || + m_impl->type=="friend union")); } bool MemberDef::isDocumentedFriendClass() const { + makeResident(); ClassDef *fcd=0; QCString baseName=name(); int i=baseName.find('<'); @@ -2075,25 +2359,29 @@ bool MemberDef::isDocumentedFriendClass() const bool MemberDef::hasDocumentation() const { + makeResident(); return Definition::hasDocumentation() || - !m_inbodyDocs.isEmpty() || - (mtype==Enumeration && docEnumValues) || // has enum values - (defArgList!=0 && defArgList->hasDocumentation()); // has doc arguments + !m_impl->inbodyDocs.isEmpty() || + (m_impl->mtype==Enumeration && m_impl->docEnumValues) || // has enum values + (m_impl->defArgList!=0 && m_impl->defArgList->hasDocumentation()); // has doc arguments } void MemberDef::setMemberGroup(MemberGroup *grp) { - memberGroup = grp; + makeResident(); + m_impl->memberGroup = grp; } bool MemberDef::visibleMemberGroup(bool hideNoHeader) { - return memberGroup!=0 && - (!hideNoHeader || memberGroup->header()!="[NOHEADER]"); + makeResident(); + return m_impl->memberGroup!=0 && + (!hideNoHeader || m_impl->memberGroup->header()!="[NOHEADER]"); } QCString MemberDef::getScopeString() const { + makeResident(); QCString result; if (getClassDef()) result=getClassDef()->displayName(); else if (getNamespaceDef()) result=getNamespaceDef()->displayName(); @@ -2127,10 +2415,11 @@ static QCString escapeAnchor(const QCString &anchor) void MemberDef::setAnchor(const char *a) { + makeResident(); //anc=a; a=a; QCString memAnchor = name(); - if (!args.isEmpty()) memAnchor+=args; + if (!m_impl->args.isEmpty()) memAnchor+=m_impl->args; // include definition as well, to distinguish between two template // specializations that only differ in the template parameters. @@ -2141,7 +2430,7 @@ void MemberDef::setAnchor(const char *a) QCString sigStr(33); MD5Buffer((const unsigned char *)memAnchor.data(),memAnchor.length(),md5_sig); MD5SigToString(md5_sig,sigStr.data(),33); - anc = sigStr; + m_impl->anc = sigStr; } void MemberDef::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, @@ -2149,48 +2438,54 @@ void MemberDef::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, bool hasDocs,MemberDef *member) { //printf("%s MemberDef::setGroupDef(%s)\n",name().data(),gd->name().data()); - group=gd; - grouppri=pri; - groupFileName=fileName; - groupStartLine=startLine; - groupHasDocs=hasDocs; - groupMember=member; + makeResident(); + m_impl->group=gd; + m_impl->grouppri=pri; + m_impl->groupFileName=fileName; + m_impl->groupStartLine=startLine; + m_impl->groupHasDocs=hasDocs; + m_impl->groupMember=member; } void MemberDef::setEnumScope(MemberDef *md) { - enumScope=md; - if (md->group) + makeResident(); + m_impl->enumScope=md; + if (md->getGroupDef()) { - group=md->group; - grouppri=md->grouppri; - groupFileName=md->groupFileName; - groupStartLine=md->groupStartLine; - groupHasDocs=md->groupHasDocs; + m_impl->group=md->getGroupDef(); + m_impl->grouppri=md->getGroupPri(); + m_impl->groupFileName=md->getGroupFileName(); + m_impl->groupStartLine=md->getGroupStartLine(); + m_impl->groupHasDocs=md->getGroupHasDocs(); } } void MemberDef::setMemberClass(ClassDef *cd) { - classDef=cd; + makeResident(); + m_impl->classDef=cd; setOuterScope(cd); } void MemberDef::setNamespace(NamespaceDef *nd) { - nspace=nd; + makeResident(); + m_impl->nspace=nd; setOuterScope(nd); } MemberDef *MemberDef::createTemplateInstanceMember( ArgumentList *formalArgs,ArgumentList *actualArgs) { + makeResident(); + LockingPtr<MemberDef> lock(this,this); //printf(" Member %s %s %s\n",typeString(),name().data(),argsString()); ArgumentList *actualArgList = 0; - if (defArgList) + if (m_impl->defArgList) { actualArgList = new ArgumentList; - ArgumentListIterator ali(*defArgList); + ArgumentListIterator ali(*m_impl->defArgList); Argument *arg; for (;(arg=ali.current());++ali) { @@ -2198,9 +2493,9 @@ MemberDef *MemberDef::createTemplateInstanceMember( actArg->type = substituteTemplateArgumentsInString(actArg->type,formalArgs,actualArgs); actualArgList->append(actArg); } - actualArgList->constSpecifier = defArgList->constSpecifier; - actualArgList->volatileSpecifier = defArgList->volatileSpecifier; - actualArgList->pureSpecifier = defArgList->pureSpecifier; + actualArgList->constSpecifier = m_impl->defArgList->constSpecifier; + actualArgList->volatileSpecifier = m_impl->defArgList->volatileSpecifier; + actualArgList->pureSpecifier = m_impl->defArgList->pureSpecifier; } QCString methodName=name(); @@ -2211,14 +2506,14 @@ MemberDef *MemberDef::createTemplateInstanceMember( MemberDef *imd = new MemberDef( getDefFileName(),getDefLine(), - substituteTemplateArgumentsInString(type,formalArgs,actualArgs), + substituteTemplateArgumentsInString(m_impl->type,formalArgs,actualArgs), methodName, - substituteTemplateArgumentsInString(args,formalArgs,actualArgs), - exception, prot, - virt, stat, related, mtype, 0, 0 + substituteTemplateArgumentsInString(m_impl->args,formalArgs,actualArgs), + m_impl->exception, m_impl->prot, + m_impl->virt, m_impl->stat, m_impl->related, m_impl->mtype, 0, 0 ); - imd->defArgList = actualArgList; - imd->def = substituteTemplateArgumentsInString(def,formalArgs,actualArgs); + imd->setArgumentList(actualArgList); + imd->setDefinition(substituteTemplateArgumentsInString(m_impl->def,formalArgs,actualArgs)); imd->setBodyDef(getBodyDef()); imd->setBodySegment(getStartBodyLine(),getEndBodyLine()); //imd->setBodyMember(this); @@ -2230,34 +2525,38 @@ MemberDef *MemberDef::createTemplateInstanceMember( bool MemberDef::hasOneLineInitializer() const { + makeResident(); //printf("%s: init=%s, initLines=%d maxInitLines=%d userInitLines=%d\n", // name().data(),init.data(),initLines,maxInitLines,userInitLines); - return !init.isEmpty() && initLines==0 && // one line initializer - ((maxInitLines>0 && userInitLines==-1) || userInitLines>0); // enabled by default or explicitly + return !m_impl->initializer.isEmpty() && m_impl->initLines==0 && // one line initializer + ((m_impl->maxInitLines>0 && m_impl->userInitLines==-1) || m_impl->userInitLines>0); // enabled by default or explicitly } bool MemberDef::hasMultiLineInitializer() const { + makeResident(); //printf("initLines=%d userInitLines=%d maxInitLines=%d\n", // initLines,userInitLines,maxInitLines); - return initLines>0 && - ((initLines<maxInitLines && userInitLines==-1) // implicitly enabled - || initLines<userInitLines // explicitly enabled + return m_impl->initLines>0 && + ((m_impl->initLines<m_impl->maxInitLines && m_impl->userInitLines==-1) // implicitly enabled + || m_impl->initLines<m_impl->userInitLines // explicitly enabled ); } void MemberDef::setInitializer(const char *initializer) { + makeResident(); //printf("setInitializer(%s)\n",initializer); - init=initializer; - int p=init.length()-1; - while (p>=0 && isspace((uchar)init.at(p))) p--; - init=init.left(p+1); - initLines=init.contains('\n'); + m_impl->initializer=initializer; + int p=m_impl->initializer.length()-1; + while (p>=0 && isspace((uchar)m_impl->initializer.at(p))) p--; + m_impl->initializer=m_impl->initializer.left(p+1); + m_impl->initLines=m_impl->initializer.contains('\n'); } void MemberDef::addListReference(Definition *) { + makeResident(); static bool optimizeOutputForC = Config_getBool("OPTIMIZE_OUTPUT_FOR_C"); static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES"); static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); @@ -2300,30 +2599,38 @@ void MemberDef::addListReference(Definition *) memArgs = argsString(); } } - if (xrefListItems()) + LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); + if (xrefItems!=0) { - addRefItem(xrefListItems(),memLabel, + addRefItem(xrefItems.pointer(),memLabel, getOutputFileBase()+"#"+anchor(),memName,memArgs); } - else - { - } } MemberList *MemberDef::getSectionList(Definition *d) const { - return (d!=0 && classSectionSDict) ? classSectionSDict->find((char *)d) : 0; + makeResident(); + char key[20]; + sprintf(key,"%p",d); + return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0; } void MemberDef::setSectionList(Definition *d, MemberList *sl) { - if (classSectionSDict==0) classSectionSDict = new SDict<MemberList>(7); - classSectionSDict->append((char *)d,sl); + makeResident(); + char key[20]; + sprintf(key,"%p",d); + if (m_impl->classSectionSDict==0) + { + m_impl->classSectionSDict = new SDict<MemberList>(7); + } + m_impl->classSectionSDict->append(key,sl); } Specifier MemberDef::virtualness() const { - Specifier v = virt; + makeResident(); + Specifier v = m_impl->virt; MemberDef *rmd = reimplements(); while (rmd && v==Normal) { @@ -2335,19 +2642,21 @@ Specifier MemberDef::virtualness() const bool MemberDef::isConstructor() const { - if (classDef) + makeResident(); + if (m_impl->classDef) { - if (m_isDMember) // for D + if (m_impl->isDMember) // for D { return name()=="this"; } - else if (fileDef && getLanguageFromFileName(fileDef->name())==SrcLangExt_PHP) + else if (m_impl->fileDef && + getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_PHP) { // for PHP return name()=="__construct"; } else // for other languages { - QCString locName = classDef->localName(); + QCString locName = m_impl->classDef->localName(); int i=locName.find('<'); if (i==-1) // not a template class { @@ -2365,11 +2674,13 @@ bool MemberDef::isConstructor() const bool MemberDef::isDestructor() const { - if (m_isDMember) // for D + makeResident(); + if (m_impl->isDMember) // for D { return name()=="~this"; } - else if (fileDef && getLanguageFromFileName(fileDef->name())==SrcLangExt_PHP) + else if (m_impl->fileDef && + getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_PHP) { // for PHP return name()=="__destruct"; } @@ -2382,9 +2693,11 @@ bool MemberDef::isDestructor() const void MemberDef::writeEnumDeclaration(OutputList &typeDecl, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd) { + makeResident(); + LockingPtr<MemberDef> lock(this,this); int enumMemCount=0; - QList<MemberDef> *fmdl=enumFieldList(); + QList<MemberDef> *fmdl=m_impl->enumFields; uint numVisibleEnumValues=0; if (fmdl) { @@ -2395,7 +2708,10 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, fmd=fmdl->next(); } } - if (numVisibleEnumValues==0 && !isBriefSectionVisible()) return; + if (numVisibleEnumValues==0 && !isBriefSectionVisible()) + { + return; + } QCString n = name(); int i=n.findRev("::"); @@ -2503,64 +2819,73 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, void MemberDef::setArgumentList(ArgumentList *al) { - if (defArgList) delete defArgList; - defArgList = al; + makeResident(); + if (m_impl->defArgList) delete m_impl->defArgList; + m_impl->defArgList = al; } void MemberDef::setDeclArgumentList(ArgumentList *al) { - if (declArgList) delete declArgList; - declArgList = al; + makeResident(); + if (m_impl->declArgList) delete m_impl->declArgList; + m_impl->declArgList = al; } void MemberDef::findSectionsInDocumentation() { + makeResident(); docFindSections(documentation(),this,0,docFile()); } void MemberDef::enableCallGraph(bool e) { - m_hasCallGraph=e; + makeResident(); + m_impl->hasCallGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } void MemberDef::enableCallerGraph(bool e) { - m_hasCallerGraph=e; + makeResident(); + m_impl->hasCallerGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } bool MemberDef::protectionVisible() const { - return prot==Public || - (prot==Private && Config_getBool("EXTRACT_PRIVATE")) || - (prot==Protected && Config_getBool("EXTRACT_PROTECTED")) || - (prot==Package && Config_getBool("EXTRACT_PACKAGE")); + makeResident(); + return m_impl->prot==Public || + (m_impl->prot==Private && Config_getBool("EXTRACT_PRIVATE")) || + (m_impl->prot==Protected && Config_getBool("EXTRACT_PROTECTED")) || + (m_impl->prot==Package && Config_getBool("EXTRACT_PACKAGE")); } void MemberDef::setInbodyDocumentation(const char *docs, const char *docFile,int docLine) { - m_inbodyDocs = docs; - m_inbodyDocs = m_inbodyDocs.stripWhiteSpace(); - m_inbodyLine = docLine; - m_inbodyFile = docFile; + makeResident(); + m_impl->inbodyDocs = docs; + m_impl->inbodyDocs = m_impl->inbodyDocs.stripWhiteSpace(); + m_impl->inbodyLine = docLine; + m_impl->inbodyFile = docFile; } bool MemberDef::isObjCMethod() const { - if (classDef && classDef->isObjectiveC() && isFunction()) return TRUE; + makeResident(); + if (m_impl->classDef && m_impl->classDef->isObjectiveC() && isFunction()) return TRUE; return FALSE; } QCString MemberDef::qualifiedName() { + makeResident(); if (isObjCMethod()) { QCString qm; if (isStatic()) qm="+"; else qm="-"; qm+="["; - qm+=classDef->name()+" "; + qm+=m_impl->classDef->name()+" "; qm+=name(); qm+="]"; return qm; @@ -2575,14 +2900,16 @@ void MemberDef::setTagInfo(TagInfo *ti) { if (ti) { - anc=ti->anchor; + makeResident(); + m_impl->anc=ti->anchor; setReference(ti->tagName); - explicitOutputFileBase = stripExtension(ti->fileName); + m_impl->explicitOutputFileBase = stripExtension(ti->fileName); } } QCString MemberDef::objCMethodName(bool localLink,bool showStatic) const { + makeResident(); QCString qm; if (showStatic) { @@ -2592,9 +2919,862 @@ QCString MemberDef::objCMethodName(bool localLink,bool showStatic) const if (!localLink) // link to method of same class { qm+=" ("; - qm+=classDef->name(); + qm+=m_impl->classDef->name(); qm+=")"; } return qm; } +const char *MemberDef::declaration() const +{ + makeResident(); + return m_impl->decl; +} + +const char *MemberDef::definition() const +{ + makeResident(); + return m_impl->def; +} + +const char *MemberDef::typeString() const +{ + makeResident(); + return m_impl->type; +} + +const char *MemberDef::argsString() const +{ + makeResident(); + return m_impl->args; +} + +const char *MemberDef::excpString() const +{ + makeResident(); + return m_impl->exception; +} + +const char *MemberDef::bitfieldString() const +{ + makeResident(); + return m_impl->bitfields; +} + +const QCString &MemberDef::initializer() const +{ + makeResident(); + return m_impl->initializer; +} + +int MemberDef::initializerLines() const +{ + makeResident(); + return m_impl->initLines; +} + +int MemberDef::getMemberSpecifiers() const +{ + makeResident(); + return m_impl->memSpec; +} + +ClassDef *MemberDef::getClassDef() const +{ + makeResident(); + return m_impl->classDef; +} + +FileDef *MemberDef::getFileDef() const +{ + makeResident(); + return m_impl->fileDef; +} + +NamespaceDef* MemberDef::getNamespaceDef() const +{ + makeResident(); + return m_impl->nspace; +} + +const char *MemberDef::getReadAccessor() const +{ + makeResident(); + return m_impl->read; +} + +const char *MemberDef::getWriteAccessor() const +{ + makeResident(); + return m_impl->write; +} + +GroupDef *MemberDef::getGroupDef() const +{ + makeResident(); + return m_impl->group; +} + +Grouping::GroupPri_t MemberDef::getGroupPri() const +{ + makeResident(); + return m_impl->grouppri; +} + +const char *MemberDef::getGroupFileName() const +{ + makeResident(); + return m_impl->groupFileName; +} + +int MemberDef::getGroupStartLine() const +{ + makeResident(); + return m_impl->groupStartLine; +} + +bool MemberDef::getGroupHasDocs() const +{ + makeResident(); + return m_impl->groupHasDocs; +} + +Protection MemberDef::protection() const +{ + makeResident(); + return m_impl->prot; +} + +MemberDef::MemberType MemberDef::memberType() const +{ + makeResident(); + return m_impl->mtype; +} + +bool MemberDef::isSignal() const +{ + makeResident(); + return m_impl->mtype==Signal; +} + +bool MemberDef::isSlot() const +{ + makeResident(); + return m_impl->mtype==Slot; +} + +bool MemberDef::isVariable() const +{ + makeResident(); + return m_impl->mtype==Variable; +} + +bool MemberDef::isEnumerate() const +{ + makeResident(); + return m_impl->mtype==Enumeration; +} + +bool MemberDef::isEnumValue() const +{ + makeResident(); + return m_impl->mtype==EnumValue; +} + +bool MemberDef::isTypedef() const +{ + makeResident(); + return m_impl->mtype==Typedef; +} + +bool MemberDef::isFunction() const +{ + makeResident(); + return m_impl->mtype==Function; +} + +bool MemberDef::isDefine() const +{ + makeResident(); + return m_impl->mtype==Define; +} + +bool MemberDef::isFriend() const +{ + makeResident(); + return m_impl->mtype==Friend; +} + +bool MemberDef::isDCOP() const +{ + makeResident(); + return m_impl->mtype==DCOP; +} + +bool MemberDef::isProperty() const +{ + makeResident(); + return m_impl->mtype==Property; +} + +bool MemberDef::isEvent() const +{ + makeResident(); + return m_impl->mtype==Event; +} + +bool MemberDef::isRelated() const +{ + makeResident(); + return m_impl->related; +} + +bool MemberDef::isStatic() const +{ + makeResident(); + return m_impl->stat; +} + +bool MemberDef::isInline() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Inline)!=0; +} + +bool MemberDef::isExplicit() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Explicit)!=0; +} + +bool MemberDef::isMutable() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Mutable)!=0; +} + +bool MemberDef::isGettable() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Gettable)!=0; +} + +bool MemberDef::isSettable() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Settable)!=0; +} + +bool MemberDef::isReadable() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Readable)!=0; +} + +bool MemberDef::isWritable() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Writable)!=0; +} + +bool MemberDef::isFinal() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Final)!=0; +} + +bool MemberDef::isAbstract() const +{ + makeResident(); + return (m_impl->memSpec&Entry::Abstract)!=0; +} + +bool MemberDef::isImplementation() const +{ + makeResident(); + return m_impl->implOnly; +} + +bool MemberDef::isExternal() const +{ + makeResident(); + return m_impl->explExt; +} + +bool MemberDef::isTemplateSpecialization() const +{ + makeResident(); + return m_impl->tspec; +} + +bool MemberDef::hasDocumentedParams() const +{ + makeResident(); + return m_impl->hasDocumentedParams; +} + +bool MemberDef::hasDocumentedReturnType() const +{ + makeResident(); + return m_impl->hasDocumentedReturnType; +} + +int MemberDef::inbodyLine() const +{ + makeResident(); + return m_impl->inbodyLine; +} + +QCString MemberDef::inbodyFile() const +{ + makeResident(); + return m_impl->inbodyFile; +} + +const QCString &MemberDef::inbodyDocumentation() const +{ + makeResident(); + return m_impl->inbodyDocs; +} + +ClassDef *MemberDef::relatedAlso() const +{ + makeResident(); + return m_impl->relatedAlso; +} + +bool MemberDef::hasDocumentedEnumValues() const +{ + makeResident(); + return m_impl->docEnumValues; +} + +MemberDef *MemberDef::getAnonymousEnumType() const +{ + makeResident(); + return m_impl->annEnumType; +} + +bool MemberDef::isDocsForDefinition() const +{ + makeResident(); + return m_impl->docsForDefinition; +} + +MemberDef *MemberDef::getEnumScope() const +{ + makeResident(); + return m_impl->enumScope; +} + +LockingPtr<MemberList> MemberDef::enumFieldList() const +{ + makeResident(); + return LockingPtr<MemberList>(this,m_impl->enumFields); +} + +LockingPtr<ExampleSDict> MemberDef::getExamples() const +{ + makeResident(); + return LockingPtr<ExampleSDict>(this,m_impl->exampleSDict); +} + +bool MemberDef::isPrototype() const +{ + makeResident(); + return m_impl->proto; +} + +LockingPtr<ArgumentList> MemberDef::argumentList() const +{ + makeResident(); + return LockingPtr<ArgumentList>(this,m_impl->defArgList); +} + +LockingPtr<ArgumentList> MemberDef::declArgumentList() const +{ + makeResident(); + return LockingPtr<ArgumentList>(this,m_impl->declArgList); +} + +LockingPtr<ArgumentList> MemberDef::templateArguments() const +{ + makeResident(); + return LockingPtr<ArgumentList>(this,m_impl->tArgList); +} + +LockingPtr< QList<ArgumentList> > MemberDef::definitionTemplateParameterLists() const +{ + makeResident(); + return LockingPtr< QList<ArgumentList> >(this,m_impl->defTmpArgLists); +} + +int MemberDef::getMemberGroupId() const +{ + makeResident(); + return m_impl->grpId; +} + +MemberGroup *MemberDef::getMemberGroup() const +{ + makeResident(); + return m_impl->memberGroup; +} + +bool MemberDef::fromAnonymousScope() const +{ + makeResident(); + return m_impl->annScope; +} + +bool MemberDef::anonymousDeclShown() const +{ + makeResident(); + return m_impl->annUsed; +} + +void MemberDef::setAnonymousUsed() +{ + makeResident(); + m_impl->annUsed = TRUE; +} + +bool MemberDef::hasCallGraph() const +{ + makeResident(); + return m_impl->hasCallGraph; +} + +bool MemberDef::hasCallerGraph() const +{ + makeResident(); + return m_impl->hasCallerGraph; +} + +MemberDef *MemberDef::templateMaster() const +{ + makeResident(); + return m_impl->templateMaster; +} + +bool MemberDef::isTypedefValCached() const +{ + makeResident(); + return m_impl->isTypedefValCached; +} + +ClassDef *MemberDef::getCachedTypedefVal() const +{ + makeResident(); + return m_impl->cachedTypedefValue; +} + +QCString MemberDef::getCachedTypedefTemplSpec() const +{ + makeResident(); + return m_impl->cachedTypedefTemplSpec; +} + +MemberDef *MemberDef::memberDefinition() const +{ + makeResident(); + return m_impl->memDef; +} + +MemberDef *MemberDef::memberDeclaration() const +{ + makeResident(); + return m_impl->memDec; +} + +MemberDef *MemberDef::inheritsDocsFrom() const +{ + makeResident(); + return m_impl->docProvider; +} + +MemberDef *MemberDef::getGroupAlias() const +{ + makeResident(); + return m_impl->groupAlias; +} + +void MemberDef::setMemberType(MemberType t) +{ + makeResident(); + m_impl->mtype=t; +} + +void MemberDef::setDefinition(const char *d) +{ + makeResident(); + m_impl->def=d; +} + +void MemberDef::setFileDef(FileDef *fd) +{ + makeResident(); + m_impl->fileDef=fd; +} + +void MemberDef::setProtection(Protection p) +{ + makeResident(); + m_impl->prot=p; +} + +void MemberDef::setMemberSpecifiers(int s) +{ + makeResident(); + m_impl->memSpec=s; +} + +void MemberDef::mergeMemberSpecifiers(int s) +{ + makeResident(); + m_impl->memSpec|=s; +} + +void MemberDef::setBitfields(const char *s) +{ + makeResident(); + m_impl->bitfields = s; +} + +void MemberDef::setMaxInitLines(int lines) +{ + makeResident(); + m_impl->userInitLines=lines; +} + +void MemberDef::setExplicitExternal(bool b) +{ + makeResident(); + m_impl->explExt=b; +} + +void MemberDef::setReadAccessor(const char *r) +{ + makeResident(); + m_impl->read=r; +} + +void MemberDef::setWriteAccessor(const char *w) +{ + makeResident(); + m_impl->write=w; +} + +void MemberDef::setTemplateSpecialization(bool b) +{ + makeResident(); + m_impl->tspec=b; +} + +void MemberDef::makeRelated() +{ + makeResident(); + m_impl->related=TRUE; +} + +void MemberDef::setHasDocumentedParams(bool b) +{ + makeResident(); + m_impl->hasDocumentedParams = b; +} + +void MemberDef::setHasDocumentedReturnType(bool b) +{ + makeResident(); + m_impl->hasDocumentedReturnType = b; +} + +void MemberDef::setInheritsDocsFrom(MemberDef *md) +{ + makeResident(); + m_impl->docProvider = md; +} + +void MemberDef::setArgsString(const char *as) +{ + makeResident(); + m_impl->args = as; +} + +void MemberDef::setRelatedAlso(ClassDef *cd) +{ + makeResident(); + m_impl->relatedAlso=cd; +} + +void MemberDef::setEnumClassScope(ClassDef *cd) +{ + makeResident(); + m_impl->classDef = cd; +} + +void MemberDef::setDocumentedEnumValues(bool value) +{ + makeResident(); + m_impl->docEnumValues=value; +} + +void MemberDef::setAnonymousEnumType(MemberDef *md) +{ + makeResident(); + m_impl->annEnumType = md; +} + +void MemberDef::setPrototype(bool p) +{ + makeResident(); + m_impl->proto=p; +} + +void MemberDef::setMemberGroupId(int id) +{ + makeResident(); + m_impl->grpId=id; +} + +void MemberDef::makeImplementationDetail() +{ + makeResident(); + m_impl->implOnly=TRUE; +} + +void MemberDef::setFromAnonymousScope(bool b) +{ + makeResident(); + m_impl->annScope=b; +} + +void MemberDef::setFromAnonymousMember(MemberDef *m) +{ + makeResident(); + m_impl->annMemb=m; +} + +void MemberDef::setTemplateMaster(MemberDef *mt) +{ + makeResident(); + m_impl->templateMaster=mt; +} + +void MemberDef::setDocsForDefinition(bool b) +{ + makeResident(); + m_impl->docsForDefinition = b; +} + +void MemberDef::setGroupAlias(MemberDef *md) +{ + makeResident(); + m_impl->groupAlias = md; +} + +void MemberDef::invalidateTypedefValCache() +{ + makeResident(); + m_impl->isTypedefValCached=FALSE; +} + +void MemberDef::setMemberDefinition(MemberDef *md) +{ + makeResident(); + m_impl->memDef=md; +} + +void MemberDef::setMemberDeclaration(MemberDef *md) +{ + makeResident(); + m_impl->memDec=md; +} + +void MemberDef::cacheTypedefVal(ClassDef*val, QCString const& templSpec) +{ + makeResident(); + m_impl->isTypedefValCached=TRUE; + m_impl->cachedTypedefValue=val; + m_impl->cachedTypedefTemplSpec=templSpec; +} + +void MemberDef::flushToDisk() const +{ + //printf("%p: MemberDef::flushToDisk()\n",this); + // write the definition base class member variables to disk + Definition::flushToDisk(); + + if (isLocked()) return; + //printf("%p: flushing specific part\n",this); + + // write the memberdef member variables to disk + marshalUInt(Doxygen::symbolStorage,START_MARKER); + marshalObjPointer (Doxygen::symbolStorage,m_impl->classDef); + marshalObjPointer (Doxygen::symbolStorage,m_impl->fileDef); + marshalObjPointer (Doxygen::symbolStorage,m_impl->nspace); + marshalObjPointer (Doxygen::symbolStorage,m_impl->enumScope); + marshalObjPointer (Doxygen::symbolStorage,m_impl->annEnumType); + marshalMemberList (Doxygen::symbolStorage,m_impl->enumFields); + marshalObjPointer (Doxygen::symbolStorage,m_impl->redefines); + marshalMemberList (Doxygen::symbolStorage,m_impl->redefinedBy); + marshalObjPointer (Doxygen::symbolStorage,m_impl->memDef); + marshalObjPointer (Doxygen::symbolStorage,m_impl->memDec); + marshalObjPointer (Doxygen::symbolStorage,m_impl->relatedAlso); + marshalExampleSDict (Doxygen::symbolStorage,m_impl->exampleSDict); + marshalQCString (Doxygen::symbolStorage,m_impl->type); + marshalQCString (Doxygen::symbolStorage,m_impl->args); + marshalQCString (Doxygen::symbolStorage,m_impl->def); + marshalQCString (Doxygen::symbolStorage,m_impl->anc); + marshalInt (Doxygen::symbolStorage,(int)m_impl->virt); + marshalInt (Doxygen::symbolStorage,(int)m_impl->prot); + marshalQCString (Doxygen::symbolStorage,m_impl->decl); + marshalQCString (Doxygen::symbolStorage,m_impl->bitfields); + marshalQCString (Doxygen::symbolStorage,m_impl->read); + marshalQCString (Doxygen::symbolStorage,m_impl->write); + marshalQCString (Doxygen::symbolStorage,m_impl->exception); + marshalQCString (Doxygen::symbolStorage,m_impl->initializer); + marshalInt (Doxygen::symbolStorage,m_impl->initLines); + marshalInt (Doxygen::symbolStorage,m_impl->memSpec); + marshalInt (Doxygen::symbolStorage,(int)m_impl->mtype); + marshalInt (Doxygen::symbolStorage,m_impl->maxInitLines); + marshalInt (Doxygen::symbolStorage,m_impl->userInitLines); + marshalObjPointer (Doxygen::symbolStorage,m_impl->annMemb); + marshalArgumentList (Doxygen::symbolStorage,m_impl->defArgList); + marshalArgumentList (Doxygen::symbolStorage,m_impl->declArgList); + marshalArgumentList (Doxygen::symbolStorage,m_impl->tArgList); + marshalObjPointer (Doxygen::symbolStorage,m_impl->templateMaster); + marshalArgumentLists(Doxygen::symbolStorage,m_impl->defTmpArgLists); + marshalObjPointer (Doxygen::symbolStorage,m_impl->cachedAnonymousType); + marshalMemberLists (Doxygen::symbolStorage,m_impl->classSectionSDict); + marshalObjPointer (Doxygen::symbolStorage,m_impl->groupAlias); + marshalInt (Doxygen::symbolStorage,m_impl->grpId); + marshalObjPointer (Doxygen::symbolStorage,m_impl->memberGroup); + marshalObjPointer (Doxygen::symbolStorage,m_impl->group); + marshalInt (Doxygen::symbolStorage,(int)m_impl->grouppri); + marshalQCString (Doxygen::symbolStorage,m_impl->groupFileName); + marshalInt (Doxygen::symbolStorage,m_impl->groupStartLine); + marshalObjPointer (Doxygen::symbolStorage,m_impl->groupMember); + marshalBool (Doxygen::symbolStorage,m_impl->isTypedefValCached); + marshalObjPointer (Doxygen::symbolStorage,m_impl->cachedTypedefValue); + marshalQCString (Doxygen::symbolStorage,m_impl->cachedTypedefTemplSpec); + marshalInt (Doxygen::symbolStorage,m_impl->inbodyLine); + marshalQCString (Doxygen::symbolStorage,m_impl->inbodyFile); + marshalQCString (Doxygen::symbolStorage,m_impl->inbodyDocs); + marshalObjPointer (Doxygen::symbolStorage,m_impl->docProvider); + marshalQCString (Doxygen::symbolStorage,m_impl->explicitOutputFileBase); + marshalBool (Doxygen::symbolStorage,m_impl->implOnly); + marshalBool (Doxygen::symbolStorage,m_impl->hasDocumentedParams); + marshalBool (Doxygen::symbolStorage,m_impl->hasDocumentedReturnType); + marshalBool (Doxygen::symbolStorage,m_impl->isDMember); + marshalBool (Doxygen::symbolStorage,m_impl->related); + marshalBool (Doxygen::symbolStorage,m_impl->stat); + marshalBool (Doxygen::symbolStorage,m_impl->proto); + marshalBool (Doxygen::symbolStorage,m_impl->docEnumValues); + marshalBool (Doxygen::symbolStorage,m_impl->annScope); + marshalBool (Doxygen::symbolStorage,m_impl->annUsed); + marshalBool (Doxygen::symbolStorage,m_impl->hasCallGraph); + marshalBool (Doxygen::symbolStorage,m_impl->hasCallerGraph); + marshalBool (Doxygen::symbolStorage,m_impl->explExt); + marshalBool (Doxygen::symbolStorage,m_impl->tspec); + marshalBool (Doxygen::symbolStorage,m_impl->groupHasDocs); + marshalBool (Doxygen::symbolStorage,m_impl->docsForDefinition); + marshalUInt(Doxygen::symbolStorage,END_MARKER); + + // function doesn't modify the object conceptually but compiler doesn't know this. + MemberDef *that = (MemberDef *)this; + delete that->m_impl; + that->m_impl=0; +} + +void MemberDef::loadFromDisk() const +{ + //printf("%p: MemberDef::loadFromDisk()\n",this); + Definition::loadFromDisk(); + + if (isLocked()) + { + assert(m_impl!=0); + return; + } + assert(m_impl==0); + //printf("%p: loading specific part\n",this); + + MemberDef *that = (MemberDef *)this; + that->m_impl = new MemberDefImpl; + + uint marker = unmarshalUInt(Doxygen::symbolStorage); + assert(marker==START_MARKER); + m_impl->classDef = (ClassDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->fileDef = (FileDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->nspace = (NamespaceDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->enumScope = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->annEnumType = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->enumFields = unmarshalMemberList (Doxygen::symbolStorage); + m_impl->redefines = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->redefinedBy = unmarshalMemberList (Doxygen::symbolStorage); + m_impl->memDef = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->memDec = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->relatedAlso = (ClassDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->exampleSDict = unmarshalExampleSDict (Doxygen::symbolStorage); + m_impl->type = unmarshalQCString (Doxygen::symbolStorage); + m_impl->args = unmarshalQCString (Doxygen::symbolStorage); + m_impl->def = unmarshalQCString (Doxygen::symbolStorage); + m_impl->anc = unmarshalQCString (Doxygen::symbolStorage); + m_impl->virt = (Specifier)unmarshalInt (Doxygen::symbolStorage); + m_impl->prot = (Protection)unmarshalInt(Doxygen::symbolStorage); + m_impl->decl = unmarshalQCString (Doxygen::symbolStorage); + m_impl->bitfields = unmarshalQCString (Doxygen::symbolStorage); + m_impl->read = unmarshalQCString (Doxygen::symbolStorage); + m_impl->write = unmarshalQCString (Doxygen::symbolStorage); + m_impl->exception = unmarshalQCString (Doxygen::symbolStorage); + m_impl->initializer = unmarshalQCString (Doxygen::symbolStorage); + m_impl->initLines = unmarshalInt (Doxygen::symbolStorage); + m_impl->memSpec = unmarshalInt (Doxygen::symbolStorage); + m_impl->mtype = (MemberDef::MemberType)unmarshalInt (Doxygen::symbolStorage); + m_impl->maxInitLines = unmarshalInt (Doxygen::symbolStorage); + m_impl->userInitLines = unmarshalInt (Doxygen::symbolStorage); + m_impl->annMemb = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->defArgList = unmarshalArgumentList (Doxygen::symbolStorage); + m_impl->declArgList = unmarshalArgumentList (Doxygen::symbolStorage); + m_impl->tArgList = unmarshalArgumentList (Doxygen::symbolStorage); + m_impl->templateMaster = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->defTmpArgLists = unmarshalArgumentLists(Doxygen::symbolStorage); + m_impl->cachedAnonymousType = (ClassDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->classSectionSDict = unmarshalMemberLists (Doxygen::symbolStorage); + m_impl->groupAlias = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->grpId = unmarshalInt (Doxygen::symbolStorage); + m_impl->memberGroup = (MemberGroup*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->group = (GroupDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->grouppri = (Grouping::GroupPri_t)unmarshalInt (Doxygen::symbolStorage); + m_impl->groupFileName = unmarshalQCString (Doxygen::symbolStorage); + m_impl->groupStartLine = unmarshalInt (Doxygen::symbolStorage); + m_impl->groupMember = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->isTypedefValCached = unmarshalBool (Doxygen::symbolStorage); + m_impl->cachedTypedefValue = (ClassDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->cachedTypedefTemplSpec = unmarshalQCString (Doxygen::symbolStorage); + m_impl->inbodyLine = unmarshalInt (Doxygen::symbolStorage); + m_impl->inbodyFile = unmarshalQCString (Doxygen::symbolStorage); + m_impl->inbodyDocs = unmarshalQCString (Doxygen::symbolStorage); + m_impl->docProvider = (MemberDef*)unmarshalObjPointer (Doxygen::symbolStorage); + m_impl->explicitOutputFileBase = unmarshalQCString (Doxygen::symbolStorage); + m_impl->implOnly = unmarshalBool (Doxygen::symbolStorage); + m_impl->hasDocumentedParams = unmarshalBool (Doxygen::symbolStorage); + m_impl->hasDocumentedReturnType = unmarshalBool (Doxygen::symbolStorage); + m_impl->isDMember = unmarshalBool (Doxygen::symbolStorage); + m_impl->related = unmarshalBool (Doxygen::symbolStorage); + m_impl->stat = unmarshalBool (Doxygen::symbolStorage); + m_impl->proto = unmarshalBool (Doxygen::symbolStorage); + m_impl->docEnumValues = unmarshalBool (Doxygen::symbolStorage); + m_impl->annScope = unmarshalBool (Doxygen::symbolStorage); + m_impl->annUsed = unmarshalBool (Doxygen::symbolStorage); + m_impl->hasCallGraph = unmarshalBool (Doxygen::symbolStorage); + m_impl->hasCallerGraph = unmarshalBool (Doxygen::symbolStorage); + m_impl->explExt = unmarshalBool (Doxygen::symbolStorage); + m_impl->tspec = unmarshalBool (Doxygen::symbolStorage); + m_impl->groupHasDocs = unmarshalBool (Doxygen::symbolStorage); + m_impl->docsForDefinition = unmarshalBool (Doxygen::symbolStorage); + marker = unmarshalUInt(Doxygen::symbolStorage); + assert(marker==END_MARKER); +} + diff --git a/src/memberdef.h b/src/memberdef.h index 1d2d9d3..52ee455 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -38,6 +38,7 @@ class OutputList; class GroupDef; class QTextStream; class ArgumentList; +class MemberDefImpl; struct SourceReference { @@ -73,76 +74,79 @@ class MemberDef : public Definition ~MemberDef(); DefType definitionType() const { return TypeMember; } + //----------------------------------------------------------------------------------- + // ---- getters ----- + //----------------------------------------------------------------------------------- + // link id QCString getOutputFileBase() const; QCString getReference() const; QCString anchor() const; - const char *declaration() const { return decl; } - const char *definition() const { return def; } - const char *typeString() const { return type; } - const char *argsString() const { return args; } - const char *excpString() const { return exception; } - const char *bitfieldString() const { return bitfields; } - const QCString &initializer() const { return init; } - int initializerLines() const { return initLines; } - int getMemberSpecifiers() const { return memSpec; } + const char *declaration() const; + const char *definition() const; + const char *typeString() const; + const char *argsString() const; + const char *excpString() const; + const char *bitfieldString() const; + const QCString &initializer() const; + int initializerLines() const; + int getMemberSpecifiers() const; MemberList *getSectionList(Definition *d) const; // scope query members - ClassDef *getClassDef() const { return classDef; } - FileDef *getFileDef() const { return fileDef; } - NamespaceDef* getNamespaceDef() const { return nspace; } - //Definition *getCompoundDef() const; + ClassDef *getClassDef() const; + FileDef *getFileDef() const; + NamespaceDef* getNamespaceDef() const; // grabbing the property read/write accessor names - const char *getReadAccessor() const { return read; } - const char *getWriteAccessor() const { return write; } + const char *getReadAccessor() const; + const char *getWriteAccessor() const; // querying the grouping definition - GroupDef *getGroupDef() const { return group; } - Grouping::GroupPri_t getGroupPri() const { return grouppri; } - const char *getGroupFileName() const { return groupFileName; } - int getGroupStartLine() const { return groupStartLine; } - bool getGroupHasDocs() const { return groupHasDocs; } + GroupDef *getGroupDef() const; + Grouping::GroupPri_t getGroupPri() const; + const char *getGroupFileName() const; + int getGroupStartLine() const; + bool getGroupHasDocs() const; QCString qualifiedName(); QCString objCMethodName(bool localLink,bool showStatic) const; // direct kind info - Protection protection() const { return prot; } + Protection protection() const; Specifier virtualness() const; - MemberType memberType() const { return mtype; } + MemberType memberType() const; QCString memberTypeName() const; // getter methods - bool isSignal() const { return mtype==Signal; } - bool isSlot() const { return mtype==Slot; } - bool isVariable() const { return mtype==Variable; } - bool isEnumerate() const { return mtype==Enumeration; } - bool isEnumValue() const { return mtype==EnumValue; } - bool isTypedef() const { return mtype==Typedef; } - bool isFunction() const { return mtype==Function; } - bool isDefine() const { return mtype==Define; } - bool isFriend() const { return mtype==Friend; } - bool isDCOP() const { return mtype==DCOP; } - bool isProperty() const { return mtype==Property; } - bool isEvent() const { return mtype==Event; } - bool isRelated() const { return related; } - bool isStatic() const { return stat; } - bool isInline() const { return (memSpec&Entry::Inline)!=0; } - bool isExplicit() const { return (memSpec&Entry::Explicit)!=0; } - bool isMutable() const { return (memSpec&Entry::Mutable)!=0; } - bool isGettable() const { return (memSpec&Entry::Gettable)!=0; } - bool isSettable() const { return (memSpec&Entry::Settable)!=0; } - bool isReadable() const { return (memSpec&Entry::Readable)!=0; } - bool isWritable() const { return (memSpec&Entry::Writable)!=0; } - bool isFinal() const { return (memSpec&Entry::Final)!=0; } - bool isAbstract() const { return (memSpec&Entry::Abstract)!=0; } - bool isImplementation() const { return m_implOnly; } - bool isExternal() const { return explExt; } - bool isTemplateSpecialization() const { return tspec; } - bool hasDocumentedParams() const { return m_hasDocumentedParams; } - bool hasDocumentedReturnType() const { return m_hasDocumentedReturnType; } + bool isSignal() const; + bool isSlot() const; + bool isVariable() const; + bool isEnumerate() const; + bool isEnumValue() const; + bool isTypedef() const; + bool isFunction() const; + bool isDefine() const; + bool isFriend() const; + bool isDCOP() const; + bool isProperty() const; + bool isEvent() const; + bool isRelated() const; + bool isStatic() const; + bool isInline() const; + bool isExplicit() const; + bool isMutable() const; + bool isGettable() const; + bool isSettable() const; + bool isReadable() const; + bool isWritable() const; + bool isFinal() const; + bool isAbstract() const; + bool isImplementation() const; + bool isExternal() const; + bool isTemplateSpecialization() const; + bool hasDocumentedParams() const; + bool hasDocumentedReturnType() const; bool isObjCMethod() const; bool isConstructor() const; bool isDestructor() const; @@ -160,153 +164,173 @@ class MemberDef : public Definition bool isFriendClass() const; bool isDocumentedFriendClass() const; + MemberDef *reimplements() const; + LockingPtr<MemberList> reimplementedBy() const; + + int inbodyLine() const; + QCString inbodyFile() const; + const QCString &inbodyDocumentation() const; + + ClassDef *relatedAlso() const; + + bool hasDocumentedEnumValues() const; + MemberDef *getAnonymousEnumType() const; + bool isDocsForDefinition() const; + MemberDef *getEnumScope() const; + LockingPtr<MemberList> enumFieldList() const; + + bool hasExamples(); + LockingPtr<ExampleSDict> getExamples() const; + bool isPrototype() const; + + // argument related members + LockingPtr<ArgumentList> argumentList() const; + LockingPtr<ArgumentList> declArgumentList() const; + LockingPtr<ArgumentList> templateArguments() const; + LockingPtr< QList<ArgumentList> > definitionTemplateParameterLists() const; + + // member group related members + int getMemberGroupId() const; + MemberGroup *getMemberGroup() const; + + bool fromAnonymousScope() const; + bool anonymousDeclShown() const; + + // callgraph related members + bool hasCallGraph() const; + bool hasCallerGraph() const; + bool visibleMemberGroup(bool hideNoHeader); + + MemberDef *templateMaster() const; + QCString getScopeString() const; + ClassDef *getClassDefOfAnonymousType(); + + // cached typedef functions + bool isTypedefValCached() const; + ClassDef *getCachedTypedefVal() const; + QCString getCachedTypedefTemplSpec() const; + + MemberDef *memberDefinition() const; + MemberDef *memberDeclaration() const; + MemberDef *inheritsDocsFrom() const; + MemberDef *getGroupAlias() const; + + //----------------------------------------------------------------------------------- + // ---- setters ----- + //----------------------------------------------------------------------------------- + // set functions - void setMemberType(MemberType t) { mtype=t; } - void setDefinition(const char *d) { def=d; } - void setFileDef(FileDef *fd) { fileDef=fd; } + void setMemberType(MemberType t); + void setDefinition(const char *d); + void setFileDef(FileDef *fd); void setAnchor(const char *a); - void setProtection(Protection p) { prot=p; } - void setMemberSpecifiers(int s) { memSpec=s; } - void mergeMemberSpecifiers(int s) { memSpec|=s; } + void setProtection(Protection p); + void setMemberSpecifiers(int s); + void mergeMemberSpecifiers(int s); void setInitializer(const char *i); - void setBitfields(const char *s) { bitfields = s; } - void setMaxInitLines(int lines) { userInitLines=lines; } + void setBitfields(const char *s); + void setMaxInitLines(int lines); void setMemberClass(ClassDef *cd); void setSectionList(Definition *d,MemberList *sl); void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, MemberDef *member=0); - void setExplicitExternal(bool b) { explExt=b; } - void setReadAccessor(const char *r) { read=r; } - void setWriteAccessor(const char *w) { write=w; } - void setTemplateSpecialization(bool b) { tspec=b; } + void setExplicitExternal(bool b); + void setReadAccessor(const char *r); + void setWriteAccessor(const char *w); + void setTemplateSpecialization(bool b); - void makeRelated() { related=TRUE; } - void setHasDocumentedParams(bool b) { m_hasDocumentedParams = b; } - void setHasDocumentedReturnType(bool b) { m_hasDocumentedReturnType = b; } - void setInheritsDocsFrom(MemberDef *md) { m_docProvider = md; } + void makeRelated(); + void setHasDocumentedParams(bool b); + void setHasDocumentedReturnType(bool b); + void setInheritsDocsFrom(MemberDef *md); void setTagInfo(TagInfo *i); - void setArgsString(const char *as) { args = as; } + void setArgsString(const char *as); - // output generation - void writeDeclaration(OutputList &ol, - ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - bool inGroup); - void writeDocumentation(MemberList *ml,OutputList &ol, - const char *scopeName,Definition *container, - bool inGroup,bool showEnumValues=FALSE); - void warnIfUndocumented(); - // relation to other members void setReimplements(MemberDef *md); void insertReimplementedBy(MemberDef *md); - MemberDef *reimplements() const; - MemberList *reimplementedBy() const; - + // in-body documentation void setInbodyDocumentation(const char *docs,const char *file,int line); - int inbodyLine() const { return m_inbodyLine; } - QCString inbodyFile() const { return m_inbodyFile; } - const QCString &inbodyDocumentation() const { return m_inbodyDocs; } - - // For function documentation that can also be found in a class's related func section. - void setRelatedAlso(ClassDef *cd) { m_relatedAlso=cd; } - ClassDef *relatedAlso() const { return m_relatedAlso; } - + + void setRelatedAlso(ClassDef *cd); + // enumeration specific members void insertEnumField(MemberDef *md); void setEnumScope(MemberDef *md); - void setEnumClassScope(ClassDef *cd) { classDef = cd; } - MemberDef *getEnumScope() const { return enumScope; } - MemberList *enumFieldList() const { return enumFields; } - void setDocumentedEnumValues(bool value) { docEnumValues=value; } - bool hasDocumentedEnumValues() const { return docEnumValues; } - void setAnonymousEnumType(MemberDef *md) { annEnumType = md; } - MemberDef *getAnonymousEnumType() const { return annEnumType; } - bool isDocsForDefinition() const { return docsForDefinition; } - + void setEnumClassScope(ClassDef *cd); + void setDocumentedEnumValues(bool value); + void setAnonymousEnumType(MemberDef *md); + // example related members bool addExample(const char *anchor,const char *name,const char *file); - bool hasExamples(); - ExampleSDict *getExamples() const { return exampleSDict; } // prototype related members - void setPrototype(bool p) { proto=p; } - bool isPrototype() const { return proto; } - + void setPrototype(bool p); + // argument related members - ArgumentList *argumentList() const { return defArgList; } - ArgumentList *declArgumentList() const { return declArgList; } void setArgumentList(ArgumentList *al); void setDeclArgumentList(ArgumentList *al); - ArgumentList *templateArguments() const { return tArgList; } void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists); - QList<ArgumentList> *definitionTemplateParameterLists() const - { return m_defTmpArgLists; } - + // namespace related members void setNamespace(NamespaceDef *nd); // member group related members void setMemberGroup(MemberGroup *grp); - MemberGroup *getMemberGroup() const { return memberGroup; } - void setMemberGroupId(int id) { grpId=id; } - int getMemberGroupId() const { return grpId; } - void makeImplementationDetail() { m_implOnly=TRUE; } - + void setMemberGroupId(int id); + void makeImplementationDetail(); + // anonymous scope members - void setFromAnonymousScope(bool b) { annScope=b; } - void setFromAnonymousMember(MemberDef *m) { annMemb=m; } - bool fromAnonymousScope() const { return annScope; } - bool anonymousDeclShown() const { return annUsed; } + void setFromAnonymousScope(bool b); + void setFromAnonymousMember(MemberDef *m); - // callgraph related members - bool hasCallGraph() const { return m_hasCallGraph; } void enableCallGraph(bool e); - - // callergraph related members - bool hasCallerGraph() const { return m_hasCallerGraph; } void enableCallerGraph(bool e); - - bool visibleMemberGroup(bool hideNoHeader); - MemberDef *templateMaster() const { return m_templateMaster; } - QCString getScopeString() const; - - ClassDef *getClassDefOfAnonymousType(); - MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, - ArgumentList *actualArgs); - void setTemplateMaster(MemberDef *mt) { m_templateMaster=mt; } + void setTemplateMaster(MemberDef *mt); void addListReference(Definition *d); + void setDocsForDefinition(bool b); + void setGroupAlias(MemberDef *md); - MemberDef *inheritsDocsFrom() const { return m_docProvider; } - - void setDocsForDefinition(bool b) { docsForDefinition = b; } - void setGroupAlias(MemberDef *md) { groupAlias = md; } - MemberDef *getGroupAlias() const { return groupAlias; } - - // cached typedef functions - bool isTypedefValCached() const { return m_isTypedefValCached; } - ClassDef *getCachedTypedefVal() const { return m_cachedTypedefValue; } - QCString getCachedTypedefTemplSpec() const { return m_cachedTypedefTemplSpec; } - void cacheTypedefVal(ClassDef *val,const QCString &templSpec) - { m_isTypedefValCached=TRUE; m_cachedTypedefValue=val; m_cachedTypedefTemplSpec=templSpec; } - void invalidateTypedefValCache() { m_isTypedefValCached=FALSE; } + void cacheTypedefVal(ClassDef *val,const QCString &templSpec); + void invalidateTypedefValCache(); // declaration <-> definition relation - void setMemberDefinition(MemberDef *md) { memDef=md; } - void setMemberDeclaration(MemberDef *md) { memDec=md; } - MemberDef *memberDefinition() const { return memDef; } - MemberDef *memberDeclaration() const { return memDec; } + void setMemberDefinition(MemberDef *md); + void setMemberDeclaration(MemberDef *md); + void setAnonymousUsed(); + + //----------------------------------------------------------------------------------- + // --- actions ---- + //----------------------------------------------------------------------------------- + + // output generation + void writeDeclaration(OutputList &ol, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, + bool inGroup); + void writeDocumentation(MemberList *ml,OutputList &ol, + const char *scopeName,Definition *container, + bool inGroup,bool showEnumValues=FALSE); + void warnIfUndocumented(); + + MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, + ArgumentList *actualArgs); + void writeEnumDeclaration(OutputList &typeDecl, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd); void findSectionsInDocumentation(); bool visited; - + + protected: + void flushToDisk() const; + void loadFromDisk() const; private: + static int s_indentLevel; // disable copying of member defs MemberDef(const MemberDef &); MemberDef &operator=(const MemberDef &); @@ -315,107 +339,7 @@ class MemberDef : public Definition ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, bool onlyText=FALSE); - ClassDef *classDef; // member of or related to - FileDef *fileDef; // member of file definition - NamespaceDef *nspace; // the namespace this member is in. - - MemberDef *enumScope; // the enclosing scope, if this is an enum field - MemberDef *annEnumType; // the annonymous enum that is the type of this member - MemberList *enumFields; // enumeration fields - OutputList *enumDeclList; // stored piece of documentation for enumeration. - - MemberDef *redefines; // the members that this member redefines - MemberList *redefinedBy; // the list of members that redefine this one - - MemberDef *memDef; // member definition for this declaration - MemberDef *memDec; // member declaration for this definition - ClassDef *m_relatedAlso; // points to class marked by relatedAlso - - ExampleSDict *exampleSDict; // a dictionary of all examples for quick access - - QCString type; // return type - QCString args; // function arguments/variable array specifiers - QCString def; // member definition in code (fully qualified name) - QCString anc; // HTML anchor name - Specifier virt; // normal/virtual/pure virtual - Protection prot; // protection type [Public/Protected/Private] - QCString decl; // member declaration in class: TODO: can be generated - - QCString bitfields; // struct member bitfields - QCString read; // property read accessor - QCString write; // property write accessor - QCString exception; // exceptions that can be thrown - QCString init; // initializer - int initLines; // number of lines in the initializer - - int memSpec; // The specifiers present for this member - MemberType mtype; // returns the kind of member - int maxInitLines; // when the initializer will be displayed - int userInitLines; // result of explicit \hideinitializer or \showinitializer - MemberList *section; // declation list containing this member - MemberDef *annMemb; - - ArgumentList *defArgList; // argument list of this member definition - ArgumentList *declArgList; // argument list of this member declaration - - ArgumentList *tArgList; // template argument list of function template - MemberDef *m_templateMaster; - QList<ArgumentList> *m_defTmpArgLists; - - ClassDef *cachedAnonymousType; // if the member has an anonymous compound - // as its type then this is computed by - // getClassDefOfAnonymousType() and - // cached here. - SDict<MemberList> *classSectionSDict; - - MemberDef *groupAlias; // Member containing the definition - int grpId; // group id - MemberGroup *memberGroup; // group's member definition - GroupDef *group; // group in which this member is in - Grouping::GroupPri_t grouppri; // priority of this definition - QCString groupFileName; // file where this grouping was defined - int groupStartLine; // line " " " " " - MemberDef *groupMember; - - bool m_isTypedefValCached; - ClassDef *m_cachedTypedefValue; - QCString m_cachedTypedefTemplSpec; - - // inbody documentation - int m_inbodyLine; - QCString m_inbodyFile; - QCString m_inbodyDocs; - - // documentation inheritance - MemberDef *m_docProvider; - - // to store the output file base from tag files - QCString explicitOutputFileBase; - - // objective-c - bool m_implOnly; // function found in implementation but not - // in the interface - bool m_hasDocumentedParams; - bool m_hasDocumentedReturnType; - bool m_isDMember; - bool related; // is this a member that is only related to a class - bool stat; // is it a static function? - bool proto; // is it a prototype; - bool docEnumValues; // is an enum with documented enum values. - bool annScope; // member is part of an annoymous scope - bool annUsed; - bool annShown; - bool m_hasCallGraph; - bool m_hasCallerGraph; - bool explExt; // member was explicitly declared external - bool tspec; // member is a template specialization - bool groupHasDocs; // true if the entry that caused the grouping was documented - bool docsForDefinition; // TRUE => documentation block is put before - // definition. - // FALSE => block is put before declaration. - - static int s_indentLevel; - + MemberDefImpl *m_impl; }; #endif diff --git a/src/membergroup.cpp b/src/membergroup.cpp index e3c4b24..786b38f 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -27,6 +27,7 @@ #include "groupdef.h" #include "doxygen.h" #include "docparser.h" +#include "marshal.h" //static QCString idToName(int id) //{ @@ -35,6 +36,10 @@ // return result; //} +MemberGroup::MemberGroup() +{ +} + MemberGroup::MemberGroup(Definition *parent, int id,const char *hdr,const char *d,const char *docFile) { @@ -244,3 +249,35 @@ void MemberGroup::findSectionsInDocumentation() memberList->findSectionsInDocumentation(); } +void MemberGroup::marshal(StorageIntf *s) +{ + marshalMemberList(s,memberList); + marshalObjPointer(s,inDeclSection); // reference only + marshalInt(s,grpId); + marshalQCString(s,grpHeader); + marshalQCString(s,fileName); + marshalObjPointer(s,scope); + marshalQCString(s,doc); + marshalBool(s,inSameSection); + marshalInt(s,m_numDecMembers); + marshalInt(s,m_numDocMembers); + marshalObjPointer(s,m_parent); + marshalQCString(s,m_docFile); +} + +void MemberGroup::unmarshal(StorageIntf *s) +{ + memberList = unmarshalMemberList(s); + inDeclSection = (MemberList *)unmarshalObjPointer(s); + grpId = unmarshalInt(s); + grpHeader = unmarshalQCString(s); + fileName = unmarshalQCString(s); + scope = (Definition *)unmarshalObjPointer(s); + doc = unmarshalQCString(s); + inSameSection = unmarshalBool(s); + m_numDecMembers = unmarshalInt(s); + m_numDocMembers = unmarshalInt(s); + m_parent = (Definition *)unmarshalObjPointer(s); + m_docFile = unmarshalQCString(s); +} + diff --git a/src/membergroup.h b/src/membergroup.h index 9c72fd6..885341a 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -20,6 +20,7 @@ #include "qtbc.h" #include <qlist.h> +#include <qfile.h> #include "sortdict.h" #define DOX_NOGROUP -1 @@ -32,10 +33,12 @@ class MemberList; class GroupDef; class OutputList; class Definition; +class StorageIntf; class MemberGroup { public: + MemberGroup(); MemberGroup(Definition *parent,int id,const char *header, const char *docs,const char *docFile); ~MemberGroup(); @@ -74,14 +77,17 @@ class MemberGroup MemberList *members() const { return memberList; } Definition *parent() const { return m_parent; } + void marshal(StorageIntf *s); + void unmarshal(StorageIntf *s); + private: MemberList *memberList; // list of all members in the group + MemberList *inDeclSection; int grpId; QCString grpHeader; QCString fileName; // base name of the generated file Definition *scope; QCString doc; - MemberList *inDeclSection; bool inSameSection; int m_numDecMembers; int m_numDocMembers; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index b4fbdb3..78509bb 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -25,12 +25,17 @@ #include "doxygen.h" #include "outputlist.h" #include "groupdef.h" +#include "marshal.h" + +MemberList::MemberList() +{ +} MemberList::MemberList(ListType lt) : m_listType(lt) { memberGroupList=0; - m_numDecMembers=-1; // special value indicating that computation is needed - m_numDocMembers=-1; // special value indicating that computation is needed + m_numDecMembers=-1; // special value indicating that value needs to be computed + m_numDocMembers=-1; // special value indicating that value needs to be computed m_inGroup=FALSE; m_inFile=FALSE; } @@ -456,9 +461,10 @@ void MemberList::addListReferences(Definition *def) if (md->getGroupDef()==0 || def->definitionType()==Definition::TypeGroup) { md->addListReference(def); - if (md->memberType()==MemberDef::Enumeration && md->enumFieldList()) + LockingPtr<MemberList> enumFields = md->enumFieldList(); + if (md->memberType()==MemberDef::Enumeration && enumFields!=0) { - MemberListIterator vmli(*md->enumFieldList()); + MemberListIterator vmli(*enumFields); MemberDef *vmd; for ( ; (vmd=vmli.current()) ; ++vmli) { @@ -497,6 +503,69 @@ void MemberList::findSectionsInDocumentation() } } +void MemberList::marshal(StorageIntf *s) +{ + marshalInt(s,(int)m_listType); + marshalInt(s,m_varCnt); + marshalInt(s,m_funcCnt); + marshalInt(s,m_enumCnt); + marshalInt(s,m_enumValCnt); + marshalInt(s,m_typeCnt); + marshalInt(s,m_protoCnt); + marshalInt(s,m_defCnt); + marshalInt(s,m_friendCnt); + marshalInt(s,m_numDecMembers); + marshalInt(s,m_numDocMembers); + marshalBool(s,m_inGroup); + marshalBool(s,m_inFile); + if (memberGroupList==0) + { + marshalUInt(s,NULL_LIST); // null pointer representation + } + else + { + marshalUInt(s,memberGroupList->count()); + QListIterator<MemberGroup> mgi(*memberGroupList); + MemberGroup *mg=0; + for (mgi.toFirst();(mg=mgi.current());++mgi) + { + mg->marshal(s); + } + } +} + +void MemberList::unmarshal(StorageIntf *s) +{ + m_listType = (MemberList::ListType)unmarshalInt(s); + m_varCnt = unmarshalInt(s); + m_funcCnt = unmarshalInt(s); + m_enumCnt = unmarshalInt(s); + m_enumValCnt = unmarshalInt(s); + m_typeCnt = unmarshalInt(s); + m_protoCnt = unmarshalInt(s); + m_defCnt = unmarshalInt(s); + m_friendCnt = unmarshalInt(s); + m_numDecMembers = unmarshalInt(s); + m_numDocMembers = unmarshalInt(s); + m_inGroup = unmarshalBool(s); + m_inFile = unmarshalBool(s); + uint i,count = unmarshalUInt(s); + if (count==NULL_LIST) // empty list + { + memberGroupList = 0; + } + else // add member groups + { + memberGroupList = new MemberGroupList; + for (i=0;i<count;i++) + { + MemberGroup *mg = new MemberGroup; + mg->unmarshal(s); + memberGroupList->append(mg); + } + } +} + //-------------------------------------------------------------------------- int MemberSDict::compareItems(GCI item1, GCI item2) diff --git a/src/memberlist.h b/src/memberlist.h index 27c1c52..1467835 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -25,6 +25,7 @@ class GroupDef; class MemberGroup; class MemberGroupList; +class StorageIntf; class MemberList : public QList<MemberDef> { @@ -99,6 +100,7 @@ class MemberList : public QList<MemberDef> memberGroup = 55 }; + MemberList(); MemberList(ListType lt); ~MemberList(); ListType listType() const { return m_listType; } @@ -134,9 +136,18 @@ class MemberList : public QList<MemberDef> void findSectionsInDocumentation(); MemberGroupList *getMemberGroupList() const { return memberGroupList; } + void marshal(StorageIntf *s); + void unmarshal(StorageIntf *s); + private: - int m_varCnt,m_funcCnt,m_enumCnt,m_enumValCnt,m_typeCnt; - int m_protoCnt,m_defCnt,m_friendCnt; + int m_varCnt; + int m_funcCnt; + int m_enumCnt; + int m_enumValCnt; + int m_typeCnt; + int m_protoCnt; + int m_defCnt; + int m_friendCnt; int m_numDecMembers; // number of members in the brief part of the memberlist int m_numDocMembers; // number of members in the detailed part of the memberlist MemberGroupList *memberGroupList; diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 5918966..e216081 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -91,14 +91,6 @@ void NamespaceDef::findSectionsInDocumentation() ml->findSectionsInDocumentation(); } } -#if 0 - decDefineMembers.findSectionsInDocumentation(); - decProtoMembers.findSectionsInDocumentation(); - decTypedefMembers.findSectionsInDocumentation(); - decEnumMembers.findSectionsInDocumentation(); - decFuncMembers.findSectionsInDocumentation(); - decVarMembers.findSectionsInDocumentation(); -#endif } void NamespaceDef::insertUsedFile(const char *f) @@ -159,14 +151,6 @@ void NamespaceDef::addMembersToMemberGroup() ::addMembersToMemberGroup(ml,&memberGroupSDict,this); } } -#if 0 - ::addMembersToMemberGroup(&decDefineMembers,&memberGroupSDict,this); - ::addMembersToMemberGroup(&decProtoMembers,&memberGroupSDict,this); - ::addMembersToMemberGroup(&decTypedefMembers,&memberGroupSDict,this); - ::addMembersToMemberGroup(&decEnumMembers,&memberGroupSDict,this); - ::addMembersToMemberGroup(&decFuncMembers,&memberGroupSDict,this); - ::addMembersToMemberGroup(&decVarMembers,&memberGroupSDict,this); -#endif } void NamespaceDef::insertMember(MemberDef *md) @@ -178,82 +162,35 @@ void NamespaceDef::insertMember(MemberDef *md) m_memberLists.append(allMemberList); } allMemberList->append(md); + ::addNamespaceMemberNameToIndex(md); //static bool sortBriefDocs=Config_getBool("SORT_BRIEF_DOCS"); switch(md->memberType()) { case MemberDef::Variable: addMemberToList(MemberList::decVarMembers,md); - //if (sortBriefDocs) - // decVarMembers.inSort(md); - //else - // decVarMembers.append(md); addMemberToList(MemberList::docVarMembers,md); - //if (sortBriefDocs) - // docVarMembers.inSort(md); - //else - // docVarMembers.append(md); break; case MemberDef::Function: addMemberToList(MemberList::decFuncMembers,md); - //if (sortBriefDocs) - // decFuncMembers.inSort(md); - //else - // decFuncMembers.append(md); addMemberToList(MemberList::docFuncMembers,md); - //if (sortBriefDocs) - // docFuncMembers.inSort(md); - //else - // docFuncMembers.append(md); break; case MemberDef::Typedef: addMemberToList(MemberList::decTypedefMembers,md); - //if (sortBriefDocs) - // decTypedefMembers.inSort(md); - //else - // decTypedefMembers.append(md); addMemberToList(MemberList::docTypedefMembers,md); - //if (sortBriefDocs) - // docTypedefMembers.inSort(md); - //else - // docTypedefMembers.append(md); break; case MemberDef::Enumeration: addMemberToList(MemberList::decEnumMembers,md); - //if (sortBriefDocs) - // decEnumMembers.inSort(md); - //else - // decEnumMembers.append(md); addMemberToList(MemberList::docEnumMembers,md); - //if (sortBriefDocs) - // docEnumMembers.inSort(md); - //else - // docEnumMembers.append(md); break; case MemberDef::EnumValue: break; case MemberDef::Prototype: addMemberToList(MemberList::decProtoMembers,md); - //if (sortBriefDocs) - // decProtoMembers.inSort(md); - //else - // decProtoMembers.append(md); addMemberToList(MemberList::docProtoMembers,md); - //if (sortBriefDocs) - // docProtoMembers.inSort(md); - //else - // docProtoMembers.append(md); break; case MemberDef::Define: addMemberToList(MemberList::decDefineMembers,md); - //if (sortBriefDocs) - // decDefineMembers.inSort(md); - //else - // decDefineMembers.append(md); addMemberToList(MemberList::docDefineMembers,md); - //if (sortBriefDocs) - // docDefineMembers.inSort(md); - //else - // docDefineMembers.append(md); break; default: err("NamespaceDef::insertMembers(): " @@ -262,7 +199,6 @@ void NamespaceDef::insertMember(MemberDef *md) md->getClassDef() ? md->getClassDef()->name().data() : "", name().data()); } - //addMemberToGroup(md,groupId); } void NamespaceDef::computeAnchors() @@ -388,17 +324,11 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } writeMemberDeclarations(ol,MemberList::decDefineMembers,theTranslator->trDefines()); - //decDefineMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trDefines(),0); writeMemberDeclarations(ol,MemberList::decProtoMembers,theTranslator->trFuncProtos()); - //decProtoMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trFuncProtos(),0); writeMemberDeclarations(ol,MemberList::decTypedefMembers,theTranslator->trTypedefs()); - //decTypedefMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trTypedefs(),0); writeMemberDeclarations(ol,MemberList::decEnumMembers,theTranslator->trEnumerations()); - //decEnumMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trEnumerations(),0); writeMemberDeclarations(ol,MemberList::decFuncMembers,theTranslator->trFunctions()); - //decFuncMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trFunctions(),0); writeMemberDeclarations(ol,MemberList::decVarMembers,theTranslator->trVariables()); - //decVarMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trVariables(),0); ol.endMemberSections(); if (!Config_getBool("DETAILS_AT_TOP")) @@ -441,28 +371,11 @@ void NamespaceDef::writeMemberDocumentation(OutputList &ol) } writeMemberDocumentation(ol,MemberList::docDefineMembers,theTranslator->trDefineDocumentation()); - //docDefineMembers.writeDocumentation(ol,name(),this, - // theTranslator->trDefineDocumentation()); - writeMemberDocumentation(ol,MemberList::docProtoMembers,theTranslator->trFunctionPrototypeDocumentation()); - //docProtoMembers.writeDocumentation(ol,name(),this, - // theTranslator->trFunctionPrototypeDocumentation()); - writeMemberDocumentation(ol,MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()); - //docTypedefMembers.writeDocumentation(ol,name(),this, - // theTranslator->trTypedefDocumentation()); - writeMemberDocumentation(ol,MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); - //docEnumMembers.writeDocumentation(ol,name(),this, - // theTranslator->trEnumerationTypeDocumentation()); - writeMemberDocumentation(ol,MemberList::docFuncMembers,theTranslator->trFunctionDocumentation()); - //docFuncMembers.writeDocumentation(ol,name(),this, - // theTranslator->trFunctionDocumentation()); - writeMemberDocumentation(ol,MemberList::docVarMembers,theTranslator->trVariableDocumentation()); - //docVarMembers.writeDocumentation(ol,name(),this, - // theTranslator->trVariableDocumentation()); if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -484,15 +397,6 @@ void NamespaceDef::writeMemberPages(OutputList &ol) ml->writeDocumentationPage(ol,name(),this); } } -#if 0 - docDefineMembers.writeDocumentationPage(ol,name(),this); - docProtoMembers.writeDocumentationPage(ol,name(),this); - docTypedefMembers.writeDocumentationPage(ol,name(),this); - docEnumMembers.writeDocumentationPage(ol,name(),this); - docFuncMembers.writeDocumentationPage(ol,name(),this); - docVarMembers.writeDocumentationPage(ol,name(),this); -#endif - ol.popGeneratorState(); } @@ -602,10 +506,13 @@ Definition *NamespaceDef::findInnerCompound(const char *n) void NamespaceDef::addListReferences() { - addRefItem(xrefListItems(), - theTranslator->trNamespace(TRUE,TRUE), - getOutputFileBase(),displayName() - ); + { + LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); + addRefItem(xrefItems.pointer(), + theTranslator->trNamespace(TRUE,TRUE), + getOutputFileBase(),displayName() + ); + } MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) @@ -621,14 +528,6 @@ void NamespaceDef::addListReferences() ml->addListReferences(this); } } -#if 0 - docDefineMembers.addListReferences(this); - docProtoMembers.addListReferences(this); - docTypedefMembers.addListReferences(this); - docEnumMembers.addListReferences(this); - docFuncMembers.addListReferences(this); - docVarMembers.addListReferences(this); -#endif } QCString NamespaceDef::displayName() const diff --git a/src/objcache.cpp b/src/objcache.cpp new file mode 100644 index 0000000..c192504 --- /dev/null +++ b/src/objcache.cpp @@ -0,0 +1,315 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2006 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#include <stdio.h> +#include <assert.h> +#include "objcache.h" + +//---------------------------------------------------------------------- + +#ifdef CACHE_STATS +int ObjCache::misses = 0; +int ObjCache::hits = 0; +#endif + +//---------------------------------------------------------------------- + +ObjCache::ObjCache(unsigned int logSize) + : m_head(-1), m_tail(-1), //m_numEntries(0), + m_size(1<<logSize), m_freeHashNodes(0), m_freeCacheNodes(0), m_lastHandle(-1) +{ + int i; + m_cache = new CacheNode[m_size]; + m_hash = new HashNode[m_size]; + // add all items to list of free buckets + for (i=0;i<m_size-1;i++) + { + m_hash[i].nextHash = i+1; + m_cache[i].next = i+1; + } +} + +ObjCache::~ObjCache() +{ + delete[] m_cache; + delete[] m_hash; +} + +int ObjCache::add(void *obj,void **victim) +{ + *victim=0; + + HashNode *hnode = hashFind(obj); + //printf("hnode=%p\n",hnode); + if (hnode) // move object to the front of the LRU list, since it is used + // most recently + { + //printf("moveToFront=%d\n",hnode->index); + moveToFront(hnode->index); +#ifdef CACHE_STATS + hits++; +#endif + } + else // object not in the cache. + { + void *lruObj=0; + if (m_freeCacheNodes!=-1) // cache not full -> add element to the cache + { + // remove element from free list + int index = m_freeCacheNodes; + m_freeCacheNodes = m_cache[index].next; + + // add to head of the list + if (m_tail==-1) + { + m_tail = index; + } + m_cache[index].prev = -1; + m_cache[index].next = m_head; + if (m_head!=-1) + { + m_cache[m_head].prev = index; + } + m_head = index; + } + else // cache full -> replace element in the cache + { + //printf("Cache full!\n"); + lruObj = m_cache[m_tail].obj; + hashRemove(lruObj); + moveToFront(m_tail); // m_tail indexes the emptied element, which becomes m_head + } + //printf("numEntries=%d size=%d\n",m_numEntries,m_size); + m_cache[m_head].obj = obj; + hnode = hashInsert(obj); + hnode->index = m_head; + *victim = lruObj; +#ifdef CACHE_STATS + misses++; +#endif + } + return m_head; +} + +void ObjCache::del(int index) +{ + assert(index!=-1); + assert(m_cache[index].obj!=0); + hashRemove(m_cache[index].obj); + moveToFront(index); + m_head = m_cache[index].next; + if (m_head==-1) + m_tail=-1; + else + m_cache[m_head].prev=-1; + m_cache[index].obj=0; + m_cache[index].prev=-1; + m_cache[index].next = m_freeCacheNodes; + m_freeCacheNodes = index; +} + +#ifdef CACHE_DEBUG +#define cache_debug_printf printf +void ObjCache::printLRU() +{ + cache_debug_printf("MRU->LRU: "); + int index = m_head; + while (index!=-1) + { + cache_debug_printf("%d=%p ",index,m_cache[index].obj); + index = m_cache[index].next; + } + cache_debug_printf("\n"); + + cache_debug_printf("LRU->MRU: "); + index = m_tail; + while (index!=-1) + { + cache_debug_printf("%d=%p ",index,m_cache[index].obj); + index = m_cache[index].prev; + } + cache_debug_printf("\n"); +} +#endif + +#ifdef CACHE_STATS +#define cache_stats_printf printf +void ObjCache::printStats() +{ + cache_stats_printf("ObjCache: hits=%d misses=%d hit ratio=%f\n",hits,misses,hits*100.0/(hits+misses)); +} +#endif + +void ObjCache::moveToFront(int index) +{ + int prev,next; + if (m_head!=index) + { + next = m_cache[index].next; + prev = m_cache[index].prev; + + // de-chain node at index + m_cache[prev].next = next; + if (next!=-1) m_cache[next].prev = prev; else m_tail = prev; + + // add to head + m_cache[index].prev = -1; + m_cache[index].next = m_head; + m_cache[m_head].prev = index; + m_head = index; + } +} + +unsigned int ObjCache::hash(void *addr) +{ + // Thomas Wang's 32 bit Mix Function + + // TODO: what if sizeof(void*)!=4 ? + unsigned int key = (unsigned int)addr; + key += ~(key << 15); + key ^= (key >> 10); + key += (key << 3); + key ^= (key >> 6); + key += ~(key << 11); + key ^= (key >> 16); + return key & (m_size-1); +} + +ObjCache::HashNode *ObjCache::hashFind(void *obj) +{ + HashNode *node = 0; + int index = m_hash[hash(obj)].head; + //printf("hashFind: obj=%p index=%d\n",obj,index); + while (index!=-1 && + m_hash[index].obj!=obj + ) // search for right object in the list + { + index = m_hash[index].nextHash; + } + // found the obj at index, so it is in the cache! + if (index!=-1) + { + node = &m_hash[index]; + } + return node; +} + +ObjCache::HashNode *ObjCache::hashInsert(void *obj) +{ + int index = hash(obj); + //printf("Inserting %p index=%d\n",obj,index); + + // remove element from empty list + int newElement = m_freeHashNodes; + assert(newElement!=-1); + m_freeHashNodes = m_hash[m_freeHashNodes].nextHash; + + if (m_hash[index].head!=-1) // hash collision -> goto end of the list + { + index = m_hash[index].head; + while (m_hash[index].nextHash!=-1) + { + index = m_hash[index].nextHash; + } + // add to end of the list + m_hash[index].nextHash = newElement; + } + else // first element in the hash list + { + m_hash[index].head = newElement; + } + // add to the end of the list + m_hash[newElement].nextHash = -1; + m_hash[newElement].obj = obj; + return &m_hash[newElement]; +} + +void ObjCache::hashRemove(void *obj) +{ + int index = hash(obj); + + // find element + int curIndex = m_hash[index].head; + int prevIndex=-1; + while (m_hash[curIndex].obj!=obj) + { + prevIndex = curIndex; + curIndex = m_hash[curIndex].nextHash; + } + + if (prevIndex==-1) // remove from start + { + m_hash[index].head = m_hash[curIndex].nextHash; + } + else // remove in the middle + { + m_hash[prevIndex].nextHash = m_hash[curIndex].nextHash; + } + + // add curIndex element to empty list + m_hash[curIndex].nextHash = m_freeHashNodes; + m_hash[curIndex].index = -1; + m_hash[curIndex].obj = 0; + m_freeHashNodes = curIndex; +} + +#ifdef CACHE_TEST +int main() +{ + int i; + struct obj + { + obj() : handle(-1) {} + int handle; + }; + obj *objs = new obj[100]; + ObjCache c(3); + for (i=0;i<32;i++) + { + int objId=(i%3)+(i>>2)*4; + printf("------- use(%d=%p)--------\n",objId,&objs[objId]); +#ifdef CACHE_DEBUG + c.printLRU(); +#endif + obj *victim=0; + if (objs[objId].handle==-1) + { + objs[objId].handle = c.add(&objs[objId],(void**)&victim); + if (victim) victim->handle=-1; + } + else + { + c.use(objs[objId].handle); + } + printf("i=%d objId=%d using %p victim=%p\n",i,objId,&objs[objId],victim); + } + for (i=0;i<100;i++) + { + if (objs[i].handle!=-1) + { + printf("------ del objId=%d handle=%d ------\n",i,objs[i].handle); + c.del(objs[i].handle); + objs[i].handle=-1; +#ifdef CACHE_DEBUG + c.printLRU(); +#endif + } + } + c.printStats(); + return 0; +} +#endif diff --git a/src/objcache.h b/src/objcache.h new file mode 100644 index 0000000..3516534 --- /dev/null +++ b/src/objcache.h @@ -0,0 +1,113 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2006 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef OBJCACHE_H +#define OBJCACHE_H + +//#define CACHE_TEST +//#define CACHE_DEBUG +#define CACHE_STATS + +/** @brief Cache for objects. + * + * This cache is used to decide which objects should remain in + * memory. It uses a least recently used policy (LRU) to decide + * which object should make room for a new object when the cache + * is full. An object should be added using add(), and then use() + * should be called when the object is used. + */ +class ObjCache +{ + private: + struct CacheNode + { + CacheNode() : next(-1), prev(-1), obj(0) {} + int next; + int prev; + void *obj; + }; + struct HashNode + { + HashNode() : head(-1), nextHash(-1), index(-1), obj(0) {} + int head; + int nextHash; + int index; + void *obj; + }; + + public: + /*! Creates the cache. The number of elements in the cache is 2 to + * the power of \a logSize. + */ + ObjCache(unsigned int logSize); + + /*! Deletes the cache and free all internal data-structures used. */ + ~ObjCache(); + + /*! Adds \a obj to the cache. When victim is not null, this object is + * removed from the cache to make room for \a obj. + * Returns a handle to the object, which can be used by the use() + * function, each time the object is used. + */ + int add(void *obj,void **victim); + + /*! Indicates that this object is used. This will move the object + * to the front of the internal LRU list to make sure it is removed last. + * The parameter \a handle is returned when called add(). + */ + void use(int handle) + { + hits++; + if (handle==m_lastHandle) return; + m_lastHandle = handle; + moveToFront(handle); + } + + /*! Removes the item identified by \a handle from the cache. + * @see add() + */ + void del(int handle); + + /*! Debug function. Prints the LRU list */ + void printLRU(); + /*! Print miss/hits statistics */ + void printStats(); + + private: + void moveToFront(int index); + unsigned int hash(void *addr); + HashNode *hashFind(void *obj); + HashNode *hashInsert(void *obj); + void hashRemove(void *obj); + + CacheNode *m_cache; + HashNode *m_hash; + int m_head; + int m_tail; + int m_size; + int m_freeHashNodes; + int m_freeCacheNodes; + int m_lastHandle; + +#ifdef CACHE_STATS + static int misses; + static int hits; +#endif +}; + +#endif // OBJCACHE_H + diff --git a/src/outputgen.h b/src/outputgen.h index 81cda2d..dbe6807 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -299,8 +299,8 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endIndexKey() = 0; virtual void startIndexValue(bool) = 0; virtual void endIndexValue(const char *,bool) = 0; - virtual void writeIndexItem(const char *ref,const char *file, - const char *text) = 0; + virtual void startIndexItem(const char *ref,const char *file) = 0; + virtual void endIndexItem(const char *ref,const char *file) = 0; virtual void startGroupHeader() = 0; virtual void endGroupHeader() = 0; virtual void startMemberSections() = 0; diff --git a/src/outputlist.h b/src/outputlist.h index 8c6def4..bdc0f01 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -115,8 +115,10 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startItemList); } void endItemList() { forall(&OutputGenerator::endItemList); } - void writeIndexItem(const char *ref,const char *file,const char *text) - { forall(&OutputGenerator::writeIndexItem,ref,file,text); } + void startIndexItem(const char *ref,const char *file) + { forall(&OutputGenerator::startIndexItem,ref,file); } + void endIndexItem(const char *ref,const char *file) + { forall(&OutputGenerator::endIndexItem,ref,file); } void docify(const char *s) { forall(&OutputGenerator::docify,s); } void codify(const char *s) diff --git a/src/pagedef.cpp b/src/pagedef.cpp index a965946..7ed229f 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -29,7 +29,8 @@ void PageDef::findSectionsInDocumentation() GroupDef *PageDef::getGroupDef() const { - return partOfGroups() ? partOfGroups()->getFirst() : 0; + LockingPtr<GroupList> groups = partOfGroups(); + return groups!=0 ? groups->getFirst() : 0; } QCString PageDef::getOutputFileBase() const diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index cf8be57..c1298d5 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1440,16 +1440,16 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) md->memberType()!=MemberDef::Enumeration) m_output.addFieldQuotedString("type", md->typeString()); + LockingPtr<ArgumentList> al = md->argumentList(); if (isFunc) //function { - ArgumentList *al = md->argumentList(); - m_output.addFieldBoolean("const", al && al->constSpecifier) - .addFieldBoolean("volatile", al && al->volatileSpecifier); + m_output.addFieldBoolean("const", al!=0 && al->constSpecifier) + .addFieldBoolean("volatile", al!=0 && al->volatileSpecifier); m_output.openList("parameters"); - ArgumentList *declAl = md->declArgumentList(); - ArgumentList *defAl = md->argumentList(); - if (declAl && declAl->count()>0) + LockingPtr<ArgumentList> declAl = md->declArgumentList(); + LockingPtr<ArgumentList> defAl = md->argumentList(); + if (declAl!=0 && declAl->count()>0) { ArgumentListIterator declAli(*declAl); ArgumentListIterator defAli(*defAl); @@ -1487,7 +1487,7 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) md->argsString()!=0) // define { m_output.openList("parameters"); - ArgumentListIterator ali(*md->argumentList()); + ArgumentListIterator ali(*al); Argument *a; for (ali.toFirst();(a=ali.current());++ali) { @@ -1505,10 +1505,11 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) if (md->memberType()==MemberDef::Enumeration) // enum { - if (md->enumFieldList()) + LockingPtr<MemberList> enumFields = md->enumFieldList(); + if (enumFields!=0) { m_output.openList("values"); - MemberListIterator emli(*md->enumFieldList()); + MemberListIterator emli(*enumFields); MemberDef *emd; for (emli.toFirst();(emd=emli.current());++emli) { @@ -1534,8 +1535,8 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) .addFieldQuotedString("name", rmd->name()) .closeHash(); - MemberList *rbml = md->reimplementedBy(); - if (rbml) + LockingPtr<MemberList> rbml = md->reimplementedBy(); + if (rbml!=0) { MemberListIterator mli(*rbml); m_output.openList("reimplemented_by"); @@ -2014,21 +2015,21 @@ bool PerlModGenerator::generatePerlModOutput() m_output.add("$doxydocs=").openHash(); m_output.openList("classes"); - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) generatePerlModForClass(cd); m_output.closeList(); m_output.openList("namespaces"); - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) generatePerlModForNamespace(nd); m_output.closeList(); m_output.openList("files"); - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -2040,7 +2041,7 @@ bool PerlModGenerator::generatePerlModOutput() m_output.closeList(); m_output.openList("groups"); - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (;(gd=gli.current());++gli) { @@ -1048,13 +1048,13 @@ void addDefine() md->setFileDef(g_yyFileDef); md->setDefinition("#define "+g_defName); - MemberName *mn=Doxygen::functionNameSDict[g_defName]; + MemberName *mn=Doxygen::functionNameSDict->find(g_defName); if (mn==0) { mn = new MemberName(g_defName); //Doxygen::functionNameList.append(mn); //Doxygen::functionNameDict.insert(g_defName,mn); - Doxygen::functionNameSDict.append(g_defName,mn); + Doxygen::functionNameSDict->append(g_defName,mn); } mn->append(md); if (g_yyFileDef) g_yyFileDef->insertMember(md); diff --git a/src/pyscanner.l b/src/pyscanner.l index ea4776b..5f7abb0 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -88,7 +88,7 @@ static bool g_doubleQuote; static bool g_specialBlock; //static bool g_expectModuleDocs; static int g_stringContext; -static QCString * g_copyString; +static QGString * g_copyString; static int g_indent = 0; static int g_curIndent = 0; diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 3494dd8..0194de9 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -417,7 +417,7 @@ void RTFGenerator::startIndexSection(IndexSections is) case isModuleDocumentation: { //Module Documentation - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; bool found=FALSE; for (gli.toFirst();(gd=gli.current()) && !found;++gli) @@ -433,7 +433,7 @@ void RTFGenerator::startIndexSection(IndexSections is) case isDirDocumentation: { //Directory Documentation - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; bool found=FALSE; for (dli.toFirst();(dd=dli.current()) && !found;++dli) @@ -449,7 +449,7 @@ void RTFGenerator::startIndexSection(IndexSections is) case isNamespaceDocumentation: { // Namespace Documentation - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; bool found=FALSE; for (nli.toFirst();(nd=nli.current()) && !found;++nli) @@ -465,7 +465,7 @@ void RTFGenerator::startIndexSection(IndexSections is) case isClassDocumentation: { //Compound Documentation - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) @@ -482,7 +482,7 @@ void RTFGenerator::startIndexSection(IndexSections is) { //File Documentation bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); while (fn) { FileDef *fd=fn->first(); @@ -499,7 +499,7 @@ void RTFGenerator::startIndexSection(IndexSections is) } fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } } break; @@ -647,7 +647,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isModuleDocumentation: { - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}"<< endl; for (gli.toFirst();(gd=gli.current());++gli) @@ -664,7 +664,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isDirDocumentation: { - SDict<DirDef>::Iterator dli(Doxygen::directories); + SDict<DirDef>::Iterator dli(*Doxygen::directories); DirDef *dd; t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}"<< endl; for (dli.toFirst();(dd=dli.current());++dli) @@ -681,7 +681,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isNamespaceDocumentation: { - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; bool found=FALSE; for (nli.toFirst();(nd=nli.current()) && !found;++nli) @@ -711,7 +711,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isClassDocumentation: { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; bool found=FALSE; @@ -743,7 +743,7 @@ void RTFGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList.first(); + FileName *fn=Doxygen::inputNameList->first(); t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl; while (fn) @@ -772,7 +772,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } fd=fn->next(); } - fn=Doxygen::inputNameList.next(); + fn=Doxygen::inputNameList->next(); } } break; @@ -935,12 +935,14 @@ void RTFGenerator::writeListItem() m_omitParagraph = TRUE; } -void RTFGenerator::writeIndexItem(const char *ref,const char *fn, - const char *name) +void RTFGenerator::startIndexItem(const char *,const char *) { - DBG_RTF(t << "{\\comment (writeIndexItem)}" << endl) - //t << rtf_LCList_DepthStyle() << endl; - docify(name); + DBG_RTF(t << "{\\comment (startIndexItem)}" << endl) +} + +void RTFGenerator::endIndexItem(const char *ref,const char *fn) +{ + DBG_RTF(t << "{\\comment (endIndexItem)}" << endl) if (!ref && fn) { t << "\\tab "; diff --git a/src/rtfgen.h b/src/rtfgen.h index 91ca8b6..b0edb10 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -72,12 +72,8 @@ class RTFGenerator : public OutputGenerator void endIndexValue(const char *,bool); void startItemList(); void endItemList(); - //void startEnumList(); - //void endEnumList(); - //void startAlphabeticalIndexList() {} - //void endAlphabeticalIndexList() {} - //void writeIndexHeading(const char *) {} - void writeIndexItem(const char *ref,const char *file,const char *name); + void startIndexItem(const char *ref,const char *file); + void endIndexItem(const char *ref,const char *file); void docify(const char *text); void codify(const char *text); void writeObjectLink(const char *ref,const char *file, @@ -88,7 +84,6 @@ class RTFGenerator : public OutputGenerator void endTextLink(); void startHtmlLink(const char *url); void endHtmlLink(); - //void writeMailLink(const char *url); void startTypewriter() { t << "{\\f2 "; } void endTypewriter() { t << "}"; } void startGroupHeader(); diff --git a/src/scanner.l b/src/scanner.l index a1b76e2..3e8da49 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -123,10 +123,15 @@ static QCString fullArgString; static ArgumentList *currentArgumentList; static char lastCopyArgChar; + +static QCString *pCopyQuotedString; static QCString *pCopyRoundString; static QCString *pCopyCurlyString; -static QCString *pCopyQuotedString; -static QCString *pSkipVerbString; + +static QGString *pCopyCurlyGString; +static QGString *pCopyRoundGString; +static QGString *pCopyQuotedGString; +static QGString *pSkipVerbString; static QStack<Grouping> autoGroupStack; static bool insideFormula; @@ -640,8 +645,12 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) %x NSAliasArg %x CopyString %x CopyPHPString +%x CopyGString +%x CopyPHPGString %x CopyRound %x CopyCurly +%x GCopyRound +%x GCopyCurly %x SkipUnionSwitch %x Specialization %x FuncPtrInit @@ -772,7 +781,8 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) lineCount() ; } -<FindMembers>{B}*"signals"{BN}*":"{BN}* { current->mtype = mtype = Signal; +<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { current->mtype = mtype = Signal; + current->protection = protection = Public ; current->type.resize(0); current->name.resize(0); @@ -781,7 +791,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) lineCount() ; } -<FindMembers>{B}*"public"{BN}*"slots"{BN}*":"{BN}* { +<FindMembers>{B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { current->protection = protection = Public ; current->mtype = mtype = Slot; current->type.resize(0); @@ -791,7 +801,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) lineCount(); } -<FindMembers>{B}*"protected"{BN}*"slots"{BN}*":"{BN}* { +<FindMembers>{B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { current->protection = protection = Protected ; current->mtype = mtype = Slot; current->type.resize(0); @@ -801,7 +811,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) lineCount(); } -<FindMembers>{B}*"private"{BN}*"slots"{BN}*":"{BN}* { +<FindMembers>{B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { current->protection = protection = Private ; current->mtype = mtype = Slot; current->type.resize(0); @@ -1886,17 +1896,17 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) /* Read initializer rules */ <ReadInitializer>"(" { lastRoundContext=YY_START; - pCopyRoundString=¤t->initializer; + pCopyRoundGString=¤t->initializer; roundCount=0; current->initializer+=*yytext; - BEGIN(CopyRound); + BEGIN(GCopyRound); } <ReadInitializer>"{" { lastCurlyContext=YY_START; - pCopyCurlyString=¤t->initializer; + pCopyCurlyGString=¤t->initializer; curlyCount=0; current->initializer+=*yytext; - BEGIN(CopyCurly); + BEGIN(GCopyCurly); } <ReadInitializer>[;,] { //printf(">> initializer `%s' <<\n",current->initializer.data()); @@ -1924,8 +1934,8 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) { lastStringContext=YY_START; current->initializer+=*yytext; - pCopyQuotedString=¤t->initializer; - BEGIN(CopyString); + pCopyQuotedGString=¤t->initializer; + BEGIN(CopyGString); } } <ReadInitializer>"->" { @@ -1949,9 +1959,9 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) if (insidePHP) { current->initializer+=yytext; - pCopyQuotedString = ¤t->initializer; + pCopyQuotedGString = ¤t->initializer; lastStringContext=YY_START; - BEGIN(CopyPHPString); + BEGIN(CopyPHPGString); } else { @@ -2037,6 +2047,29 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) *pCopyQuotedString+=*yytext; } + /* generic quoted growable string copy rules */ +<CopyGString,CopyPHPGString>\\. { + *pCopyQuotedGString+=yytext; + } +<CopyGString>\" { + *pCopyQuotedGString+=*yytext; + BEGIN( lastStringContext ); + } +<CopyPHPGString>\' { + *pCopyQuotedGString+=*yytext; + BEGIN( lastStringContext ); + } +<CopyGString,CopyPHPGString>"/*"|"*/"|"//" { + *pCopyQuotedGString+=yytext; + } +<CopyGString,CopyPHPGString>\n { + *pCopyQuotedGString+=*yytext; + yyLineNr++; + } +<CopyGString,CopyPHPGString>. { + *pCopyQuotedGString+=*yytext; + } + /* generic round bracket list copy rules */ <CopyRound>\" { *pCopyRoundString+=*yytext; @@ -2087,6 +2120,56 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) *pCopyRoundString+=*yytext; } + /* generic round bracket list copy rules for growable strings */ +<GCopyRound>\" { + *pCopyRoundGString+=*yytext; + pCopyQuotedGString=pCopyRoundGString; + lastStringContext=YY_START; + BEGIN(CopyGString); + } +<GCopyRound>"(" { + *pCopyRoundGString+=*yytext; + roundCount++; + } +<GCopyRound>")" { + *pCopyRoundGString+=*yytext; + if (--roundCount<0) + BEGIN(lastRoundContext); + } +<GCopyRound>\n { + yyLineNr++; + *pCopyRoundGString+=*yytext; + } +<GCopyRound>\' { + if (insidePHP) + { + current->initializer+=yytext; + pCopyQuotedGString = pCopyRoundGString; + lastStringContext=YY_START; + BEGIN(CopyPHPGString); + } + else + { + *pCopyRoundGString+=yytext; + } + } +<GCopyRound>{CHARLIT} { + if (insidePHP) + { + REJECT; + } + else + { + *pCopyRoundGString+=yytext; + } + } +<GCopyRound>[^"'()\n]+ { + *pCopyRoundGString+=yytext; + } +<GCopyRound>. { + *pCopyRoundGString+=*yytext; + } + /* generic curly bracket list copy rules */ <CopyCurly>\" { *pCopyCurlyString+=*yytext; @@ -2132,6 +2215,56 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) <CopyCurly>. { *pCopyCurlyString+=*yytext; } + + /* generic curly bracket list copy rules for growable strings */ +<GCopyCurly>\" { + *pCopyCurlyGString+=*yytext; + pCopyQuotedGString=pCopyCurlyGString; + lastStringContext=YY_START; + BEGIN(CopyGString); + } +<GCopyCurly>\' { + *pCopyCurlyGString+=*yytext; + if (insidePHP) + { + pCopyQuotedGString=pCopyCurlyGString; + lastStringContext=YY_START; + BEGIN(CopyPHPGString); + } + } +<GCopyCurly>"{" { + *pCopyCurlyGString+=*yytext; + curlyCount++; + } +<GCopyCurly>"}" { + *pCopyCurlyGString+=*yytext; + if (--curlyCount<0) + BEGIN(lastCurlyContext); + } +<GCopyCurly>{CHARLIT} { if (insidePHP) + { + REJECT; + } + else + { + *pCopyCurlyGString+=yytext; + } + } +<GCopyCurly>[^"'{}\/\n]+ { + *pCopyCurlyGString+=yytext; + } +<GCopyCurly>"/" { *pCopyCurlyGString+=yytext; } +<GCopyCurly>\n { + yyLineNr++; + *pCopyCurlyGString+=*yytext; + } +<GCopyCurly>. { + *pCopyCurlyGString+=*yytext; + } + + /* ---------------------- */ + + <FindMembers>":" { if (current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" { @@ -2377,9 +2510,9 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) BEGIN( SkipVerbString ); } <ReadBody,ReadNSBody,ReadBodyIntf>\" { current->program += yytext ; - pCopyQuotedString = ¤t->program; + pCopyQuotedGString = ¤t->program; lastStringContext=YY_START; - BEGIN( CopyString ); + BEGIN( CopyGString ); } <ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { current->program += yytext ; lastContext = YY_START ; @@ -2398,9 +2531,9 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) else { // begin of single quoted string current->program += yytext; - pCopyQuotedString = ¤t->program; + pCopyQuotedGString = ¤t->program; lastStringContext=YY_START; - BEGIN(CopyPHPString); + BEGIN(CopyPHPGString); } } <ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} { @@ -4213,6 +4346,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) } else { + mtype = Method; unput(';'); BEGIN(FindMembers); } diff --git a/src/sortdict.h b/src/sortdict.h index e54da38..07c450a 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -319,6 +319,75 @@ class SDict QListIterator<T> *m_li; }; + class IteratorDict; // first forward declare + friend class IteratorDict; // then make it a friend + /*! Simple iterator for SDict. It iterates in over the dictionary elements + * in an unsorted way, but does provide information about the element's key. + */ + class IteratorDict + { + public: + /*! Create an iterator given the dictionary. */ + IteratorDict(const SDict<T> &dict) + { + m_di = new QDictIterator<T>(*dict.m_dict); + } + + /*! Destroys the dictionary */ + virtual ~IteratorDict() + { + delete m_di; + } + + /*! Set the iterator to the first element in the list. + * \return The first compound, or zero if the list was empty. + */ + T *toFirst() const + { + return m_di->toFirst(); + } + + /*! Set the iterator to the last element in the list. + * \return The first compound, or zero if the list was empty. + */ + T *toLast() const + { + return m_di->toLast(); + } + + /*! Returns the current compound */ + T *current() const + { + return m_di->current(); + } + + /*! Returns the current key */ + QCString currentKey() const + { + return m_di->currentKey(); + } + + /*! Moves the iterator to the next element. + * \return the new "current" element, or zero if the iterator was + * already pointing at the last element. + */ + T *operator++() + { + return m_di->operator++(); + } + + /*! Moves the iterator to the previous element. + * \return the new "current" element, or zero if the iterator was + * already pointing at the first element. + */ + T *operator--() + { + return m_di->operator--(); + } + + private: + QDictIterator<T> *m_di; + }; }; /*! internal wrapper class that redirects compareItems() to the diff --git a/src/store.cpp b/src/store.cpp new file mode 100644 index 0000000..f1f24cd --- /dev/null +++ b/src/store.cpp @@ -0,0 +1,392 @@ +#include "store.h" + + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <assert.h> + +#define BLOCK_SIZE 512 // should be >8 and a multiple of 8 +#define BLOCK_POINTER_SIZE sizeof(off_t) + + +#define ASSERTS_ENABLED + +#ifdef ASSERTS_ENABLED +#define STORE_ASSERT(x) assert(x) +#else +#define STORE_ASSERT(x) +#endif + +#ifdef _WIN32 // TODO: add 64bit support using _fseeki64 and _ftelli64 (studio 2003+ req) +#define fseeko fseek +#define ftello ftell +#endif + + +//------------------------------------------------------------------------------------ + +Store::Store() +{ + m_file = 0; + m_front = 0; + m_head = 0; + m_state = Init; + m_reads = 0; + m_writes = 0; +} + +Store::~Store() +{ + if (m_file) fclose(m_file); + + // clean up free list + while (m_head) + { + Node *node = m_head; + m_head = node->next; + delete node; + } +} + +int Store::open(const char *name) +{ + int i; + STORE_ASSERT(m_state==Init); + if (m_file) return 0; // already open + m_file = fopen(name,"w+b"); + if (m_file==0) return -1; + + // first block serves as header, so offset=0 can be used as the end of the list. + for (i=0;i<BLOCK_SIZE/8;i++) + { + fputc('D',m_file); + fputc('O',m_file); + fputc('X',m_file); + fputc('Y',m_file); + fputc('G',m_file); + fputc('E',m_file); + fputc('N',m_file); + fputc(0,m_file); + } + m_front = BLOCK_SIZE; + m_head = 0; + m_state = Reading; + return 0; +} + +void Store::close() +{ + if (m_file) fclose(m_file); + m_file=0; + m_state = Init; +} + +off_t Store::alloc() +{ + STORE_ASSERT(m_state==Reading); + m_state=Writing; + off_t pos; + if (m_head==0) // allocate new block + { + //printf("alloc: new block\n"); + if (fseeko(m_file,0,SEEK_END)==-1) // go to end of the file + { + fprintf(stderr,"Store::alloc: Error seeking to end of file: %s\n",strerror(errno)); + exit(1); + } + pos = ftello(m_file); + STORE_ASSERT( (pos & (BLOCK_SIZE-1))==0 ); + m_front = pos + BLOCK_SIZE; // move front to end of this block + } + else // reuse freed block + { + //printf("alloc: reuse block: m_head=%d\n",(int)m_head); + Node *node = m_head; + pos = node->pos; + // point head to next free item + m_head = node->next; + delete node; + // move to start of the block + if (fseeko(m_file,pos,SEEK_SET)==-1) + { + fprintf(stderr,"Store::alloc: Error seeking to position %d: %s\n", + (int)pos,strerror(errno)); + exit(1); + } + STORE_ASSERT( (pos & (BLOCK_SIZE-1))==0 ); + } + //printf("%x: Store::alloc\n",(int)pos); + return pos; +} + +int Store::write(const char *buf,uint size) +{ + STORE_ASSERT(m_state==Writing); + //printf("%x: Store::write\n",(int)ftello(m_file)); + do + { + off_t curPos = ftello(m_file); + int bytesInBlock = BLOCK_SIZE - BLOCK_POINTER_SIZE - (curPos & (BLOCK_SIZE-1)); + int bytesLeft = bytesInBlock<(int)size ? (int)size-bytesInBlock : 0; + int numBytes = size - bytesLeft; + STORE_ASSERT(bytesInBlock>=0); + STORE_ASSERT(numBytes<=(int)(BLOCK_SIZE-BLOCK_POINTER_SIZE)); + if (numBytes>0) + { + if ((int)fwrite(buf,1,numBytes,m_file)!=numBytes) + { + fprintf(stderr,"Error writing: %s\n",strerror(errno)); + exit(1); + } + m_writes++; + } + if (bytesLeft>0) // still more bytes to write + { + STORE_ASSERT(((ftello(m_file)+BLOCK_POINTER_SIZE)&(BLOCK_SIZE-1))==0); + // allocate new block + if (m_head==0) // no free blocks to reuse + { + //printf("%x: Store::write: new: pos=%x\n",(int)m_front,(int)ftello(m_file)); + // write pointer to next block + if (fwrite(&m_front,BLOCK_POINTER_SIZE,1,m_file)!=1) + { + fprintf(stderr,"Error writing to store: %s\n",strerror(errno)); + exit(1); + } + STORE_ASSERT(ftello(m_file)==(curPos&~(BLOCK_SIZE-1))+BLOCK_SIZE); + + // move to next block + if (fseeko(m_file,0,SEEK_END)==-1) // go to end of the file + { + fprintf(stderr,"Store::alloc: Error seeking to end of file: %s\n",strerror(errno)); + exit(1); + } + STORE_ASSERT(ftello(m_file)==m_front); + // move front to the next of the block + m_front+=BLOCK_SIZE; + } + else // reuse block from the free list + { + // write pointer to next block + if (fwrite(&m_head->pos,BLOCK_POINTER_SIZE,1,m_file)!=1) + { + fprintf(stderr,"Error writing to store: %s\n",strerror(errno)); + exit(1); + } + Node *node = m_head; + off_t pos = node->pos; + // point head to next free item + m_head = node->next; + delete node; + // move to start of the block + if (fseeko(m_file,pos,SEEK_SET)==-1) + { + fprintf(stderr,"Store::write: Error seeking to position %d: %s\n", + (int)pos,strerror(errno)); + exit(1); + } + //printf("%x: Store::write: reuse\n",(int)pos); + } + } + size-=numBytes; + buf+=numBytes; + } + while (size>0); + return size; +} + +void Store::end() +{ + STORE_ASSERT(m_state==Writing); + off_t curPos = ftello(m_file); + int bytesInBlock = BLOCK_SIZE - (curPos & (BLOCK_SIZE-1)); + //printf("%x: Store::end erasing %x bytes\n",(int)curPos&~(BLOCK_SIZE-1),bytesInBlock); + //printf("end: bytesInBlock=%x\n",bytesInBlock); + // zero out rest of the block + int i; + for (i=0;i<bytesInBlock;i++) + { + fputc(0,m_file); + } + m_state=Reading; +} + +void Store::release(off_t pos) +{ + STORE_ASSERT(m_state==Reading); + //printf("%x: Store::release\n",(int)pos); + STORE_ASSERT(pos>0 && (pos & (BLOCK_SIZE-1))==0); + // goto end of the block + off_t cur = pos, next; + while (1) + { + // add new node to the free list + Node *node = new Node; + node->next = m_head; + node->pos = cur; + + m_head = node; + // goto the end of cur block + if (fseeko(m_file,cur+BLOCK_SIZE-BLOCK_POINTER_SIZE,SEEK_SET)==-1) + { + fprintf(stderr,"Store::release: Error seeking to position %d: %s\n", + (int)(cur+BLOCK_SIZE-BLOCK_POINTER_SIZE),strerror(errno)); + exit(1); + } + // read pointer to next block + if (fread(&next,BLOCK_POINTER_SIZE,1,m_file)!=1) + { + fprintf(stderr,"Store::release: Error reading from store: %s\n",strerror(errno)); + exit(1); + } + if (next==0) break; // found end of list -> cur is last element + STORE_ASSERT((next & (BLOCK_SIZE-1))==0); + cur = next; + //printf("%x: Store::release\n",(int)cur); + } +} + +void Store::seek(off_t pos) +{ + STORE_ASSERT(m_state==Reading); + //printf("%x: Store::seek\n",(int)pos); + if (fseeko(m_file,pos,SEEK_SET)==-1) + { + fprintf(stderr,"Store::seek: Error seeking to position %d: %s\n", + (int)pos,strerror(errno)); + exit(1); + } + STORE_ASSERT((pos&(BLOCK_SIZE-1))==0); +} + +int Store::read(char *buf,uint size) +{ + STORE_ASSERT(m_state==Reading); + //printf("%x: Store::read total=%d\n",(int)ftello(m_file),size); + do + { + off_t curPos = ftello(m_file); + int bytesInBlock = BLOCK_SIZE - BLOCK_POINTER_SIZE - (curPos & (BLOCK_SIZE-1)); + int bytesLeft = bytesInBlock<(int)size ? (int)size-bytesInBlock : 0; + int numBytes = size - bytesLeft; + //printf(" Store::read: pos=%x num=%d left=%d\n",(int)curPos,numBytes,bytesLeft); + + if (numBytes>0) + { + //printf("%x: Store::read: %d out of %d bytes\n",(int)ftello(m_file),numBytes,size); + if ((int)fread(buf,1,numBytes,m_file)!=numBytes) + { + fprintf(stderr,"Error reading from store: %s\n",strerror(errno)); + exit(1); + } + m_reads++; + } + if (bytesLeft>0) + { + off_t newPos; + // read offset of the next block + STORE_ASSERT(((ftello(m_file)+BLOCK_POINTER_SIZE)&(BLOCK_SIZE-1))==0); + if (fread((char *)&newPos,BLOCK_POINTER_SIZE,1,m_file)!=1) + { + fprintf(stderr,"Error reading from store: %s\n",strerror(errno)); + exit(1); + } + //printf("%x: Store::read: continue in next block, %d bytes to go\n",(int)newPos,bytesLeft); + //printf(" Store::read: next block=%x\n",(int)newPos); + STORE_ASSERT(newPos!=0); + STORE_ASSERT((newPos&(BLOCK_SIZE-1))==0); + curPos = newPos; + // move to next block + if (fseeko(m_file,curPos,SEEK_SET)==-1) + { + fprintf(stderr,"Store::read: Error seeking to position %d: %s\n", + (int)curPos,strerror(errno)); + exit(1); + } + } + + size-=numBytes; + buf+=numBytes; + } + while (size>0); + return size; +} + +void Store::printFreeList() +{ + printf("FreeList: "); + off_t pos = m_head->pos; + while (pos) + { + printf("%x ",(int)pos); + m_head = m_head->next; + } + printf("\n"); +} + +void Store::printStats() +{ + printf("ObjStore: block size %d bytes, total size %ld blocks, wrote %d blocks, read %d blocks\n", + BLOCK_SIZE,(long)(m_front/BLOCK_SIZE),m_reads,m_writes); +} + +#ifdef STORE_TEST + +int main() +{ + printf("sizeof(off_t)=%d\n",(int)sizeof(off_t)); + Store s; + if (s.open("test.db")==0) + { + const char *str1 = "This is a test message... "; + const char *str2 = "Another message. "; + + int i,j; + for (j=0;j<5;j++) + { + char buf[100]; + + off_t handle = s.alloc(); + for (i=0;i<1000000000;i++) + { + s.write(str1,strlen(str1)+1); + } + s.end(); + off_t handle2 = s.alloc(); + for (i=0;i<10;i++) + { + s.write(str2,strlen(str2)+1); + } + s.end(); + + s.seek(handle); + for (i=0;i<3;i++) + { + s.read(buf,strlen(str1)+1); + printf("i=%d Read: %s\n",i,buf); + } + + s.release(handle); + + s.seek(handle2); + for (i=0;i<3;i++) + { + s.read(buf,strlen(str2)+1); + printf("i=%d Read: %s\n",i,buf); + } + + s.release(handle2); + } + + s.close(); + } + else + { + printf("Open failed! %s\n",strerror(errno)); + } +} + +#endif + diff --git a/src/store.h b/src/store.h new file mode 100644 index 0000000..3fc3ac0 --- /dev/null +++ b/src/store.h @@ -0,0 +1,117 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2006 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef STORE_H +#define STORE_H + +#include <qglobal.h> +#include <stdio.h> +#include <sys/types.h> + +/*! @brief Abstract interface for file based memory storage operations */ +class StorageIntf +{ + public: + /*! Required by gcc */ + virtual ~StorageIntf() {} + /*! Read \a size bytes from the store into \a buf. */ + virtual int read(char *buf,uint size) = 0; + /*! Write \a size bytes from \a buf into the store. */ + virtual int write(const char *buf,uint size) = 0; +}; + +/*! @brief The Store is a file based memory manager. + * + * You can open the store using open(). Then obtain a handle via alloc() + * followed by a sequence of write() commands to store information, + * and finalize it using end(). + * + * Later on you locate the information + * with seek() using the handle obtained with alloc(), and then use a + * sequence of read() calls to read the information back. + * + * If no longer needed the storage space can be freed using release(). + * + * The store will dynamically grow the file on disk if needed. + */ +class Store : public StorageIntf +{ + public: + /*! Creates a store. */ + Store(); + + /*! Releases the store object. Will close the underlying file if opened. */ + ~Store(); + + /*! Opens the file underlying the store using \a name as the file name. + * Returns 0 upon success, or -1 otherwise. + */ + int open(const char *name); + + /*! Allocates a handle to write to and read from. */ + off_t alloc(); + + /*! Writes \a size bytes in array \a buf to the store. + * First alloc() has to be called. + * \note The information can only be read after end() has been called. + */ + int write(const char *buf,uint size); + + /*! Ends the sequence of writes. + * \note After this call, first alloc() has to be called + * before new writes can be done. + */ + void end(); + + /*! Releases the memory corresponding to the handle returned with alloc() */ + void release(off_t handle); + + /*! Closes the store */ + void close(); + + /*! Goes to the start of information corresponding to handle \a pos */ + void seek(off_t handle); + + /*! Reads \a size bytes from the store into the array pointed to be \a buf. + * \note Before reading seek() has to be called to set the right start of the store. + */ + int read(char *buf,uint size); + + void printStats(); + + private: + enum State + { + Init, + Reading, + Writing + }; + struct Node + { + off_t pos; + struct Node *next; + }; + void printFreeList(); + FILE *m_file; + off_t m_front; + Node *m_head; + State m_state; + int m_reads; + int m_writes; +}; + +#endif diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 253d7d5..a8a74bb 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1247,7 +1247,7 @@ void TagFileParser::buildLists(Entry *root) { mn = new FileName(fullName,tfi->name); mn->append(fd); - Doxygen::inputNameList.inSort(mn); + Doxygen::inputNameList->inSort(mn); Doxygen::inputNameDict->insert(tfi->name,mn); } buildMemberList(fe,tfi->members); diff --git a/src/translator_dk.h b/src/translator_dk.h index 1d498e5..98fdea1 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -23,6 +23,7 @@ * First version (not complete) for Doxygen 1.2.7 * Extended and revised for Doxygen 1.3 * Extended and revised for Doxygen 1.3.4 + * Extended and revised for Doxygen 1.3.8 */ /* Translator's notes: @@ -34,25 +35,30 @@ '..?' angiver ord, der endnu ikke er fundet en oversættelse til '(do.)' angiver ord, der med vilje ikke er oversat, idet jeg selv overvejende bruger det engelske udtryk - '(-> _) angiver ord, der er fundet en oversættelse til, men som jeg - vægrer mig ved at oversætte. + '(-> _)' angiver ord, der er fundet en oversættelse til, men som jeg + vægrer mig ved at oversætte. + 'KLID:_' angiver ord, hvor jeg med overlæg har rettet mig efter + KLID.dk's oversættelsesguide (enig eller ej). ) bug -> 'kendt fejl' class -> klasse compound -> 'sammensat type' constructor -> konstruktør ? destructor -> destruktør ? + directory -> KLID:katalog (kunne også være 'bibliotek','mappe','folder') event -> begivenhed ? - exception (-> undtagelse ?) + exception (-> undtagelse ?) friend ..? - interface -> grænseflade ? + interface -> grænseflade ? member -> medlem (TODO) namespace -> (do.) + overloaded -> KLID:overdefineret private -> privat property -> egenskab? protected -> beskyttet ?? public -> offentlig - slot ..? + reference(vb) -> "indeholde referencer til" (?) + slot ..? source code -> kildekode struct -> datastruktur template (-> skabelon ?) @@ -62,6 +68,7 @@ Specielle forbindelser: 'Inheritance diagram' -> Stamtræ (selvom Nedarvningsdiagram også gik an) + ----- @@ -258,7 +265,7 @@ class TranslatorDanish : public TranslatorAdapter_1_3_9 /*! This is an introduction to the class hierarchy. */ virtual QCString trClassHierarchyDescription() { return "Denne nedarvningsliste er sorteret næsten - " - "men ikke helt - alfabetisk:"; + "men ikke nødvendigvis helt - alfabetisk:"; } /*! This is an introduction to the list with all files. */ @@ -323,7 +330,7 @@ class TranslatorDanish : public TranslatorAdapter_1_3_9 } else { result+="fil-medlemmer"; } - result+=" med links til "; + result+=", med links til "; if (extractAll) result+="de filer, de tilhører:"; else @@ -871,7 +878,7 @@ class TranslatorDanish : public TranslatorAdapter_1_3_9 /*! this text is put before an include dependency graph */ virtual QCString trInclDepGraph(const char *fName) { - return (QCString)"Include-afhængighedsgraf for "+fName+":"; + return (QCString)"Inklusions-afhængighedsgraf for "+fName+":"; } /*! header that is put before the list of constructor/destructors. */ virtual QCString trConstructorDocumentation() @@ -1297,7 +1304,7 @@ class TranslatorDanish : public TranslatorAdapter_1_3_9 */ virtual QCString trReferences() { - return "Referencer"; + return "Indeholder referencer til"; } ////////////////////////////////////////////////////////////////////////// @@ -1458,6 +1465,85 @@ class TranslatorDanish : public TranslatorAdapter_1_3_9 } +////////////////////////////////////////////////////////////////////////// +// new since 1.3.9 +////////////////////////////////////////////////////////////////////////// + + /*! This is used as the name of the chapter containing the directory + * hierarchy. + */ + virtual QCString trDirIndex() + { return "Katalogstruktur"; } + + /*! This is used as the name of the chapter containing the documentation + * of the directories. + */ + virtual QCString trDirDocumentation() + { return "Katalog-dokumentation"; } + + /*! This is used as the title of the directory index and also in the + * Quick links of an HTML page, to link to the directory hierarchy. + */ + virtual QCString trDirectories() + { return "Kataloger"; } + + /*! This returns a sentences that introduces the directory hierarchy. + * and the fact that it is sorted alphabetically per level + */ + virtual QCString trDirDescription() + { return "Denne katalogstruktur er sorteret næsten - " + "men ikke nødvendigvis helt - alfabetisk:"; + } + + /*! This returns the title of a directory page. The name of the + * directory is passed via \a dirName. + */ + virtual QCString trDirReference(const char *dirName) + { QCString result="Indhold af kataloget "; result+=dirName; return result;} + + /*! This returns the word directory with or without starting capital + * (\a first_capital) and in sigular or plural form (\a singular). + */ + virtual QCString trDir(bool first_capital, bool singular) + { + return createNoun(first_capital, singular, "katalog", "er"); + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.4.1 +////////////////////////////////////////////////////////////////////////// + + /*! This text is added to the documentation when the \\overload command + * is used for a overloaded function. + */ + virtual QCString trOverloadText() + { + return "Dette er en overdefineret medlemsfunktion, " + "defineret af bekvemmelighedshensyn. " + "Den adskiller sig kun fra den ovenstående funktion i, " + "hvilke argumenter den tager."; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.4.6 +////////////////////////////////////////////////////////////////////////// + + /*! This is used to introduce a caller (or called-by) graph */ + virtual QCString trCallerGraph() + { + return "Her er kalder-grafen for denne funktion:"; + } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for enumeration values + */ + /* + virtual QCString trEnumerationValueDocumentation() + { return "Enumerator-dokumentation"; } //TODO? +*/ + + + /*---------- For internal use: ----------------------------------------*/ protected: /*! For easy flexible-noun implementation. diff --git a/src/util.cpp b/src/util.cpp index 8db8b80..c9993a1 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -217,9 +217,9 @@ int iSystem(const char *command,const char *args,bool commandHasConsole) } else { - // gswin32 is a GUI api which will pop up a window and run - // asynchronously. To prevent both, we use ShellExecuteEx and - // WaitForSingleObject (thanks to Robert Golias for the code) + // gswin32 is a GUI api which will pop up a window and run + // asynchronously. To prevent both, we use ShellExecuteEx and + // WaitForSingleObject (thanks to Robert Golias for the code) SHELLEXECUTEINFO sInfo = { sizeof(SHELLEXECUTEINFO), /* structure size */ @@ -335,7 +335,7 @@ QCString stripAnonymousNamespaceScope(const QCString &s) while ((i=getScopeFragment(s,p,&l))!=-1) { //printf("Scope fragment %s\n",s.mid(i,l).data()); - if (Doxygen::namespaceSDict[s.left(i+l)]!=0) + if (Doxygen::namespaceSDict->find(s.left(i+l))!=0) { if (s.at(i)!='@') { @@ -501,11 +501,11 @@ QCString resolveTypeDef(Definition *context,const QCString &qualifiedName, MemberNameSDict *mnd=0; if (resScope->definitionType()==Definition::TypeClass) { - mnd=&Doxygen::memberNameSDict; + mnd=Doxygen::memberNameSDict; } else { - mnd=&Doxygen::functionNameSDict; + mnd=Doxygen::functionNameSDict; } MemberName *mn=mnd->find(resName); if (mn) @@ -558,7 +558,7 @@ QCString resolveTypeDef(Definition *context,const QCString &qualifiedName, ClassDef *getClass(const char *name) { if (name==0 || name[0]=='\0') return 0; - return Doxygen::classSDict.find(name); + return Doxygen::classSDict->find(name); } NamespaceDef *getResolvedNamespace(const char *name) @@ -578,11 +578,11 @@ NamespaceDef *getResolvedNamespace(const char *name) { warn_cont("Warning: possible recursive namespace alias detected for %s!\n",name); } - return Doxygen::namespaceSDict[subst->data()]; + return Doxygen::namespaceSDict->find(subst->data()); } else { - return Doxygen::namespaceSDict[name]; + return Doxygen::namespaceSDict->find(name); } } @@ -606,7 +606,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope,Definition * * Example: typedef int T; will return 0, since "int" is not a class. */ -static ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, +ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, MemberDef **pMemType,QCString *pTemplSpec) { //printf("newResolveTypedef(md=%p,cachedVal=%p)\n",md,md->getCachedTypedefVal()); @@ -668,7 +668,7 @@ static ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, } else // Something like A<T>::B<S> => lookup A::B, spec=<S> { - *pTemplSpec = type.mid(i); + if (pTemplSpec) *pTemplSpec = type.mid(i); } result = getResolvedClassRec(md->getOuterScope(),fileScope, stripTemplateSpecifiersFromScope(type.left(i),FALSE),0,0); @@ -700,7 +700,8 @@ static ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, /*! Substitutes a simple unqualified \a name within \a scope. Returns the * value of the typedef or \a name if no typedef was found. */ -QCString substTypedef(Definition *scope,FileDef *fileScope,const QCString &name) +static QCString substTypedef(Definition *scope,FileDef *fileScope,const QCString &name, + MemberDef **pTypeDef=0) { QCString result=name; if (name.isEmpty()) return result; @@ -752,7 +753,12 @@ QCString substTypedef(Definition *scope,FileDef *fileScope,const QCString &name) } } } - if (bestMatch) result = bestMatch->typeString(); + if (bestMatch) + { + result = bestMatch->typeString(); + if (pTypeDef) *pTypeDef=bestMatch; + } + //printf("substTypedef(%s,%s)=%s\n",scope?scope->name().data():"<global>", // name.data(),result.data()); return result; @@ -782,14 +788,24 @@ static Definition *endOfPathIsUsedClass(SDict<Definition> *cl,const QCString &lo */ static Definition *followPath(Definition *start,FileDef *fileScope,const QCString &path) { - int is,ps=0; + int is,ps; int l; Definition *current=start; + ps=0; // for each part of the explicit scope while ((is=getScopeFragment(path,ps,&l))!=-1) { // try to resolve the part if it is a typedef - QCString qualScopePart = substTypedef(current,fileScope,path.mid(is,l)); + MemberDef *typeDef=0; + QCString qualScopePart = substTypedef(current,fileScope,path.mid(is,l),&typeDef); + if (typeDef) + { + ClassDef *type = newResolveTypedef(fileScope,typeDef); + if (type) + { + return type; + } + } Definition *next = current->findInnerCompound(qualScopePart); if (next==0) // failed to follow the path { @@ -1090,6 +1106,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, #endif } done: + //printf("> result=%d\n",result); visitedDict.remove(key); //Doxygen::lookupCache.insert(key,new int(result)); return result; @@ -1111,8 +1128,8 @@ void getResolvedSymbol(Definition *scope, QCString &bestTemplSpec ) { - //printf(" found type %x name=%s (%d/%d) d=%p\n", - // d->definitionType(),d->name().data(),count,dl->count(),d); + //printf(" found type %x name=%s d=%p\n", + // d->definitionType(),d->name().data(),d); // only look at classes and members if (d->definitionType()==Definition::TypeClass || @@ -1275,7 +1292,7 @@ ClassDef *getResolvedClassRec(Definition *scope, } DefinitionIntf *di = Doxygen::symbolMap->find(name); - //printf("Looking for symbol %s result=%p\n",name.data(),dl); + //printf("Looking for symbol %s result=%p\n",name.data(),di); if (di==0) { return 0; @@ -2083,12 +2100,11 @@ QCString yearToString() return result; } - //---------------------------------------------------------------------- // recursive function that returns the number of branches in the // inheritance tree that the base class `bcd' is below the class `cd' -int minClassDistance(ClassDef *cd,ClassDef *bcd,int level) +int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) { if (bcd->categoryOf()) // use class that is being extended in case of // an Objective-C category @@ -3381,7 +3397,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data()); - MemberName *mn = Doxygen::memberNameSDict[mName]; + MemberName *mn = Doxygen::memberNameSDict->find(mName); //printf("mName=%s mn=%p\n",mName.data(),mn); if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty())) { @@ -3420,8 +3436,9 @@ bool getDefs(const QCString &scName,const QCString &memberName, { //if (mmd->isLinkable()) //{ + LockingPtr<ArgumentList> mmdAl = mmd->argumentList(); bool match=args==0 || - matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), + matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmdAl.pointer(), fcd,fcd->getFileDef(),argList, checkCV ); @@ -3429,12 +3446,15 @@ bool getDefs(const QCString &scName,const QCString &memberName, if (match) { ClassDef *mcd=mmd->getClassDef(); - int m=minClassDistance(fcd,mcd); - if (m<mdist && mcd->isLinkable()) + if (mcd) { - mdist=m; - cd=mcd; - md=mmd; + int m=minClassDistance(fcd,mcd); + if (m<mdist && mcd->isLinkable()) + { + mdist=m; + cd=mcd; + md=mmd; + } } } //} @@ -3453,13 +3473,16 @@ bool getDefs(const QCString &scName,const QCString &memberName, //{ ClassDef *mcd=mmd->getClassDef(); //printf(" >Class %s found\n",mcd->name().data()); - int m=minClassDistance(fcd,mcd); - if (m<mdist /* && mcd->isLinkable()*/ ) + if (mcd) { - //printf("Class distance %d\n",m); - mdist=m; - cd=mcd; - md=mmd; + int m=minClassDistance(fcd,mcd); + if (m<mdist /* && mcd->isLinkable()*/ ) + { + //printf("Class distance %d\n",m); + mdist=m; + cd=mcd; + md=mmd; + } } //} } @@ -3514,7 +3537,8 @@ bool getDefs(const QCString &scName,const QCString &memberName, QCString className = mmd->getClassDef()->name(); - if (matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), + LockingPtr<ArgumentList> mmdAl = mmd->argumentList(); + if (matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmdAl.pointer(), Doxygen::globalScope,mmd->getFileDef(),argList, checkCV ) @@ -3540,7 +3564,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, // maybe an namespace, file or group member ? //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n", // scopeName.data(),mScope.data(),mName.data()); - if ((mn=Doxygen::functionNameSDict[mName])) // name is known + if ((mn=Doxygen::functionNameSDict->find(mName))) // name is known { //printf(" >function name found\n"); NamespaceDef *fnd=0; @@ -3558,7 +3582,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, } //printf("Trying namespace %s\n",namespaceName.data()); if (!namespaceName.isEmpty() && - (fnd=Doxygen::namespaceSDict[namespaceName]) && + (fnd=Doxygen::namespaceSDict->find(namespaceName)) && fnd->isLinkable() ) { @@ -3577,9 +3601,10 @@ bool getDefs(const QCString &scName,const QCString &memberName, if (args && strcmp(args,"()")!=0) { argList=new ArgumentList; + LockingPtr<ArgumentList> mmdAl = mmd->argumentList(); stringToArgumentList(args,argList); match=matchArguments2( - mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), + mmd->getOuterScope(),mmd->getFileDef(),mmdAl.pointer(), fnd,mmd->getFileDef(),argList, checkCV); } @@ -3659,9 +3684,10 @@ bool getDefs(const QCString &scName,const QCString &memberName, if (args && !md->isDefine() && strcmp(args,"()")!=0) { argList=new ArgumentList; + LockingPtr<ArgumentList> mdAl = md->argumentList(); stringToArgumentList(args,argList); match=matchArguments2( - md->getOuterScope(),fd,md->argumentList(), + md->getOuterScope(),fd,mdAl.pointer(), Doxygen::globalScope,fd,argList, checkCV); delete argList; argList=0; @@ -3780,7 +3806,7 @@ bool getScopeDefs(const char *docScope,const char *scope, { return TRUE; // class link written => quit } - else if ((nd=Doxygen::namespaceSDict[fullName]) && nd->isLinkable()) + else if ((nd=Doxygen::namespaceSDict->find(fullName)) && nd->isLinkable()) { return TRUE; // namespace link written => quit } @@ -3915,7 +3941,7 @@ bool resolveRef(/* in */ const char *scName, // md->name().data(),md,md->anchor().data(),md->isLinkable(),(*resContext)->name().data()); return TRUE; } - else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupSDict[nameStr])) + else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupSDict->find(nameStr))) { // group link *resContext=gd; return TRUE; @@ -4068,7 +4094,7 @@ bool resolveLink(/* in */ const char *scName, *resContext=pd; return TRUE; } - else if ((gd=Doxygen::groupSDict[linkRef])) // link to a group + else if ((gd=Doxygen::groupSDict->find(linkRef))) // link to a group { *resContext=gd; return TRUE; @@ -4089,12 +4115,12 @@ bool resolveLink(/* in */ const char *scName, *resContext=cd; return TRUE; } - else if ((nd=Doxygen::namespaceSDict.find(linkRef))) + else if ((nd=Doxygen::namespaceSDict->find(linkRef))) { *resContext=nd; return TRUE; } - else if ((dir=Doxygen::directories.find(QFileInfo(linkRef).absFilePath()+"/")) + else if ((dir=Doxygen::directories->find(QFileInfo(linkRef).absFilePath()+"/")) && dir->isLinkable()) // TODO: make this location independent like filedefs { *resContext=dir; @@ -4782,8 +4808,8 @@ void addMembersToMemberGroup(MemberList *ml, { if (md->isEnumerate()) // insert enum value of this enum into groups { - QList<MemberDef> *fmdl=md->enumFieldList(); - if (fmdl) + LockingPtr<MemberList> fmdl=md->enumFieldList(); + if (fmdl!=0) { MemberDef *fmd=fmdl->first(); while (fmd) @@ -5310,14 +5336,15 @@ void addRefItem(const QList<ListItemInfo> *sli, void addGroupListToTitle(OutputList &ol,Definition *d) { - if (d->partOfGroups()) // write list of group to which this definition belongs + LockingPtr<GroupList> groups = d->partOfGroups(); + if (groups!=0) // write list of group to which this definition belongs { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.lineBreak(); ol.startSmall(); ol.docify("["); - GroupListIterator gli(*d->partOfGroups()); + GroupListIterator gli(*groups); GroupDef *gd; bool first=TRUE; for (gli.toFirst();(gd=gli.current());++gli) @@ -220,7 +220,7 @@ void initClassHierarchy(ClassSDict *cl); bool hasVisibleRoot(BaseClassList *bcl); -int minClassDistance(ClassDef *cd,ClassDef *bcd,int level=0); +int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level=0); QCString convertNameToFile(const char *name,bool allowDots=FALSE); @@ -325,6 +325,8 @@ SrcLangExt getLanguageFromFileName(const QCString fileName); bool checkIfTypedef(Definition *scope,FileDef *fileScope,const char *n); +ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, + MemberDef **pMemType=0,QCString *pTemplSpec=0); #endif diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 2f751a9..3b416d0 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -456,9 +456,10 @@ static void writeTemplateArgumentList(ArgumentList *al, static void writeMemberTemplateLists(MemberDef *md,QTextStream &t) { - if (md->templateArguments()) // function template prefix + LockingPtr<ArgumentList> templMd = md->templateArguments(); + if (templMd!=0) // function template prefix { - writeTemplateArgumentList(md->templateArguments(),t,md->getClassDef(),md->getFileDef(),8); + writeTemplateArgumentList(templMd.pointer(),t,md->getClassDef(),md->getFileDef(),8); } } @@ -622,9 +623,9 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De if (isFunc) { - ArgumentList *al = md->argumentList(); + LockingPtr<ArgumentList> al = md->argumentList(); t << " const=\""; - if (al && al->constSpecifier) t << "yes"; else t << "no"; + if (al!=0 && al->constSpecifier) t << "yes"; else t << "no"; t << "\""; t << " explicit=\""; @@ -711,8 +712,8 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De << rmd->getOutputFileBase() << "_1" << rmd->anchor() << "\">" << convertToXML(rmd->name()) << "</reimplements>" << endl; } - MemberList *rbml = md->reimplementedBy(); - if (rbml) + LockingPtr<MemberList> rbml = md->reimplementedBy(); + if (rbml!=0) { MemberListIterator mli(*rbml); for (mli.toFirst();(rmd=mli.current());++mli) @@ -725,9 +726,9 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De if (isFunc) //function { - ArgumentList *declAl = md->declArgumentList(); - ArgumentList *defAl = md->argumentList(); - if (declAl && declAl->count()>0) + LockingPtr<ArgumentList> declAl = md->declArgumentList(); + LockingPtr<ArgumentList> defAl = md->argumentList(); + if (declAl!=0 && declAl->count()>0) { ArgumentListIterator declAli(*declAl); ArgumentListIterator defAli(*defAl); @@ -820,9 +821,10 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De if (md->memberType()==MemberDef::Enumeration) // enum { - if (md->enumFieldList()) + LockingPtr<MemberList> enumFields = md->enumFieldList(); + if (enumFields!=0) { - MemberListIterator emli(*md->enumFieldList()); + MemberListIterator emli(*enumFields); MemberDef *emd; for (emli.toFirst();(emd=emli.current());++emli) { @@ -887,18 +889,20 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De } //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers()); - if (md->getReferencesMembers()) + LockingPtr<MemberSDict> mdict = md->getReferencesMembers(); + if (mdict!=0) { - MemberSDict::Iterator mdi(*md->getReferencesMembers()); + MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { writeMemberReference(t,def,rmd,"references"); } } - if (md->getReferencedByMembers()) + mdict = md->getReferencedByMembers(); + if (mdict!=0) { - MemberSDict::Iterator mdi(*md->getReferencedByMembers()); + MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { @@ -1837,7 +1841,7 @@ void generateXML() t << "version=\"" << versionString << "\">" << endl; { - ClassSDict::Iterator cli(Doxygen::classSDict); + ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { @@ -1854,14 +1858,14 @@ void generateXML() // generateXMLForClass(cd,t); // } //} - NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { msg("Generating XML output for namespace %s\n",nd->name().data()); generateXMLForNamespace(nd,t); } - FileNameListIterator fnli(Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -1873,7 +1877,7 @@ void generateXML() generateXMLForFile(fd,t); } } - GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (;(gd=gli.current());++gli) { @@ -1891,7 +1895,7 @@ void generateXML() } { DirDef *dir; - DirSDict::Iterator sdi(Doxygen::directories); + DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { msg("Generate XML output for dir %s\n",dir->name().data()); |