From 21587da40824d8609575284f0ee0fac90c972f27 Mon Sep 17 00:00:00 2001 From: dimitri Date: Sun, 24 Mar 2002 20:06:51 +0000 Subject: Release-1.2.14-20020324 --- INSTALL | 4 +- README | 4 +- VERSION | 2 +- addon/doxmlparser/include/doxmlintf.h | 7 +- addon/doxmlparser/src/compoundhandler.cpp | 12 ++- addon/doxmlparser/src/compoundhandler.h | 2 + addon/doxmlparser/src/doxmlintf.h | 7 +- addon/doxmlparser/src/graphhandler.cpp | 110 ++++++++++++++++++++++ addon/doxmlparser/src/graphhandler.h | 43 ++++++++- addon/doxmlparser/src/mainhandler.cpp | 3 + doc/config.doc | 9 ++ doc/index.doc | 5 +- doc/language.doc | 2 +- doc/starting.doc | 7 +- packages/rpm/doxygen.spec | 2 +- src/classdef.cpp | 35 ++++--- src/classlist.cpp | 4 +- src/code.l | 35 +++++-- src/config.l | 8 ++ src/definition.cpp | 11 ++- src/diagram.cpp | 6 +- src/doc.l | 6 +- src/doxygen.cpp | 65 ++++++------- src/filedef.cpp | 4 +- src/index.cpp | 50 +++++++--- src/memberdef.cpp | 10 +- src/namespacedef.cpp | 27 +++++- src/namespacedef.h | 1 + src/scanner.l | 40 ++++++-- src/util.cpp | 147 +++++++++++++++++------------- 30 files changed, 493 insertions(+), 175 deletions(-) diff --git a/INSTALL b/INSTALL index 83f9df6..e5d74a4 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ -DOXYGEN Version 1.2.14-20020317 +DOXYGEN Version 1.2.14-20020324 Please read the installation section of the manual for instructions. -------- -Dimitri van Heesch (17 March 2002) +Dimitri van Heesch (24 March 2002) diff --git a/README b/README index b29c29b..8cc3937 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -DOXYGEN Version 1.2.14_20020317 +DOXYGEN Version 1.2.14_20020324 Please read INSTALL for compilation instructions. @@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives. Enjoy, -Dimitri van Heesch (dimitri@stack.nl) (17 March 2002) +Dimitri van Heesch (dimitri@stack.nl) (24 March 2002) diff --git a/VERSION b/VERSION index aec6593..2bcee3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.14-20020317 +1.2.14-20020324 diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 89e567d..880df30 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -391,7 +391,7 @@ class IDocIterator class IEdgeLabel { public: - virtual QString label() = 0; + virtual QString label() const = 0; }; class IEdgeLabelIterator @@ -409,10 +409,11 @@ class IChildNode { public: enum NodeRelation { PublicInheritance, ProtectedInheritance, - PrivateInheritance, Usage, TemplateInstace + PrivateInheritance, Usage, TemplateInstance }; virtual QString id() const = 0; virtual NodeRelation relation() const = 0; + virtual QString relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; }; @@ -551,6 +552,8 @@ class ICompound virtual ISectionIterator *sections() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; + virtual IGraph *inheritanceGraph() const = 0; + virtual IGraph *collaborationGraph() const = 0; /*! Returns an interface to a member given its id. * @param id The member id. diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index caca36b..2873da5 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -98,7 +98,7 @@ void compoundhandler_exit() CompoundHandler::CompoundHandler(const QString &xmlDir) : m_brief(0), m_detailed(0), m_programListing(0), m_xmlDir(xmlDir), m_refCount(1), m_memberDict(257), m_memberNameDict(257), - m_mainHandler(0) + m_mainHandler(0), m_inheritanceGraph(0), m_collaborationGraph(0) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); @@ -311,3 +311,13 @@ IMember *CompoundHandler::memberById(const QString &id) const return m_memberDict[id]; } +IGraph *CompoundHandler::inheritanceGraph() const +{ + return m_inheritanceGraph; +} + +IGraph *CompoundHandler::collaborationGraph() const +{ + return m_collaborationGraph; +} + diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 1639487..c90b466 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -60,6 +60,8 @@ class CompoundHandler : public ICompound, public BaseHandler ISectionIterator *sections() const; IDocRoot *briefDescription() const; IDocRoot *detailedDescription() const; + IGraph *inheritanceGraph() const; + IGraph *collaborationGraph() const; IMember *memberById(const QString &id) const; IMemberIterator *memberByName(const QString &name) const; void release(); diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 89e567d..880df30 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -391,7 +391,7 @@ class IDocIterator class IEdgeLabel { public: - virtual QString label() = 0; + virtual QString label() const = 0; }; class IEdgeLabelIterator @@ -409,10 +409,11 @@ class IChildNode { public: enum NodeRelation { PublicInheritance, ProtectedInheritance, - PrivateInheritance, Usage, TemplateInstace + PrivateInheritance, Usage, TemplateInstance }; virtual QString id() const = 0; virtual NodeRelation relation() const = 0; + virtual QString relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; }; @@ -551,6 +552,8 @@ class ICompound virtual ISectionIterator *sections() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; + virtual IGraph *inheritanceGraph() const = 0; + virtual IGraph *collaborationGraph() const = 0; /*! Returns an interface to a member given its id. * @param id The member id. diff --git a/addon/doxmlparser/src/graphhandler.cpp b/addon/doxmlparser/src/graphhandler.cpp index 9c822de..0e47f10 100644 --- a/addon/doxmlparser/src/graphhandler.cpp +++ b/addon/doxmlparser/src/graphhandler.cpp @@ -1,5 +1,38 @@ #include "graphhandler.h" +class EdgeRelationMapper +{ + public: + EdgeRelationMapper() + { + m_map.insert("public-inheritance", IChildNode::PublicInheritance); + m_map.insert("protected-inheritance", IChildNode::ProtectedInheritance); + m_map.insert("private-inheritance", IChildNode::PrivateInheritance); + m_map.insert("usage", IChildNode::Usage); + m_map.insert("template-instance", IChildNode::TemplateInstance); + } + IChildNode::NodeRelation stringToNodeRelation(const QString &nrStr) + { + return m_map[nrStr]; + } + private: + QMap m_map; +}; + +static EdgeRelationMapper *s_edgeRelationMapper; + +void graphhandler_init() +{ + s_edgeRelationMapper = new EdgeRelationMapper; +} + +void graphhandler_exit() +{ + delete s_edgeRelationMapper; +} + +//------------------------------------------------------------------------ + GraphHandler::GraphHandler(IBaseHandler *parent,const char *endTag) : m_parent(parent) { @@ -44,6 +77,8 @@ NodeHandler::NodeHandler(IBaseHandler *parent) addEndHandler("link",this,&NodeHandler::endLink); addStartHandler("label",this,&NodeHandler::startLabel); addEndHandler("label",this,&NodeHandler::endLabel); + addStartHandler("childnode",this,&NodeHandler::startChildNode); + m_children.setAutoDelete(TRUE); } NodeHandler::~NodeHandler() @@ -80,6 +115,81 @@ void NodeHandler::endLabel() m_label = m_curString; } +void NodeHandler::startChildNode(const QXmlAttributes &attrib) +{ + ChildNodeHandler *cnh = new ChildNodeHandler(this); + cnh->startChildNode(attrib); + m_children.append(cnh); +} + +IChildNodeIterator *NodeHandler::children() const +{ + return new ChildNodeIterator(*this); +} + +//------------------------------------------------------------------------ + +ChildNodeHandler::ChildNodeHandler(IBaseHandler *parent) + : m_parent(parent) +{ + addStartHandler("edgelabel",this,&ChildNodeHandler::startEdgeLabel); + m_edgeLabels.setAutoDelete(TRUE); +} + +ChildNodeHandler::~ChildNodeHandler() +{ +} + +void ChildNodeHandler::startChildNode(const QXmlAttributes &attrib) +{ + m_id = attrib.value("id"); + m_relationString = attrib.value("relation"); + m_relation = s_edgeRelationMapper->stringToNodeRelation(m_relationString); + m_parent->setDelegate(this); +} + +void ChildNodeHandler::endChildNode() +{ + m_parent->setDelegate(0); +} + + +void ChildNodeHandler::startEdgeLabel(const QXmlAttributes &attrib) +{ + EdgeLabelHandler *elh = new EdgeLabelHandler(this); + elh->startEdgeLabel(attrib); + m_edgeLabels.append(elh); +} + +IEdgeLabelIterator *ChildNodeHandler::edgeLabels() const +{ + return new EdgeLabelIterator(*this); +} + + +//----------------------------------------------------------------------- + +EdgeLabelHandler::EdgeLabelHandler(IBaseHandler *parent) + : m_parent(parent) +{ +} + +EdgeLabelHandler::~EdgeLabelHandler() +{ +} + +void EdgeLabelHandler::startEdgeLabel(const QXmlAttributes &) +{ + m_parent->setDelegate(this); + m_curString=""; +} + +void EdgeLabelHandler::endEdgeLabel() +{ + m_label=m_curString; + m_parent->setDelegate(0); +} + diff --git a/addon/doxmlparser/src/graphhandler.h b/addon/doxmlparser/src/graphhandler.h index 47222d1..d9e0ae4 100644 --- a/addon/doxmlparser/src/graphhandler.h +++ b/addon/doxmlparser/src/graphhandler.h @@ -22,6 +22,7 @@ class NodeHandler; class ChildNodeHandler; +class EdgeLabelHandler; class GraphHandler : public IGraph, public BaseHandler { @@ -57,12 +58,13 @@ class NodeHandler : public INode, public BaseHandler void endLabel(); void startLink(const QXmlAttributes &attrib); void endLink(); + void startChildNode(const QXmlAttributes &attrib); // INode virtual QString id() const { return m_id; } virtual QString label() const { return m_label; } virtual QString linkId() const { return m_link; } - virtual IChildNodeIterator *children() const { return 0; } // TODO: implement + virtual IChildNodeIterator *children() const; private: IBaseHandler *m_parent; @@ -83,19 +85,27 @@ class NodeIterator : public BaseIterator class ChildNodeHandler : public IChildNode, public BaseHandler { + friend class EdgeLabelIterator; public: ChildNodeHandler(IBaseHandler *parent); virtual ~ChildNodeHandler(); void startChildNode(const QXmlAttributes &attrib); void endChildNode(); + void startEdgeLabel(const QXmlAttributes &attrib); // IChildNode virtual QString id() const { return m_id; } + virtual NodeRelation relation() const { return m_relation; } + virtual QString relationString() const { return m_relationString; } + virtual IEdgeLabelIterator *edgeLabels() const; private: IBaseHandler *m_parent; - QString m_id; + QString m_id; + NodeRelation m_relation; + QString m_relationString; + QList m_edgeLabels; }; class ChildNodeIterator : public BaseIterator @@ -105,6 +115,35 @@ class ChildNodeIterator : public BaseIterator(handler.m_children) {} }; +//---------------------------------------------------------------------- + +class EdgeLabelHandler : public IEdgeLabel, public BaseHandler +{ + friend class EdgeLabelIterator; + public: + EdgeLabelHandler(IBaseHandler *parent); + virtual ~EdgeLabelHandler(); + + void startEdgeLabel(const QXmlAttributes &attrib); + void endEdgeLabel(); + + // IEdgeLabel + virtual QString label() const { return m_label; } + + private: + IBaseHandler *m_parent; + QString m_label; +}; + +class EdgeLabelIterator : public BaseIterator +{ + public: + EdgeLabelIterator(const ChildNodeHandler &handler) : + BaseIterator(handler.m_edgeLabels) {} +}; + +void graphhandler_init(); +void graphhandler_exit(); #endif diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 98249ee..aa54cda 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -17,6 +17,7 @@ #include "mainhandler.h" #include "compoundhandler.h" #include "sectionhandler.h" +#include "graphhandler.h" #include "debug.h" class ErrorHandler : public QXmlErrorHandler @@ -256,6 +257,7 @@ IDoxygen *createObjectModel() sectionhandler_init(); memberhandler_init(); dochandler_init(); + graphhandler_init(); return new MainHandler; } @@ -267,6 +269,7 @@ void MainHandler::release() { debug(1,"Compound %s not released\n",ch->name().data()); } + graphhandler_exit(); dochandler_exit(); memberhandler_exit(); sectionhandler_exit(); diff --git a/doc/config.doc b/doc/config.doc index 3b36cd5..d85a7c9 100644 --- a/doc/config.doc +++ b/doc/config.doc @@ -155,6 +155,7 @@ followed by the descriptions of the tags grouped by category.
  • \refitem cfg_max_dot_graph_width MAX_DOT_GRAPH_WIDTH
  • \refitem cfg_max_initializer_lines MAX_INITIALIZER_LINES
  • \refitem cfg_optimize_output_for_c OPTIMIZE_OUTPUT_FOR_C +
  • \refitem cfg_optimize_output_java OPTIMIZE_OUTPUT_JAVA
  • \refitem cfg_output_directory OUTPUT_DIRECTORY
  • \refitem cfg_output_language OUTPUT_LANGUAGE
  • \refitem cfg_paper_type PAPER_TYPE @@ -498,6 +499,14 @@ followed by the descriptions of the tags grouped by category. for C. For instance some of the names that are used will be different. The list of all members will be omitted, etc. +\anchor cfg_optimize_output_java +
    \c OPTIMIZE_OUTPUT_JAVA
    + \addindex OPTIMIZE_OUTPUT_JAVA + Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources + only. Doxygen will then generate output that is more tailored for Java. + For instance namespaces will be presented as packages, qualified scopes + will look different, etc. + \anchor cfg_show_used_files
    \c SHOW_USED_FILES
    \addindex SHOW_USED_FILES diff --git a/doc/index.doc b/doc/index.doc index ca2d9b5..1c44e69 100644 --- a/doc/index.doc +++ b/doc/index.doc @@ -178,8 +178,9 @@ Thanks go to:
  • Ken Wong for providing the HTML tree view code.
  • Petr Prikryl for coordinating the internationalisation support. All language maintainers for providing translations into many languages. -
  • Erik Jan Lingen of Habanera for - donating money. +
  • Erik Jan Lingen of Habanera, Mark + Roddy, Paul Schwartz, Charles Duffy, and Vadym Voznyuk + for donating money.
  • The Comms group of Symbian for donating an ultra cool trCompoundReference(name(),m_compType,outerTempArgList!=0)); + parseText(ol,theTranslator->trCompoundReference(displayName(),m_compType,outerTempArgList!=0)); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),name()); @@ -844,11 +844,11 @@ void ClassDef::writeDocumentation(OutputList &ol) } Doxygen::tagFile << ">" << convertToXML(cd->name()) << "" << endl; } - ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()+bcd->templSpecifiers); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()+bcd->templSpecifiers); } else { - ol.docify(cd->name()); + ol.docify(cd->displayName()); } } else @@ -879,11 +879,11 @@ void ClassDef::writeDocumentation(OutputList &ol) ClassDef *cd=bcd->classDef; if (cd->isLinkable()) { - ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } else { - ol.docify(cd->name()); + ol.docify(cd->displayName()); } writeInheritanceSpecifier(ol,bcd); } @@ -945,9 +945,9 @@ void ClassDef::writeDocumentation(OutputList &ol) ClassDiagram diagram(this); // create a diagram of this class. ol.startClassDiagram(); ol.disable(OutputGenerator::Man); - parseText(ol,theTranslator->trClassDiagram(name())); + parseText(ol,theTranslator->trClassDiagram(displayName())); ol.enable(OutputGenerator::Man); - ol.endClassDiagram(diagram,getOutputFileBase(),name()); + ol.endClassDiagram(diagram,getOutputFileBase(),displayName()); } if (Config_getBool("HAVE_DOT") && Config_getBool("COLLABORATION_GRAPH")) @@ -958,7 +958,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.startDotGraph(); - parseText(ol,theTranslator->trCollaborationDiagram(name())); + parseText(ol,theTranslator->trCollaborationDiagram(displayName())); ol.endDotGraph(usageImplGraph); if (Config_getBool("GENERATE_LEGEND")) { @@ -1251,10 +1251,10 @@ void ClassDef::writeMemberList(OutputList &ol) startFile(ol,m_memListFileName,m_memListFileName, theTranslator->trMemberList()); startTitle(ol,0); - parseText(ol,name()+" "+theTranslator->trMemberList()); + parseText(ol,displayName()+" "+theTranslator->trMemberList()); endTitle(ol,0,0); parseText(ol,theTranslator->trThisIsTheListOfAllMembers()); - ol.writeObjectLink(getReference(),getOutputFileBase(),0,name()); + ol.writeObjectLink(getReference(),getOutputFileBase(),0,displayName()); parseText(ol,theTranslator->trIncludingInheritedMembers()); //ol.startItemList(); @@ -1328,12 +1328,12 @@ void ClassDef::writeMemberList(OutputList &ol) parseText(ol,theTranslator->trDefinedIn()+" "); if (cd->isLinkable()) { - ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); } else { ol.startBold(); - ol.docify(cd->name()); + ol.docify(cd->displayName()); ol.endBold(); } ol.writeString(")"); @@ -1344,7 +1344,7 @@ void ClassDef::writeMemberList(OutputList &ol) { ol.writeString(""); ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), - 0,cd->name()); + 0,cd->displayName()); ol.writeString(""); ol.writeString(""); } @@ -2383,7 +2383,14 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( scName = d->qualifiedName(); } } - if (!scName.isEmpty()) scName+="::"; + + QCString scopeSeparator; + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + scopeSeparator="."; + else + scopeSeparator="::"; + + if (!scName.isEmpty()) scName+=scopeSeparator; scName+=localName(); ArgumentList *al=0; bool isSpecialization = localName().find('<')!=-1; diff --git a/src/classlist.cpp b/src/classlist.cpp index f28281c..04664ef 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -104,13 +104,13 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f ol.writeObjectLink(cd->getReference(), cd->getOutputFileBase(), 0, - cd->name() + cd->localName() ); } else { ol.startBold(); - ol.docify(cd->name()); + ol.docify(cd->localName()); ol.endBold(); } ol.endMemberItem(FALSE); diff --git a/src/code.l b/src/code.l index adabd5a..57bbff1 100644 --- a/src/code.l +++ b/src/code.l @@ -623,10 +623,11 @@ static void generateClassOrGlobalLink(OutputDocInterface &ol,char *clName,int *c if (!g_theVarContext.findVariable(className)) // not a local variable { - cd = getResolvedClass(g_currentDefinition,className); + Definition *d = g_currentDefinition; + cd = getResolvedClass(d,className); if (cd==0 && (i=className.find('<'))!=-1) { - cd=getResolvedClass(g_currentDefinition,className.left(i)); + cd=getResolvedClass(d,className.left(i)); } } if (cd && cd->isLinkable()) // is it a linkable class @@ -976,9 +977,9 @@ SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" SCOPETNAME ((({ID}{TEMPLIST}?){BN}*"::"{BN}*)*)((~{BN}*)?{ID}) SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*"::"{BN}*)+ -KEYWORD ("asm"|"auto"|"class"|"const"|"const_cast"|"delete"|"dynamic_cast"|"enum"|"explicit"|"extern"|"false"|"friend"|"inline"|"mutable"|"namespace"|"new"|"operator"|"private"|"protected"|"public"|"register"|"reinterpret_cast"|"sizeof"|"static"|"static_cast"|"struct"|"template"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile") -FLOWKW ("break"|"case"|"catch"|"continue"|"default"|"do"|"else"|"for"|"goto"|"if"|"return"|"switch"|"throw"|"try"|"while") -TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned"|"void"|"wchar_t") +KEYWORD ("asm"|"auto"|"class"|"const"|"const_cast"|"delete"|"dynamic_cast"|"enum"|"explicit"|"extern"|"false"|"friend"|"inline"|"mutable"|"namespace"|"new"|"operator"|"private"|"protected"|"public"|"register"|"reinterpret_cast"|"sizeof"|"static"|"static_cast"|"struct"|"template"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient") +FLOWKW ("break"|"case"|"catch"|"continue"|"default"|"do"|"else"|"for"|"goto"|"if"|"return"|"switch"|"throw"|"throws"|"try"|"while") +TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"boolean") %option noyywrap @@ -994,6 +995,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" %x MemberCall2 %x SkipInits %x ClassName +%x PackageName %x ClassVar %x Bases %x SkipSharp @@ -1012,10 +1014,15 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" startFontClass("keyword"); codifyLines(yytext); endFontClass(); - //g_code->codify(yytext); if (!g_insideTemplate) BEGIN( ClassName ); } +("package")[ \t\n]+ { + startFontClass("keyword"); + codifyLines(yytext); + endFontClass(); + BEGIN( PackageName ); + } [^\n\"\>]+/(">"|"\"") { //FileInfo *f; bool ambig; @@ -1108,10 +1115,24 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" generateClassOrGlobalLink(*g_code,yytext); BEGIN( ClassVar ); } +{ID}("."{ID})* { + g_curClassName=yytext; + g_curClassName=substitute(g_curClassName,".","::"); + //printf("found package: %s\n",g_curClassName.data()); + addType(); + codifyLines(yytext); + } "=" { unput(*yytext); BEGIN( Body ); } +("extends"|"implements") { // Java + startFontClass("keyword"); + codifyLines(yytext); + endFontClass(); + g_curClassBases.clear(); + BEGIN( Bases ); + } {ID} { g_type = g_curClassName.copy(); g_name = yytext; @@ -1123,6 +1144,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" g_curClassBases.clear(); BEGIN( Bases ); } +[ \t]*";" | [ \t]*"{"[ \t]* { g_theVarContext.pushScope(); g_code->codify(yytext); @@ -1138,6 +1160,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" { g_scopeStack.push(SCOPEBLOCK); pushScope(g_curClassName); + //printf("***** g_curClassName=%s\n",g_curClassName.data()); //CodeClassDef *cd=new CodeClassDef(g_ccd); //g_codeClassDict.insert(cd->name,cd); if (getResolvedClass(g_currentDefinition,g_curClassName)==0) diff --git a/src/config.l b/src/config.l index 62f2382..4c81fca 100644 --- a/src/config.l +++ b/src/config.l @@ -1565,6 +1565,14 @@ void Config::create() FALSE ); cb = addBool( + "OPTIMIZE_OUTPUT_JAVA", + "Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources \n" + "only. Doxygen will then generate output that is more tailored for Java. \n" + "For instance namespaces will be presented as packages, qualified scopes \n" + "will look different, etc. \n", + FALSE + ); + cb = addBool( "SHOW_USED_FILES", "Set the SHOW_USED_FILES tag to NO to disable the list of files generated \n" "at the bottom of the documentation of classes and structs. If set to YES the \n" diff --git a/src/definition.cpp b/src/definition.cpp index 8800f81..08ddf6f 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -388,7 +388,14 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),scope.data(),scopeName); if (!scope.isEmpty() && scope!=scopeName) { - name.prepend(scope+"::"); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + name.prepend(scope+"."); + } + else + { + name.prepend(scope+"::"); + } } Definition *d = md->getOuterScope(); if (d==Doxygen::globalScope) d=md->getBodyDef(); @@ -429,7 +436,7 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, { ol.docify(name); } - if (md->isFunction() && md->isSlot()) ol.docify("()"); + if (md->isFunction() || md->isSlot() || md->isPrototype() || md->isSignal()) ol.docify("()"); } index=newIndex+matchLen; } diff --git a/src/diagram.cpp b/src/diagram.cpp index 9df2bf5..3e9eb33 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -167,7 +167,7 @@ static void writeMapArea(QTextStream &t,ClassDef *cd,int x,int y,int w,int h) if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/"; } t << cd->getOutputFileBase() << htmlFileExtension << "\" "; - t << "alt=\"" << cd->name(); + t << "alt=\"" << cd->displayName(); t << "\" shape=\"rect\" coords=\"" << x << "," << y << ","; t << (x+w) << "," << (y+h) << "\">" << endl; } @@ -199,11 +199,11 @@ QCString DiagramItem::label() const QCString result; if (!templSpec.isEmpty()) { - result=insertTemplateSpecifierInScope(classDef->name(),templSpec); + result=insertTemplateSpecifierInScope(classDef->displayName(),templSpec); } else { - result=classDef->name(); + result=classDef->displayName(); } if (Config_getBool("HIDE_SCOPE_NAMES")) result=stripScope(result); return result; diff --git a/src/doc.l b/src/doc.l index b6469a7..bafc73f 100644 --- a/src/doc.l +++ b/src/doc.l @@ -2485,7 +2485,7 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) outDoc->startEmphasis(); if (!insideHtmlLink) { - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,TRUE); } else { @@ -2524,7 +2524,7 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) outDoc->startBold(); if (!insideHtmlLink) { - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,TRUE); } else { @@ -2563,7 +2563,7 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) outDoc->startTypewriter(); if (!insideHtmlLink) { - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,TRUE); } else { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index dc688b1..b3ea9ae 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -440,13 +440,14 @@ static bool addNamespace(Entry *root,ClassDef *cd) if (e->section==Entry::NAMESPACE_SEC) { NamespaceDef *nd=0; - //printf("addNameSpace() trying: %s\n",e->name.data()); QCString nsName = stripAnonymousNamespaceScope(e->name); + //printf("addNameSpace() trying: %s\n",nsName.data()); if (!nsName.isEmpty() && nsName.at(0)!='@' && (nd=getResolvedNamespace(nsName)) ) { cd->setNamespace(nd); + cd->setOuterScope(nd); nd->insertClass(cd); return TRUE; } @@ -1080,18 +1081,25 @@ static MemberDef *addVariableToClass( Entry *root, ClassDef *cd, MemberDef::MemberType mtype, - const QCString &scope, + /*const QCString &scope,*/ const QCString &name, bool fromAnnScope, int indentDepth, MemberDef *fromAnnMemb, Protection prot) { + QCString qualScope = cd->qualifiedNameWithTemplateParameters(); + QCString scopeSeparator="::"; + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + qualScope = substitute(qualScope,"::","."); + scopeSeparator="."; + } Debug::print(Debug::Variables,0, " class variable:\n" " %s' %s'::`%s' `%s' prot=`%d ann=%d init=%s\n", root->type.data(), - scope.data(), + qualScope.data(), name.data(), root->args.data(), root->protection, @@ -1099,20 +1107,6 @@ static MemberDef *addVariableToClass( root->initializer.data() ); - // class friends may be templatized - //QCString name=n; - //int i; - //if (root->type.left(7)=="friend " && (i=name.find('<'))!=-1) - //{ - // name=name.left(i); - //} - - // add template names, if the class is a non-specialized template - //if (scope.find('<')==-1 && cd->templateArguments()) - //{ - // scope+=cd->getTemplateNameString(); - //} - // generate member definition. QCString def; if (!root->type.isEmpty()) { @@ -1122,7 +1116,7 @@ static MemberDef *addVariableToClass( } else { - def=root->type+" "+scope+"::"+name+root->args; + def=root->type+" "+qualScope+scopeSeparator+name+root->args; } } else @@ -1133,7 +1127,7 @@ static MemberDef *addVariableToClass( } else { - def=scope+"::"+name+root->args; + def=qualScope+scopeSeparator+name+root->args; } } if (def.left(7)=="static ") def=def.right(def.length()-7); @@ -1510,7 +1504,7 @@ void buildVarList(Entry *root) cd=getClass(scope); if (cd) { - addVariableToClass(root,cd,MemberDef::Friend,scope, + addVariableToClass(root,cd,MemberDef::Friend,/*scope,*/ root->name,FALSE,0,0,Public); } } @@ -1563,7 +1557,7 @@ void buildVarList(Entry *root) if (!pScope.isEmpty() && (pcd=getClass(pScope))) { //Protection p = (Protection)QMAX((int)root->protection,(int)cd->protection()); - md=addVariableToClass(root,pcd,mtype,pScope,name,TRUE,indentDepth,0,root->protection); + md=addVariableToClass(root,pcd,mtype,/*pScope,*/name,TRUE,indentDepth,0,root->protection); } else // annonymous scope inside namespace or file => put variable in the global scope { @@ -1573,7 +1567,7 @@ void buildVarList(Entry *root) } } } - addVariableToClass(root,cd,mtype,scope,name,FALSE,indentDepth,md,root->protection); + addVariableToClass(root,cd,mtype,/*scope,*/name,FALSE,indentDepth,md,root->protection); } else if (!name.isEmpty()) // global variable { @@ -1607,8 +1601,8 @@ nextMember: // Searches the Entry tree for Function sections. // If found they are stored in their class or in the global list. -void addNewMemberToClass(Entry *root,ClassDef *cd, - const QCString &rname,const QCString &scope,bool isFriend) +void addMethodToClass(Entry *root,ClassDef *cd, + const QCString &rname,/*const QCString &scope,*/bool isFriend) { int l,i; static QRegExp re("([a-z_A-Z0-9: ]*[ *]*[ ]*"); @@ -1658,6 +1652,13 @@ void addNewMemberToClass(Entry *root,ClassDef *cd, //md->setScopeTemplateArguments(root->tArgList); md->addSectionsToDefinition(root->anchors); QCString def; + QCString qualScope = cd->qualifiedNameWithTemplateParameters(); + QCString scopeSeparator="::"; + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + qualScope = substitute(qualScope,"::","."); + scopeSeparator="."; + } if (!root->relates.isEmpty() || isFriend || Config_getBool("HIDE_SCOPE_NAMES")) { if (!root->type.isEmpty()) @@ -1685,27 +1686,26 @@ void addNewMemberToClass(Entry *root,ClassDef *cd, } else { - QCString qualScope = cd->qualifiedNameWithTemplateParameters(); if (!root->type.isEmpty()) { if (root->argList) { - def=root->type+" "+qualScope+"::"+name; + def=root->type+" "+qualScope+scopeSeparator+name; } else { - def=root->type+" "+qualScope+"::"+name+root->args; + def=root->type+" "+qualScope+scopeSeparator+name+root->args; } } else { if (root->argList) { - def=qualScope+"::"+name; + def=qualScope+scopeSeparator+name; } else { - def=qualScope+"::"+name+root->args; + def=qualScope+scopeSeparator+name+root->args; } } } @@ -1717,7 +1717,7 @@ void addNewMemberToClass(Entry *root,ClassDef *cd, " `%s' `%s'::`%s' `%s' proto=%d\n" " def=`%s'\n", root->type.data(), - scope.data(), + qualScope.data(), rname.data(), root->args.data(), root->proto, @@ -1815,7 +1815,7 @@ static void buildFunctionList(Entry *root) ) ) { - addNewMemberToClass(root,cd,rname,scope,isFriend); + addMethodToClass(root,cd,rname,/*scope,*/isFriend); } else if (root->parent && !(root->parent->section & Entry::COMPOUND_MASK) && @@ -4125,7 +4125,7 @@ static void findMember(Entry *root, // for which there is only a definition, no declaration in // the class. TODO: we should actually check whether // the arguments match! - addNewMemberToClass(root,cd,md->name(),cd->name(),isFriend); + addMethodToClass(root,cd,md->name(),/*cd->name(),*/isFriend); return; } candidates++; @@ -5157,6 +5157,7 @@ static void generateClassList(ClassSDict &classSDict) { ClassDef *cd=cli.current(); + //printf("cd=%s getOuterScope=%p global=%p\n",cd->name().data(),cd->getOuterScope(),Doxygen::globalScope); if (cd->getOuterScope()==0 || // <-- should not happen, but can if we read an old tag file cd->getOuterScope()==Doxygen::globalScope // only look at global classes ) diff --git a/src/filedef.cpp b/src/filedef.cpp index fe5c70b..4c669e6 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -291,7 +291,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.writeObjectLink(nd->getReference(), nd->getOutputFileBase(), 0, - nd->name() + nd->displayName() ); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { @@ -301,7 +301,7 @@ void FileDef::writeDocumentation(OutputList &ol) else { ol.startBold(); - ol.docify(nd->name()); + ol.docify(nd->displayName()); ol.endBold(); } ol.endMemberItem(FALSE); diff --git a/src/index.cpp b/src/index.cpp index b07200d..2720545 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -190,13 +190,13 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) parseText(ol,theTranslator->trMainPage()); ol.endQuickIndexItem(); - if (documentedPackages>0) - { - if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"packages"+htmlFileExtension); - parseText(ol,theTranslator->trPackages()); - ol.endQuickIndexItem(); - } + //if (documentedPackages>0) + //{ + // if (!compact) ol.writeListItem(); + // ol.startQuickIndexItem(extLink,"packages"+htmlFileExtension); + // parseText(ol,theTranslator->trPackages()); + // ol.endQuickIndexItem(); + //} if (documentedGroups>0) { if (!compact) ol.writeListItem(); @@ -208,7 +208,14 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"namespaces"+htmlFileExtension); - parseText(ol,theTranslator->trNamespaceList()); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + parseText(ol,theTranslator->trPackages()); + } + else + { + parseText(ol,theTranslator->trNamespaceList()); + } ol.endQuickIndexItem(); } if (hierarchyClasses>0) @@ -1054,9 +1061,18 @@ void writeNamespaceIndex(OutputList &ol) if (documentedNamespaces==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"namespaces",0,"Namespace Index"); + QCString title; + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + startFile(ol,"namespaces",0,"Package Index"); + title = theTranslator->trPackageList(); + } + else + { + startFile(ol,"namespaces",0,"Namespace Index"); + title = theTranslator->trNamespaceList(); + } startTitle(ol,0); - QCString title = theTranslator->trNamespaceList(); QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); @@ -1081,7 +1097,14 @@ void writeNamespaceIndex(OutputList &ol) ftvHelp->incContentsDepth(); } //ol.newParagraph(); - parseText(ol,theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL"))); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + parseText(ol,theTranslator->trPackageListDescription()); + } + else + { + parseText(ol,theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL"))); + } //ol.newParagraph(); ol.endTextBlock(); @@ -1100,7 +1123,7 @@ void writeNamespaceIndex(OutputList &ol) } //ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name()); ol.startIndexKey(); - ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->name()); + ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->displayName()); ol.endIndexKey(); bool hasBrief = !nd->briefDescription().isEmpty(); ol.startIndexValue(hasBrief); @@ -1110,7 +1133,7 @@ void writeNamespaceIndex(OutputList &ol) parseDoc(ol, nd->getDefFileName(),nd->getDefLine(), nd->name(),0, - abbreviate(nd->briefDescription(),nd->name())); + abbreviate(nd->briefDescription(),nd->displayName())); //ol.docify(")"); } ol.endIndexValue(nd->getOutputFileBase(),hasBrief); @@ -1206,6 +1229,7 @@ void writeAnnotatedClassList(OutputList &ol) //---------------------------------------------------------------------------- +// OBSOLETE void writePackageList(OutputList &ol) { bool &generateHtml = Config_getBool("GENERATE_HTML") ; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index dfcea4a..7adc450 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1343,7 +1343,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, Definition *bd=bmd->group; if (bd==0) bd=bcd; ol.writeObjectLink(bd->getReference(),bd->getOutputFileBase(), - bmd->anchor(),bcd->name()); + bmd->anchor(),bcd->displayName()); //ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), // bmd->anchor(),bcd->name()); @@ -1355,7 +1355,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, else { ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), - 0,bcd->name()); + 0,bcd->displayName()); if (bcd->isLinkableInProject()/* && !Config_getBool("PDF_HYPERLINKS")*/ ) { writePageRef(ol,bcd->getOutputFileBase(),0); @@ -1437,7 +1437,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (bmd->group) bd=bmd->group; else bd=bcd; ol.writeObjectLink(bd->getReference(),bd->getOutputFileBase(), - bmd->anchor(),bcd->name()); + bmd->anchor(),bcd->displayName()); if (bd->isLinkableInProject() ) { @@ -1569,8 +1569,8 @@ bool MemberDef::visibleMemberGroup(bool hideNoHeader) QCString MemberDef::getScopeString() const { QCString result; - if (getClassDef()) result=getClassDef()->name(); - else if (getNamespaceDef()) result=getNamespaceDef()->name(); + if (getClassDef()) result=getClassDef()->displayName(); + else if (getNamespaceDef()) result=getNamespaceDef()->displayName(); return result; } diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 96affc7..3a98438 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -176,9 +176,16 @@ void NamespaceDef::writeDocumentation(OutputList &ol) startFile(ol,getOutputFileBase(),name(),pageTitle); startTitle(ol,getOutputFileBase()); //ol.docify(pageTitle); - parseText(ol,theTranslator->trNamespaceReference(name())); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + parseText(ol,theTranslator->trPackage(displayName())); + } + else + { + parseText(ol,theTranslator->trNamespaceReference(displayName())); + } addGroupListToTitle(ol,this); - endTitle(ol,getOutputFileBase(),name()); + endTitle(ol,getOutputFileBase(),displayName()); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { @@ -327,10 +334,10 @@ QCString NamespaceDef::getOutputFileBase() const return convertNameToFile(fileName); } -Definition *NamespaceDef::findInnerCompound(const char *name) +Definition *NamespaceDef::findInnerCompound(const char *n) { - if (name==0) return 0; - return m_innerCompounds->find(name); + if (n==0) return 0; + return m_innerCompounds->find(n); } void NamespaceDef::addInnerCompound(Definition *d) @@ -358,3 +365,13 @@ void NamespaceDef::addListReferences() docVarMembers.addListReferences(this); } +QCString NamespaceDef::displayName() const +{ + QCString result=name(); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + result = substitute(result,"::","."); + } + return result; +} + diff --git a/src/namespacedef.h b/src/namespacedef.h index 5ee62ed..5df8fa6 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -55,6 +55,7 @@ class NamespaceDef : public Definition NamespaceList *getUsedNamespaces() const { return usingDirList; } void addUsingDeclaration(ClassDef *cd); ClassList *getUsedClasses() const { return usingDeclList; } + QCString displayName() const; bool isLinkableInProject() const { diff --git a/src/scanner.l b/src/scanner.l index ab08498..049dc9b 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -753,15 +753,32 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) {B}*"package"{BN}+ { // Java package lineCount(); BEGIN(PackageName); + } {ID}("."{ID})* { - current->name = yytext; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->section=Entry::PACKAGE_SEC; + //current->name = yytext; + //current->fileName = yyFileName; + //current->startLine = yyLineNr; + //current->section=Entry::PACKAGE_SEC; + //current_root->addSubEntry(current); + //current = new Entry ; + //initEntry(); + + isTypedef=FALSE; + current->name = yytext; + current->name = substitute(current->name,".","::"); + current->section = Entry::NAMESPACE_SEC; + current->type = "namespace" ; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + lineCount(); + curlyCount=0; current_root->addSubEntry(current); - current = new Entry ; + current_root = current ; + current = new Entry ; initEntry(); + BEGIN( FindMembers ) ; } ";" { BEGIN(FindMembers); @@ -2222,6 +2239,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) . { current->args += *yytext; } {BN}*"try"{BN}+ { /* try-function-block */ insideTryBlock=TRUE; + lineCount(); } {BN}*"throw"{BN}*"(" { // C++ style throw clause current->exception = " throw (" ; @@ -2255,8 +2273,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) "{" { unput('{'); BEGIN( FuncQual ); } +";" { + unput(';'); BEGIN( FuncQual ); + } "\n" { current->exception += ' '; + yyLineNr++; } . { current->exception += *yytext; @@ -2579,7 +2601,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } BEGIN( FindMembers ); } -{B}*"{"{B}* { current->fileName = yyFileName ; +{B}*"{"{B}* { + current->fileName = yyFileName ; current->startLine = yyLineNr ; current->name = removeRedundantWhiteSpace(current->name); if (current->name.isEmpty() && !isTypedef) // anonymous compound @@ -4244,7 +4267,10 @@ static void parseCompounds(Entry *rt) // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class { - current->protection = protection = Private ; + if (ce->fileName.right(5)==".java") + current->protection = protection = Public ; // Actually this should be package scope! + else + current->protection = protection = Private ; } else if (ce->section == Entry::ENUM_SEC ) // enum { diff --git a/src/util.cpp b/src/util.cpp index c99b1bd..d15cbff 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -453,86 +453,105 @@ ClassDef *getResolvedClass( QCString *pTemplSpec ) { - //printf("getResolvedClass(%s,%s)\n",scope ? scope->name().data() : "", n); QCString name = n; - if (name.isEmpty()) return 0; if (scope==0) scope=Doxygen::globalScope; - int i = name.findRev("::"); - QCString subst; - if (i!=-1) - { - subst = resolveTypeDef(scope,name.right(name.length()-i-2)); - } - else - { - subst = resolveTypeDef(scope,name); - } - //printf(" typedef subst=`%s'\n",subst.data()); - - if (!subst.isEmpty()) - { - // 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 (name.isEmpty()) return 0; + int index = name.findRev("::"); + ClassDef *cd=0; - if (pIsTypeDef) *pIsTypeDef=TRUE; - //printf(" getResolvedClass `%s'->`%s'\n",name.data(),subst.data()); - if (subst==name) // avoid resolving typedef struct foo foo; + do + { + //fprintf(stderr,"getResolvedClass(%s,%s)\n",scope ? scope->name().data() : "", n); + QCString subst; + if (index!=-1) { - return Doxygen::classSDict.find(name); + subst = resolveTypeDef(scope,name.right(name.length()-index-2)); } - int count=0; // recursion detection guard - QCString newSubst; - QCString typeName = subst; - - if (i!=-1) typeName.prepend(name.left(i)+"::"); - while (!(newSubst=resolveTypeDef(scope,typeName)).isEmpty() - && count<10) + else + { + subst = resolveTypeDef(scope,name); + } + //printf(" typedef subst=`%s'\n",subst.data()); + + if (!subst.isEmpty()) { - if (typeName==newSubst) - { - ClassDef *cd = Doxygen::classSDict.find(subst); // for breaking typedef struct A A; - //printf(" getClass: exit `%s' %p\n",subst.data(),cd); - return cd; - } - subst=newSubst; // strip * and & from n int ip=subst.length()-1; - while (ip>=0 && subst.at(ip)=='*' || subst.at(ip)=='&' || subst.at(ip)==' ') ip--; + while (ip>=0 && (subst.at(ip)=='*' || subst.at(ip)=='&' || subst.at(ip)==' ')) ip--; subst=subst.left(ip+1); - //printf(" getResolvedClass `%s'->`%s'\n",name.data(),subst.data()); - typeName=newSubst; - if (i!=-1) typeName.prepend(name.left(i)+"::"); - count++; - } - if (count==10) - { - warn_cont("Warning: possible recursive typedef dependency detected for %s!\n",n); - return Doxygen::classSDict.find(name); - } - else - { - int i; - ClassDef *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 + if (pIsTypeDef) *pIsTypeDef=TRUE; + if (subst==name) // avoid resolving typedef struct foo foo; { - if (pTemplSpec) *pTemplSpec = typeName.right(typeName.length()-i); - return Doxygen::classSDict.find(typeName.left(i)); + cd = Doxygen::classSDict.find(name); + if (cd) goto found; } else { - return cd; + int count=0; // recursion detection guard + QCString newSubst; + QCString typeName = subst; + + if (index!=-1) typeName.prepend(name.left(index)+"::"); + while (!(newSubst=resolveTypeDef(scope,typeName)).isEmpty() + && count<10) + { + if (typeName==newSubst) + { + cd = Doxygen::classSDict.find(subst); // for breaking typedef struct A A; + //printf(" getClass: exit `%s' %p\n",subst.data(),cd); + if (cd) goto found; + break; + } + subst=newSubst; + // 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); + //printf(" getResolvedClass `%s'->`%s'\n",name.data(),subst.data()); + + typeName=newSubst; + if (index!=-1) typeName.prepend(name.left(index)+"::"); + count++; + } + if (count==10) + { + warn_cont("Warning: possible recursive typedef dependency detected for %s!\n",n); + cd = Doxygen::classSDict.find(name); + if (cd) goto found; + } + else + { + int i; + 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 + { + if (pTemplSpec) *pTemplSpec = typeName.right(typeName.length()-i); + cd = Doxygen::classSDict.find(typeName.left(i)); + } + if (cd) goto found; + } } } - } - else - { - if (pIsTypeDef) *pIsTypeDef=FALSE; - return Doxygen::classSDict.find(name); - } + else + { + if (pIsTypeDef) *pIsTypeDef=FALSE; + if (scope!=Doxygen::globalScope) + cd = Doxygen::classSDict.find(scope->name()+"::"+name); + else + cd = Doxygen::classSDict.find(name); + if (cd) goto found; + } + + if (scope==Doxygen::globalScope) scope=0; + else if (scope) scope=scope->getOuterScope(); + //fprintf(stderr,"scope=%p\n",scope); + } while (scope); + +found: + //fprintf(stderr, "getResolvedClass()=%s\n",cd?cd->name().data():""); + return cd; } static bool findOperator(const QCString &s,int i) -- cgit v0.12