diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dot.cpp | 30 | ||||
-rw-r--r-- | src/doxygen.cpp | 105 | ||||
-rw-r--r-- | src/htmlgen.cpp | 26 | ||||
-rw-r--r-- | src/htmlgen.h | 4 | ||||
-rw-r--r-- | src/index.cpp | 32 | ||||
-rw-r--r-- | src/memberdef.cpp | 1 | ||||
-rw-r--r-- | src/rtfgen.h | 4 | ||||
-rw-r--r-- | src/scanner.l | 7 | ||||
-rw-r--r-- | src/translator_en.h | 2 | ||||
-rw-r--r-- | src/util.cpp | 132 | ||||
-rw-r--r-- | src/util.h | 3 | ||||
-rw-r--r-- | src/xmlgen.cpp | 53 |
12 files changed, 249 insertions, 150 deletions
diff --git a/src/dot.cpp b/src/dot.cpp index ffd4abd..478de8a 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -769,11 +769,11 @@ void DotGfxHierarchyTable::writeGraph(QTextStream &out,const char *path) return; } QCString mapLabel = convertNameToFile(n->m_label); - out << "<tr><td><img src=\"" << imgName << "\" border=\"0\" usemap=\"#" - << mapLabel << "_map\"></td></tr>" << endl; + out << "<tr><td><img src=\"" << imgName << "\" border=\"0\" alt=\"\" usemap=\"#" + << mapLabel << "_map\">" << endl; out << "<map name=\"" << mapLabel << "_map\">" << endl; convertMapFile(out,mapName); - out << "</map>" << endl; + out << "</map></td></tr>" << endl; if (Config_getBool("DOT_CLEANUP")) thisDir.remove(dotName); thisDir.remove(mapName); } @@ -1378,9 +1378,15 @@ QCString DotClassGraph::writeGraph(QTextStream &out, break; } out << "\"></center>" << endl; - out << "<map name=\"" << mapLabel << "\">" << endl; - convertMapFile(out,baseName+".map"); - out << "</map>" << endl; + QString tmpstr; + QTextOStream tmpout(&tmpstr); + convertMapFile(tmpout,baseName+".map"); + if (!tmpstr.isEmpty()) + { + out << "<map name=\"" << mapLabel << "\">" << endl; + out << tmpstr; + out << "</map>" << endl; + } thisDir.remove(baseName+".map"); } } @@ -1601,9 +1607,15 @@ QCString DotInclDepGraph::writeGraph(QTextStream &out, if (m_inverse) out << "Included by dependency graph"; else out << "Include dependency graph"; out << "\">"; out << "</center>" << endl; - out << "<map name=\"" << mapName << "_map\">" << endl; - convertMapFile(out,baseName+".map"); - out << "</map>" << endl; + QString tmpstr; + QTextOStream tmpout(&tmpstr); + convertMapFile(tmpout,baseName+".map"); + if (!tmpstr.isEmpty()) + { + out << "<map name=\"" << mapName << "\">" << endl; + out << tmpstr; + out << "</map>" << endl; + } thisDir.remove(baseName+".map"); } } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 7f6b12e..76a9a2d 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1908,6 +1908,24 @@ static void buildFunctionList(Entry *root) md->setDocsForDefinition(!root->proto); ArgumentList *argList = new ArgumentList; stringToArgumentList(root->args,argList); + //printf("root->argList=%p\n",root->argList); + //if (root->argList) + //{ + // ArgumentListIterator ali1(*root->argList); + // ArgumentListIterator ali2(*argList); + // Argument *sa,*da; + // for (;(sa=ali1.current()) && (da=ali2.current());++ali1,++ali2) + // { + // printf("sa->name=%s (doc=%s) da->name=%s (doc=%s)\n", + // sa->name.data(),sa->docs.data(), + // da->name.data(),da->docs.data() + // ); + // if (!sa->docs.isEmpty() && da->docs.isEmpty()) + // { + // da->docs=sa->docs.copy(); + // } + // } + //} if (root->proto) { md->setDeclArgumentList(argList); @@ -1957,6 +1975,9 @@ static void buildFunctionList(Entry *root) root->type,name,root->args,root->exception, root->protection,root->virt,root->stat,FALSE, MemberDef::Function,tArgList,root->argList); + //printf("new member %p\n",md); + + if (root->tagInfo) { md->setAnchor(root->tagInfo->anchor); @@ -2154,6 +2175,33 @@ static void findFriends() //---------------------------------------------------------------------- +static void transferArgumentDocumentation(ArgumentList *decAl,ArgumentList *defAl) +{ + if (decAl && defAl) + { + ArgumentListIterator decAli(*decAl); + ArgumentListIterator defAli(*defAl); + Argument *decA,*defA; + for (decAli.toFirst(),defAli.toFirst(); + (decA=decAli.current()) && (defA=defAli.current()); + ++decAli,++defAli) + { + //printf("Argument decA->name=%s (doc=%s) defA->name=%s (doc=%s)\n", + // decA->name.data(),decA->docs.data(), + // defA->name.data(),defA->docs.data() + // ); + if (decA->docs.isEmpty() && !defA->docs.isEmpty()) + { + decA->docs = defA->docs.copy(); + } + else if (defA->docs.isEmpty() && !decA->docs.isEmpty()) + { + defA->docs = decA->docs.copy(); + } + } + } +} + static void transferFunctionDocumentation() { //printf("transferFunctionDocumentation()\n"); @@ -2185,23 +2233,15 @@ static void transferFunctionDocumentation() matchArguments(mdef->argumentList(),mdec->argumentList()) ) /* match found */ { - /* FIX: Always match declaration and definition. - FileDef *fdef = mdef->getFileDef(); - FileDef *fdec = mdec->getFileDef(); - - // check if not in different but documented files - if (Config_getBool("EXTRACT_ALL") || - fdef==fdec || - (fdef!=0 && (!fdef->hasDocumentation() || !fdec->hasDocumentation())) - ) - */ - { - //printf("Found member %s: definition in %s (doc=%d) and declation in %s (doc=%d)\n", + //printf("Found member %s: definition in %s (doc=`%s') and declaration in %s (doc=`%s')\n", // mn->memberName(), - // mdef->getFileDef()->name().data(),!mdef->documentation().isEmpty(), - // mdec->getFileDef()->name().data(),!mdec->documentation().isEmpty() + // mdef->getFileDef()->name().data(),mdef->documentation().data(), + // mdec->getFileDef()->name().data(),mdec->documentation().data() // ); + // first merge argument documentation + transferArgumentDocumentation(mdec->argumentList(),mdef->argumentList()); + /* copy documentation between function definition and declaration */ if (!mdec->briefDescription().isEmpty()) { @@ -2218,6 +2258,10 @@ static void transferFunctionDocumentation() mdec->setDocsForDefinition(mdef->isDocsForDefinition()); ArgumentList *mdefAl = new ArgumentList; stringToArgumentList(mdef->argsString(),mdefAl); + if (mdef->argumentList()) + { + transferArgumentDocumentation(mdef->argumentList(),mdefAl); + } mdec->setArgumentList(mdefAl); } else if (!mdec->documentation().isEmpty()) @@ -2227,6 +2271,10 @@ static void transferFunctionDocumentation() mdef->setDocsForDefinition(mdec->isDocsForDefinition()); ArgumentList *mdecAl = new ArgumentList; stringToArgumentList(mdec->argsString(),mdecAl); + if (mdec->argumentList()) + { + transferArgumentDocumentation(mdec->argumentList(),mdecAl); + } mdef->setDeclArgumentList(mdecAl); } if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1) @@ -2244,27 +2292,6 @@ static void transferFunctionDocumentation() mdec->mergeMemberSpecifiers(mdef->getMemberSpecifiers()); mdef->mergeMemberSpecifiers(mdec->getMemberSpecifiers()); - ArgumentList *decAl = mdec->argumentList(); - ArgumentList *defAl = mdef->argumentList(); - if (decAl && defAl) - { - ArgumentListIterator decAli(*decAl); - ArgumentListIterator defAli(*defAl); - Argument *decA,*defA; - for (decAli.toFirst(),defAli.toFirst(); - (decA=decAli.current()) && (defA=defAli.current()); - ++decAli,++defAli) - { - if (decA->docs.isEmpty() && !defA->docs.isEmpty()) - { - decA->docs = defA->docs.copy(); - } - else if (defA->docs.isEmpty() && !decA->docs.isEmpty()) - { - defA->docs = decA->docs.copy(); - } - } - } // copy group info. //if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0) @@ -2281,7 +2308,6 @@ static void transferFunctionDocumentation() int testId = QMAX(mdec->testId(),mdef->testId()); int bugId = QMAX(mdec->bugId() ,mdef->bugId() ); mdec->setRefItems(todoId,testId,bugId); - } } } } @@ -2552,6 +2578,7 @@ static void findUsedClassesForClass(Entry *root, if (usedCd) { if (isArtificial) usedCd->setClassIsArtificial(); + Debug::print(Debug::Classes,0," Adding used class `%s'\n", usedCd->name().data()); instanceCd->addUsedClass(usedCd,md->name()); } } @@ -2583,6 +2610,7 @@ static void findUsedClassesForClass(Entry *root, if (usedCd) { found=TRUE; + Debug::print(Debug::Classes,0," Adding used class `%s'\n", usedCd->name().data()); instanceCd->addUsedClass(usedCd,md->name()); // class exists } } @@ -2610,6 +2638,7 @@ static void findUsedClassesForClass(Entry *root, if (usedCd) { if (isArtificial) usedCd->setClassIsArtificial(); + Debug::print(Debug::Classes,0," Adding used class `%s'\n", usedCd->name().data()); instanceCd->addUsedClass(usedCd,md->name()); } } @@ -2653,6 +2682,7 @@ static void findBaseClassesForClass( { tbi.name = substituteTemplateArgumentsInString(bi->name,formalArgs,actualArgs); } + //printf("bi->name=%s tbi.name=%s\n",bi->name.data(),tbi.name.data()); if (mode==DocumentedOnly) { @@ -2779,6 +2809,7 @@ static bool findClassRelation( biName=biName.right(biName.length()-2); explicitGlobalScope=TRUE; } + //printf("biName=`%s'\n",biName.data()); Entry *parentNode=root->parent; bool lastParent=FALSE; @@ -2817,7 +2848,7 @@ static bool findClassRelation( if (!isRecursiveBaseClass(root->name,baseClassName) || explicitGlobalScope) { Debug::print( - Debug::Classes,0," class relation %s inherited by %s found (%s and %s)\n", + Debug::Classes,0," class relation %s inherited/used by %s found (%s and %s)\n", baseClassName.data(), root->name.data(), (bi->prot==Private)?"private":((bi->prot==Protected)?"protected":"public"), diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 4f971c2..80e2dc5 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -85,13 +85,13 @@ static const char *defaultStyleSheet = " margin-top : 2px; \n" " margin-bottom : 2px \n" "}\n" -"FONT.keyword { color: #008000 }\n" -"FONT.keywordtype { color: #604020 }\n" -"FONT.keywordflow { color: #e08000 }\n" -"FONT.comment { color: #800000 }\n" -"FONT.preprocessor { color: #806020 }\n" -"FONT.stringliteral { color: #002080 }\n" -"FONT.charliteral { color: #008080 }\n"; +"span.keyword { color: #008000 }\n" +"span.keywordtype { color: #604020 }\n" +"span.keywordflow { color: #e08000 }\n" +"span.comment { color: #800000 }\n" +"span.preprocessor { color: #806020 }\n" +"span.stringliteral { color: #002080 }\n" +"span.charliteral { color: #008080 }\n"; static QCString g_header; @@ -181,7 +181,7 @@ void HtmlGenerator::writeHeaderFile(QFile &file) void HtmlGenerator::writeFooterFile(QFile &file) { QTextStream t(&file); - t << "<hr><address align=\"right\"><small>\n"; + t << "<hr><address style=\"align: right;\"><small>\n"; t << theTranslator->trGeneratedAt( "$datetime", "$projectname" ); t << " <a href=\"http://www.doxygen.org/index.html\">\n" << "<img src=\"doxygen.png\" alt=\"doxygen\" " @@ -257,7 +257,7 @@ void HtmlGenerator::writeFooter(int part,bool external) { case 0: if (g_footer.isEmpty()) - t << "<hr><address align=\"right\"><small>"; + t << "<hr><address style=\"align: right;\"><small>"; else t << substituteKeywords(g_footer,convertToHtml(lastTitle)); break; @@ -519,14 +519,14 @@ void HtmlGenerator::endGroupHeader() void HtmlGenerator::startSection(const char *lab,const char *,bool sub) { - t << "<a name=\"" << lab << "\">"; if (sub) t << "<h3>"; else t << "<h2>"; + t << "<a name=\"" << lab << "\">"; } void HtmlGenerator::endSection(const char *,bool sub) { - if (sub) t << "</h3>"; else t << "</h2>"; t << "</a>" << endl; + if (sub) t << "</h3>"; else t << "</h2>"; } void HtmlGenerator::writeSectionRef(const char *ref,const char *name, @@ -654,7 +654,7 @@ void HtmlGenerator::endClassDiagram(ClassDiagram &d, { t << "\n<p><center><img src=\"" << fileName << ".png\" usemap=\"#" << name << "_map\"" - << " border=\"0\"></center>" << endl + << " border=\"0\" alt=\"\"></center>" << endl << "<map name=\"" << name << "_map\">" << endl; d.writeImage(t,dir,fileName); @@ -786,6 +786,8 @@ void HtmlGenerator::startMemberSections() if (Config_getBool("HTML_ALIGN_MEMBERS")) { t << "<table border=0 cellpadding=0 cellspacing=0>" << endl; + // HTML is not recursively decomposable, sorry + t << "<tr><td></td></tr>" << endl; } } diff --git a/src/htmlgen.h b/src/htmlgen.h index 2ad8c2b..55322ed 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -254,8 +254,8 @@ class HtmlGenerator : public OutputGenerator void startParameterList(); void endParameterList(); - void startFontClass(const char *s) { t << "<font class=\"" << s << "\">"; } - void endFontClass() { t << "</font>"; } + void startFontClass(const char *s) { t << "<span class=\"" << s << "\">"; } + void endFontClass() { t << "</span>"; } void startHtmlOnly() {} void endHtmlOnly() {} diff --git a/src/index.cpp b/src/index.cpp index d82e923..a9c52de 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -417,11 +417,11 @@ void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level) } if (hasHtmlHelp) { - htmlHelp->addContentsItem(hasChildren,cd->name(),cd->getOutputFileBase()); + htmlHelp->addContentsItem(hasChildren,cd->displayName(),cd->getOutputFileBase()); } if (hasFtvHelp) { - ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } } else @@ -429,11 +429,11 @@ void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level) ol.writeIndexItem(0,0,cd->name()); if (hasHtmlHelp) { - htmlHelp->addContentsItem(hasChildren,cd->name(),0); + htmlHelp->addContentsItem(hasChildren,cd->displayName(),0); } if (hasFtvHelp) { - ftvHelp->addContentsItem(hasChildren,0,0,0,cd->name()); + ftvHelp->addContentsItem(hasChildren,0,0,0,cd->displayName()); } } if (hasChildren) @@ -492,11 +492,11 @@ void writeClassTree(BaseClassList *cl,int level) { if (hasHtmlHelp) { - htmlHelp->addContentsItem(hasChildren,cd->name(),cd->getOutputFileBase()); + htmlHelp->addContentsItem(hasChildren,cd->displayName(),cd->getOutputFileBase()); } if (hasFtvHelp) { - ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } } if (hasChildren) @@ -530,11 +530,11 @@ void writeClassTreeNode(ClassDef *cd,bool hasHtmlHelp,bool hasFtvHelp,bool &star { if (hasHtmlHelp) { - HtmlHelp::getInstance()->addContentsItem(hasChildren,cd->name(),cd->getOutputFileBase()); + HtmlHelp::getInstance()->addContentsItem(hasChildren,cd->displayName(),cd->getOutputFileBase()); } if (hasFtvHelp) { - FTVHelp::getInstance()->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + FTVHelp::getInstance()->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } } if (hasChildren) @@ -624,11 +624,11 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started) } if (hasHtmlHelp) { - htmlHelp->addContentsItem(hasChildren,cd->name(),cd->getOutputFileBase()); + htmlHelp->addContentsItem(hasChildren,cd->displayName(),cd->getOutputFileBase()); } if (hasFtvHelp) { - ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + ftvHelp->addContentsItem(hasChildren,cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } } else @@ -636,11 +636,11 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started) ol.writeIndexItem(0,0,cd->displayName()); if (hasHtmlHelp) { - htmlHelp->addContentsItem(hasChildren,cd->name(),0); + htmlHelp->addContentsItem(hasChildren,cd->displayName(),0); } if (hasFtvHelp) { - ftvHelp->addContentsItem(hasChildren,0,0,0,cd->name()); + ftvHelp->addContentsItem(hasChildren,0,0,0,cd->displayName()); } } if (hasChildren) @@ -1140,11 +1140,11 @@ void writeNamespaceIndex(OutputList &ol) //ol.writeEndAnnoItem(nd->getOutputFileBase()); if (hasHtmlHelp) { - htmlHelp->addContentsItem(FALSE,nd->name(),nd->getOutputFileBase()); + htmlHelp->addContentsItem(FALSE,nd->displayName(),nd->getOutputFileBase()); } if (hasFtvHelp) { - ftvHelp->addContentsItem(FALSE,nd->getReference(),nd->getOutputFileBase(),0,nd->name()); + ftvHelp->addContentsItem(FALSE,nd->getReference(),nd->getOutputFileBase(),0,nd->displayName()); } } } @@ -1216,11 +1216,11 @@ void writeAnnotatedClassList(OutputList &ol) //ol.writeEndAnnoItem(cd->getOutputFileBase()); if (hasHtmlHelp) { - HtmlHelp::getInstance()->addContentsItem(FALSE,cd->name(),cd->getOutputFileBase()); + HtmlHelp::getInstance()->addContentsItem(FALSE,cd->displayName(),cd->getOutputFileBase()); } if (hasFtvHelp) { - FTVHelp::getInstance()->addContentsItem(FALSE,cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + FTVHelp::getInstance()->addContentsItem(FALSE,cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } } } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7d8c8d2..b43436b 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -340,6 +340,7 @@ MemberDef::MemberDef(const char *df,int dl, 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; diff --git a/src/rtfgen.h b/src/rtfgen.h index afa2df6..fa70b13 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -114,8 +114,8 @@ class RTFGenerator : public OutputGenerator void endCodeFragment(); void startPreFragment() { startCodeFragment(); } void endPreFragment() { endCodeFragment(); } - void startVerbatimFragment() { startVerbatimFragment(); } - void endVerbatimFragment() { endVerbatimFragment(); } + void startVerbatimFragment() { startCodeFragment(); } + void endVerbatimFragment() { endCodeFragment(); } void writeLineNumber(const char *,const char *,const char *,int l) { t << l << " "; } void startCodeLine() { col=0; } void endCodeLine() { lineBreak(); } diff --git a/src/scanner.l b/src/scanner.l index 79fe0f1..eced109 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2668,12 +2668,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) current->args += yytext; } <Bases>{BN}*{ID}("."{ID})* { // Java style class - QCString name = yytext; - int i=name.findRev('.'); - if (i!=-1) // strip part before dots - { - name=name.right(name.length()-i-1); - } + QCString name = substitute(yytext,".","::"); baseName += name; current->args += ' '; current->args += name; diff --git a/src/translator_en.h b/src/translator_en.h index 258f6a1..c7ab6c7 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -1072,7 +1072,7 @@ class TranslatorEnglish : public Translator "\\endcode\n" "If the \\c MAX_DOT_GRAPH_HEIGHT tag in the configuration file " "is set to 240 this will result in the following graph:" - "<p><center><img src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n" + "<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n" "<p>\n" "The boxes in the above graph have the following meaning:\n" "<ul>\n" diff --git a/src/util.cpp b/src/util.cpp index 83dd2a2..57e7149 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -360,53 +360,100 @@ int guessSection(const char *name) return 0; } -QCString resolveTypeDef(Definition *d,const QCString &name) +QCString resolveTypeDef(Definition *context,const QCString &qualifiedName, + Definition **typedefContext) { - //printf("resolveTypeDef(%s,%s)\n",d ? d->name().data() : "<none>",name.data()); + //printf("resolveTypeDef(%s,%s)\n", + // context ? context->name().data() : "<none>",qualifiedName.data()); QCString result; - if (name.isEmpty()) return result; + if (qualifiedName.isEmpty()) return result; - Definition *mContext=d; + Definition *mContext=context; + if (typedefContext) *typedefContext=context; + + // see if the qualified name has a scope part + int scopeIndex = qualifiedName.findRev("::"); + QCString resName=qualifiedName; + if (scopeIndex!=-1) // strip scope part for the name + { + resName=qualifiedName.right(qualifiedName.length()-scopeIndex-2); + } + else + { + resName=qualifiedName; + } MemberDef *md=0; while (mContext && md==0) { - MemberNameSDict *mnd=0; - if (mContext->definitionType()==Definition::TypeClass) - { - mnd=&Doxygen::memberNameSDict; - } - else + // step 1: get the right scope + Definition *resScope=mContext; + if (scopeIndex!=-1) { - mnd=&Doxygen::functionNameSDict; + // split-off scope part + QCString resScopeName = qualifiedName.left(scopeIndex); + //printf("resScopeName=`%s'\n",resScopeName.data()); + + // look-up scope in context + int is,ps=0; + int l; + while ((is=getScopeFragment(resScopeName,ps,&l))!=-1) + { + QCString qualScopePart = resScopeName.mid(is,l); + QCString tmp = resolveTypeDef(context,qualScopePart); + if (!tmp.isEmpty()) qualScopePart=tmp; + resScope = resScope->findInnerCompound(qualScopePart); + //printf("qualScopePart=`%s' resScope=%p\n",qualScopePart.data(),resScope); + if (resScope==0) break; + ps=is+l; + } } - MemberName *mn=mnd->find(name); - if (mn) + + // step 2: get the member + if (resScope) // no scope or scope found in the current context { - MemberNameIterator mni(*mn); - MemberDef *tmd=0; - for (;(tmd=mni.current());++mni) + //printf("scope found: %s, look for typedef %s\n", + // resScope->qualifiedName().data(),resName.data()); + MemberNameSDict *mnd=0; + if (resScope->definitionType()==Definition::TypeClass) + { + mnd=&Doxygen::memberNameSDict; + } + else { - //printf("Found member %s scope=%p mContext=%p\n",tmd->name().data(), - // tmd->getOuterScope(),mContext); - if (tmd->isTypedef() && tmd->getOuterScope()==mContext) + mnd=&Doxygen::functionNameSDict; + } + MemberName *mn=mnd->find(resName); + if (mn) + { + MemberNameIterator mni(*mn); + MemberDef *tmd=0; + for (;(tmd=mni.current());++mni) { - md=tmd; + //printf("Found member %s scope=%p mContext=%p\n",tmd->name().data(), + // tmd->getOuterScope(),mContext); + if (tmd->isTypedef() && tmd->getOuterScope()==resScope) + { + md=tmd; + } } } } mContext=mContext->getOuterScope(); } + + // step 3: get the member's type if (md) { //printf("Found typedef name `%s' in scope `%s' value=`%s'\n", - // name.data(),d->name().data(),md->typeString() + // qualifiedName.data(),context->name().data(),md->typeString() // ); result=md->typeString(); + if (typedefContext) *typedefContext=md->getOuterScope(); } else { //printf("Typedef `%s' not found in scope `%s'!\n", - // name.data(),d ? d->name().data() : "<global>"); + // qualifiedName.data(),context ? context->name().data() : "<global>"); } return result; @@ -456,32 +503,27 @@ ClassDef *getResolvedClass( QCString name = n; if (scope==0) scope=Doxygen::globalScope; if (name.isEmpty()) return 0; - int index = name.findRev("::"); + //int index = name.findRev("::"); ClassDef *cd=0; + //printf("===================\n"); do { - //fprintf(stderr,"getResolvedClass(%s,%s)\n",scope ? scope->name().data() : "<none>", n); - QCString subst; - if (index!=-1) - { - subst = resolveTypeDef(scope,name.right(name.length()-index-2)); - } - else - { - subst = resolveTypeDef(scope,name); - } - //printf(" typedef subst=`%s'\n",subst.data()); + //printf("trying getResolvedClass(%s,%s)\n",scope ? scope->name().data() : "<none>", n); + Definition *typedefScope = 0; + QCString subst = resolveTypeDef(scope,name,&typedefScope); if (!subst.isEmpty()) { + //printf(" typedef value=%s typedefScope=%s\n",subst.data(), + // typedefScope?typedefScope->qualifiedName().data():0); // strip * and & from n int ip=subst.length()-1; while (ip>=0 && (subst.at(ip)=='*' || subst.at(ip)=='&' || subst.at(ip)==' ')) ip--; subst=subst.left(ip+1); if (pIsTypeDef) *pIsTypeDef=TRUE; - if (subst==name) // avoid resolving typedef struct foo foo; + if (subst==name) // avoid resolving "typedef struct foo foo"; { cd = Doxygen::classSDict.find(name); if (cd) goto found; @@ -492,8 +534,8 @@ ClassDef *getResolvedClass( QCString newSubst; QCString typeName = subst; - if (index!=-1) typeName.prepend(name.left(index)+"::"); - while (!(newSubst=resolveTypeDef(scope,typeName)).isEmpty() + //if (index!=-1) typeName.prepend(name.left(index)+"::"); + while (!(newSubst=resolveTypeDef(typedefScope,typeName)).isEmpty() && count<10) { if (typeName==newSubst) @@ -511,7 +553,7 @@ ClassDef *getResolvedClass( //printf(" getResolvedClass `%s'->`%s'\n",name.data(),subst.data()); typeName=newSubst; - if (index!=-1) typeName.prepend(name.left(index)+"::"); + //if (index!=-1) typeName.prepend(name.left(index)+"::"); count++; } if (count==10) @@ -523,7 +565,14 @@ ClassDef *getResolvedClass( else { int i; - cd = Doxygen::classSDict.find(typeName); + if (typedefScope) + { + cd = Doxygen::classSDict.find(typedefScope->qualifiedName()+"::"+typeName); + } + if (cd==0) + { + cd = Doxygen::classSDict.find(typeName); + } //printf(" getClass: subst %s->%s cd=%p\n",name.data(),typeName.data(),cd); if (cd==0 && (i=typeName.find('<'))>0) // try unspecialized version as well { @@ -534,8 +583,9 @@ ClassDef *getResolvedClass( } } } - else + else // not a typedef { + //printf(" not a typedef value\n"); if (pIsTypeDef) *pIsTypeDef=FALSE; if (scope!=Doxygen::globalScope) cd = Doxygen::classSDict.find(scope->name()+"::"+name); @@ -550,7 +600,7 @@ ClassDef *getResolvedClass( } while (scope); found: - //fprintf(stderr, "getResolvedClass()=%s\n",cd?cd->name().data():"<none>"); + //printf("getResolvedClass()=%s\n",cd?cd->name().data():"<none>"); return cd; } @@ -164,7 +164,8 @@ ArgumentList *copyArgumentList(const ArgumentList *src); QList<ArgumentList> *copyArgumentLists(const QList<ArgumentList> *srcLists); QCString stripTemplateSpecifiersFromScope(const QCString &fullName, bool parentOnly=TRUE); -QCString resolveTypeDef(Definition *d,const QCString &name); +QCString resolveTypeDef(Definition *d,const QCString &name, + Definition **typedefContext=0); QCString mergeScopes(const QCString &leftScope,const QCString &rightScope); int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 60eb9f3..f8f1fe9 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1083,19 +1083,9 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De // + template arguments // (templateArguments(), definitionTemplateParameterLists()) + // enum values are written as part of the enum if (md->memberType()==MemberDef::EnumValue) return; - ti << " <member id=\"" << md->getOutputFileBase() - << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << "</member>" << endl; - - QCString scopeName; - if (md->getClassDef()) - scopeName=md->getClassDef()->name(); - else if (md->getNamespaceDef()) - scopeName=md->getNamespaceDef()->name(); - - t << " <memberdef kind=\""; - //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t; QCString memType; bool isFunc=FALSE; switch (md->memberType()) @@ -1113,6 +1103,19 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De case MemberDef::DCOP: memType="dcop"; isFunc=TRUE; break; case MemberDef::Slot: memType="slot"; isFunc=TRUE; break; } + + ti << " <member refid=\"" << md->getOutputFileBase() + << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>" + << convertToXML(md->name()) << "</name></member>" << endl; + + QCString scopeName; + if (md->getClassDef()) + scopeName=md->getClassDef()->name(); + else if (md->getNamespaceDef()) + scopeName=md->getNamespaceDef()->name(); + + t << " <memberdef kind=\""; + //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t; t << memType << "\" id=\""; t << md->getOutputFileBase() << "_1" // encoded `:' character (see util.cpp:convertNameToFile) @@ -1407,7 +1410,8 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) if (cd->name().find('@')!=-1) return; // skip anonymous compounds. if (cd->templateMaster()!=0) return; // skip generated template instances. - ti << " <compound id=\"" << cd->getOutputFileBase() + ti << " <compound refid=\"" << cd->getOutputFileBase() + << "\" kind=\"" << cd->compoundTypeString() << "\"><name>" << convertToXML(cd->name()) << "</name>" << endl; QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); @@ -1477,7 +1481,7 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) case Pure: t << "pure-virtual"; break; } t << "\">" << convertToXML(bcd->classDef->displayName()) - << "</basecompoundref>" << endl; + << "</derivedcompoundref>" << endl; } } @@ -1573,8 +1577,9 @@ static void generateXMLForNamespace(NamespaceDef *nd,QTextStream &ti) if (nd->isReference()) return; // skip external references - ti << " <compound id=\"" << nd->getOutputFileBase() - << "\"><name>" << convertToXML(nd->name()) << "</name>" << endl; + ti << " <compound refid=\"" << nd->getOutputFileBase() + << "\" kind=\"namespace\"" << "><name>" + << convertToXML(nd->name()) << "</name>" << endl; QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QCString fileName=outputDirectory+"/xml/"+nd->getOutputFileBase()+".xml"; @@ -1663,8 +1668,9 @@ static void generateXMLForFile(FileDef *fd,QTextStream &ti) if (fd->isReference()) return; // skip external references - ti << " <compound id=\"" << fd->getOutputFileBase() - << "\"><name>" << convertToXML(fd->name()) << "</name>" << endl; + ti << " <compound refid=\"" << fd->getOutputFileBase() + << "\" kind=\"file\"><name>" << convertToXML(fd->name()) + << "</name>" << endl; QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QCString fileName=outputDirectory+"/xml/"+fd->getOutputFileBase()+".xml"; @@ -1796,8 +1802,8 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) if (gd->isReference()) return; // skip external references - ti << " <compound id=\"" << gd->getOutputFileBase() - << "\"><name>" << convertToXML(gd->name()) << "</name>" << endl; + ti << " <compound refid=\"" << gd->getOutputFileBase() + << "\" kind=\"group\"><name>" << convertToXML(gd->name()) << "</name>" << endl; QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QCString fileName=outputDirectory+"/xml/"+gd->getOutputFileBase()+".xml"; @@ -1857,7 +1863,7 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) for (pli.toFirst();(pi=pli.current());++pli) { t << " <innerpage refid=\"" << pi->getOutputFileBase() - << "\"/>" << convertToXML(pi->title) << "</innerpage>" << endl; + << "\">" << convertToXML(pi->title) << "</innerpage>" << endl; } } @@ -1869,7 +1875,8 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) for (gli.toFirst();(sgd=gli.current());++gli) { t << " <innergroup refid=\"" << gd->getOutputFileBase() - << "\"/>" << convertToXML(sgd->groupTitle()) << "</innergroup>" << endl; + << "\">" << convertToXML(sgd->groupTitle()) + << "</innergroup>" << endl; } } @@ -1907,8 +1914,8 @@ static void generateXMLForPage(PageInfo *pi,QTextStream &ti) if (pi->isReference()) return; - ti << " <compound id=\"" << pi->getOutputFileBase() - << "\"><name>" << convertToXML(pi->name) << "</name>" << endl; + ti << " <compound refid=\"" << pi->getOutputFileBase() + << "\" kind=\"page\"><name>" << convertToXML(pi->name) << "</name>" << endl; QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QCString fileName=outputDirectory+"/xml/"+pi->getOutputFileBase()+".xml"; |