diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-08-09 08:29:54 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-08-09 08:29:54 (GMT) |
commit | f1ddf16acd015f8cf9ffc1fbf5719e8c764150e2 (patch) | |
tree | a09074ed1c9a5c1efb292f69db4f9bbb3a97cb19 | |
parent | 3a7dcb4cbc953fcf5ab62243743707e5e0e3d379 (diff) | |
download | Doxygen-f1ddf16acd015f8cf9ffc1fbf5719e8c764150e2.zip Doxygen-f1ddf16acd015f8cf9ffc1fbf5719e8c764150e2.tar.gz Doxygen-f1ddf16acd015f8cf9ffc1fbf5719e8c764150e2.tar.bz2 |
Release-1.4.7-20060809
60 files changed, 3291 insertions, 1852 deletions
@@ -1,7 +1,7 @@ -DOXYGEN Version 1.4.7-20060716 +DOXYGEN Version 1.4.7-20060809 Please read the installation section of the manual (http://www.doxygen.org/install.html) for instructions. -------- -Dimitri van Heesch (16 July 2006) +Dimitri van Heesch (09 August 2006) diff --git a/Makefile.in b/Makefile.in index 719cc00..7b8ffee 100644 --- a/Makefile.in +++ b/Makefile.in @@ -24,6 +24,7 @@ distclean: clean cd addon/doxmlparser/src ; $(MAKE) distclean cd addon/doxmlparser/test ; $(MAKE) distclean cd addon/doxmlparser/examples/metrics ; $(MAKE) distclean + cd addon/doxyapp ; $(MAKE) distclean -rm -f lib/lib* -rm -f bin/doxy* -rm -f html @@ -1,4 +1,4 @@ -DOXYGEN Version 1.4.7_20060716 +DOXYGEN Version 1.4.7_20060809 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) (16 July 2006) +Dimitri van Heesch (dimitri@stack.nl) (09 August 2006) diff --git a/addon/doxyapp/Makefile.in b/addon/doxyapp/Makefile.in new file mode 100644 index 0000000..835f406 --- /dev/null +++ b/addon/doxyapp/Makefile.in @@ -0,0 +1,17 @@ + +all clean depend: Makefile.doxyapp + $(MAKE) -f Makefile.doxyapp $@ + +distclean: clean + $(RM) -rf Makefile doxyapp.pro Makefile.doxyapp + +tmake: + $(ENV) $(PERL) $(TMAKE) doxyapp.pro >Makefile.doxyapp + +strip: + strip doxyapp + +Makefile.doxyapp: doxyapp.pro + $(ENV) $(PERL) $(TMAKE) doxyapp.pro >Makefile.doxyapp + +install: diff --git a/addon/doxyapp/README b/addon/doxyapp/README new file mode 100644 index 0000000..f92e106 --- /dev/null +++ b/addon/doxyapp/README @@ -0,0 +1,8 @@ +This directory contains an example of how to use doxygen as +an "source parsing engine" in an application. It shows how to configure doxygen +from the application and shows how to run doxygen without generating output, +and then uses the information about the symbols found in the source code. + +Note that if you use this approach your application should be licensed under the GPL. + + diff --git a/addon/doxyapp/doxyapp.cpp b/addon/doxyapp/doxyapp.cpp new file mode 100644 index 0000000..75be1f1 --- /dev/null +++ b/addon/doxyapp/doxyapp.cpp @@ -0,0 +1,309 @@ +/****************************************************************************** + * + * 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. + * + */ + +/** @file + * @brief Example of how to use doxygen as part of another GPL applications + * + * This example shows how to configure and run doxygen programmatically from + * within an application without generating the usual output. + * The example should work on any Unix like OS (including Linux and Mac OS X). + * + * This example shows how to use to code parser to get cross-references information + * and it also shows how to look up symbols in a program parsed by doxygen and + * show some information about it. + */ + +#include </usr/include/unistd.h> // ugly hack to get the right unistd.h (doxygen has one too) +#include "doxygen.h" +#include "outputgen.h" +#include "parserintf.h" + +class XRefDummyCodeGenerator : public CodeOutputInterface +{ + public: + XRefDummyCodeGenerator(FileDef *fd) : m_fd(fd) {} + ~XRefDummyCodeGenerator() {} + + // these are just null functions, they can be used to produce a syntax highlighted + // and cross-linked version of the source code, but who needs that anyway ;-) + void codify(const char *) {} + void writeCodeLink(const char *,const char *,const char *,const char *) {} + void startCodeLine() {} + void endCodeLine() {} + void startCodeAnchor(const char *) {} + void endCodeAnchor() {} + void startFontClass(const char *) {} + void endFontClass() {} + void writeCodeAnchor(const char *) {} + void writeLineNumber(const char *,const char *,const char *,int) {} + + // here we are presented with the symbols found by the code parser + void linkableSymbol(int l, const char *sym,Definition *symDef,Definition *context) + { + QCString ctx; + if (context) // the context of the symbol is known + { + if (context->definitionType()==Definition::TypeMember) // it is inside a member + { + Definition *parentContext = context->getOuterScope(); + if (parentContext && parentContext->definitionType()==Definition::TypeClass) + // it is inside a member of a class + { + ctx.sprintf("inside %s %s of %s %s", + ((MemberDef *)context)->memberTypeName().data(), + context->name().data(), + ((ClassDef*)parentContext)->compoundTypeString().data(), + parentContext->name().data()); + } + else if (parentContext==Doxygen::globalScope) // it is inside a global member + { + ctx.sprintf("inside %s %s", + ((MemberDef *)context)->memberTypeName().data(), + context->name().data()); + } + } + if (ctx.isEmpty()) // it is something else (class, or namespace member, ...) + { + ctx.sprintf("in %s",context->name().data()); + } + } + printf("Found symbol %s at line %d of %s %s\n", + sym,l,m_fd->getDefFileName().data(),ctx.data()); + if (symDef && context) // in this case the definition of the symbol is + // known to doxygen. + { + printf("-> defined at line %d of %s\n", + symDef->getDefLine(),symDef->getDefFileName().data()); + } + } + private: + FileDef *m_fd; +}; + +static void findXRefSymbols(FileDef *fd) +{ + // get the interface to a parser that matches the file extension + ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension()); + + // reset the parsers state + pIntf->resetCodeParserState(); + + // create a new backend object + XRefDummyCodeGenerator *xrefGen = new XRefDummyCodeGenerator(fd); + + // parse the source code + pIntf->parseCode(*xrefGen, + 0, + fileToString(fd->absFilePath()), + FALSE, + 0, + fd); + + // dismiss the object. + delete xrefGen; +} + +static void listSymbol(Definition *d) +{ + if (d!=Doxygen::globalScope && // skip the global namespace symbol + d->name().at(0)!='@' // skip anonymous stuff + ) + { + printf("%s\n", + d->name().data()); + } +} + +static void listSymbols() +{ + QDictIterator<DefinitionIntf> sli(*Doxygen::symbolMap); + DefinitionIntf *di; + for (sli.toFirst();(di=sli.current());++sli) + { + if (di->definitionType()==DefinitionIntf::TypeSymbolList) // list of symbols + // with same name + { + DefinitionListIterator dli(*(DefinitionList*)di); + Definition *d; + // for each symbol + for (dli.toFirst();(d=dli.current());++dli) + { + listSymbol(d); + } + } + else // single symbol + { + listSymbol((Definition*)di); + } + } +} + +static void lookupSymbol(Definition *d) +{ + if (d!=Doxygen::globalScope && // skip the global namespace symbol + d->name().at(0)!='@' // skip anonymous stuff + ) + { + printf("Symbol info\n"); + printf("-----------\n"); + printf("Name: %s\n",d->name().data()); + printf("File: %s\n",d->getDefFileName().data()); + printf("Line: %d\n",d->getDefLine()); + // depending on the definition type we can case to the appropriate + // derived to get additional information + switch (d->definitionType()) + { + case Definition::TypeClass: + { + ClassDef *cd = (ClassDef *)d; + printf("Kind: %s\n",cd->compoundTypeString().data()); + } + break; + case Definition::TypeFile: + { + FileDef *fd = (FileDef *)d; + printf("Kind: File: #includes %d other files\n", + fd->includeFileList() ? fd->includeFileList()->count() : 0); + } + break; + case Definition::TypeNamespace: + { + NamespaceDef *nd = (NamespaceDef *)d; + printf("Kind: Namespace: contains %d classes and %d namespaces\n", + nd->getClassSDict() ? nd->getClassSDict()->count() : 0, + nd->getNamespaceSDict() ? nd->getNamespaceSDict()->count() : 0); + } + break; + case Definition::TypeMember: + { + MemberDef *md = (MemberDef *)d; + printf("Kind: %s\n",md->memberTypeName().data()); + } + break; + default: + // ignore groups/pages/packages/dirs for now + break; + } + } +} + +static void lookupSymbols(const QCString &sym) +{ + if (!sym.isEmpty()) + { + DefinitionIntf *di = Doxygen::symbolMap->find(sym); + if (di) + { + if (di->definitionType()==DefinitionIntf::TypeSymbolList) + { + DefinitionListIterator dli(*(DefinitionList*)di); + Definition *d; + // for each symbol with the given name + for (dli.toFirst();(d=dli.current());++dli) + { + lookupSymbol(d); + } + } + else + { + lookupSymbol((Definition*)di); + } + } + else + { + printf("Unknown symbol\n"); + } + } +} + +int main(int argc,char **argv) +{ + char cmd[256]; + + if (argc<2) + { + printf("Usage: %s [source_file | source_dir]\n",argv[0]); + exit(1); + } + + // initialize data structures + initDoxygen(); + + // setup the non-default configuration options + + // we need a place to put intermediate files + Config_getString("OUTPUT_DIRECTORY")="/tmp/doxygen"; + // disable html output + Config_getBool("GENERATE_HTML")=FALSE; + // disable latex output + Config_getBool("GENERATE_LATEX")=FALSE; + // be quiet + Config_getBool("QUIET")=TRUE; + // turn off warnings + Config_getBool("WARNINGS")=FALSE; + Config_getBool("WARN_IF_UNDOCUMENTED")=FALSE; + Config_getBool("WARN_IF_DOC_ERROR")=FALSE; + // Extract as much as possible + Config_getBool("EXTRACT_ALL")=TRUE; + Config_getBool("EXTRACT_STATIC")=TRUE; + Config_getBool("EXTRACT_PRIVATE")=TRUE; + Config_getBool("EXTRACT_LOCAL_METHODS")=TRUE; + // Extract source browse information, needed + // to make doxygen gather the cross reference info + Config_getBool("SOURCE_BROWSER")=TRUE; + + // set the input + Config_getList("INPUT").append(argv[1]); + + // check and finialize the configuration + checkConfiguration(); + + // parse the files + parseInput(); + + // iterate over the input files + FileNameListIterator fnli(Doxygen::inputNameList); + FileName *fn; + // foreach file with a certain name + for (fnli.toFirst();(fn=fnli.current());++fnli) + { + FileNameIterator fni(*fn); + FileDef *fd; + // for each file definition + for (;(fd=fni.current());++fni) + { + // get the references (linked and unlinked) found in this file + findXRefSymbols(fd); + } + } + + // clean up after us + rmdir("/tmp/doxygen"); + + while (1) + { + printf("> Type a symbol name or\n> .list for a list of symbols or\n> .quit to exit\n> "); + fgets(cmd,256,stdin); + QCString s(cmd); + if (s.at(s.length()-1)=='\n') s=s.left(s.length()-1); // strip trailing \n + if (s==".list") + listSymbols(); + else if (s==".quit") + exit(0); + else + lookupSymbols(s); + } +} + diff --git a/addon/doxyapp/doxyapp.pro.in b/addon/doxyapp/doxyapp.pro.in new file mode 100644 index 0000000..68fea3d --- /dev/null +++ b/addon/doxyapp/doxyapp.pro.in @@ -0,0 +1,12 @@ +TEMPLATE = app.t +CONFIG = console warn_on debug +HEADERS = +SOURCES = doxyapp.cpp +LIBS += -L../../lib -L../../lib -ldoxygen -lqtools -lmd5 -ldoxycfg -lpng +DESTDIR = +OBJECTS_DIR = ../../objects +TARGET = ../../bin/doxyapp +INCLUDEPATH += ../../qtools ../../src +DEPENDPATH += ../../src +TARGETDEPS = ../../lib/libdoxygen.a + diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index 099792b..d10ff05 100644 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -47,6 +47,7 @@ QCString getResourcePath() return result; } +#if 0 #define GRAPHVIZ_PATH "/Applications/Graphviz.app" #define DOT_PATH GRAPHVIZ_PATH "/Contents/MacOS" #define DOT_LOCATION DOT_PATH "/dot" @@ -73,6 +74,12 @@ void setDotPath() //Config_getBool("HAVE_DOT")=TRUE; } } +#endif + +void setDotPath() +{ + Config_getString("DOT_PATH")=getResourcePath(); +} #endif @@ -512,7 +519,12 @@ Step4::Step4(QWidget *parent) : QWidget(parent,"Step4") dotGroup->setButton(0); m_dotOptions->setEnabled(FALSE); gbox->addWidget(w,4,0); + +#if defined(Q_OS_MACX) // we bundle dot with the mac package + m_diagramMode->setButton(2); +#else m_diagramMode->setButton(1); +#endif layout->addWidget(m_diagramMode); layout->addStretch(1); @@ -678,6 +690,7 @@ MainWidget::MainWidget(QWidget *parent) // initialize config settings Config::instance()->init(); Config::instance()->check(); + Config_getBool("HAVE_DOT")=TRUE; #if defined(Q_OS_MACX) setDotPath(); #endif @@ -887,8 +900,8 @@ void MainWidget::launchWizard() // -------- Initialize the dialog ---------------- // step1 - wizard.setProjectName(Config_getString("PROJECT_NAME")); - wizard.setProjectNumber(Config_getString("PROJECT_NUMBER")); + wizard.setProjectName(QString::fromLocal8Bit(Config_getString("PROJECT_NAME"))); + wizard.setProjectNumber(QString::fromLocal8Bit(Config_getString("PROJECT_NUMBER"))); if (Config_getList("INPUT").count()>0) { QString dirName=Config_getList("INPUT").getFirst(); @@ -899,7 +912,7 @@ void MainWidget::launchWizard() } } wizard.setRecursiveScan(Config_getBool("RECURSIVE")); - wizard.setDestinationDir(Config_getString("OUTPUT_DIRECTORY")); + wizard.setDestinationDir(QString::fromLocal8Bit(Config_getString("OUTPUT_DIRECTORY"))); // step2 wizard.setExtractAll(Config_getBool("EXTRACT_ALL")); @@ -979,12 +992,12 @@ void MainWidget::launchWizard() // -------- Store the results ---------------- // step1 - Config_getString("PROJECT_NAME")=wizard.getProjectName(); + Config_getString("PROJECT_NAME")=wizard.getProjectName().local8Bit(); Config_getString("PROJECT_NUMBER")=wizard.getProjectNumber(); Config_getList("INPUT").clear(); Config_getList("INPUT").append(wizard.getSourceDir()); Config_getBool("RECURSIVE")=wizard.scanRecursively(); - Config_getString("OUTPUT_DIRECTORY")=wizard.getDestinationDir(); + Config_getString("OUTPUT_DIRECTORY")=wizard.getDestinationDir().local8Bit(); // step2 if (wizard.extractAll()) @@ -1125,7 +1138,7 @@ void MainWidget::loadConfigFromFile(const QString &fn) else { Config::instance()->convertStrToVal(); -#if defined(Q_OS_MACX) +#if 0 //defined(Q_OS_MACX) if (checkIfDotInstalled() && qstricmp(Config_getString("DOT_PATH"),DOT_PATH)!=0 ) @@ -1163,9 +1176,9 @@ void MainWidget::launchExpert() Expert expert(this); expert.init(); expert.exec(); -#if defined(Q_OS_MACX) - setDotPath(); -#endif +//#if defined(Q_OS_MACX) +// setDotPath(); +//#endif if (expert.hasChanged()) setConfigSaved(FALSE); } diff --git a/addon/doxywizard/input.h b/addon/doxywizard/input.h index ab9bcf5..9f23e17 100644 --- a/addon/doxywizard/input.h +++ b/addon/doxywizard/input.h @@ -6,6 +6,7 @@ class QObject; class IInput { public: + virtual ~IInput() {} virtual void init() = 0; virtual void setEnabled(bool) = 0; virtual QObject *qobject() = 0; @@ -20,7 +20,7 @@ doxygen_version_minor=4 doxygen_version_revision=7 #NOTE: Setting version_mmn to "NO" will omit mmn info from the package. -doxygen_version_mmn=20060716 +doxygen_version_mmn=20060809 bin_dirs=`echo $PATH | sed -e "s/:/ /g"` @@ -34,6 +34,7 @@ f_prefix=/usr/local f_insttool=NO f_english=NO f_wizard=NO +f_app=NO f_thread=NO f_langs=nl,se,cz,fr,id,it,de,jp,je,es,fi,ru,hr,pl,pt,hu,kr,ke,ro,si,cn,no,br,dk,sk,ua,gr,tw,sr,ca,lt,za,ar,fa @@ -81,6 +82,9 @@ while test -n "$1"; do --with-doxywizard | -with-doxywizard) f_wizard=YES ;; + --with-doxyapp | -with-doxyapp) + f_app=YES + ;; -h | -help | --help) f_help=y ;; @@ -521,7 +525,7 @@ TMAKE_CXXFLAGS += -DENGLISH_ONLY EOF fi -f_inmakefiles="Makefile.in qtools/Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/doxywizard/Makefile.in addon/doxmlparser/src/Makefile.in addon/doxmlparser/test/Makefile.in addon/doxmlparser/examples/metrics/Makefile.in libpng/Makefile.in libmd5/Makefile.in" +f_inmakefiles="Makefile.in qtools/Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/doxywizard/Makefile.in addon/doxmlparser/src/Makefile.in addon/doxmlparser/test/Makefile.in addon/doxmlparser/examples/metrics/Makefile.in libpng/Makefile.in libmd5/Makefile.in addon/doxyapp/Makefile.in" for i in $f_inmakefiles ; do SRC=$i @@ -544,6 +548,9 @@ EOF if test $f_wizard = YES; then echo " \$(MAKE) -C addon/doxywizard" >> $DST fi + if test $f_app = YES; then + echo " \$(MAKE) -C addon/doxyapp" >> $DST + fi echo "" >> $DST echo "doxywizard_install:" >> $DST if test $f_wizard = YES; then @@ -555,7 +562,7 @@ EOF echo " Created $DST from $SRC..." done -f_inprofiles="qtools/qtools.pro.in src/libdoxygen.pro.in src/libdoxycfg.pro.in src/doxygen.pro.in src/doxytag.pro.in addon/doxywizard/doxywizard.pro.in addon/doxmlparser/src/doxmlparser.pro.in addon/doxmlparser/test/xmlparse.pro.in addon/doxmlparser/examples/metrics/metrics.pro.in libpng/libpng.pro.in libmd5/libmd5.pro.in" +f_inprofiles="qtools/qtools.pro.in src/libdoxygen.pro.in src/libdoxycfg.pro.in src/doxygen.pro.in src/doxytag.pro.in addon/doxywizard/doxywizard.pro.in addon/doxmlparser/src/doxmlparser.pro.in addon/doxmlparser/test/xmlparse.pro.in addon/doxmlparser/examples/metrics/metrics.pro.in libpng/libpng.pro.in libmd5/libmd5.pro.in addon/doxyapp/doxyapp.pro.in" for i in $f_inprofiles ; do SRC=$i diff --git a/src/classdef.cpp b/src/classdef.cpp index e484748..a753940 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -37,6 +37,12 @@ #include "docparser.h" #include "searchindex.h" +//static inline MemberList *createNewMemberList(MemberList::ListType lt) +//{ +// MemberList *result = new MemberList(lt); +// return result; +//} + // constructs a new class definition ClassDef::ClassDef( @@ -98,6 +104,8 @@ ClassDef::ClassDef( m_isLocal=FALSE; } + +#if 0 pubMethods=0; proMethods=0; pacMethods=0; @@ -137,6 +145,7 @@ ClassDef::ClassDef( variableMembers=0; propertyMembers=0; eventMembers=0; +#endif } @@ -157,6 +166,48 @@ 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 } QCString ClassDef::getMemberListFileName() const @@ -217,35 +268,15 @@ void ClassDef::insertSubClass(ClassDef *cd,Protection p, void ClassDef::addMembersToMemberGroup() { - ::addMembersToMemberGroup(pubTypes,&memberGroupSDict,this); - ::addMembersToMemberGroup(pubMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(pubAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(pubSlots,&memberGroupSDict,this); - ::addMembersToMemberGroup(signals,&memberGroupSDict,this); - ::addMembersToMemberGroup(dcopMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(pubStaticMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(pubStaticAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(pacTypes,&memberGroupSDict,this); - ::addMembersToMemberGroup(pacMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(pacAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(pacStaticMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(pacStaticAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(proTypes,&memberGroupSDict,this); - ::addMembersToMemberGroup(proMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(proAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(proSlots,&memberGroupSDict,this); - ::addMembersToMemberGroup(proStaticMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(proStaticAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(priTypes,&memberGroupSDict,this); - ::addMembersToMemberGroup(priMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(priAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(priSlots,&memberGroupSDict,this); - ::addMembersToMemberGroup(priStaticMethods,&memberGroupSDict,this); - ::addMembersToMemberGroup(priStaticAttribs,&memberGroupSDict,this); - ::addMembersToMemberGroup(friends,&memberGroupSDict,this); - ::addMembersToMemberGroup(related,&memberGroupSDict,this); - ::addMembersToMemberGroup(properties,&memberGroupSDict,this); - ::addMembersToMemberGroup(events,&memberGroupSDict,this); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::detailedLists)==0) + { + ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + } + } // add members inside sections to their groups if (memberGroupSDict) @@ -272,93 +303,47 @@ void ClassDef::internalInsertMember(MemberDef *md, //printf("adding %s::%s\n",name().data(),md->name().data()); if (!isReference()) { - static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); + static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); + /********************************************/ /* insert member in the declaration section */ /********************************************/ - if (md->isRelated() && - (Config_getBool("EXTRACT_PRIVATE") || prot!=Private)) + if (md->isRelated() && (extractPrivate || prot!=Private)) { - if (related==0) related = new MemberList; - if (sortBriefDocs) - related->inSort(md); - else - related->append(md); - md->setSectionList(this,related); + addMemberToList(MemberList::related,md); } else if (md->isFriend()) { - if (friends==0) friends = new MemberList; - if (sortBriefDocs) - friends->inSort(md); - else - friends->append(md); - md->setSectionList(this,friends); + addMemberToList(MemberList::friends,md); } else { switch (md->memberType()) { case MemberDef::Signal: // Qt specific - if (signals==0) signals = new MemberList; - if (sortBriefDocs) - signals->inSort(md); - else - signals->append(md); - md->setSectionList(this,signals); + addMemberToList(MemberList::signals,md); break; case MemberDef::DCOP: // KDE2 specific - if (dcopMethods==0) dcopMethods = new MemberList; - if (sortBriefDocs) - dcopMethods->inSort(md); - else - dcopMethods->append(md); - md->setSectionList(this,dcopMethods); + addMemberToList(MemberList::dcopMethods,md); break; case MemberDef::Property: - if (properties==0) properties = new MemberList; - if (sortBriefDocs) - properties->inSort(md); - else - properties->append(md); - md->setSectionList(this,properties); + addMemberToList(MemberList::properties,md); break; case MemberDef::Event: - if (events==0) events = new MemberList; - if (sortBriefDocs) - events->inSort(md); - else - events->append(md); - md->setSectionList(this,events); + addMemberToList(MemberList::events,md); break; case MemberDef::Slot: // Qt specific switch (prot) { case Protected: case Package: // slots in packages are not possible! - if (proSlots==0) proSlots = new MemberList; - if (sortBriefDocs) - proSlots->inSort(md); - else - proSlots->append(md); - md->setSectionList(this,proSlots); - break; + addMemberToList(MemberList::proSlots,md); break; case Public: - if (pubSlots==0) pubSlots = new MemberList; - if (sortBriefDocs) - pubSlots->inSort(md); - else - pubSlots->append(md); - md->setSectionList(this,pubSlots); + addMemberToList(MemberList::pubSlots,md); break; case Private: - if (priSlots==0) priSlots = new MemberList; - if (sortBriefDocs) - priSlots->inSort(md); - else - priSlots->append(md); - md->setSectionList(this,priSlots); + addMemberToList(MemberList::priSlots,md); break; } break; @@ -370,36 +355,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - if (proStaticAttribs==0) proStaticAttribs= new MemberList; - if (sortBriefDocs) - proStaticAttribs->inSort(md); - else - proStaticAttribs->append(md); - md->setSectionList(this,proStaticAttribs); + addMemberToList(MemberList::proStaticAttribs,md); break; case Package: - if (pacStaticAttribs==0) pacStaticAttribs= new MemberList; - if (sortBriefDocs) - pacStaticAttribs->inSort(md); - else - pacStaticAttribs->append(md); - md->setSectionList(this,pacStaticAttribs); + addMemberToList(MemberList::pacStaticAttribs,md); break; case Public: - if (pubStaticAttribs==0) pubStaticAttribs= new MemberList; - if (sortBriefDocs) - pubStaticAttribs->inSort(md); - else - pubStaticAttribs->append(md); - md->setSectionList(this,pubStaticAttribs); + addMemberToList(MemberList::pubStaticAttribs,md); break; case Private: - if (priStaticAttribs==0) priStaticAttribs= new MemberList; - if (sortBriefDocs) - priStaticAttribs->inSort(md); - else - priStaticAttribs->append(md); - md->setSectionList(this,priStaticAttribs); + addMemberToList(MemberList::priStaticAttribs,md); break; } } @@ -408,36 +373,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - if (proStaticMethods==0) proStaticMethods = new MemberList; - if (sortBriefDocs) - proStaticMethods->inSort(md); - else - proStaticMethods->append(md); - md->setSectionList(this,proStaticMethods); + addMemberToList(MemberList::proStaticMethods,md); break; case Package: - if (pacStaticMethods==0) pacStaticMethods = new MemberList; - if (sortBriefDocs) - pacStaticMethods->inSort(md); - else - pacStaticMethods->append(md); - md->setSectionList(this,pacStaticMethods); + addMemberToList(MemberList::pacStaticMethods,md); break; case Public: - if (pubStaticMethods==0) pubStaticMethods = new MemberList; - if (sortBriefDocs) - pubStaticMethods->inSort(md); - else - pubStaticMethods->append(md); - md->setSectionList(this,pubStaticMethods); + addMemberToList(MemberList::pubStaticMethods,md); break; case Private: - if (priStaticMethods==0) priStaticMethods = new MemberList; - if (sortBriefDocs) - priStaticMethods->inSort(md); - else - priStaticMethods->append(md); - md->setSectionList(this,priStaticMethods); + addMemberToList(MemberList::priStaticMethods,md); break; } } @@ -449,36 +394,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - if (proAttribs==0) proAttribs = new MemberList; - if (sortBriefDocs) - proAttribs->inSort(md); - else - proAttribs->append(md); - md->setSectionList(this,proAttribs); + addMemberToList(MemberList::proAttribs,md); break; case Package: - if (pacAttribs==0) pacAttribs = new MemberList; - if (sortBriefDocs) - pacAttribs->inSort(md); - else - pacAttribs->append(md); - md->setSectionList(this,pacAttribs); + addMemberToList(MemberList::pacAttribs,md); break; case Public: - if (pubAttribs==0) pubAttribs = new MemberList; - if (sortBriefDocs) - pubAttribs->inSort(md); - else - pubAttribs->append(md); - md->setSectionList(this,pubAttribs); + addMemberToList(MemberList::pubAttribs,md); break; case Private: - if (priAttribs==0) priAttribs = new MemberList; - if (sortBriefDocs) - priAttribs->inSort(md); - else - priAttribs->append(md); - md->setSectionList(this,priAttribs); + addMemberToList(MemberList::priAttribs,md); break; } } @@ -487,36 +412,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - if (proTypes==0) proTypes = new MemberList; - if (sortBriefDocs) - proTypes->inSort(md); - else - proTypes->append(md); - md->setSectionList(this,proTypes); + addMemberToList(MemberList::proTypes,md); break; case Package: - if (pacTypes==0) pacTypes = new MemberList; - if (sortBriefDocs) - pacTypes->inSort(md); - else - pacTypes->append(md); - md->setSectionList(this,pacTypes); + addMemberToList(MemberList::pacTypes,md); break; case Public: - if (pubTypes==0) pubTypes = new MemberList; - if (sortBriefDocs) - pubTypes->inSort(md); - else - pubTypes->append(md); - md->setSectionList(this,pubTypes); + addMemberToList(MemberList::pubTypes,md); break; case Private: - if (priTypes==0) priTypes = new MemberList; - if (sortBriefDocs) - priTypes->inSort(md); - else - priTypes->append(md); - md->setSectionList(this,priTypes); + addMemberToList(MemberList::priTypes,md); break; } } @@ -525,36 +430,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - if (proMethods==0) proMethods = new MemberList; - if (sortBriefDocs) - proMethods->inSort(md); - else - proMethods->append(md); - md->setSectionList(this,proMethods); + addMemberToList(MemberList::proMethods,md); break; case Package: - if (pacMethods==0) pacMethods = new MemberList; - if (sortBriefDocs) - pacMethods->inSort(md); - else - pacMethods->append(md); - md->setSectionList(this,pacMethods); + addMemberToList(MemberList::pacMethods,md); break; case Public: - if (pubMethods==0) pubMethods = new MemberList; - if (sortBriefDocs) - pubMethods->inSort(md); - else - pubMethods->append(md); - md->setSectionList(this,pubMethods); + addMemberToList(MemberList::pubMethods,md); break; case Private: - if (priMethods==0) priMethods = new MemberList; - if (sortBriefDocs) - priMethods->inSort(md); - else - priMethods->append(md); - md->setSectionList(this,priMethods); + addMemberToList(MemberList::priMethods,md); break; } } @@ -566,42 +451,23 @@ void ClassDef::internalInsertMember(MemberDef *md, /*******************************************************/ /* insert member in the detailed documentation section */ /*******************************************************/ - if ((md->isRelated() && - (Config_getBool("EXTRACT_PRIVATE") || prot!=Private) - ) || md->isFriend() - ) - { - if (relatedMembers==0) relatedMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - relatedMembers->inSort(md); - else - relatedMembers->append(md); + if ((md->isRelated() && (extractPrivate || prot!=Private)) || md->isFriend()) + { + addMemberToList(MemberList::relatedMembers,md); } else { switch (md->memberType()) { case MemberDef::Property: - if (propertyMembers==0) propertyMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - propertyMembers->inSort(md); - else - propertyMembers->append(md); + addMemberToList(MemberList::propertyMembers,md); break; case MemberDef::Event: - if (eventMembers==0) eventMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - eventMembers->inSort(md); - else - eventMembers->append(md); + addMemberToList(MemberList::eventMembers,md); break; case MemberDef::Signal: // fall through case MemberDef::DCOP: - if (functionMembers==0) functionMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - functionMembers->inSort(md); - else - functionMembers->append(md); + addMemberToList(MemberList::functionMembers,md); break; case MemberDef::Slot: switch (prot) @@ -609,71 +475,44 @@ void ClassDef::internalInsertMember(MemberDef *md, case Protected: case Package: case Public: - if (functionMembers==0) functionMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - functionMembers->inSort(md); - else - functionMembers->append(md); + addMemberToList(MemberList::functionMembers,md); break; case Private: - if (functionMembers==0) functionMembers = new MemberList; - if (Config_getBool("EXTRACT_PRIVATE")) + if (extractPrivate) { - if (Config_getBool("SORT_MEMBER_DOCS")) - functionMembers->inSort(md); - else - functionMembers->append(md); + addMemberToList(MemberList::functionMembers,md); } break; } break; default: // any of the other members - if (prot!=Private || Config_getBool("EXTRACT_PRIVATE")) + if (prot!=Private || extractPrivate) { switch (md->memberType()) { case MemberDef::Typedef: - if (typedefMembers==0) typedefMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - typedefMembers->inSort(md); - else - typedefMembers->append(md); + addMemberToList(MemberList::typedefMembers,md); break; case MemberDef::Enumeration: - if (enumMembers==0) enumMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - enumMembers->inSort(md); - else - enumMembers->append(md); + addMemberToList(MemberList::enumMembers,md); break; case MemberDef::EnumValue: - if (enumValMembers==0) enumValMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - enumValMembers->inSort(md); - else - enumValMembers->append(md); + addMemberToList(MemberList::enumValMembers,md); break; case MemberDef::Function: if (md->isConstructor() || md->isDestructor()) { - if (constructors==0) constructors = new MemberList; - constructors->append(md); + MemberList *ml = createMemberList(MemberList::constructors); + ml->append(md); + md->setSectionList(this,ml); } else { - if (functionMembers==0) functionMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - functionMembers->inSort(md); - else - functionMembers->append(md); + addMemberToList(MemberList::functionMembers,md); } break; case MemberDef::Variable: - if (variableMembers==0) variableMembers = new MemberList; - if (Config_getBool("SORT_MEMBER_DOCS")) - variableMembers->inSort(md); - else - variableMembers->append(md); + addMemberToList(MemberList::variableMembers,md); break; default: err("Unexpected member type %d found!\n",md->memberType()); @@ -735,34 +574,18 @@ void ClassDef::insertMember(MemberDef *md) void ClassDef::computeAnchors() { ClassDef *context = Config_getBool("INLINE_INHERITED_MEMB") ? this : 0; - setAnchors(context,'a',pubMethods); - setAnchors(context,'b',proMethods); - setAnchors(context,'c',pacMethods); - setAnchors(context,'d',priMethods); - setAnchors(context,'e',pubStaticMethods); - setAnchors(context,'f',proStaticMethods); - setAnchors(context,'g',pacStaticMethods); - setAnchors(context,'h',priStaticMethods); - setAnchors(context,'i',pubSlots); - setAnchors(context,'j',proSlots); - setAnchors(context,'k',priSlots); - setAnchors(context,'l',signals); - setAnchors(context,'m',related); - setAnchors(context,'n',friends); - setAnchors(context,'o',pubAttribs); - setAnchors(context,'p',proAttribs); - setAnchors(context,'q',pacAttribs); - setAnchors(context,'r',priAttribs); - setAnchors(context,'s',pubStaticAttribs); - setAnchors(context,'t',proStaticAttribs); - setAnchors(context,'u',pacStaticAttribs); - setAnchors(context,'v',priStaticAttribs); - setAnchors(context,'w',pubTypes); - setAnchors(context,'x',proTypes); - setAnchors(context,'y',priTypes); - setAnchors(context,'z',dcopMethods); - setAnchors(context,'0',properties); - setAnchors(context,'1',events); + const char *letters = "abcdefghijklmnopqrstuvwxyz0123456789"; + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + int index = 0; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::detailedLists)==0) + { + setAnchors(context,letters[index++],ml); + } + } + if (memberGroupSDict) { MemberGroupSDict::Iterator mgli(*memberGroupSDict); @@ -799,35 +622,15 @@ void ClassDef::findSectionsInDocumentation() mg->findSectionsInDocumentation(); } } - if (pubTypes) pubTypes->findSectionsInDocumentation(); - if (pubMethods) pubMethods->findSectionsInDocumentation(); - if (pubAttribs) pubAttribs->findSectionsInDocumentation(); - if (pubSlots) pubSlots->findSectionsInDocumentation(); - if (signals) signals->findSectionsInDocumentation(); - if (dcopMethods) dcopMethods->findSectionsInDocumentation(); - if (pubStaticMethods) pubStaticMethods->findSectionsInDocumentation(); - if (pubStaticAttribs) pubStaticAttribs->findSectionsInDocumentation(); - if (pacTypes) pacTypes->findSectionsInDocumentation(); - if (pacMethods) pacMethods->findSectionsInDocumentation(); - if (pacAttribs) pacAttribs->findSectionsInDocumentation(); - if (pacStaticMethods) pacStaticMethods->findSectionsInDocumentation(); - if (pacStaticAttribs) pacStaticAttribs->findSectionsInDocumentation(); - if (proTypes) proTypes->findSectionsInDocumentation(); - if (proMethods) proMethods->findSectionsInDocumentation(); - if (proAttribs) proAttribs->findSectionsInDocumentation(); - if (proSlots) proSlots->findSectionsInDocumentation(); - if (proStaticMethods) proStaticMethods->findSectionsInDocumentation(); - if (proStaticAttribs) proStaticAttribs->findSectionsInDocumentation(); - if (priTypes) priTypes->findSectionsInDocumentation(); - if (priMethods) priMethods->findSectionsInDocumentation(); - if (priAttribs) priAttribs->findSectionsInDocumentation(); - if (priSlots) priSlots->findSectionsInDocumentation(); - if (priStaticMethods) priStaticMethods->findSectionsInDocumentation(); - if (priStaticAttribs) priStaticAttribs->findSectionsInDocumentation(); - if (friends) friends->findSectionsInDocumentation(); - if (related) related->findSectionsInDocumentation(); - if (properties) properties->findSectionsInDocumentation(); - if (events) events->findSectionsInDocumentation(); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::detailedLists)==0) + { + ml->findSectionsInDocumentation(); + } + } } @@ -1502,71 +1305,102 @@ void ClassDef::writeDocumentation(OutputList &ol) } // public types - if (pubTypes) pubTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicTypes(),0); + writeMemberDeclarations(ol,MemberList::pubTypes,theTranslator->trPublicTypes()); + //if (pubTypes) pubTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicTypes(),0); // public methods - if (pubSlots) pubSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicSlots(),0); - if (signals) signals->writeDeclarations(ol,this,0,0,0,theTranslator->trSignals(),0); - if (dcopMethods) dcopMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trDCOPMethods(),0); - if (pubMethods) pubMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicMembers(),0); - if (pubStaticMethods) pubStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicMembers(),0); + 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 - if (pubAttribs) pubAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPublicAttribs(),0); - if (pubStaticAttribs) pubStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicAttribs(),0); + 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 - if (proTypes) proTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedTypes(),0); + writeMemberDeclarations(ol,MemberList::proTypes,theTranslator->trProtectedTypes()); + //if (proTypes) proTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedTypes(),0); // protected methods - if (proSlots) proSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedSlots(),0); - if (proMethods) proMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedMembers(),0); - if (proStaticMethods) proStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedMembers(),0); + 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 - if (proAttribs) proAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedAttribs(),0); - if (proStaticAttribs) proStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedAttribs(),0); + 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 - if (pacTypes) pacTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageTypes(),0); + writeMemberDeclarations(ol,MemberList::pacTypes,theTranslator->trPackageTypes()); + //if (pacTypes) pacTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageTypes(),0); // package methods - if (pacMethods) pacMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageMembers(),0); - if (pacStaticMethods) pacStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPackageMembers(),0); + 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 - if (pacAttribs) pacAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPackageAttribs(),0); - if (pacStaticAttribs) pacStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPackageAttribs(),0); + 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 - if (properties) properties->writeDeclarations(ol,this,0,0,0,theTranslator->trProperties(),0); + writeMemberDeclarations(ol,MemberList::properties,theTranslator->trProperties()); + //if (properties) properties->writeDeclarations(ol,this,0,0,0,theTranslator->trProperties(),0); // events - if (events) events->writeDeclarations(ol,this,0,0,0,theTranslator->trEvents(),0); + 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 - if (priTypes) priTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateTypes(),0); + writeMemberDeclarations(ol,MemberList::priTypes,theTranslator->trPrivateTypes()); + //if (priTypes) priTypes->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateTypes(),0); // private members - if (priSlots) priSlots->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateSlots(),0); - if (priMethods) priMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateMembers(),0); - if (priStaticMethods) priStaticMethods->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateMembers(),0); + 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 - if (priAttribs) priAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateAttribs(),0); - if (priStaticAttribs) priStaticAttribs->writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateAttribs(),0); + 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 - if (friends) friends->writeDeclarations(ol,this,0,0,0,theTranslator->trFriends(),0); + writeMemberDeclarations(ol,MemberList::friends,theTranslator->trFriends()); + //if (friends) friends->writeDeclarations(ol,this,0,0,0,theTranslator->trFriends(),0); // related functions - if (related) related->writeDeclarations(ol,this,0,0,0, - theTranslator->trRelatedFunctions(), - theTranslator->trRelatedSubscript() - ); + writeMemberDeclarations(ol,MemberList::related,theTranslator->trRelatedFunctions(), + theTranslator->trRelatedSubscript() + ); + //if (related) related->writeDeclarations(ol,this,0,0,0, + // theTranslator->trRelatedFunctions(), + // theTranslator->trRelatedSubscript() + // ); // nested classes if (m_innerClasses) m_innerClasses->writeDeclaration(ol,0,0,TRUE); @@ -1628,29 +1462,37 @@ void ClassDef::writeMemberDocumentation(OutputList &ol) Doxygen::suppressDocWarnings = TRUE; } - if (typedefMembers) typedefMembers->writeDocumentation(ol,name(),this, - theTranslator->trMemberTypedefDocumentation()); + writeMemberDocumentation(ol,MemberList::typedefMembers,theTranslator->trMemberTypedefDocumentation()); + //if (typedefMembers) typedefMembers->writeDocumentation(ol,name(),this, + // theTranslator->trMemberTypedefDocumentation()); - if (enumMembers) enumMembers->writeDocumentation(ol,name(),this, - theTranslator->trMemberEnumerationDocumentation()); + writeMemberDocumentation(ol,MemberList::enumMembers,theTranslator->trMemberEnumerationDocumentation()); + //if (enumMembers) enumMembers->writeDocumentation(ol,name(),this, + // theTranslator->trMemberEnumerationDocumentation()); - if (constructors) constructors->writeDocumentation(ol,name(),this, - theTranslator->trConstructorDocumentation()); + writeMemberDocumentation(ol,MemberList::constructors,theTranslator->trConstructorDocumentation()); + //if (constructors) constructors->writeDocumentation(ol,name(),this, + // theTranslator->trConstructorDocumentation()); - if (functionMembers) functionMembers->writeDocumentation(ol,name(),this, - theTranslator->trMemberFunctionDocumentation()); + writeMemberDocumentation(ol,MemberList::functionMembers,theTranslator->trMemberFunctionDocumentation()); + //if (functionMembers) functionMembers->writeDocumentation(ol,name(),this, + // theTranslator->trMemberFunctionDocumentation()); - if (relatedMembers) relatedMembers->writeDocumentation(ol,name(),this, - theTranslator->trRelatedFunctionDocumentation()); + writeMemberDocumentation(ol,MemberList::relatedMembers,theTranslator->trRelatedFunctionDocumentation()); + //if (relatedMembers) relatedMembers->writeDocumentation(ol,name(),this, + // theTranslator->trRelatedFunctionDocumentation()); - if (variableMembers) variableMembers->writeDocumentation(ol,name(),this, - theTranslator->trMemberDataDocumentation()); + writeMemberDocumentation(ol,MemberList::variableMembers,theTranslator->trMemberDataDocumentation()); + //if (variableMembers) variableMembers->writeDocumentation(ol,name(),this, + // theTranslator->trMemberDataDocumentation()); - if (propertyMembers) propertyMembers->writeDocumentation(ol,name(),this, - theTranslator->trPropertyDocumentation()); + writeMemberDocumentation(ol,MemberList::propertyMembers,theTranslator->trPropertyDocumentation()); + //if (propertyMembers) propertyMembers->writeDocumentation(ol,name(),this, + // theTranslator->trPropertyDocumentation()); - if (eventMembers) eventMembers->writeDocumentation(ol,name(),this, - theTranslator->trEventDocumentation()); + writeMemberDocumentation(ol,MemberList::eventMembers,theTranslator->trEventDocumentation()); + //if (eventMembers) eventMembers->writeDocumentation(ol,name(),this, + // theTranslator->trEventDocumentation()); if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -1668,6 +1510,16 @@ void ClassDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::detailedLists) + { + 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); @@ -1676,6 +1528,7 @@ void ClassDef::writeMemberPages(OutputList &ol) if (variableMembers) variableMembers->writeDocumentationPage(ol,name(),this); if (propertyMembers) propertyMembers->writeDocumentationPage(ol,name(),this); if (eventMembers) eventMembers->writeDocumentationPage(ol,name(),this); +#endif ol.popGeneratorState(); } @@ -2082,67 +1935,96 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup) } } - if (pubTypes) pubTypes->setInGroup(inGroup); - if (pubTypes) pubTypes->writePlainDeclarations(ol,this,0,0,0); - if (pubMethods) pubMethods->setInGroup(inGroup); - if (pubMethods) pubMethods->writePlainDeclarations(ol,this,0,0,0); - if (pubAttribs) pubAttribs->setInGroup(inGroup); - if (pubAttribs) pubAttribs->writePlainDeclarations(ol,this,0,0,0); - if (pubSlots) pubSlots->setInGroup(inGroup); - if (pubSlots) pubSlots->writePlainDeclarations(ol,this,0,0,0); - if (signals) signals->setInGroup(inGroup); - if (signals) signals->writePlainDeclarations(ol,this,0,0,0); - if (dcopMethods) dcopMethods->setInGroup(inGroup); - if (dcopMethods) dcopMethods->writePlainDeclarations(ol,this,0,0,0); - if (properties) properties->setInGroup(inGroup); - if (properties) properties->writePlainDeclarations(ol,this,0,0,0); - if (events) events->setInGroup(inGroup); - if (events) events->writePlainDeclarations(ol,this,0,0,0); - if (pubStaticMethods) pubStaticMethods->setInGroup(inGroup); - if (pubStaticMethods) pubStaticMethods->writePlainDeclarations(ol,this,0,0,0); - if (pubStaticAttribs) pubStaticAttribs->setInGroup(inGroup); - if (pubStaticAttribs) pubStaticAttribs->writePlainDeclarations(ol,this,0,0,0); - if (proTypes) proTypes->setInGroup(inGroup); - if (proTypes) proTypes->writePlainDeclarations(ol,this,0,0,0); - if (proMethods) proMethods->setInGroup(inGroup); - if (proMethods) proMethods->writePlainDeclarations(ol,this,0,0,0); - if (proAttribs) proAttribs->setInGroup(inGroup); - if (proAttribs) proAttribs->writePlainDeclarations(ol,this,0,0,0); - if (proSlots) proSlots->setInGroup(inGroup); - if (proSlots) proSlots->writePlainDeclarations(ol,this,0,0,0); - if (proStaticMethods) proStaticMethods->setInGroup(inGroup); - if (proStaticMethods) proStaticMethods->writePlainDeclarations(ol,this,0,0,0); - if (proStaticAttribs) proStaticAttribs->setInGroup(inGroup); - if (proStaticAttribs) proStaticAttribs->writePlainDeclarations(ol,this,0,0,0); - if (pacTypes) pacTypes->setInGroup(inGroup); - if (pacTypes) pacTypes->writePlainDeclarations(ol,this,0,0,0); - if (pacMethods) pacMethods->setInGroup(inGroup); - if (pacMethods) pacMethods->writePlainDeclarations(ol,this,0,0,0); - if (pacAttribs) pacAttribs->setInGroup(inGroup); - if (pacAttribs) pacAttribs->writePlainDeclarations(ol,this,0,0,0); - if (pacStaticMethods) pacStaticMethods->setInGroup(inGroup); - if (pacStaticMethods) pacStaticMethods->writePlainDeclarations(ol,this,0,0,0); - if (pacStaticAttribs) pacStaticAttribs->setInGroup(inGroup); - if (pacStaticAttribs) pacStaticAttribs->writePlainDeclarations(ol,this,0,0,0); + 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")) { - if (priTypes) priTypes->setInGroup(inGroup); - if (priTypes) priTypes->writePlainDeclarations(ol,this,0,0,0); - if (priMethods) priMethods->setInGroup(inGroup); - if (priMethods) priMethods->writePlainDeclarations(ol,this,0,0,0); - if (priAttribs) priAttribs->setInGroup(inGroup); - if (priAttribs) priAttribs->writePlainDeclarations(ol,this,0,0,0); - if (priSlots) priSlots->setInGroup(inGroup); - if (priSlots) priSlots->writePlainDeclarations(ol,this,0,0,0); - if (priStaticMethods) priStaticMethods->setInGroup(inGroup); - if (priStaticMethods) priStaticMethods->writePlainDeclarations(ol,this,0,0,0); - if (priStaticAttribs) priStaticAttribs->setInGroup(inGroup); - if (priStaticAttribs) priStaticAttribs->writePlainDeclarations(ol,this,0,0,0); - } - if (friends) friends->setInGroup(inGroup); - if (friends) friends->writePlainDeclarations(ol,this,0,0,0); - if (related) related->setInGroup(inGroup); - if (related) related->writePlainDeclarations(ol,this,0,0,0); + 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 */ @@ -3142,15 +3024,15 @@ void ClassDef::addListReferences() mg->addListReferences(this); } } - if (constructors) constructors->addListReferences(this); - if (typedefMembers) typedefMembers->addListReferences(this); - if (enumMembers) enumMembers->addListReferences(this); - if (enumValMembers) enumValMembers->addListReferences(this); - if (functionMembers) functionMembers->addListReferences(this); - if (relatedMembers) relatedMembers->addListReferences(this); - if (variableMembers) variableMembers->addListReferences(this); - if (propertyMembers) propertyMembers->addListReferences(this); - if (eventMembers) eventMembers->addListReferences(this); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::detailedLists) + { + ml->addListReferences(this); + } + } } MemberDef *ClassDef::getMemberByName(const QCString &name) @@ -3183,3 +3065,69 @@ MemberDef *ClassDef::getMemberByName(const QCString &name) return xmd; } +MemberList *ClassDef::createMemberList(MemberList::ListType lt) +{ + m_memberLists.setAutoDelete(TRUE); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()==lt) + { + return ml; + } + } + // not found, create a new member list + ml = new MemberList(lt); + m_memberLists.append(ml); + return ml; +} + +MemberList *ClassDef::getMemberList(MemberList::ListType lt) +{ + MemberList *ml = m_memberLists.first(); + while (ml) + { + if (ml->listType()==lt) + { + return ml; + } + ml = m_memberLists.next(); + } + return 0; +} + +void ClassDef::addMemberToList(MemberList::ListType lt,MemberDef *md) +{ + static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); + MemberList *ml = createMemberList(lt); + if (sortBriefDocs) + ml->inSort(md); + else + ml->append(md); + md->setSectionList(this,ml); +} + +void ClassDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title, + const char *subTitle) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDeclarations(ol,this,0,0,0,title,subTitle); +} + +void ClassDef::writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDocumentation(ol,name(),this,title); +} + +void ClassDef::writePlainMemberDeclaration(OutputList &ol,MemberList::ListType lt,bool inGroup) +{ + MemberList * ml = getMemberList(lt); + if (ml) + { + ml->setInGroup(inGroup); + ml->writePlainDeclarations(ol,this,0,0,0); + } +} + diff --git a/src/classdef.h b/src/classdef.h index ca486dd..b57ecb4 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -54,10 +54,6 @@ struct IncludeInfo; class ClassDef : public Definition { public: - /*! \name Public API - * \{ - */ - /*! The various compound types */ enum CompoundType { Class=Entry::CLASS_SEC, Struct=Entry::STRUCT_SEC, @@ -67,22 +63,68 @@ class ClassDef : public Definition Category=Entry::CATEGORY_SEC, Exception=Entry::EXCEPTION_SEC }; + + /*! Creates a new compound definition. + * \param fileName full path and file name in which this compound was + * found. + * \param startLine line number where the definition of this compound + * starts. + * \param name the name of this compound (including scope) + * \param ct the kind of Compound + * \param ref the tag file from which this compound is extracted + * or 0 if the compound doesn't come from a tag file + * \param fName the file name as found in the tag file. + * This overwrites the file that doxygen normally + * generates based on the compound type & name. + * \param isSymbol If TRUE this class name is added as a publicly + * visible (and referencable) symbol. + */ + ClassDef(const char *fileName,int startLine, + const char *name,CompoundType ct, + const char *ref=0,const char *fName=0, + bool isSymbol=TRUE); + /*! Destroys a compound definition. */ + ~ClassDef(); + + //----------------------------------------------------------------------------------- + // --- getters + //----------------------------------------------------------------------------------- + + /*! Used for RTTI, this is a class */ DefType definitionType() const { return TypeClass; } + + /*! Returns the unique base name (without extension) of the class's file on disk */ QCString getOutputFileBase() const; QCString getInstanceOutputFileBase() const; QCString getFileBase() const; + + /*! Returns the base name for the source code file */ QCString getSourceFileBase() const; + + /*! If this class originated from a tagfile, this will return the tag file reference */ QCString getReference() const; + + /*! Returns TRUE if this class is imported via a tag file */ bool isReference() const; + + /*! Returns TRUE if this is a local class definition, see EXTRACT_LOCAL_CLASSES */ bool isLocal() const { return m_isLocal; } + + /*! 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; } + /*! returns the classes nested into this class */ + ClassSDict *getInnerClasses() { return m_innerClasses; } + + /*! returns TRUE if this class has documentation */ bool hasDocumentation() const; /*! Returns the name as it is appears in the documentation */ QCString displayName() const; - /*! Returns the type of compound this is */ + /*! Returns the type of compound this is, i.e. class/struct/union/.. */ CompoundType compoundType() const { return m_compType; } /*! Returns the type of compound as a string */ @@ -93,7 +135,7 @@ class ClassDef : public Definition */ BaseClassList *baseClasses() { return m_inherits; } - /*! Returns the list of sub classes that directly inherit from this class + /*! Returns the list of sub classes that directly derive from this class */ BaseClassList *subClasses() { return m_inheritedBy; } @@ -102,21 +144,12 @@ class ClassDef : public Definition */ MemberNameInfoSDict *memberNameInfoSDict() { return m_allMemberNameInfoSDict; } - void writeDocumentation(OutputList &ol); - void writeDocumentationForInnerClasses(OutputList &ol); - void writeMemberDocumentation(OutputList &ol); - void writeMemberPages(OutputList &ol); - void writeMemberList(OutputList &ol); - void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup); - void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag); - void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const; - /*! Return the protection level (Public,Protected,Private) in which * this compound was found. */ Protection protection() const { return m_prot; } - /*! returns TRUE iff a link is possible to an item within this project. + /*! returns TRUE iff a link is possible to this item within this project. */ bool isLinkableInProject() const; @@ -159,11 +192,13 @@ class ClassDef : public Definition * this template class. Returns 0 if not a template or no instances. */ QDict<ClassDef> *getTemplateInstances() const { return m_templateInstances; } + /*! Returns the template master of which this class is an instance. * Returns 0 if not applicable. */ ClassDef *templateMaster() const { return m_templateMaster; } + /*! Returns TRUE if this class is a template */ bool isTemplate() const { return m_tempArgs!=0; } IncludeInfo *includeInfo() const { return m_incInfo; } @@ -183,12 +218,6 @@ class ClassDef : public Definition return m_usesIntfClassDict; } - /** Marks this class as a template argument of some another class */ - void makeTemplateArgument(bool b=TRUE) - { - m_isTemplArg = b; - } - bool isTemplateArgument() const { return m_isTemplArg; @@ -208,6 +237,7 @@ class ClassDef : public Definition * with type="class" and name="T". */ void getTemplateParameterLists(QList<ArgumentList> &lists) const; + QCString qualifiedNameWithTemplateParameters( QList<ArgumentList> *actualParams=0) const; @@ -219,128 +249,78 @@ class ClassDef : public Definition /*! Returns TRUE if this class is implemented in Objective-C */ bool isObjectiveC() const { return m_isObjC; } + /*! Returns the class of which this is a category (Objective-C only) */ ClassDef *categoryOf() const { return m_categoryOf; } - /*! returns the name of the class including outer classes, but not + /*! Returns the name of the class including outer classes, but not * including namespaces. */ QCString className() const; - /* member lists by protection */ - MemberList *pubMethods; - MemberList *proMethods; - MemberList *pacMethods; - MemberList *priMethods; - MemberList *pubStaticMethods; - MemberList *proStaticMethods; - MemberList *pacStaticMethods; - MemberList *priStaticMethods; - MemberList *pubSlots; - MemberList *proSlots; - MemberList *priSlots; - MemberList *pubAttribs; - MemberList *proAttribs; - MemberList *pacAttribs; - MemberList *priAttribs; - MemberList *pubStaticAttribs; - MemberList *proStaticAttribs; - MemberList *pacStaticAttribs; - MemberList *priStaticAttribs; - MemberList *pubTypes; - MemberList *proTypes; - MemberList *pacTypes; - MemberList *priTypes; - MemberList *related; - MemberList *signals; - MemberList *friends; - MemberList *dcopMethods; - MemberList *properties; - MemberList *events; - - /* member list by types */ - MemberList *constructors; - MemberList *typedefMembers; - MemberList *enumMembers; - MemberList *enumValMembers; - MemberList *functionMembers; - MemberList *relatedMembers; - MemberList *variableMembers; - MemberList *propertyMembers; - MemberList *eventMembers; + /*! Returns the members in the list identified by \a lt */ + MemberList *getMemberList(MemberList::ListType lt); - /* user defined member groups */ - MemberGroupSDict *memberGroupSDict; + /*! Returns the list containing the list of members sorted per type */ + const QList<MemberList> &getMemberLists() const { return m_memberLists; } - /*! \} Public API */ + /*! Returns the member groups defined for this class */ + MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + + QDict<int> *getTemplateBaseClassNames() const; + ClassDef *getVariableInstance(const char *templSpec); + + //----------------------------------------------------------------------------------- + // --- setters ---- + //----------------------------------------------------------------------------------- - /*! \name Doxygen internal API - * \{ - */ void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0); void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0); void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); void insertMember(MemberDef *); void insertUsedFile(const char *); - void computeAnchors(); - //void computeMemberGroups(); - //void setAnchor(MemberDef *); - //void dumpMembers(); bool addExample(const char *anchor,const char *name, const char *file); - void addMembersToMemberGroup(); - void distributeMemberGroupDocumentation(); - void findSectionsInDocumentation(); - void setNamespace(NamespaceDef *nd) { m_nspace = nd; } - void setTemplateArguments(ArgumentList *al); - void mergeMembers(); void mergeCategory(ClassDef *category); + void setNamespace(NamespaceDef *nd) { m_nspace = nd; } void setFileDef(FileDef *fd) { m_fileDef=fd; } - //void determineImplUsageRelation(); - //void determineIntfUsageRelation(); void setSubGrouping(bool enabled) { m_subGrouping = enabled; } void setProtection(Protection p) { m_prot=p; } void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs); void addInnerCompound(Definition *d); - void addUsedClass(ClassDef *cd,const char *accessName); - void addUsedByClass(ClassDef *cd,const char *accessName); - //void initTemplateMapping(); - //void setTemplateArgumentMapping(const char *formal,const char *actual); - //QCString getTemplateArgumentMapping(const char *formal) const; ClassDef *insertTemplateInstance(const QCString &fileName,int startLine, const QCString &templSpec,bool &freshInstance); - ClassDef *getVariableInstance(const char *templSpec); - void setTemplateBaseClassNames(QDict<int> *templateNames); - QDict<int> *getTemplateBaseClassNames() const; - void setTemplateMaster(ClassDef *tm) { m_templateMaster=tm; } - void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec); + 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 addListReferences(); void setCompoundType(CompoundType t) { m_compType = t; } - /*! Creates a new compound definition. - * \param fileName full path and file name in which this compound was - * found. - * \param startLine line number where the definition of this compound - * starts. - * \param name the name of this compound (including scope) - * \param ct the kind of Compound - * \param ref the tag file from which this compound is extracted - * or 0 if the compound doesn't come from a tag file - * \param fName the file name as found in the tag file. - * This overwrites the file that doxygen normally - * generates based on the compound type & name. - * \param isSymbol If TRUE this class name is added as a publicly - * visible (and referencable) symbol. - */ - ClassDef(const char *fileName,int startLine, - const char *name,CompoundType ct, - const char *ref=0,const char *fName=0, - bool isSymbol=TRUE); - /*! Destroys a compound definition. */ - ~ClassDef(); + void setTemplateArguments(ArgumentList *al); + void setTemplateBaseClassNames(QDict<int> *templateNames); + void setTemplateMaster(ClassDef *tm) { m_templateMaster=tm; } + void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec); - ClassSDict *getInnerClasses() { return m_innerClasses; } + /*! Marks this class as a template argument of some another class */ + void makeTemplateArgument(bool b=TRUE) { m_isTemplArg = b; } + + //----------------------------------------------------------------------------------- + // --- actions ---- + //----------------------------------------------------------------------------------- + + void findSectionsInDocumentation(); + void addMembersToMemberGroup(); + void addListReferences(); + void computeAnchors(); + void mergeMembers(); + void distributeMemberGroupDocumentation(); + void writeDocumentation(OutputList &ol); + void writeDocumentationForInnerClasses(OutputList &ol); + void writeMemberDocumentation(OutputList &ol); + void writeMemberPages(OutputList &ol); + void writeMemberList(OutputList &ol); + void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup); + void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag); + void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const; bool visited; @@ -350,11 +330,15 @@ class ClassDef : public Definition bool hasNonReferenceSuperClass(); void showUsedFiles(OutputList &ol); - /*! \} Interal API */ - private: void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList); QCString getMemberListFileName() const; + void addMemberToList(MemberList::ListType lt,MemberDef *md); + MemberList *createMemberList(MemberList::ListType lt); + void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title, + const char *subTitle=0); + void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); + void writePlainMemberDeclaration(OutputList &ol,MemberList::ListType lt,bool inGroup); /*! file name that forms the base for the output file containing the * class documentation. For compatibility with Qt (e.g. links via tag @@ -367,16 +351,6 @@ class ClassDef : public Definition */ IncludeInfo *m_incInfo; - /*! file name that forms the base for the "list of members" for this - * class. - */ - //QCString m_memListFileName; - - /*! Bare name of the class without any scoping prefixes - * (like for nested classes and classes inside namespaces) - */ - //QCString m_scopelessName; - /*! List of base class (or super-classes) from which this class derives * directly. */ @@ -450,6 +424,11 @@ class ClassDef : public Definition */ ClassDef *m_categoryOf; + QList<MemberList> m_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 @@ -25,10 +25,11 @@ class CodeOutputInterface; class FileDef; class MemberDef; -extern void parseCCode(CodeOutputInterface &,const char *,const QCString &, +void parseCCode(CodeOutputInterface &,const char *,const QCString &, bool ,const char *,FileDef *fd=0, int startLine=-1,int endLine=-1,bool inlineFragment=FALSE, MemberDef *memberDef=0); -extern void resetCCodeParserState(); +void resetCCodeParserState(); +void codeFreeScanner(); #endif @@ -106,6 +106,7 @@ static int g_lastCContext; static bool g_insideObjC; static bool g_insideProtocolList; +static bool g_lexInit = FALSE; // context for an Objective-C method call struct ObjCCallCtx @@ -458,7 +459,6 @@ static void startCodeLine() Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr); //printf("startCodeLine %d d=%s\n", g_yyLineNr,d ? d->name().data() : "<null>"); - //g_code->startLineNumber(); if (!g_includeCodeFragment && d) { g_currentDefinition = d; @@ -498,10 +498,8 @@ static void startCodeLine() } else { - //g_code->codify(lineNumber); g_code->writeLineNumber(0,0,0,g_yyLineNr); } - //g_code->endLineNumber(); } g_code->startCodeLine(); if (g_currentFontClass) @@ -764,15 +762,20 @@ static MemberDef *setCallContextForVar(const QCString &name) static void addDocCrossReference(MemberDef *src,MemberDef *dst) { + static bool referencedByRelation = Config_getBool("REFERENCED_BY_RELATION"); + static bool referencesRelation = Config_getBool("REFERENCES_RELATION"); + static bool callerGraph = Config_getBool("CALLER_GRAPH"); + static bool callGraph = Config_getBool("CALL_GRAPH"); + if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types //printf("addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data()); - if ((Config_getBool("REFERENCED_BY_RELATION") || Config_getBool("CALLER_GRAPH")) && + if ((referencedByRelation || callerGraph) && (src->isFunction() || src->isSlot()) ) { dst->addSourceReferencedBy(src); } - if ((Config_getBool("REFERENCES_RELATION") || Config_getBool("CALL_GRAPH")) && + if ((referencesRelation || callGraph) && (src->isFunction() || src->isSlot()) ) { @@ -828,6 +831,8 @@ static bool getLinkInScope(const QCString &c, // scope } //printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); + ol.linkableSymbol(g_yyLineNr,md->name(),md, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(ol,md->getReference(), md->getOutputFileBase(), md->anchor(), @@ -936,6 +941,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, g_anchorCount++; } } + ol.linkableSymbol(g_yyLineNr,cd->name(),cd, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(ol,cd->getReference(),cd->getOutputFileBase(),0,clName); addToSearchIndex(className); if (md) @@ -977,6 +984,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, //printf("is a global md=%p g_currentDefinition=%s\n",md,g_currentDefinition?g_currentDefinition->name().data():"<none>"); if (md->isLinkable()) { + ol.linkableSymbol(g_yyLineNr,md->name(),md, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(ol,md->getReference(),md->getOutputFileBase(),md->anchor(),clName); addToSearchIndex(clName); if (g_currentMemberDef) @@ -989,6 +998,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, } // nothing found, just write out the word + ol.linkableSymbol(g_yyLineNr,clName,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); codifyLines(clName); addToSearchIndex(clName); } @@ -1044,6 +1055,8 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,ClassDef *mcd,const } // write the actual link + ol.linkableSymbol(g_yyLineNr,xmd->name(),xmd, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(ol,xmd->getReference(), xmd->getOutputFileBase(),xmd->anchor(),memName); addToSearchIndex(memName); @@ -1149,6 +1162,9 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, } } } + // nothing found -> write result as is + ol.linkableSymbol(g_yyLineNr,memName,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); codifyLines(memName); addToSearchIndex(memName); return; @@ -1331,6 +1347,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) { if (ctx->method && ctx->method->isLinkable()) { + g_code->linkableSymbol(g_yyLineNr,ctx->method->name(),ctx->method, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(*g_code, ctx->method->getReference(), ctx->method->getOutputFileBase(), @@ -1343,6 +1361,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) } else { + g_code->linkableSymbol(g_yyLineNr,pName->data(),0, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); codifyLines(pName->data()); } } @@ -1414,6 +1434,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) } else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable { + g_code->linkableSymbol(g_yyLineNr,ctx->objectVar->name(),ctx->objectVar, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(*g_code, ctx->objectVar->getReference(), ctx->objectVar->getOutputFileBase(), @@ -1430,6 +1452,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) ) // object is class name { ClassDef *cd = ctx->objectType; + g_code->linkableSymbol(g_yyLineNr,cd->name(),cd, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(*g_code, cd->getReference(), cd->getOutputFileBase(), @@ -1443,6 +1467,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (cd && cd->isLinkable()) { if (ctx->objectType==0) ctx->objectType=cd; + g_code->linkableSymbol(g_yyLineNr,cd->name(),cd, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); writeMultiLineCodeLink(*g_code, cd->getReference(), cd->getOutputFileBase(), @@ -1451,6 +1477,8 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) } else { + g_code->linkableSymbol(g_yyLineNr,pObject->data(),0, + g_currentMemberDef ? g_currentMemberDef : g_currentDefinition); codifyLines(pObject->data()); } } @@ -1708,6 +1736,9 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} g_theVarContext.addVariable(g_parmType,g_parmName); g_parmType.resize(0);g_parmName.resize(0); } +<ObjCMethod,ObjCParams,ObjCParamType>{ID} { + generateClassOrGlobalLink(*g_code,yytext); + } <ObjCMethod,ObjCParams,ObjCParamType>. { g_code->codify(yytext); } @@ -1811,6 +1842,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} g_inClass=FALSE; + //fprintf(stderr,"g_bodyCurlyCount=%d\n",g_bodyCurlyCount); if (--g_bodyCurlyCount<=0) { g_insideBody=FALSE; @@ -2232,6 +2264,8 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} { if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),yytext)) { + g_code->linkableSymbol(g_yyLineNr,yytext,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); g_code->codify(yytext); addToSearchIndex(yytext); } @@ -2239,6 +2273,8 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} } else { + g_code->linkableSymbol(g_yyLineNr,yytext,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); g_code->codify(yytext); addToSearchIndex(yytext); g_name.resize(0); @@ -2260,6 +2296,8 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} //fprintf(stderr,"g_theCallContext.getClass()=%p\n",g_theCallContext.getClass()); if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),yytext)) { + g_code->linkableSymbol(g_yyLineNr,yytext,0, + g_currentMemberDef?g_currentMemberDef:g_currentDefinition); g_code->codify(yytext); addToSearchIndex(yytext); } @@ -3140,6 +3178,7 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, codeYYrestart( codeYYin ); BEGIN( Body ); codeYYlex(); + g_lexInit=TRUE; if (g_needsTermination) { endFontClass(); @@ -3154,11 +3193,23 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, return; } +void codeFreeScanner() +{ +#if defined(YY_FLEX_SUBMINOR_VERSION) + if (g_lexInit) + { + codeYYlex_destroy(); + } +#endif +} + + + #if !defined(YY_FLEX_SUBMINOR_VERSION) extern "C" { // some bogus code to keep the compiler happy void codeYYdummy() { yy_flex_realloc(0,0); } } #elif YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." +#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" #endif diff --git a/src/commentscan.l b/src/commentscan.l index 59c7d53..95404b5 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -2329,8 +2329,8 @@ void openGroup(Entry *e,const char *,int) if (e->section==Entry::GROUPDOC_SEC) // auto group { g_autoGroupStack.push(new Grouping(e->name,e->groupingPri())); - printf("==> openGroup(name=%s,sec=%x) g_autoGroupStack=%d\n", - e->name.data(),e->section,g_autoGroupStack.count()); + //printf("==> openGroup(name=%s,sec=%x) g_autoGroupStack=%d\n", + // e->name.data(),e->section,g_autoGroupStack.count()); } else // start of a member group { @@ -2352,8 +2352,8 @@ void openGroup(Entry *e,const char *,int) void closeGroup(Entry *e,const char *fileName,int) { - printf("==> closeGroup(name=%s,sec=%x) g_autoGroupStack=%d\n", - e->name.data(),e->section,g_autoGroupStack.count()); + //printf("==> closeGroup(name=%s,sec=%x) g_autoGroupStack=%d\n", + // e->name.data(),e->section,g_autoGroupStack.count()); if (g_memberGroupId!=DOX_NOGROUP) // end of member group { MemberGroupInfo *info=Doxygen::memGrpInfoDict.find(g_memberGroupId); @@ -2372,7 +2372,7 @@ void closeGroup(Entry *e,const char *fileName,int) { Grouping *grp = g_autoGroupStack.pop(); e->groups->removeLast(); - printf("Removing %s\n",grp->groupname.data()); + //printf("Removing %s\n",grp->groupname.data()); delete grp; initGroupInfo(e); } @@ -2386,9 +2386,9 @@ void initGroupInfo(Entry *e) e->relates = g_memberGroupRelates; if (!g_autoGroupStack.isEmpty()) { - printf("Appending group %s to %s: count=%d entry=%p\n", - g_autoGroupStack.top()->groupname.data(), - e->name.data(),e->groups->count(),e); + //printf("Appending group %s to %s: count=%d entry=%p\n", + // g_autoGroupStack.top()->groupname.data(), + // e->name.data(),e->groups->count(),e); e->groups->append(new Grouping(*g_autoGroupStack.top())); } } diff --git a/src/config.l b/src/config.l index 40ce84b..59f42f3 100644 --- a/src/config.l +++ b/src/config.l @@ -1196,6 +1196,27 @@ void Config::check() annotationFromBrief.append("an"); annotationFromBrief.append("the"); } + + if (Config_getBool("CALL_GRAPH") && + (!Config_getBool("SOURCE_BROWSER") || !Config_getBool("REFERENCES_RELATION")) + ) + { + config_err("Warning: turning on CALL_GRAPH requires turning " + "SOURCE_BROWSER and\nREFERENCES_RELATION on as well!\n" + "Assuming SOURCE_BROWSER=YES and REFERENCES_RELATION=YES\n"); + Config_getBool("SOURCE_BROWSER")=TRUE; + Config_getBool("REFERENCES_RELATION")=TRUE; + } + if (Config_getBool("CALLER_GRAPH") && + (!Config_getBool("SOURCE_BROWSER") || !Config_getBool("REFERENCED_BY_RELATION")) + ) + { + config_err("Warning: turning on CALLER_GRAPH requires turning " + "SOURCE_BROWSER and\nREFERENCEDBY_RELATION on as well!\n" + "Assuming SOURCE_BROWSER=YES and REFERENCED_BY_RELATION=YES\n"); + Config_getBool("SOURCE_BROWSER")=TRUE; + Config_getBool("REFERENCED_BY_RELATION")=TRUE; + } } void Config::init() diff --git a/src/defgen.cpp b/src/defgen.cpp index e5944fc..119fa69 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -313,7 +313,7 @@ void generateDEFClassSection(ClassDef *cd, MemberList *ml, const char *kind) { - if (cd && ml->count()>0) + if (cd && ml && ml->count()>0) { t << " cp-section = {" << endl; t << " sec-kind = '" << kind << "';" << endl; @@ -408,54 +408,41 @@ void generateDEFForClass(ClassDef *cd,QTextStream &t) } } - int numMembers = - (cd->pubTypes ? cd->pubTypes->count() : 0)+ - (cd->pubMethods ? cd->pubMethods->count() : 0)+ - (cd->pubAttribs ? cd->pubAttribs->count() : 0)+ - (cd->pubSlots ? cd->pubSlots->count() : 0)+ - (cd->signals ? cd->signals->count() : 0)+ - (cd->dcopMethods ? cd->dcopMethods->count() : 0)+ - (cd->pubStaticMethods ? cd->pubStaticMethods->count() : 0)+ - (cd->pubStaticAttribs ? cd->pubStaticAttribs->count() : 0)+ - (cd->proTypes ? cd->proTypes->count() : 0)+ - (cd->proMethods ? cd->proMethods->count() : 0)+ - (cd->proAttribs ? cd->proAttribs->count() : 0)+ - (cd->proSlots ? cd->proSlots->count() : 0)+ - (cd->proStaticMethods ? cd->proStaticMethods->count() : 0)+ - (cd->proStaticAttribs ? cd->proStaticAttribs->count() : 0)+ - (cd->priTypes ? cd->priTypes->count() : 0)+ - (cd->priMethods ? cd->priMethods->count() : 0)+ - (cd->priAttribs ? cd->priAttribs->count() : 0)+ - (cd->priSlots ? cd->priSlots->count() : 0)+ - (cd->priStaticMethods ? cd->priStaticMethods->count() : 0)+ - (cd->priStaticAttribs ? cd->priStaticAttribs->count() : 0)+ - (cd->friends ? cd->friends->count() : 0)+ - (cd->related ? cd->related->count() : 0); + int numMembers = 0; + QListIterator<MemberList> mli(cd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::detailedLists)==0) + { + numMembers+=ml->count(); + } + } if (numMembers>0) { - generateDEFClassSection(cd,t,cd->pubTypes,"public-type"); - generateDEFClassSection(cd,t,cd->pubMethods,"public-func"); - generateDEFClassSection(cd,t,cd->pubAttribs,"public-attrib"); - generateDEFClassSection(cd,t,cd->pubSlots,"public-slot"); - generateDEFClassSection(cd,t,cd->signals,"signal"); - generateDEFClassSection(cd,t,cd->dcopMethods,"dcop-func"); - generateDEFClassSection(cd,t,cd->properties,"property"); - generateDEFClassSection(cd,t,cd->pubStaticMethods,"public-static-func"); - generateDEFClassSection(cd,t,cd->pubStaticAttribs,"public-static-attrib"); - generateDEFClassSection(cd,t,cd->proTypes,"protected-type"); - generateDEFClassSection(cd,t,cd->proMethods,"protected-func"); - generateDEFClassSection(cd,t,cd->proAttribs,"protected-attrib"); - generateDEFClassSection(cd,t,cd->proSlots,"protected-slot"); - generateDEFClassSection(cd,t,cd->proStaticMethods,"protected-static-func"); - generateDEFClassSection(cd,t,cd->proStaticAttribs,"protected-static-attrib"); - generateDEFClassSection(cd,t,cd->priTypes,"private-type"); - generateDEFClassSection(cd,t,cd->priMethods,"private-func"); - generateDEFClassSection(cd,t,cd->priAttribs,"private-attrib"); - generateDEFClassSection(cd,t,cd->priSlots,"private-slot"); - generateDEFClassSection(cd,t,cd->priStaticMethods,"private-static-func"); - generateDEFClassSection(cd,t,cd->priStaticAttribs,"private-static-attrib"); - generateDEFClassSection(cd,t,cd->friends,"signal"); - generateDEFClassSection(cd,t,cd->related,"related"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubTypes),"public-type"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubMethods),"public-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubAttribs),"public-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubSlots),"public-slot"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::signals),"signal"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::dcopMethods),"dcop-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::properties),"property"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubStaticMethods),"public-static-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubStaticAttribs),"public-static-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proTypes),"protected-type"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proMethods),"protected-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proAttribs),"protected-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proSlots),"protected-slot"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proStaticMethods),"protected-static-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proStaticAttribs),"protected-static-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priTypes),"private-type"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priMethods),"private-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priAttribs),"private-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priSlots),"private-slot"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priStaticMethods),"private-static-func"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priStaticAttribs),"private-static-attrib"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::friends),"signal"); + generateDEFClassSection(cd,t,cd->getMemberList(MemberList::related),"related"); } t << " cp-filename = '" << cd->getDefFileName() << "';" << endl; @@ -512,12 +499,12 @@ void generateDEFForNamespace(NamespaceDef *nd,QTextStream &t) writeDEFString(t,nd->name()); t << ';' << endl; - generateDEFSection(nd,t,&nd->decDefineMembers,"define"); - generateDEFSection(nd,t,&nd->decProtoMembers,"prototype"); - generateDEFSection(nd,t,&nd->decTypedefMembers,"typedef"); - generateDEFSection(nd,t,&nd->decEnumMembers,"enum"); - generateDEFSection(nd,t,&nd->decFuncMembers,"func"); - generateDEFSection(nd,t,&nd->decVarMembers,"var"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decDefineMembers),"define"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decProtoMembers),"prototype"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decTypedefMembers),"typedef"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decEnumMembers),"enum"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decFuncMembers),"func"); + generateDEFSection(nd,t,nd->getMemberList(MemberList::decVarMembers),"var"); t << " ns-filename = '" << nd->getDefFileName() << "';" << endl; t << " ns-fileline = '" << nd->getDefLine() << "';" << endl; @@ -539,12 +526,12 @@ void generateDEFForFile(FileDef *fd,QTextStream &t) writeDEFString(t,fd->name()); t << ';' << endl; - generateDEFSection(fd,t,fd->decDefineMembers,"define"); - generateDEFSection(fd,t,fd->decProtoMembers,"prototype"); - generateDEFSection(fd,t,fd->decTypedefMembers,"typedef"); - generateDEFSection(fd,t,fd->decEnumMembers,"enum"); - generateDEFSection(fd,t,fd->decFuncMembers,"func"); - generateDEFSection(fd,t,fd->decVarMembers,"var"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decDefineMembers),"define"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decProtoMembers),"prototype"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decTypedefMembers),"typedef"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decEnumMembers),"enum"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decFuncMembers),"func"); + generateDEFSection(fd,t,fd->getMemberList(MemberList::decVarMembers),"var"); t << " file-full-name = '" << fd->getDefFileName() << "';" << endl; t << " file-first-line = '" << fd->getDefLine() << "';" << endl; diff --git a/src/definition.cpp b/src/definition.cpp index 61c2590..fb2c993 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -46,14 +46,41 @@ static void addToMap(const char *name,Definition *d) if (index!=-1) symbolName=symbolName.mid(index+2); if (!symbolName.isEmpty()) { - DefinitionList *dl=Doxygen::symbolMap->find(symbolName); - if (dl==0) + //printf("******* adding symbol `%s' (%p)\n",symbolName.data(),d); + DefinitionIntf *di=Doxygen::symbolMap->find(symbolName); + //printf(" addToMap(%p): looking for symbol %s: %p\n",d,symbolName.data(),di); + if (di==0) // new Symbol { - dl = new DefinitionList; - Doxygen::symbolMap->append(symbolName,dl); + //printf(" new symbol!\n"); + Doxygen::symbolMap->insert(symbolName,d); } - //printf("******* adding symbol `%s' (%p)\n",symbolName.data(),d); - dl->append(d); + else // existing symbol + { + //printf(" existing symbol: "); + if (di->definitionType()==DefinitionIntf::TypeSymbolList) // already multiple symbols + { + //printf("adding to exiting list\n"); + DefinitionList *dl = (DefinitionList*)di; + dl->append(d); + } + else // going from one to two symbols + { + Doxygen::symbolMap->take(symbolName); + DefinitionList *dl = new DefinitionList; + //printf("replacing symbol by list %p with elements %p and %p\n",dl,di,d); + dl->append((Definition*)di); + dl->append(d); + Doxygen::symbolMap->insert(symbolName,dl); + } + } + + // auto resize if needed + static int sizeIndex=9; + if (Doxygen::symbolMap->size()>SDict_primes[sizeIndex]) + { + Doxygen::symbolMap->resize(SDict_primes[++sizeIndex]); + } + d->setSymbolName(symbolName); } } @@ -66,12 +93,26 @@ static void removeFromMap(Definition *d) if (!symbolName.isEmpty()) { //printf("******* removing symbol `%s' (%p)\n",symbolName.data(),d); - DefinitionList *dl=Doxygen::symbolMap->find(symbolName); - if (dl) + DefinitionIntf *di=Doxygen::symbolMap->find(symbolName); + if (di) { - ASSERT(dl!=0); - bool b = dl->removeRef(d); - ASSERT(b==TRUE); + ASSERT(di!=0); + if (di!=d) // symbolName not unique + { + //printf(" removing from list: %p!\n",di); + DefinitionList *dl = (DefinitionList*)di; + bool b = dl->removeRef(d); + ASSERT(b==TRUE); + if (dl->isEmpty()) + { + Doxygen::symbolMap->take(symbolName); + } + } + else // symbolName unique + { + //printf(" removing symbol %p\n",di); + Doxygen::symbolMap->take(symbolName); + } } } } diff --git a/src/definition.h b/src/definition.h index 8110c96..5e342d6 100644 --- a/src/definition.h +++ b/src/definition.h @@ -54,18 +54,27 @@ struct BodyInfo FileDef *fileDef; // file definition containing the function body }; -/*! The common base class of all entity definitions found in the sources. */ -class Definition +/*! Abstract interface for a Definition or DefinitionList */ +class DefinitionIntf { public: + DefinitionIntf() {} + virtual ~DefinitionIntf() {} /*! Types of derived classes */ enum DefType { TypeClass, TypeMember, TypeFile, TypeGroup, - TypeNamespace, TypePackage, TypePage, TypeDir + TypeNamespace, TypePackage, TypePage, TypeDir, + TypeSymbolList }; /*! Use this for dynamic inspection of the type of the derived class */ virtual DefType definitionType() const = 0; +}; + +/*! The common base class of all entity definitions found in the sources. */ +class Definition : public DefinitionIntf +{ + public: /*! Create a new definition */ Definition( @@ -76,16 +85,24 @@ class Definition /*! Destroys the definition */ virtual ~Definition(); + //----------------------------------------------------------------------------------- + // ---- getters ----- + //----------------------------------------------------------------------------------- + /*! Returns the name of the definition */ const QCString& name() const { return m_name; } + /*! Returns the local name without any scope qualifiers. */ + QCString localName() const; + /*! Returns the base name of the output file that contains this * definition. */ virtual QCString qualifiedName(); - /*! Returns the local name without any scope qualifiers. */ - QCString localName() const; + /*! Returns the name of this definition as it appears in the symbol map. + */ + QCString symbolName() const { return m_symbolName; } /*! Returns the base file name (without extension) of this definition. * as it is referenced to/written to disk. @@ -98,15 +115,6 @@ class Definition /*! Returns the detailed description of this definition */ QCString documentation() const { return m_details ? m_details->doc : QCString(""); } - /*! Returns the brief description of this definition */ - QCString briefDescription() const { return m_brief ? m_brief->doc : QCString(""); } - - /*! Sets a new \a name for the definition */ - 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); - /*! Returns the line number at which the detailed documentation was found. */ int docLine() const { return m_details ? m_details->line : 1; } @@ -115,10 +123,8 @@ class Definition */ QCString docFile() const { return m_details ? m_details->file : QCString("<"+m_name+">"); } - /*! Sets the brief description of this definition to \a b. - * A dot is added to the sentence if not available. - */ - void setBriefDescription(const char *b,const char *briefFile,int briefLine); + /*! Returns the brief description of this definition */ + QCString briefDescription() const { return m_brief ? m_brief->doc : QCString(""); } /*! Returns the line number at which the brief description was found. */ int briefLine() const { return m_brief ? m_brief->line : 1; } @@ -166,6 +172,8 @@ class Definition virtual bool isVisible() const { return m_hidden || isLinkable(); } + bool isHidden() const { return m_hidden; } + /*! If this definition was imported via a tag file, this function * returns the tagfile for the external project. This can be * translated into an external link target via @@ -176,12 +184,37 @@ class Definition /*! Returns TRUE if this definition is imported via a tag file. */ virtual bool isReference() const { return !m_ref.isEmpty(); } - /*! Sets the tag file id via which this definition was imported. */ - void setReference(const char *r) { m_ref=r; } + int getStartBodyLine() const { return m_body ? m_body->startLine : -1; } + int getEndBodyLine() const { return m_body ? m_body->endLine : -1; } + FileDef *getBodyDef() { return m_body ? m_body->fileDef : 0; } - /*! Returns the name of this definition as it appears in the symbol map. + GroupList *partOfGroups() const { return m_partOfGroups; } + + const QList<ListItemInfo> *xrefListItems() const; + + virtual Definition *findInnerCompound(const char *name); + virtual Definition *getOuterScope() const { return m_outerScope; } + + MemberSDict *getReferencesMembers() const { return m_sourceRefsDict; } + MemberSDict *getReferencedByMembers() const { return m_sourceRefByDict; } + + //----------------------------------------------------------------------------------- + // ---- setters ----- + //----------------------------------------------------------------------------------- + + /*! Sets a new \a name for the definition */ + 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); + + /*! Sets the brief description of this definition to \a b. + * A dot is added to the sentence if not available. */ - QCString symbolName() const { return m_symbolName; } + void setBriefDescription(const char *b,const char *briefFile,int briefLine); + + /*! Sets the tag file id via which this definition was imported. */ + void setReference(const char *r) { m_ref=r; } /*! Sets the name of this definition as it should appear in the symbol map. */ @@ -192,47 +225,37 @@ class Definition */ void addSectionsToDefinition(QList<SectionInfo> *anchorList); - /*! Writes the documentation anchors of the definition to - * the Doxygen::tagFile stream. - */ - void writeDocAnchorsToTagFile(); - - bool isHidden() const { return m_hidden; } - // source references void setBodySegment(int bls,int ble); void setBodyDef(FileDef *fd); - int getStartBodyLine() const { return m_body ? m_body->startLine : -1; } - int getEndBodyLine() const { return m_body ? m_body->endLine : -1; } - FileDef *getBodyDef() { return m_body ? m_body->fileDef : 0; } - void writeSourceDef(OutputList &ol,const char *scopeName); - void writeInlineCode(OutputList &ol,const char *scopeName); - void writeSourceRefs(OutputList &ol,const char *scopeName); - void writeSourceReffedBy(OutputList &ol,const char *scopeName); void addSourceReferencedBy(MemberDef *d); void addSourceReferences(MemberDef *d); void setRefItems(const QList<ListItemInfo> *sli); void mergeRefItems(Definition *d); - const QList<ListItemInfo> *xrefListItems() const; - - virtual Definition *findInnerCompound(const char *name); - virtual Definition *getOuterScope() const { return m_outerScope; } virtual void addInnerCompound(Definition *d); virtual void setOuterScope(Definition *d); - MemberSDict *getReferencesMembers() const { return m_sourceRefsDict; } - MemberSDict *getReferencedByMembers() const { return m_sourceRefByDict; } + void setHidden(bool b) { m_hidden = b; } - void makePartOfGroup(GroupDef *gd); - GroupList *partOfGroups() const { return m_partOfGroups; } - QCString convertNameToFile(const char *name,bool allowDots=FALSE) const; + //----------------------------------------------------------------------------------- + // --- actions ---- + //----------------------------------------------------------------------------------- + QCString convertNameToFile(const char *name,bool allowDots=FALSE) const; + void writeSourceDef(OutputList &ol,const char *scopeName); + void writeInlineCode(OutputList &ol,const char *scopeName); + void writeSourceRefs(OutputList &ol,const char *scopeName); + void writeSourceReffedBy(OutputList &ol,const char *scopeName); + void makePartOfGroup(GroupDef *gd); void writePathFragment(OutputList &ol) const; void writeNavigationPath(OutputList &ol) const; virtual void writeQuickMemberLinks(OutputList &,MemberDef *) const {} - void setHidden(bool b) { m_hidden = b; } + /*! Writes the documentation anchors of the definition to + * the Doxygen::tagFile stream. + */ + void writeDocAnchorsToTagFile(); protected: void setLocalName(const QCString name) { m_localName=name; } @@ -241,7 +264,13 @@ class Definition int getXRefListId(const char *listName) const; void writeSourceRefList(OutputList &ol,const char *scopeName, const QCString &text,MemberSDict *members,bool); + + //----------------------------------------------------------------------------------- + // --- member variables + //----------------------------------------------------------------------------------- + SectionDict *m_sectionDict; // dictionary of all sections + MemberSDict *m_sourceRefByDict; MemberSDict *m_sourceRefsDict; @@ -271,10 +300,11 @@ class Definition QCString m_defFileExt; }; -class DefinitionList : public QList<Definition> +class DefinitionList : public QList<Definition>, public DefinitionIntf { public: ~DefinitionList() {} + DefType definitionType() const { return TypeSymbolList; } int compareItems(GCI item1,GCI item2) { return stricmp(((Definition *)item1)->name(), diff --git a/src/dirdef.h b/src/dirdef.h index 78fe91f..d8d7cf1 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -70,8 +70,6 @@ class DirDef : public Definition void writeDetailedDocumentation(OutputList &ol); void writeDocumentation(OutputList &ol); void writeDepGraph(QTextStream &t); - //void writePathFragment(OutputList &ol) const; - //void writeNavigationPath(OutputList &ol); static DirDef *mergeDirectoryInTree(const QCString &path); bool visited; diff --git a/src/docparser.cpp b/src/docparser.cpp index 0b9cb3c..2e97277 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -3582,6 +3582,31 @@ void DocSimpleSect::appendLinkWord(const QString &word) g_inSeeBlock=FALSE; } +QCString DocSimpleSect::typeString() const +{ + switch (m_type) + { + case Unknown: break; + case See: return "see"; + case Return: return "return"; + case Author: // fall through + case Authors: return "author"; + case Version: return "version"; + case Since: return "since"; + case Date: return "date"; + case Note: return "note"; + case Warning: return "warning"; + case Pre: return "pre"; + case Post: return "post"; + case Invar: return "invariant"; + case Remark: return "remark"; + case Attention: return "attention"; + case User: return "user"; + case Rcs: return "rcs"; + } + return "unknown"; +} + //-------------------------------------------------------------------------- int DocParamList::parse(const QString &cmdName) diff --git a/src/docparser.h b/src/docparser.h index 03d84b2..faa3d58 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -915,6 +915,7 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode virtual ~DocSimpleSect(); Kind kind() const { return Kind_SimpleSect; } Type type() const { return m_type; } + QCString typeString() const; DocNode *parent() const { return m_parent; } void accept(DocVisitor *v); int parse(bool userTitle); diff --git a/src/dot.cpp b/src/dot.cpp index c216864..382a031 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -629,29 +629,29 @@ void DotNode::writeBox(QTextStream &t, { t << "{" << convertLabel(m_label); t << "\\n|"; - writeBoxMemberList(t,'+',m_classDef->pubAttribs,m_classDef); - writeBoxMemberList(t,'+',m_classDef->pubStaticAttribs,m_classDef); - writeBoxMemberList(t,'~',m_classDef->pacAttribs,m_classDef); - writeBoxMemberList(t,'~',m_classDef->pacStaticAttribs,m_classDef); - writeBoxMemberList(t,'#',m_classDef->proAttribs,m_classDef); - writeBoxMemberList(t,'#',m_classDef->proStaticAttribs,m_classDef); - writeBoxMemberList(t,'-',m_classDef->priAttribs,m_classDef); - writeBoxMemberList(t,'-',m_classDef->priStaticAttribs,m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubAttribs),m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubStaticAttribs),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacAttribs),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacStaticAttribs),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proAttribs),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proStaticAttribs),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priAttribs),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priStaticAttribs),m_classDef); t << "|"; - writeBoxMemberList(t,'+',m_classDef->pubMethods,m_classDef); - writeBoxMemberList(t,'+',m_classDef->pubStaticMethods,m_classDef); - writeBoxMemberList(t,'+',m_classDef->pubSlots,m_classDef); - writeBoxMemberList(t,'~',m_classDef->pacMethods,m_classDef); - writeBoxMemberList(t,'~',m_classDef->pacStaticMethods,m_classDef); - writeBoxMemberList(t,'#',m_classDef->proMethods,m_classDef); - writeBoxMemberList(t,'#',m_classDef->proStaticMethods,m_classDef); - writeBoxMemberList(t,'#',m_classDef->proSlots,m_classDef); - writeBoxMemberList(t,'-',m_classDef->priMethods,m_classDef); - writeBoxMemberList(t,'-',m_classDef->priStaticMethods,m_classDef); - writeBoxMemberList(t,'-',m_classDef->priSlots,m_classDef); - if (m_classDef->memberGroupSDict) - { - MemberGroupSDict::Iterator mgdi(*m_classDef->memberGroupSDict); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubMethods),m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubStaticMethods),m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubSlots),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacMethods),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacStaticMethods),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proMethods),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proStaticMethods),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proSlots),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priMethods),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priStaticMethods),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priSlots),m_classDef); + if (m_classDef->getMemberGroupSDict()) + { + MemberGroupSDict::Iterator mgdi(*m_classDef->getMemberGroupSDict()); MemberGroup *mg; for (mgdi.toFirst();(mg=mgdi.current());++mgdi) { @@ -2774,7 +2774,7 @@ void DotGroupCollaboration::buildGraph(GroupDef* gd,int) // Write collaboration // Add members - addMemberList( gd->getMembers() ); + addMemberList( gd->getMemberList(MemberList::allMembersList) ); // Add classes if ( gd->getClasses() && gd->getClasses()->count() ) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index cf2215c..6f79229 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -27,6 +27,7 @@ #include <stdlib.h> #include <sys/stat.h> #include <qtextcodec.h> +#include <unistd.h> #include "version.h" #include "doxygen.h" @@ -66,6 +67,7 @@ #include "parserintf.h" #include "htags.h" #include "pyscanner.h" +#include "code.h" #define RECURSE_ENTRYTREE(func,var) \ @@ -125,7 +127,7 @@ bool Doxygen::parseSourcesNeeded = FALSE; double Doxygen::sysElapsedTime = 0.0; QTime Doxygen::runningTime; SearchIndex * Doxygen::searchIndex=0; -SDict<DefinitionList> *Doxygen::symbolMap; +QDict<DefinitionIntf> *Doxygen::symbolMap; bool Doxygen::outputToWizard=FALSE; QDict<int> * Doxygen::htmlDirMap = 0; QCache<LookupInfo> Doxygen::lookupCache(50000,50000); @@ -1406,7 +1408,9 @@ 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) + if (rootNav->parent() && rootNav->parent()->section()==Entry::NAMESPACE_SEC && + (fd==0 || fd->name().right(5)!=".java") // not a .java file + ) { nsName=stripAnonymousNamespaceScope(rootNav->parent()->name()); if (!nsName.isEmpty()) @@ -1582,8 +1586,13 @@ static void findUsingDeclarations(EntryNav *rootNav) // file scope). QCString name = substitute(root->name,".","::"); - MemberDef *mtd=0; - usingCd = getResolvedClass(nd,fd,name,&mtd); + //MemberDef *mtd=0; + //usingCd = getResolvedClass(nd,fd,name,&mtd); + usingCd = getClass(name); + if (usingCd==0) + { + usingCd = Doxygen::hiddenClasses.find(name); + } //printf("%s -> %p\n",root->name.data(),usingCd); if (usingCd==0) // definition not in the input => add an artificial class @@ -1592,7 +1601,7 @@ static void findUsingDeclarations(EntryNav *rootNav) name.data(),root->section,root->tArgLists ? (int)root->tArgLists->count() : -1); usingCd = new ClassDef( "<using>",1, - root->name,ClassDef::Class); + name,ClassDef::Class); Doxygen::hiddenClasses.append(root->name,usingCd); usingCd->setClassIsArtificial(); } @@ -1602,6 +1611,7 @@ static void findUsingDeclarations(EntryNav *rootNav) usingCd->name().data(),nd?nd->name().data():fd->name().data()); } +#if 0 if (mtd) // add the typedef to the correct scope { if (nd) @@ -1615,7 +1625,9 @@ static void findUsingDeclarations(EntryNav *rootNav) fd->addUsingDeclaration(mtd); } } - else if (usingCd) // add the class to the correct scope + else +#endif + if (usingCd) // add the class to the correct scope { if (nd) { @@ -2371,8 +2383,9 @@ static void buildVarList(EntryNav *rootNav) scope=root->relates; } - // note: changed from scope to classScope on 2-10-2005 - if (!classScope.isEmpty() && !name.isEmpty() && (cd=getClass(classScope))) + cd=getClass(scope); + if (cd==0 && classScope!=scope) cd=getClass(classScope); + if (cd) { MemberDef *md=0; @@ -4946,7 +4959,9 @@ static void findMember(EntryNav *rootNav, } if (root->relates.isEmpty() && rootNav->parent() && - (rootNav->parent()->section()&Entry::SCOPE_MASK) && + ((rootNav->parent()->section()&Entry::SCOPE_MASK) || + (rootNav->parent()->section()==Entry::OBJCIMPL_SEC) + ) && !rootNav->parent()->name().isEmpty()) // see if we can combine scopeName // with the scope in which it was found { @@ -5373,6 +5388,7 @@ static void findMember(EntryNav *rootNav, mn->append(md); cd->insertMember(md); md->setRefItems(root->sli); + delete tArgList; } else { @@ -5711,6 +5727,7 @@ static void filterMemberDocumentation(EntryNav *rootNav) "findMemberDocumentation(): root->type=`%s' root->inside=`%s' root->name=`%s' root->args=`%s' section=%x root->memSpec=%d root->mGrpId=%d\n", root->type.data(),root->inside.data(),root->name.data(),root->args.data(),root->section,root->memSpec,root->mGrpId ); + //printf("rootNav->parent()->name()=%s\n",rootNav->parent()->name().data()); bool isFunc=TRUE; if (root->relatesDup && !root->relates.isEmpty()) @@ -7426,7 +7443,7 @@ static void generateNamespaceDocs() nd->writeDocumentation(*outputList); } // for each class in the namespace... - ClassSDict::Iterator cli(*nd->classSDict); + ClassSDict::Iterator cli(*nd->getClassSDict()); for ( ; cli.current() ; ++cli ) { ClassDef *cd=cli.current(); @@ -8267,8 +8284,8 @@ void initDoxygen() setlocale(LC_ALL,""); setlocale(LC_NUMERIC,"C"); #endif - Doxygen::symbolMap = new SDict<DefinitionList>(1000); - Doxygen::symbolMap->setAutoDelete(TRUE); + Doxygen::symbolMap = new QDict<DefinitionIntf>(1000); + //Doxygen::symbolMap->setAutoDelete(TRUE); Doxygen::globalScope = new NamespaceDef("<globalScope>",1,"<globalScope>"); Doxygen::runningTime.start(); @@ -8315,6 +8332,26 @@ void cleanUpDoxygen() 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 (di->definitionType()==DefinitionIntf::TypeSymbolList) + { + DefinitionIntf *tmp = Doxygen::symbolMap->take(dli.currentKey()); + delete (DefinitionList *)tmp; + } + else + { + ++dli; + } + } + + //delete Doxygen::symbolMap; <- we cannot do this unless all static lists // (such as Doxygen::namespaceSDict) // with objects based on Definition are made @@ -8595,6 +8632,14 @@ void readConfiguration(int argc, char **argv) cleanUpDoxygen(); exit(0); } + + /* Perlmod wants to know the path to the config file.*/ + QFileInfo configFileInfo(configName); + setPerlModDoxyfile(configFileInfo.absFilePath()); +} + +void checkConfiguration() +{ Config::instance()->substituteEnvironmentVars(); Config::instance()->convertStrToVal(); @@ -8620,9 +8665,6 @@ void readConfiguration(int argc, char **argv) /* Set the global html file extension. */ Doxygen::htmlFileExtension = Config_getString("HTML_FILE_EXTENSION"); - /* Perlmod wants to know the path to the config file.*/ - QFileInfo configFileInfo(configName); - setPerlModDoxyfile(configFileInfo.absFilePath()); Doxygen::xrefLists->setAutoDelete(TRUE); @@ -8941,6 +8983,16 @@ void parseInput() exit(1); } + // we are done with input scanning now, so free up the buffers used by flex + // (can be around 4MB) + preFreeScanner(); + scanFreeScanner(); + pyscanFreeScanner(); + + //delete rootNav; + //g_storage.close(); + //exit(1); + /************************************************************************** * Gather information * **************************************************************************/ diff --git a/src/doxygen.h b/src/doxygen.h index 2630475..88df1e5 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -110,7 +110,7 @@ class Doxygen static double sysElapsedTime; static QTime runningTime; static SearchIndex *searchIndex; - static SDict<DefinitionList> *symbolMap; + static QDict<DefinitionIntf> *symbolMap; static bool outputToWizard; static QDict<int> *htmlDirMap; static QCache<LookupInfo> lookupCache; @@ -122,6 +122,7 @@ class Doxygen void initDoxygen(); void readConfiguration(int argc, char **argv); +void checkConfiguration(); void parseInput(); void generateOutput(); diff --git a/src/entry.cpp b/src/entry.cpp index 61de661..32e8027 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -24,6 +24,7 @@ int Entry::num=0; Entry::Entry() { + //printf("Entry::Entry(%p)\n",this); num++; m_parent=0; section = EMPTY_SEC; @@ -33,7 +34,7 @@ Entry::Entry() extends->setAutoDelete(TRUE); groups = new QList<Grouping>; groups->setAutoDelete(TRUE); - anchors = new QList<SectionInfo>; + anchors = new QList<SectionInfo>; // Doxygen::sectionDict takes ownership of the items! argList = new ArgumentList; argList->setAutoDelete(TRUE); //printf("Entry::Entry() tArgList=0\n"); @@ -49,6 +50,7 @@ Entry::Entry() Entry::Entry(const Entry &e) { + //printf("Entry::Entry(%p):copy\n",this); num++; section = e.section; protection = e.protection; @@ -171,17 +173,17 @@ Entry::Entry(const Entry &e) Entry::~Entry() { + //printf("Entry::~Entry(%p) num=%d\n",this,num); //printf("Deleting entry %d name %s type %x children %d\n", // num,name.data(),section,sublist->count()); - //delete sublist; // each element is now own by a EntryNav so we do no longer own - // our children. + delete m_sublist; // each element is now own by a EntryNav so we do no longer own + // our children. delete extends; delete groups; delete anchors; delete argList; delete tArgLists; - //delete mtArgList; delete tagInfo; delete sli; num--; @@ -200,6 +202,7 @@ void Entry::addSubEntry(Entry *current) void Entry::reset() { + //printf("Entry::reset()\n"); name.resize(0); type.resize(0); args.resize(0); @@ -273,12 +276,14 @@ void Entry::createSubtreeIndex(EntryNav *nav,QFile &storage,FileDef *fd) { childNode->createSubtreeIndex(childNav,storage,fd); } + //m_sublist->setAutoDelete(FALSE); m_sublist->clear(); } } void Entry::createNavigationIndex(EntryNav *rootNav,QFile &storage,FileDef *fd) { + //printf("createNavigationIndex(%p) sublist=%p\n",this,m_sublist); if (m_sublist) { //printf("saveEntries: %d children\n",root->sublist->count()); @@ -290,6 +295,7 @@ void Entry::createNavigationIndex(EntryNav *rootNav,QFile &storage,FileDef *fd) createSubtreeIndex(rootNav,storage,fd); } // remove all entries from root + //m_sublist->setAutoDelete(FALSE); m_sublist->clear(); } } @@ -535,6 +541,7 @@ ArgumentList *unmarshalArgumentList(QFile &f) 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++) { @@ -560,6 +567,7 @@ QList<ArgumentList> *unmarshalArgumentLists(QFile &f) 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++) { @@ -574,6 +582,7 @@ QList<BaseInfo> *unmarshalBaseInfoList(QFile &f) 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); @@ -590,6 +599,7 @@ QList<Grouping> *unmarshalGroupingList(QFile &f) 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); @@ -605,6 +615,7 @@ QList<SectionInfo> *unmarshalSectionInfoList(QFile &f) 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); @@ -623,6 +634,7 @@ QList<ListItemInfo> *unmarshalItemInfoList(QFile &f) 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; @@ -710,6 +722,7 @@ bool loadEntry(Entry *e,QFile &f) e->virt = (Specifier)unmarshalInt(f); e->args = unmarshalQCString(f); e->bitfields = unmarshalQCString(f); + delete e->argList; e->argList = unmarshalArgumentList(f); e->tArgLists = unmarshalArgumentLists(f); e->program = unmarshalQCString(f); @@ -734,8 +747,11 @@ bool loadEntry(Entry *e,QFile &f) e->bodyLine = unmarshalInt(f); e->endBodyLine = unmarshalInt(f); e->mGrpId = unmarshalInt(f); + delete e->extends; e->extends = unmarshalBaseInfoList(f); + delete e->groups; e->groups = unmarshalGroupingList(f); + delete e->anchors; e->anchors = unmarshalSectionInfoList(f); e->fileName = unmarshalQCString(f); e->startLine = unmarshalInt(f); @@ -832,8 +848,8 @@ void EntryNav::releaseEntry() { if (!m_noLoad) { - delete m_info; //printf("EntryNav::releaseEntry %p\n",m_info); + delete m_info; m_info=0; } } diff --git a/src/filedef.cpp b/src/filedef.cpp index a830fba..dfa5cc4 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -55,6 +55,7 @@ class DevNullCodeDocInterface : public CodeOutputInterface virtual void startFontClass(const char *) {} virtual void endFontClass() {} virtual void writeCodeAnchor(const char *) {} + virtual void linkableSymbol(int, const char *,Definition *,Definition *) {} }; @@ -83,6 +84,8 @@ FileDef::FileDef(const char *p,const char *nm, srcMemberDict = 0; usingDirList = 0; usingDeclList = 0; + +#if 0 allMemberList = 0; decDefineMembers = 0; decProtoMembers = 0; @@ -96,6 +99,8 @@ FileDef::FileDef(const char *p,const char *nm, docEnumMembers = 0; docFuncMembers = 0; docVarMembers = 0; +#endif + package = 0; isSource = FALSE; docname = nm; @@ -104,6 +109,7 @@ FileDef::FileDef(const char *p,const char *nm, { docname.prepend(stripFromPath(path.copy())); } + m_isJava = name().right(5)==".java"; memberGroupSDict = 0; acquireFileVersion(); } @@ -122,6 +128,8 @@ FileDef::~FileDef() delete usingDirList; delete usingDeclList; delete memberGroupSDict; + +#if 0 delete allMemberList; delete decDefineMembers; delete decProtoMembers; @@ -135,12 +143,14 @@ FileDef::~FileDef() delete docEnumMembers; delete docFuncMembers; delete docVarMembers; +#endif } /*! Compute the HTML anchor names for all members in the class */ void FileDef::computeAnchors() { - if (allMemberList) setAnchors(0,'a',allMemberList); + MemberList *ml = getMemberList(MemberList::allMembersList); + if (ml) setAnchors(0,'a',ml); } void FileDef::distributeMemberGroupDocumentation() @@ -169,12 +179,16 @@ void FileDef::findSectionsInDocumentation() mg->findSectionsInDocumentation(); } } - if (decDefineMembers) decDefineMembers->findSectionsInDocumentation(); - if (decProtoMembers) decProtoMembers->findSectionsInDocumentation(); - if (decTypedefMembers) decTypedefMembers->findSectionsInDocumentation(); - if (decEnumMembers) decEnumMembers->findSectionsInDocumentation(); - if (decFuncMembers) decFuncMembers->findSectionsInDocumentation(); - if (decVarMembers) decVarMembers->findSectionsInDocumentation(); + + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ml->findSectionsInDocumentation(); + } + } } void FileDef::writeDetailedDocumentation(OutputList &ol) @@ -520,12 +534,18 @@ void FileDef::writeDocumentation(OutputList &ol) } //allMemberList.writeDeclarations(ol,0,0,this,0,0,0); - if (decDefineMembers) decDefineMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trDefines(),0); - if (decProtoMembers) decProtoMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trFuncProtos(),0); - if (decTypedefMembers) decTypedefMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trTypedefs(),0); - if (decEnumMembers) decEnumMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trEnumerations(),0); - if (decFuncMembers) decFuncMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trFunctions(),0); - if (decVarMembers) decVarMembers->writeDeclarations(ol,0,0,this,0,theTranslator->trVariables(),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")) @@ -553,7 +573,8 @@ void FileDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEPARATE_MEMBER_PAGES")) { - if (allMemberList) allMemberList->sort(); + MemberList *ml = getMemberList(MemberList::allMembersList); + if (ml) ml->sort(); writeMemberPages(ol); } } @@ -565,41 +586,47 @@ void FileDef::writeMemberDocumentation(OutputList &ol) ol.disable(OutputGenerator::Html); } - if (docDefineMembers) - { - docDefineMembers->writeDocumentation(ol,name(),this, - theTranslator->trDefineDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docDefineMembers,theTranslator->trDefineDocumentation()); + //if (docDefineMembers) + //{ + // docDefineMembers->writeDocumentation(ol,name(),this, + // theTranslator->trDefineDocumentation()); + //} - if (docProtoMembers) - { - docProtoMembers->writeDocumentation(ol,name(),this, - theTranslator->trFunctionPrototypeDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docProtoMembers,theTranslator->trFunctionPrototypeDocumentation()); + //if (docProtoMembers) + //{ + // docProtoMembers->writeDocumentation(ol,name(),this, + // theTranslator->trFunctionPrototypeDocumentation()); + //} - if (docTypedefMembers) - { - docTypedefMembers->writeDocumentation(ol,name(),this, - theTranslator->trTypedefDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()); + //if (docTypedefMembers) + //{ + // docTypedefMembers->writeDocumentation(ol,name(),this, + // theTranslator->trTypedefDocumentation()); + //} - if (docEnumMembers) - { - docEnumMembers->writeDocumentation(ol,name(),this, - theTranslator->trEnumerationTypeDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + //if (docEnumMembers) + //{ + // docEnumMembers->writeDocumentation(ol,name(),this, + // theTranslator->trEnumerationTypeDocumentation()); + //} - if (docFuncMembers) - { - docFuncMembers->writeDocumentation(ol,name(),this, - theTranslator->trFunctionDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docFuncMembers,theTranslator->trFunctionDocumentation()); + //if (docFuncMembers) + //{ + // docFuncMembers->writeDocumentation(ol,name(),this, + // theTranslator->trFunctionDocumentation()); + //} - if (docVarMembers) - { - docVarMembers->writeDocumentation(ol,name(),this, - theTranslator->trVariableDocumentation()); - } + writeMemberDocumentation(ol,MemberList::docVarMembers,theTranslator->trVariableDocumentation()); + //if (docVarMembers) + //{ + // docVarMembers->writeDocumentation(ol,name(),this, + // theTranslator->trVariableDocumentation()); + //} if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -612,12 +639,23 @@ void FileDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + 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(); } @@ -629,6 +667,7 @@ void FileDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); + MemberList *allMemberList = getMemberList(MemberList::allMembersList); if (allMemberList) { MemberListIterator mli(*allMemberList); @@ -725,12 +764,23 @@ void FileDef::parseSource() void FileDef::addMembersToMemberGroup() { + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ::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 */ @@ -738,6 +788,7 @@ 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) { return; @@ -745,63 +796,74 @@ void FileDef::insertMember(MemberDef *md) if (allMemberList==0) { - allMemberList = new MemberList; + allMemberList = new MemberList(MemberList::allMembersList); + m_memberLists.append(allMemberList); } allMemberList->append(md); - bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); - bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); switch (md->memberType()) { case MemberDef::Variable: case MemberDef::Property: - if (decVarMembers==0) decVarMembers = new MemberList; - if (sortBriefDocs) decVarMembers->inSort(md); else decVarMembers->append(md); - if (docVarMembers==0) docVarMembers = new MemberList; - if (sortMemberDocs) docVarMembers->inSort(md); else docVarMembers->append(md); - docVarMembers->setInFile(TRUE); + 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: - if (decFuncMembers==0) decFuncMembers = new MemberList; - if (sortBriefDocs) decFuncMembers->inSort(md); else decFuncMembers->append(md); - if (docFuncMembers==0) docFuncMembers = new MemberList; - if (sortMemberDocs) docFuncMembers->inSort(md); else docFuncMembers->append(md); - docFuncMembers->setInFile(TRUE); + 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: - if (decTypedefMembers==0) decTypedefMembers = new MemberList; - if (sortBriefDocs) decTypedefMembers->inSort(md); else decTypedefMembers->append(md); - if (docTypedefMembers==0) docTypedefMembers = new MemberList; - if (sortMemberDocs) docTypedefMembers->inSort(md); else docTypedefMembers->append(md); - docTypedefMembers->setInFile(TRUE); + 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: - if (decEnumMembers==0) decEnumMembers = new MemberList; - if (sortBriefDocs) decEnumMembers->inSort(md); else decEnumMembers->append(md); - if (docEnumMembers==0) docEnumMembers = new MemberList; - if (sortMemberDocs) docEnumMembers->inSort(md); else docEnumMembers->append(md); - docEnumMembers->setInFile(TRUE); + 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: - if (decProtoMembers==0) decProtoMembers = new MemberList; - if (sortBriefDocs) decProtoMembers->inSort(md); else decProtoMembers->append(md); - if (docProtoMembers==0) docProtoMembers = new MemberList; - if (sortMemberDocs) docProtoMembers->inSort(md); else docProtoMembers->append(md); - docProtoMembers->setInFile(TRUE); + 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: - if (decDefineMembers==0) decDefineMembers = new MemberList; - if (sortBriefDocs) decDefineMembers->inSort(md); else decDefineMembers->append(md); - if (docDefineMembers==0) docDefineMembers = new MemberList; - if (sortMemberDocs) docDefineMembers->inSort(md); else docDefineMembers->append(md); - docDefineMembers->setInFile(TRUE); + 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(): " "member `%s' with class scope `%s' inserted in file scope `%s'!\n", md->name().data(), - md->getClassDef() ? md->getClassDef()->name().data() : "", + md->getClassDef() ? md->getClassDef()->name().data() : "<global>", name().data()); } //addMemberToGroup(md,groupId); @@ -1025,12 +1087,24 @@ void FileDef::addListReferences() mg->addListReferences(this); } } + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + 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 } //------------------------------------------------------------------- @@ -1383,3 +1457,64 @@ QCString FileDef::includeName() const } } +MemberList *FileDef::createMemberList(MemberList::ListType lt) +{ + m_memberLists.setAutoDelete(TRUE); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()==lt) + { + return ml; + } + } + // not found, create a new member list + ml = new MemberList(lt); + m_memberLists.append(ml); + return ml; +} + +void FileDef::addMemberToList(MemberList::ListType lt,MemberDef *md) +{ + static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); + static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); + MemberList *ml = createMemberList(lt); + if (((ml->listType()&MemberList::declarationLists) && sortBriefDocs) || + ((ml->listType()&MemberList::documentationLists) && sortMemberDocs) + ) + ml->inSort(md); + else + ml->append(md); + if (lt&MemberList::documentationLists) + { + ml->setInFile(TRUE); + } +} + +MemberList *FileDef::getMemberList(MemberList::ListType lt) const +{ + FileDef *that = (FileDef*)this; + MemberList *ml = that->m_memberLists.first(); + while (ml) + { + if (ml->listType()==lt) + { + return ml; + } + ml = that->m_memberLists.next(); + } + return 0; +} + +void FileDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDeclarations(ol,0,0,this,0,title,0); +} + +void FileDef::writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDocumentation(ol,name(),this,title); +} diff --git a/src/filedef.h b/src/filedef.h index 831c0f9..1b194f8 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -127,6 +127,8 @@ class FileDef : public Definition } bool isIncluded(const QCString &name) const; + bool isJava() const { return m_isJava; } + void writeDetailedDocumentation(OutputList &ol); void writeDocumentation(OutputList &ol); void writeMemberDocumentation(OutputList &ol); @@ -168,9 +170,13 @@ 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 @@ -188,12 +194,12 @@ class FileDef : public Definition MemberList *docEnumMembers; MemberList *docFuncMembers; MemberList *docVarMembers; +#endif /* user defined member groups */ - MemberGroupSDict *memberGroupSDict; - - NamespaceSDict *namespaceSDict; - ClassSDict *classSDict; + MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } + ClassSDict *getClassSDict() const { return classSDict; } bool visited; @@ -204,6 +210,11 @@ class FileDef : public Definition void acquireFileVersion(); private: + MemberList *createMemberList(MemberList::ListType lt); + void addMemberToList(MemberList::ListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); + QDict<IncludeInfo> *includeDict; QList<IncludeInfo> *includeList; QDict<IncludeInfo> *includedByDict; @@ -218,9 +229,14 @@ class FileDef : public Definition QIntDict<Definition> *srcDefDict; QIntDict<MemberDef> *srcMemberDict; bool isSource; + bool m_isJava; QCString fileVersion; PackageDef *package; DirDef *dir; + QList<MemberList> m_memberLists; + MemberGroupSDict *memberGroupSDict; + NamespaceSDict *namespaceSDict; + ClassSDict *classSDict; }; diff --git a/src/formula.cpp b/src/formula.cpp index c906469..07d60d2 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -107,7 +107,8 @@ void FormulaList::generateBitmaps(const char *path) if (latexCmd.isEmpty()) latexCmd="latex"; if (iSystem(latexCmd,"_formulas.tex")!=0) { - err("Problems running latex. Check your installation or look for typos in _formulas.tex!\n"); + err("Problems running latex. Check your installation or look " + "for typos in _formulas.tex and check _formulas.log!\n"); formulaError=TRUE; //return; } @@ -286,7 +287,7 @@ void FormulaList::generateBitmaps(const char *path) } // remove intermediate files produced by latex thisDir.remove("_formulas.dvi"); - thisDir.remove("_formulas.log"); + if (!formulaError) thisDir.remove("_formulas.log"); // keep file in case of errors thisDir.remove("_formulas.aux"); } // remove the latex file itself diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 7aee5c0..993b213 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -45,7 +45,6 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, pageDict = new PageSDict(17); exampleDict = new PageSDict(17); dirList = new DirList; - allMemberList = new MemberList; allMemberNameInfoSDict = new MemberNameInfoSDict(17); if (refFileName) { @@ -59,6 +58,9 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, memberGroupSDict = new MemberGroupSDict; memberGroupSDict->setAutoDelete(TRUE); + allMemberList = new MemberList(MemberList::allMembersList); +#if 0 + decDefineMembers.setInGroup(TRUE); decProtoMembers.setInGroup(TRUE); decTypedefMembers.setInGroup(TRUE); @@ -74,6 +76,7 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, docEnumValMembers.setInGroup(TRUE); docFuncMembers.setInGroup(TRUE); docVarMembers.setInGroup(TRUE); +#endif visited = 0; groupScope = 0; @@ -128,12 +131,24 @@ void GroupDef::findSectionsInDocumentation() { mg->findSectionsInDocumentation(); } + + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ml->findSectionsInDocumentation(); + } + } +#if 0 decDefineMembers.findSectionsInDocumentation(); decProtoMembers.findSectionsInDocumentation(); decTypedefMembers.findSectionsInDocumentation(); decEnumMembers.findSectionsInDocumentation(); decFuncMembers.findSectionsInDocumentation(); decVarMembers.findSectionsInDocumentation(); +#endif } void GroupDef::addFile(const FileDef *def) @@ -183,6 +198,16 @@ void GroupDef::addExample(const PageDef *def) void GroupDef::addMembersToMemberGroup() { + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + } + } +#if 0 ::addMembersToMemberGroup(&decDefineMembers,&memberGroupSDict,this); ::addMembersToMemberGroup(&decProtoMembers,&memberGroupSDict,this); ::addMembersToMemberGroup(&decTypedefMembers,&memberGroupSDict,this); @@ -190,6 +215,7 @@ void GroupDef::addMembersToMemberGroup() ::addMembersToMemberGroup(&decEnumValMembers,&memberGroupSDict,this); ::addMembersToMemberGroup(&decFuncMembers,&memberGroupSDict,this); ::addMembersToMemberGroup(&decVarMembers,&memberGroupSDict,this); +#endif //printf("GroupDef::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count()); MemberGroupSDict::Iterator mgli(*memberGroupSDict); @@ -253,94 +279,108 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly) case MemberDef::Variable: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decVarMembers.inSort(md); - else - decVarMembers.append(md); + addMemberToList(MemberList::decVarMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decVarMembers.inSort(md); + //else + // decVarMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docVarMembers.inSort(md); - else - docVarMembers.append(md); + addMemberToList(MemberList::docVarMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docVarMembers.inSort(md); + //else + // docVarMembers.append(md); break; case MemberDef::Function: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decFuncMembers.inSort(md); - else - decFuncMembers.append(md); + addMemberToList(MemberList::decFuncMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decFuncMembers.inSort(md); + //else + // decFuncMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docFuncMembers.inSort(md); - else - docFuncMembers.append(md); + addMemberToList(MemberList::docFuncMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docFuncMembers.inSort(md); + //else + // docFuncMembers.append(md); break; case MemberDef::Typedef: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decTypedefMembers.inSort(md); - else - decTypedefMembers.append(md); + addMemberToList(MemberList::decTypedefMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decTypedefMembers.inSort(md); + //else + // decTypedefMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docTypedefMembers.inSort(md); - else - docTypedefMembers.append(md); + addMemberToList(MemberList::docTypedefMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docTypedefMembers.inSort(md); + //else + // docTypedefMembers.append(md); break; case MemberDef::Enumeration: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decEnumMembers.inSort(md); - else - decEnumMembers.append(md); + addMemberToList(MemberList::decEnumMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decEnumMembers.inSort(md); + //else + // decEnumMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docEnumMembers.inSort(md); - else - docEnumMembers.append(md); + addMemberToList(MemberList::docEnumMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docEnumMembers.inSort(md); + //else + // docEnumMembers.append(md); break; case MemberDef::EnumValue: if (!docOnly) { + addMemberToList(MemberList::decEnumValMembers,md); //printf("enum value %s!\n",md->name().data()); - if (Config_getBool("SORT_BRIEF_DOCS")) - decEnumValMembers.inSort(md); - else - decEnumValMembers.append(md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decEnumValMembers.inSort(md); + //else + // decEnumValMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docEnumValMembers.inSort(md); - else - docEnumValMembers.append(md); + addMemberToList(MemberList::docEnumValMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docEnumValMembers.inSort(md); + //else + // docEnumValMembers.append(md); break; case MemberDef::Prototype: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decProtoMembers.inSort(md); - else - decProtoMembers.append(md); + addMemberToList(MemberList::decProtoMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decProtoMembers.inSort(md); + //else + // decProtoMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docProtoMembers.inSort(md); - else - docProtoMembers.append(md); + addMemberToList(MemberList::docProtoMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docProtoMembers.inSort(md); + //else + // docProtoMembers.append(md); break; case MemberDef::Define: if (!docOnly) { - if (Config_getBool("SORT_BRIEF_DOCS")) - decDefineMembers.inSort(md); - else - decDefineMembers.append(md); + addMemberToList(MemberList::decDefineMembers,md); + //if (Config_getBool("SORT_BRIEF_DOCS")) + // decDefineMembers.inSort(md); + //else + // decDefineMembers.append(md); } - if (Config_getBool("SORT_MEMBER_DOCS")) - docDefineMembers.inSort(md); - else - docDefineMembers.append(md); + addMemberToList(MemberList::docDefineMembers,md); + //if (Config_getBool("SORT_MEMBER_DOCS")) + // docDefineMembers.inSort(md); + //else + // docDefineMembers.append(md); break; default: err("GroupDef::insertMembers(): " @@ -374,36 +414,36 @@ void GroupDef::removeMember(MemberDef *md) delete mni; } - allMemberList->remove(md); + removeMemberFromList(MemberList::allMembersList,md); switch(md->memberType()) { case MemberDef::Variable: - decVarMembers.remove(md); - docVarMembers.remove(md); + removeMemberFromList(MemberList::decVarMembers,md); + removeMemberFromList(MemberList::docVarMembers,md); break; case MemberDef::Function: - decFuncMembers.remove(md); - docFuncMembers.remove(md); + removeMemberFromList(MemberList::decFuncMembers,md); + removeMemberFromList(MemberList::docFuncMembers,md); break; case MemberDef::Typedef: - decTypedefMembers.remove(md); - docTypedefMembers.remove(md); + removeMemberFromList(MemberList::decTypedefMembers,md); + removeMemberFromList(MemberList::docTypedefMembers,md); break; case MemberDef::Enumeration: - decEnumMembers.remove(md); - docEnumMembers.remove(md); + removeMemberFromList(MemberList::decEnumMembers,md); + removeMemberFromList(MemberList::docEnumMembers,md); break; case MemberDef::EnumValue: - decEnumValMembers.remove(md); - docEnumValMembers.remove(md); + removeMemberFromList(MemberList::decEnumValMembers,md); + removeMemberFromList(MemberList::docEnumValMembers,md); break; case MemberDef::Prototype: - decProtoMembers.remove(md); - docProtoMembers.remove(md); + removeMemberFromList(MemberList::decProtoMembers,md); + removeMemberFromList(MemberList::docProtoMembers,md); break; case MemberDef::Define: - decDefineMembers.remove(md); - docDefineMembers.remove(md); + removeMemberFromList(MemberList::decDefineMembers,md); + removeMemberFromList(MemberList::docDefineMembers,md); break; default: err("GroupDef::removeMember(): unexpected member remove in file!\n"); @@ -418,7 +458,7 @@ bool GroupDef::containsGroup(const GroupDef *def) void GroupDef::addGroup(const GroupDef *def) { - printf("adding group `%s' to group `%s'\n",def->name().data(),name().data()); + //printf("adding group `%s' to group `%s'\n",def->name().data(),name().data()); //if (Config_getBool("SORT_MEMBER_DOCS")) // groupList->inSort(def); //else @@ -665,13 +705,20 @@ void GroupDef::writeDocumentation(OutputList &ol) } //allMemberList->writeDeclarations(ol,0,0,0,this,0,0); - decDefineMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trDefines(),0); - decProtoMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFuncProtos(),0); - decTypedefMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trTypedefs(),0); - decEnumMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trEnumerations(),0); - decEnumValMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trEnumerationValues(),0,TRUE); - decFuncMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFunctions(),0); - decVarMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trVariables(),0); + writeMemberDeclarations(ol,MemberList::decDefineMembers,theTranslator->trDefines()); + //decDefineMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trDefines(),0); + writeMemberDeclarations(ol,MemberList::decProtoMembers,theTranslator->trFuncProtos()); + //decProtoMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFuncProtos(),0); + writeMemberDeclarations(ol,MemberList::decTypedefMembers,theTranslator->trTypedefs()); + //decTypedefMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trTypedefs(),0); + writeMemberDeclarations(ol,MemberList::decEnumMembers,theTranslator->trEnumerations()); + //decEnumMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trEnumerations(),0); + writeMemberDeclarations(ol,MemberList::decEnumValMembers,theTranslator->trEnumerationValues()); + //decEnumValMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trEnumerationValues(),0,TRUE); + writeMemberDeclarations(ol,MemberList::decFuncMembers,theTranslator->trFunctions()); + //decFuncMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFunctions(),0); + writeMemberDeclarations(ol,MemberList::decVarMembers,theTranslator->trVariables()); + //decVarMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trVariables(),0); } ol.endMemberSections(); @@ -733,26 +780,33 @@ void GroupDef::writeMemberDocumentation(OutputList &ol) ol.disable(OutputGenerator::Html); } - docDefineMembers.writeDocumentation(ol,name(),this, - theTranslator->trDefineDocumentation()); + writeMemberDocumentation(ol,MemberList::docDefineMembers,theTranslator->trDefineDocumentation()); + //docDefineMembers.writeDocumentation(ol,name(),this, + // theTranslator->trDefineDocumentation()); - docProtoMembers.writeDocumentation(ol,name(),this, - theTranslator->trFunctionPrototypeDocumentation()); + writeMemberDocumentation(ol,MemberList::docProtoMembers,theTranslator->trFunctionPrototypeDocumentation()); + //docProtoMembers.writeDocumentation(ol,name(),this, + // theTranslator->trFunctionPrototypeDocumentation()); - docTypedefMembers.writeDocumentation(ol,name(),this, - theTranslator->trTypedefDocumentation()); + writeMemberDocumentation(ol,MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()); + //docTypedefMembers.writeDocumentation(ol,name(),this, + // theTranslator->trTypedefDocumentation()); - docEnumMembers.writeDocumentation(ol,name(),this, - theTranslator->trEnumerationTypeDocumentation()); + writeMemberDocumentation(ol,MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + //docEnumMembers.writeDocumentation(ol,name(),this, + // theTranslator->trEnumerationTypeDocumentation()); - docEnumValMembers.writeDocumentation(ol,name(),this, - theTranslator->trEnumerationValueDocumentation(),TRUE); + writeMemberDocumentation(ol,MemberList::docEnumValMembers,theTranslator->trEnumerationValueDocumentation()); + //docEnumValMembers.writeDocumentation(ol,name(),this, + // theTranslator->trEnumerationValueDocumentation(),TRUE); - docFuncMembers.writeDocumentation(ol,name(),this, - theTranslator->trFunctionDocumentation()); + writeMemberDocumentation(ol,MemberList::docFuncMembers,theTranslator->trFunctionDocumentation()); + //docFuncMembers.writeDocumentation(ol,name(),this, + // theTranslator->trFunctionDocumentation()); - docVarMembers.writeDocumentation(ol,name(),this, - theTranslator->trVariableDocumentation()); + writeMemberDocumentation(ol,MemberList::docVarMembers,theTranslator->trVariableDocumentation()); + //docVarMembers.writeDocumentation(ol,name(),this, + // theTranslator->trVariableDocumentation()); if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -765,12 +819,23 @@ void GroupDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + 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(); } @@ -872,8 +937,8 @@ void addDirToGroups(Entry *root,DirDef *dd) void addGroupToGroups(Entry *root,GroupDef *subGroup) { - printf("addGroupToGroups for %s groups=%d\n",root->name.data(), - root->groups?root->groups->count():-1); + //printf("addGroupToGroups for %s groups=%d\n",root->name.data(), + // root->groups?root->groups->count():-1); QListIterator<Grouping> gli(*root->groups); Grouping *g; for (;(g=gli.current());++gli) @@ -885,6 +950,11 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup) gd->addGroup(subGroup); subGroup->makePartOfGroup(gd); } + else if (gd==subGroup) + { + warn(root->fileName,root->startLine,"Trying to add group %s to itself!", + gd->name().data()); + } } } @@ -1030,12 +1100,87 @@ void GroupDef::addListReferences() { mg->addListReferences(this); } + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + ml->addListReferences(this); + } + } +#if 0 docDefineMembers.addListReferences(this); docProtoMembers.addListReferences(this); docTypedefMembers.addListReferences(this); docEnumMembers.addListReferences(this); docFuncMembers.addListReferences(this); docVarMembers.addListReferences(this); +#endif +} + +MemberList *GroupDef::createMemberList(MemberList::ListType lt) +{ + m_memberLists.setAutoDelete(TRUE); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()==lt) + { + return ml; + } + } + // not found, create a new member list + ml = new MemberList(lt); + m_memberLists.append(ml); + ml->setInGroup(TRUE); + return ml; +} + +void GroupDef::addMemberToList(MemberList::ListType lt,MemberDef *md) +{ + static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); + static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); + MemberList *ml = createMemberList(lt); + if (((ml->listType()&MemberList::declarationLists) && sortBriefDocs) || + ((ml->listType()&MemberList::documentationLists) && sortMemberDocs) + ) + ml->inSort(md); + else + ml->append(md); } +MemberList *GroupDef::getMemberList(MemberList::ListType lt) const +{ + GroupDef *that = (GroupDef*)this; + MemberList *ml = that->m_memberLists.first(); + while (ml) + { + if (ml->listType()==lt) + { + return ml; + } + ml = that->m_memberLists.next(); + } + return 0; +} + +void GroupDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDeclarations(ol,0,0,0,this,title,0); +} + +void GroupDef::writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDocumentation(ol,name(),this,title); +} + +void GroupDef::removeMemberFromList(MemberList::ListType lt,MemberDef *md) +{ + MemberList *ml = getMemberList(lt); + if (ml) ml->remove(md); +} diff --git a/src/groupdef.h b/src/groupdef.h index 2fe2302..25bc79d 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -92,26 +92,11 @@ class GroupDef : public Definition void setGroupScope(Definition *d) { groupScope = d; } Definition *getGroupScope() const { return groupScope; } - // members in the declaration part of the documentation - MemberList decDefineMembers; - MemberList decProtoMembers; - MemberList decTypedefMembers; - MemberList decEnumMembers; - MemberList decEnumValMembers; - MemberList decFuncMembers; - MemberList decVarMembers; - - // members in the documentation part of the documentation - MemberList docDefineMembers; - MemberList docProtoMembers; - MemberList docTypedefMembers; - MemberList docEnumMembers; - MemberList docEnumValMembers; - MemberList docFuncMembers; - MemberList docVarMembers; + MemberList *getMemberList(MemberList::ListType lt) const; + const QList<MemberList> &getMemberLists() const { return m_memberLists; } /* user defined member groups */ - MemberGroupSDict *memberGroupSDict; + MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } FileList * getFiles() const { return fileList; } ClassSDict * getClasses() const { return classSDict; } @@ -119,12 +104,18 @@ class GroupDef : public Definition GroupList * getSubGroups() const { return groupList; } PageSDict * getPages() const { return pageDict; } DirList * getDirs() const { return dirList; } - MemberList* getMembers() const { return allMemberList; } + //MemberList* getMembers() const { return allMemberList; } protected: void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); private: + MemberList *createMemberList(MemberList::ListType lt); + void addMemberToList(MemberList::ListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); + void removeMemberFromList(MemberList::ListType lt,MemberDef *md); + QCString title; // title of the group bool titleSet; // true if title is not the same as the name QCString fileName; // base name of the generated file @@ -141,6 +132,9 @@ class GroupDef : public Definition Definition *groupScope; + QList<MemberList> m_memberLists; + MemberGroupSDict *memberGroupSDict; + }; class GroupSDict : public SDict<GroupDef> diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 61cb0a4..17e6dd6 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -444,7 +444,7 @@ void HtmlDocVisitor::visitPost(DocRoot *) void HtmlDocVisitor::visitPre(DocSimpleSect *s) { if (m_hide) return; - m_t << "<dl compact><dt><b>"; + m_t << "<dl class=\"" << s->typeString() << "\" compact><dt><b>"; switch(s->type()) { case DocSimpleSect::See: diff --git a/src/htmlgen.h b/src/htmlgen.h index 01db829..c9e3a62 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -222,6 +222,8 @@ class HtmlGenerator : public OutputGenerator void writeCodeAnchor(const char *anchor) { t << "<a name=\"" << anchor << "\"></a>"; } + void linkableSymbol(int,const char *,Definition *,Definition *) {} + static void writeSearchPage(); private: diff --git a/src/index.cpp b/src/index.cpp index 324b42b..8e878cd 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2637,12 +2637,55 @@ void writeGraphInfo(OutputList &ol) ol.popGeneratorState(); } +void writeGroupIndexItem(GroupDef *gd,MemberList *ml,const QCString &title, + HtmlHelp *htmlHelp,FTVHelp *ftvHelp) +{ + if (ml && ml->count()>0) + { + bool first=TRUE; + MemberDef *md=ml->first(); + while (md) + { + if (md->isDetailedSectionVisible(TRUE,FALSE)) + { + if (first) + { + first=FALSE; + if (htmlHelp) + { + htmlHelp->addContentsItem(TRUE, convertToHtml(title), gd->getOutputFileBase(),0); + htmlHelp->incContentsDepth(); + } + if (ftvHelp) + { + + ftvHelp->addContentsItem(TRUE, gd->getReference(), gd->getOutputFileBase(), 0, title); + ftvHelp->incContentsDepth(); + } + } + if (htmlHelp) + { + htmlHelp->addContentsItem(FALSE,md->name(),md->getOutputFileBase(),md->anchor()); + } + if (ftvHelp) + { + ftvHelp->addContentsItem(FALSE,md->getReference(),md->getOutputFileBase(),md->anchor(),md->name()); + } + } + md=ml->next(); + } + + if (htmlHelp && !first) htmlHelp->decContentsDepth(); + if (ftvHelp && !first) ftvHelp->decContentsDepth(); + + } +} + //---------------------------------------------------------------------------- /*! * write groups as hierarchical trees * \author KPW */ - void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) { HtmlHelp *htmlHelp=0; @@ -2680,12 +2723,15 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) int numSubItems = 0; if ( Config_getBool("TOC_EXPAND")) { - numSubItems += gd->docDefineMembers.count(); - numSubItems += gd->docTypedefMembers.count(); - numSubItems += gd->docEnumMembers.count(); - numSubItems += gd->docFuncMembers.count(); - numSubItems += gd->docVarMembers.count(); - numSubItems += gd->docProtoMembers.count(); + QListIterator<MemberList> mli(gd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + numSubItems += ml->count(); + } + } numSubItems += gd->namespaceSDict->count(); numSubItems += gd->classSDict->count(); numSubItems += gd->fileList->count(); @@ -2759,6 +2805,20 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) if (Config_getBool("TOC_EXPAND")) { + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docDefineMembers), + theTranslator->trDefines(),htmlHelp,ftvHelp); + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docTypedefMembers), + theTranslator->trTypedefs(),htmlHelp,ftvHelp); + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docEnumMembers), + theTranslator->trEnumerations(),htmlHelp,ftvHelp); + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docFuncMembers), + theTranslator->trFunctions(),htmlHelp,ftvHelp); + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docVarMembers), + theTranslator->trVariables(),htmlHelp,ftvHelp); + writeGroupIndexItem(gd,gd->getMemberList(MemberList::docProtoMembers), + theTranslator->trFuncProtos(),htmlHelp,ftvHelp); +#if 0 + // write members struct MemInfo { @@ -2821,6 +2881,7 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) } } +#endif // write namespaces NamespaceSDict *namespaceSDict=gd->namespaceSDict; diff --git a/src/latexgen.h b/src/latexgen.h index 8d6d2a0..23f87ce 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -212,6 +212,7 @@ class LatexGenerator : public OutputGenerator void endFontClass() {} void writeCodeAnchor(const char *) {} + void linkableSymbol(int,const char *,Definition *,Definition *) {} private: LatexGenerator(const LatexGenerator &); diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index bf0f155..62b8d33 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -198,6 +198,7 @@ SOURCES = ce_lex.cpp \ win32:TMAKE_CXXFLAGS += -DQT_NODLL win32-msvc:TMAKE_CXXFLAGS += -Zm200 win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti +linux-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti INCLUDEPATH += ../qtools INCLUDEPATH += ../libpng INCLUDEPATH += ../libmd5 diff --git a/src/main.cpp b/src/main.cpp index 11d10b1..232bf0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ int main(int argc,char **argv) initDoxygen(); readConfiguration(argc,argv); + checkConfiguration(); parseInput(); generateOutput(); return 0; diff --git a/src/mangen.h b/src/mangen.h index 9f5c5f8..738fd65 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -267,6 +267,7 @@ class ManGenerator : public OutputGenerator //void endSectionRefList() {} void writeCodeAnchor(const char *) {} + void linkableSymbol(int,const char *,Definition *,Definition *) {} private: bool firstCol; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index a34aa67..3759a65 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -461,7 +461,7 @@ void MemberDef::insertReimplementedBy(MemberDef *md) { m_templateMaster->insertReimplementedBy(md); } - if (redefinedBy==0) redefinedBy = new MemberList; + if (redefinedBy==0) redefinedBy = new MemberList(MemberList::redefinedBy); if (redefinedBy->findRef(md)==-1) { redefinedBy->inSort(md); @@ -480,7 +480,7 @@ MemberList *MemberDef::reimplementedBy() const void MemberDef::insertEnumField(MemberDef *md) { - if (enumFields==0) enumFields=new MemberList; + if (enumFields==0) enumFields=new MemberList(MemberList::enumFields); enumFields->append(md); } diff --git a/src/memberdef.h b/src/memberdef.h index 819671f..1d2d9d3 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -259,8 +259,6 @@ class MemberDef : public Definition void setFromAnonymousMember(MemberDef *m) { annMemb=m; } bool fromAnonymousScope() const { return annScope; } bool anonymousDeclShown() const { return annUsed; } - //void setIndentDepth( int i) { indDepth=i; } - //int indentDepth() { return indDepth; } // callgraph related members bool hasCallGraph() const { return m_hasCallGraph; } @@ -283,11 +281,6 @@ class MemberDef : public Definition MemberDef *inheritsDocsFrom() const { return m_docProvider; } - //QCString getBodyAnchor() const - //{ - // return bodyMemb ? bodyMemb->anchor() : anchor(); - //} - //void setBodyMember(MemberDef *md) { bodyMemb = md; } void setDocsForDefinition(bool b) { docsForDefinition = b; } void setGroupAlias(MemberDef *md) { groupAlias = md; } MemberDef *getGroupAlias() const { return groupAlias; } diff --git a/src/membergroup.cpp b/src/membergroup.cpp index f7091b8..e3c4b24 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -39,7 +39,7 @@ MemberGroup::MemberGroup(Definition *parent, int id,const char *hdr,const char *d,const char *docFile) { //printf("New member group id=%d header=%s desc=%s\n",id,hdr,d); - memberList = new MemberList; + memberList = new MemberList(MemberList::memberGroup); grpId = id; grpHeader = hdr; doc = d; @@ -47,6 +47,7 @@ MemberGroup::MemberGroup(Definition *parent, inSameSection = TRUE; inDeclSection = 0; m_numDecMembers = -1; + m_numDocMembers = -1; m_parent = parent; m_docFile = docFile; //printf("Member group docs=`%s'\n",doc.data()); @@ -141,6 +142,16 @@ int MemberGroup::countDecMembers(/*bool sectionPerType*/) return m_numDecMembers; } +int MemberGroup::countDocMembers() +{ + if (m_numDocMembers==-1) + { + memberList->countDocMembers(); + m_numDocMembers = memberList->numDocMembers(); + } + return m_numDocMembers; +} + void MemberGroup::distributeMemberGroupDocumentation() { //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",grpHeader.data()); diff --git a/src/membergroup.h b/src/membergroup.h index 37e8faf..9c72fd6 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -55,7 +55,8 @@ class MemberGroup QCString documentation() { return doc; } bool allMembersInSameSection() { return inSameSection; } void addToDeclarationSection(); - int countDecMembers(/*bool sectionPerType*/); + int countDecMembers(); + int countDocMembers(); void distributeMemberGroupDocumentation(); void findSectionsInDocumentation(); int varCount() const; @@ -83,6 +84,7 @@ class MemberGroup MemberList *inDeclSection; bool inSameSection; int m_numDecMembers; + int m_numDocMembers; Definition *m_parent; QCString m_docFile; }; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 1fb225e..b4fbdb3 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -26,7 +26,7 @@ #include "outputlist.h" #include "groupdef.h" -MemberList::MemberList() : QList<MemberDef>() +MemberList::MemberList(ListType lt) : m_listType(lt) { memberGroupList=0; m_numDecMembers=-1; // special value indicating that computation is needed @@ -139,7 +139,7 @@ void MemberList::countDocMembers(bool countEnumValues) MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - mg->countDecMembers(); + mg->countDocMembers(); m_numDocMembers+=mg->numDocMembers(); } } diff --git a/src/memberlist.h b/src/memberlist.h index c9f1fef..27c1c52 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -29,8 +29,79 @@ class MemberGroupList; class MemberList : public QList<MemberDef> { public: - MemberList(); + enum ListType + { + privateLists = 0x0800, + detailedLists = 0x1000, + declarationLists = 0x2000, + documentationLists = 0x4000, + + pubMethods = 0, + proMethods = 1, + pacMethods = 2, + priMethods = 3 + privateLists, + pubStaticMethods = 4, + proStaticMethods = 5, + pacStaticMethods = 6, + priStaticMethods = 7 + privateLists, + pubSlots = 8, + proSlots = 9, + priSlots = 10 + privateLists, + pubAttribs = 11, + proAttribs = 12, + pacAttribs = 13, + priAttribs = 14 + privateLists, + pubStaticAttribs = 15, + proStaticAttribs = 16, + pacStaticAttribs = 17, + priStaticAttribs = 18 + privateLists, + pubTypes = 19, + proTypes = 20, + pacTypes = 21, + priTypes = 22 + privateLists, + related = 23, + signals = 24, + friends = 25, + dcopMethods = 26, + properties = 27, + events = 28, + + typedefMembers = 29 + detailedLists, + enumMembers = 30 + detailedLists, + enumValMembers = 31 + detailedLists, + functionMembers = 32 + detailedLists, + relatedMembers = 33 + detailedLists, + variableMembers = 34 + detailedLists, + propertyMembers = 35 + detailedLists, + eventMembers = 36 + detailedLists, + constructors = 37 + detailedLists, + + allMembersList = 38, + + decDefineMembers = 39 + declarationLists, + decProtoMembers = 40 + declarationLists, + decTypedefMembers = 41 + declarationLists, + decEnumMembers = 42 + declarationLists, + decFuncMembers = 43 + declarationLists, + decVarMembers = 44 + declarationLists, + decEnumValMembers = 45 + declarationLists, + + docDefineMembers = 46 + documentationLists, + docProtoMembers = 47 + documentationLists, + docTypedefMembers = 48 + documentationLists, + docEnumMembers = 49 + documentationLists, + docFuncMembers = 50 + documentationLists, + docVarMembers = 51 + documentationLists, + docEnumValMembers = 52 + documentationLists, + + redefinedBy = 53, + enumFields = 54, + memberGroup = 55 + }; + + MemberList(ListType lt); ~MemberList(); + ListType listType() const { return m_listType; } bool insert(uint index,const MemberDef *md); void inSort(const MemberDef *md); void append(const MemberDef *md); @@ -71,6 +142,7 @@ class MemberList : public QList<MemberDef> MemberGroupList *memberGroupList; bool m_inGroup; // is this list part of a group definition bool m_inFile; // is this list part of a file definition + ListType m_listType; }; class MemberListIterator : public QListIterator<MemberDef> diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 3ead6af..baa0115 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -82,12 +82,23 @@ void NamespaceDef::findSectionsInDocumentation() { mg->findSectionsInDocumentation(); } + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ml->findSectionsInDocumentation(); + } + } +#if 0 decDefineMembers.findSectionsInDocumentation(); decProtoMembers.findSectionsInDocumentation(); decTypedefMembers.findSectionsInDocumentation(); decEnumMembers.findSectionsInDocumentation(); decFuncMembers.findSectionsInDocumentation(); decVarMembers.findSectionsInDocumentation(); +#endif } void NamespaceDef::insertUsedFile(const char *f) @@ -139,82 +150,104 @@ void NamespaceDef::insertNamespace(NamespaceDef *nd) void NamespaceDef::addMembersToMemberGroup() { + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::declarationLists) + { + ::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) { - //memList->append(md); - allMemberList.append(md); - static bool sortBriefDocs=Config_getBool("SORT_BRIEF_DOCS"); + allMemberList->append(md); + //static bool sortBriefDocs=Config_getBool("SORT_BRIEF_DOCS"); switch(md->memberType()) { case MemberDef::Variable: - if (sortBriefDocs) - decVarMembers.inSort(md); - else - decVarMembers.append(md); - if (sortBriefDocs) - docVarMembers.inSort(md); - else - docVarMembers.append(md); + 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: - if (sortBriefDocs) - decFuncMembers.inSort(md); - else - decFuncMembers.append(md); - if (sortBriefDocs) - docFuncMembers.inSort(md); - else - docFuncMembers.append(md); + 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: - if (sortBriefDocs) - decTypedefMembers.inSort(md); - else - decTypedefMembers.append(md); - if (sortBriefDocs) - docTypedefMembers.inSort(md); - else - docTypedefMembers.append(md); + 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: - if (sortBriefDocs) - decEnumMembers.inSort(md); - else - decEnumMembers.append(md); - if (sortBriefDocs) - docEnumMembers.inSort(md); - else - docEnumMembers.append(md); + 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: - if (sortBriefDocs) - decProtoMembers.inSort(md); - else - decProtoMembers.append(md); - if (sortBriefDocs) - docProtoMembers.inSort(md); - else - docProtoMembers.append(md); + 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: - if (sortBriefDocs) - decDefineMembers.inSort(md); - else - decDefineMembers.append(md); - if (sortBriefDocs) - docDefineMembers.inSort(md); - else - docDefineMembers.append(md); + 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(): " @@ -228,7 +261,7 @@ void NamespaceDef::insertMember(MemberDef *md) void NamespaceDef::computeAnchors() { - setAnchors(0,'a',&allMemberList); + setAnchors(0,'a',allMemberList); } void NamespaceDef::writeDetailedDocumentation(OutputList &ol) @@ -347,13 +380,18 @@ void NamespaceDef::writeDocumentation(OutputList &ol) mg->writeDeclarations(ol,0,this,0,0); } - //allMemberList.writeDeclarations(ol,0,this,0,0,0,0); - decDefineMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trDefines(),0); - decProtoMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trFuncProtos(),0); - decTypedefMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trTypedefs(),0); - decEnumMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trEnumerations(),0); - decFuncMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trFunctions(),0); - decVarMembers.writeDeclarations(ol,0,this,0,0,theTranslator->trVariables(),0); + 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")) @@ -382,7 +420,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEPARATE_MEMBER_PAGES")) { - allMemberList.sort(); + allMemberList->sort(); writeMemberPages(ol); } } @@ -394,23 +432,29 @@ void NamespaceDef::writeMemberDocumentation(OutputList &ol) ol.disable(OutputGenerator::Html); } - docDefineMembers.writeDocumentation(ol,name(),this, - theTranslator->trDefineDocumentation()); + writeMemberDocumentation(ol,MemberList::docDefineMembers,theTranslator->trDefineDocumentation()); + //docDefineMembers.writeDocumentation(ol,name(),this, + // theTranslator->trDefineDocumentation()); - docProtoMembers.writeDocumentation(ol,name(),this, - theTranslator->trFunctionPrototypeDocumentation()); + writeMemberDocumentation(ol,MemberList::docProtoMembers,theTranslator->trFunctionPrototypeDocumentation()); + //docProtoMembers.writeDocumentation(ol,name(),this, + // theTranslator->trFunctionPrototypeDocumentation()); - docTypedefMembers.writeDocumentation(ol,name(),this, - theTranslator->trTypedefDocumentation()); + writeMemberDocumentation(ol,MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()); + //docTypedefMembers.writeDocumentation(ol,name(),this, + // theTranslator->trTypedefDocumentation()); - docEnumMembers.writeDocumentation(ol,name(),this, - theTranslator->trEnumerationTypeDocumentation()); + writeMemberDocumentation(ol,MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + //docEnumMembers.writeDocumentation(ol,name(),this, + // theTranslator->trEnumerationTypeDocumentation()); - docFuncMembers.writeDocumentation(ol,name(),this, - theTranslator->trFunctionDocumentation()); + writeMemberDocumentation(ol,MemberList::docFuncMembers,theTranslator->trFunctionDocumentation()); + //docFuncMembers.writeDocumentation(ol,name(),this, + // theTranslator->trFunctionDocumentation()); - docVarMembers.writeDocumentation(ol,name(),this, - theTranslator->trVariableDocumentation()); + writeMemberDocumentation(ol,MemberList::docVarMembers,theTranslator->trVariableDocumentation()); + //docVarMembers.writeDocumentation(ol,name(),this, + // theTranslator->trVariableDocumentation()); if (Config_getBool("SEPARATE_MEMBER_PAGES")) { @@ -423,12 +467,23 @@ void NamespaceDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + 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(); } @@ -440,7 +495,7 @@ void NamespaceDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) co ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); - MemberListIterator mli(allMemberList); + MemberListIterator mli(*allMemberList); MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { @@ -474,8 +529,8 @@ void NamespaceDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) co int NamespaceDef::countMembers() { - allMemberList.countDocMembers(); - return allMemberList.numDocMembers()+classSDict->count(); + allMemberList->countDocMembers(); + return allMemberList->numDocMembers()+classSDict->count(); } void NamespaceDef::addUsingDirective(NamespaceDef *nd) @@ -544,12 +599,23 @@ void NamespaceDef::addListReferences() { mg->addListReferences(this); } + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()&MemberList::documentationLists) + { + 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 @@ -669,3 +735,74 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,bool localName) ol.endMemberList(); } +MemberList *NamespaceDef::createMemberList(MemberList::ListType lt) +{ + m_memberLists.setAutoDelete(TRUE); + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if (ml->listType()==lt) + { + return ml; + } + } + // not found, create a new member list + ml = new MemberList(lt); + m_memberLists.append(ml); + return ml; +} + +void NamespaceDef::addMemberToList(MemberList::ListType lt,MemberDef *md) +{ + static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); + static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); + MemberList *ml = createMemberList(lt); + if (((ml->listType()&MemberList::declarationLists) && sortBriefDocs) || + ((ml->listType()&MemberList::documentationLists) && sortMemberDocs) + ) + ml->inSort(md); + else + ml->append(md); +} + +MemberList *NamespaceDef::getMemberList(MemberList::ListType lt) const +{ + NamespaceDef *that = (NamespaceDef*)this; + MemberList *ml = that->m_memberLists.first(); + while (ml) + { + if (ml->listType()==lt) + { + return ml; + } + ml = that->m_memberLists.next(); + } + return 0; +} + +void NamespaceDef::writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0); +} + +void NamespaceDef::writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title) +{ + MemberList * ml = getMemberList(lt); + if (ml) ml->writeDocumentation(ol,name(),this,title); +} + + +bool NamespaceDef::isLinkableInProject() const +{ + int i = name().findRev("::"); + if (i==-1) i=0; else i+=2; + return !name().isEmpty() && name().at(i)!='@' && + hasDocumentation() && !isReference() && !isHidden(); +} + +bool NamespaceDef::isLinkable() const +{ + return isLinkableInProject() || isReference(); +} diff --git a/src/namespacedef.h b/src/namespacedef.h index 03418bc..e32f170 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -64,17 +64,8 @@ class NamespaceDef : public Definition void combineUsingRelations(); QCString displayName() const; - bool isLinkableInProject() const - { - int i = name().findRev("::"); - if (i==-1) i=0; else i+=2; - return !name().isEmpty() && name().at(i)!='@' && - hasDocumentation() && !isReference() && !isHidden(); - } - bool isLinkable() const - { - return isLinkableInProject() || isReference(); - } + bool isLinkableInProject() const; + bool isLinkable() const; void addMembersToMemberGroup(); void distributeMemberGroupDocumentation(); void findSectionsInDocumentation(); @@ -83,49 +74,38 @@ class NamespaceDef : public Definition void addInnerCompound(Definition *d); void addListReferences(); - //protected: - // void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); + MemberList *getMemberList(MemberList::ListType lt) const; + const QList<MemberList> &getMemberLists() const { return m_memberLists; } - public: - - // members in the declaration part of the documentation - MemberList decDefineMembers; - MemberList decProtoMembers; - MemberList decTypedefMembers; - MemberList decEnumMembers; - MemberList decFuncMembers; - MemberList decVarMembers; - - // members in the documentation part of the documentation - MemberList docAllMemberList; - MemberList docDefineMembers; - MemberList docProtoMembers; - MemberList docTypedefMembers; - MemberList docEnumMembers; - MemberList docFuncMembers; - MemberList docVarMembers; - - /* user defined member groups */ - MemberGroupSDict *memberGroupSDict; - - /*! Classes inside this namespace */ - ClassSDict *classSDict; - /*! Namespaces inside this namespace */ - NamespaceSDict *namespaceSDict; + /*! Returns the user defined member groups */ + MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } - bool visited; - - private: - //QCString reference; - QCString fileName; - QStrList files; + /*! Returns the classes contained in this namespace */ + ClassSDict *getClassSDict() const { return classSDict; } + /*! Returns the namespaces contained in this namespace */ + NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } - NamespaceSDict *usingDirList; - SDict<Definition> *usingDeclList; - SDict<Definition> *m_innerCompounds; + bool visited; - MemberList allMemberList; + private: + MemberList *createMemberList(MemberList::ListType lt); + void addMemberToList(MemberList::ListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title); + + QCString fileName; + QStrList files; + + NamespaceSDict *usingDirList; + SDict<Definition> *usingDeclList; + SDict<Definition> *m_innerCompounds; + + MemberList *allMemberList; + QList<MemberList> m_memberLists; + MemberGroupSDict *memberGroupSDict; + ClassSDict *classSDict; + NamespaceSDict *namespaceSDict; }; diff --git a/src/outputgen.h b/src/outputgen.h index ffbfc18..81cda2d 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -36,6 +36,7 @@ class DotGroupCollaboration; class DocNode; class MemberDef; class GroupDef; +class Definition; /*! \brief Output interface for code parser. */ @@ -69,6 +70,8 @@ class CodeOutputInterface virtual void startFontClass(const char *) = 0; virtual void endFontClass() = 0; virtual void writeCodeAnchor(const char *name) = 0; + virtual void linkableSymbol(int line,const char *symName, + Definition *symDef,Definition *context) = 0; }; /*! \brief Base Interface used for generating output outside of the diff --git a/src/outputlist.h b/src/outputlist.h index 5e0a9f0..8c6def4 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -391,6 +391,7 @@ class OutputList : public OutputDocInterface og=outputs->next(); } } + void linkableSymbol(int,const char *,Definition *,Definition *) {} private: void debug(); diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index c9c8962..cf8be57 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1690,34 +1690,34 @@ void PerlModGenerator::generatePerlModForClass(ClassDef *cd) addTemplateList(cd,m_output); addListOfAllMembers(cd); - MemberGroupSDict::Iterator mgli(*cd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) generatePerlModSection(cd,mg->members(),"user_defined",mg->header()); - generatePerlModSection(cd,cd->pubTypes,"public_typedefs"); - generatePerlModSection(cd,cd->pubMethods,"public_methods"); - generatePerlModSection(cd,cd->pubAttribs,"public_members"); - generatePerlModSection(cd,cd->pubSlots,"public_slots"); - generatePerlModSection(cd,cd->signals,"signals"); - generatePerlModSection(cd,cd->dcopMethods,"dcop_methods"); - generatePerlModSection(cd,cd->properties,"properties"); - generatePerlModSection(cd,cd->pubStaticMethods,"public_static_methods"); - generatePerlModSection(cd,cd->pubStaticAttribs,"public_static_members"); - generatePerlModSection(cd,cd->proTypes,"protected_typedefs"); - generatePerlModSection(cd,cd->proMethods,"protected_methods"); - generatePerlModSection(cd,cd->proAttribs,"protected_members"); - generatePerlModSection(cd,cd->proSlots,"protected_slots"); - generatePerlModSection(cd,cd->proStaticMethods,"protected_static_methods"); - generatePerlModSection(cd,cd->proStaticAttribs,"protected_static_members"); - generatePerlModSection(cd,cd->priTypes,"private_typedefs"); - generatePerlModSection(cd,cd->priMethods,"private_methods"); - generatePerlModSection(cd,cd->priAttribs,"private_members"); - generatePerlModSection(cd,cd->priSlots,"private_slots"); - generatePerlModSection(cd,cd->priStaticMethods,"private_static_methods"); - generatePerlModSection(cd,cd->priStaticAttribs,"private_static_members"); - generatePerlModSection(cd,cd->friends,"friend_methods"); - generatePerlModSection(cd,cd->related,"related_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubTypes),"public_typedefs"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubMethods),"public_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubAttribs),"public_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubSlots),"public_slots"); + generatePerlModSection(cd,cd->getMemberList(MemberList::signals),"signals"); + generatePerlModSection(cd,cd->getMemberList(MemberList::dcopMethods),"dcop_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::properties),"properties"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubStaticMethods),"public_static_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::pubStaticAttribs),"public_static_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proTypes),"protected_typedefs"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proMethods),"protected_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proAttribs),"protected_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proSlots),"protected_slots"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proStaticMethods),"protected_static_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::proStaticAttribs),"protected_static_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priTypes),"private_typedefs"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priMethods),"private_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priAttribs),"private_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priSlots),"private_slots"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priStaticMethods),"private_static_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::priStaticAttribs),"private_static_members"); + generatePerlModSection(cd,cd->getMemberList(MemberList::friends),"friend_methods"); + generatePerlModSection(cd,cd->getMemberList(MemberList::related),"related_methods"); addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->briefDescription()); addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->documentation()); @@ -1767,7 +1767,7 @@ void PerlModGenerator::generatePerlModForNamespace(NamespaceDef *nd) m_output.openHash() .addFieldQuotedString("name", nd->name()); - ClassSDict *cl = nd->classSDict; + ClassSDict *cl = nd->getClassSDict(); if (cl) { m_output.openList("classes"); @@ -1780,7 +1780,7 @@ void PerlModGenerator::generatePerlModForNamespace(NamespaceDef *nd) m_output.closeList(); } - NamespaceSDict *nl = nd->namespaceSDict; + NamespaceSDict *nl = nd->getNamespaceSDict(); if (nl) { m_output.openList("namespaces"); @@ -1793,17 +1793,17 @@ void PerlModGenerator::generatePerlModForNamespace(NamespaceDef *nd) m_output.closeList(); } - MemberGroupSDict::Iterator mgli(*nd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) generatePerlModSection(nd,mg->members(),"user-defined",mg->header()); - generatePerlModSection(nd,&nd->decDefineMembers,"defines"); - generatePerlModSection(nd,&nd->decProtoMembers,"prototypes"); - generatePerlModSection(nd,&nd->decTypedefMembers,"typedefs"); - generatePerlModSection(nd,&nd->decEnumMembers,"enums"); - generatePerlModSection(nd,&nd->decFuncMembers,"functions"); - generatePerlModSection(nd,&nd->decVarMembers,"variables"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decDefineMembers),"defines"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decProtoMembers),"prototypes"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decTypedefMembers),"typedefs"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decEnumMembers),"enums"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decFuncMembers),"functions"); + generatePerlModSection(nd,nd->getMemberList(MemberList::decVarMembers),"variables"); addPerlModDocBlock(m_output,"brief",nd->getDefFileName(),nd->getDefLine(),0,0,nd->briefDescription()); addPerlModDocBlock(m_output,"detailed",nd->getDefFileName(),nd->getDefLine(),0,0,nd->documentation()); @@ -1867,12 +1867,12 @@ void PerlModGenerator::generatePerlModForFile(FileDef *fd) } m_output.closeList(); - generatePerlModSection(fd,fd->decDefineMembers,"defines"); - generatePerlModSection(fd,fd->decProtoMembers,"prototypes"); - generatePerlModSection(fd,fd->decTypedefMembers,"typedefs"); - generatePerlModSection(fd,fd->decEnumMembers,"enums"); - generatePerlModSection(fd,fd->decFuncMembers,"functions"); - generatePerlModSection(fd,fd->decVarMembers,"variables"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decDefineMembers),"defines"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decProtoMembers),"prototypes"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decTypedefMembers),"typedefs"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decEnumMembers),"enums"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decFuncMembers),"functions"); + generatePerlModSection(fd,fd->getMemberList(MemberList::decVarMembers),"variables"); addPerlModDocBlock(m_output,"brief",fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription()); addPerlModDocBlock(m_output,"detailed",fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation()); @@ -1965,17 +1965,17 @@ void PerlModGenerator::generatePerlModForGroup(GroupDef *gd) m_output.closeList(); } - MemberGroupSDict::Iterator mgli(*gd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*gd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) generatePerlModSection(gd,mg->members(),"user-defined",mg->header()); - generatePerlModSection(gd,&gd->decDefineMembers,"defines"); - generatePerlModSection(gd,&gd->decProtoMembers,"prototypes"); - generatePerlModSection(gd,&gd->decTypedefMembers,"typedefs"); - generatePerlModSection(gd,&gd->decEnumMembers,"enums"); - generatePerlModSection(gd,&gd->decFuncMembers,"functions"); - generatePerlModSection(gd,&gd->decVarMembers,"variables"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decDefineMembers),"defines"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decProtoMembers),"prototypes"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decTypedefMembers),"typedefs"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decEnumMembers),"enums"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decFuncMembers),"functions"); + generatePerlModSection(gd,gd->getMemberList(MemberList::decVarMembers),"variables"); addPerlModDocBlock(m_output,"brief",gd->getDefFileName(),gd->getDefLine(),0,0,gd->briefDescription()); addPerlModDocBlock(m_output,"detailed",gd->getDefFileName(),gd->getDefLine(),0,0,gd->documentation()); @@ -28,5 +28,6 @@ void initPreprocessor(); void cleanUpPreprocessor(); void addSearchDir(const char *dir); void preprocessFile(const char *fileName,BufStr &output); +void preFreeScanner(); #endif @@ -105,6 +105,7 @@ static int g_condCtx; static bool g_skip; static QStack<bool> g_condStack; +static bool g_lexInit = FALSE; static void setFileName(const char *name) @@ -2377,6 +2378,7 @@ void preprocessFile(const char *fileName,BufStr &output) g_guardExpr.resize(0); preYYlex(); + g_lexInit=TRUE; if (inputFilter.isEmpty()) fclose(preYYin); else @@ -2399,6 +2401,16 @@ void preprocessFile(const char *fileName,BufStr &output) } } +void preFreeScanner() +{ +#if defined(YY_FLEX_SUBMINOR_VERSION) + if (g_lexInit) + { + preYYlex_destroy(); + } +#endif +} + #if !defined(YY_FLEX_SUBMINOR_VERSION) extern "C" { // some bogus code to keep the compiler happy // int preYYwrap() { return 1 ; } diff --git a/src/pycode.l b/src/pycode.l index 306a042..8cc79a4 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -715,6 +715,36 @@ static void generateFunctionLink(CodeOutputInterface &ol,char *funcName) return; } +static void findMemberLink(CodeOutputInterface &ol,Definition *sym,const char *symName) +{ + //printf("sym %s outerScope=%s equal=%d\n", + // sym->name().data(),sym->getOuterScope()->name().data(), + // sym->getOuterScope()==g_currentDefinition); + + if (sym->getOuterScope() && + sym->getOuterScope()->definitionType()==Definition::TypeClass && + g_currentDefinition->definitionType()==Definition::TypeClass) + { + ClassDef *cd = (ClassDef*)sym->getOuterScope(); + ClassDef *thisCd = (ClassDef *)g_currentDefinition; + QCString anchor; + if (sym->definitionType()==Definition::TypeMember) + { + anchor=((MemberDef *)sym)->anchor(); + } + + // TODO: find the nearest base class in case cd is a base class of + // thisCd + if (cd==thisCd) + { + writeMultiLineCodeLink(ol,sym->getReference(), + sym->getOutputFileBase(), + anchor, + symName); + } + } +} + static void findMemberLink(CodeOutputInterface &ol,char *symName) { //printf("Member reference: %s scope=%s member=%s\n", @@ -724,42 +754,20 @@ static void findMemberLink(CodeOutputInterface &ol,char *symName) // ); if (g_currentDefinition) { - DefinitionList *dl = Doxygen::symbolMap->find(symName); - if (dl) + DefinitionIntf *di = Doxygen::symbolMap->find(symName); + if (di->definitionType()==DefinitionIntf::TypeSymbolList) // multiple symbols { - DefinitionListIterator dli(*dl); + DefinitionListIterator dli(*(DefinitionList*)di); Definition *sym; for (dli.toFirst();(sym=dli.current());++dli) { - //printf("sym %s outerScope=%s equal=%d\n", - // sym->name().data(),sym->getOuterScope()->name().data(), - // sym->getOuterScope()==g_currentDefinition); - - if (sym->getOuterScope() && - sym->getOuterScope()->definitionType()==Definition::TypeClass && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ClassDef *cd = (ClassDef*)sym->getOuterScope(); - ClassDef *thisCd = (ClassDef *)g_currentDefinition; - QCString anchor; - if (sym->definitionType()==Definition::TypeMember) - { - anchor=((MemberDef *)sym)->anchor(); - } - - // TODO: find the nearest base class in case cd is a base class of - // thisCd - if (cd==thisCd) - { - writeMultiLineCodeLink(ol,sym->getReference(), - sym->getOutputFileBase(), - anchor, - symName); - return; - } - } + findMemberLink(ol,sym,symName); } } + else // single symbol + { + findMemberLink(ol,(Definition*)di,symName); + } } //printf("sym %s not found\n",&yytext[5]); codify(symName); diff --git a/src/pyscanner.h b/src/pyscanner.h index a277b55..03dce0b 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -54,4 +54,6 @@ class PythonLanguageScanner : public ParserInterface void parsePrototype(const char *text); }; +void pyscanFreeScanner(); + #endif diff --git a/src/pyscanner.l b/src/pyscanner.l index 63d6fd4..ea4776b 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -108,6 +108,9 @@ static bool g_hideClassDocs; static QCString g_defVal; static int g_braceCount; + +static bool g_lexInit = FALSE; + //----------------------------------------------------------------------------- @@ -1060,7 +1063,7 @@ STARTDOCSYMS ^{B}"##"/[^#] <VariableDec>{ "=" { // the assignment operator - printf("====== VariableDec at line %d\n",yyLineNr); + //printf("====== VariableDec at line %d\n",yyLineNr); } {B} { // spaces } @@ -1415,6 +1418,7 @@ static void parseCompounds(Entry *rt) groupEnterCompound(yyFileName,yyLineNr,ce->name); pyscanYYlex() ; + g_lexInit=TRUE; delete current; current=0; ce->program.resize(0); @@ -1481,6 +1485,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) pyscanYYrestart( pyscanYYin ); BEGIN( Search ); pyscanYYlex(); + g_lexInit=TRUE; groupLeaveFile(yyFileName,yyLineNr); @@ -1527,6 +1532,7 @@ static void parsePrototype(const QCString &text) BEGIN( FunctionDec ); pyscanYYlex(); + g_lexInit=TRUE; current->name = current->name.stripWhiteSpace(); if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty()) @@ -1544,6 +1550,16 @@ static void parsePrototype(const QCString &text) //printf("**** parsePrototype end\n"); } +void pyscanFreeScanner() +{ +#if defined(YY_FLEX_SUBMINOR_VERSION) + if (g_lexInit) + { + pyscanYYlex_destroy(); + } +#endif +} + //---------------------------------------------------------------------------- void PythonLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root) diff --git a/src/rtfgen.h b/src/rtfgen.h index d772010..91ca8b6 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -270,6 +270,7 @@ class RTFGenerator : public OutputGenerator //void endSectionRefList() {} void writeCodeAnchor(const char *) {} + void linkableSymbol(int,const char *,Definition *,Definition *) {} static bool preProcessFileInplace(const char *path,const char *name); diff --git a/src/scanner.h b/src/scanner.h index db46ce1..e82daf8 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -49,4 +49,6 @@ class CLanguageScanner : public ParserInterface void parsePrototype(const char *text); }; +void scanFreeScanner(); + #endif diff --git a/src/scanner.l b/src/scanner.l index 84f7395..a1b76e2 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -84,6 +84,7 @@ static Entry* tempEntry = 0 ; static Entry* firstTypedefEntry = 0 ; static int yyLineNr = 1 ; static int anonCount = 0 ; +static int anonNSCount = 0 ; static QCString yyFileName; static MethodTypes mtype; static bool gstat; @@ -157,6 +158,8 @@ static char docBlockTerm; static QCString idlAttr; static QCString idlProp; +static bool g_lexInit = FALSE; + //----------------------------------------------------------------------------- @@ -559,6 +562,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) %x DefineEnd %x CompoundName %x ClassVar +%x CSConstraint %x ClassCategory %x ClassTemplSpec %x Bases @@ -1873,7 +1877,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) <FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}".*|"/*"([!*]?){B}*{CMD}"}".*"*/" { closeGroup(current,yyFileName,yyLineNr); } -<FindMembers>"=" { +<FindMembers>"=" { // in PHP code this could also be due to "<?=" current->bodyLine = yyLineNr; lastInitializerContext = YY_START; initBracketCount=0; @@ -2000,6 +2004,12 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) <SkipVerbString>. { *pSkipVerbString+=*yytext; } +<ReadInitializer>"?>" { + if (insidePHP) + BEGIN( FindMembersPHP ); + else + current->initializer+=yytext; + } <ReadInitializer>. { current->initializer+=*yytext; } @@ -3477,6 +3487,23 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) } } } +<SkipCurlyEndDoc>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { // desc is followed by another one + docBlockContext = SkipCurlyEndDoc; + docBlockInBody = FALSE; + docBlockJavaStyle = yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF"); + docBlock.resize(0); + docBlockTerm = '}'; + if (yytext[yyleng-3]=='/') + { + startCommentBlock(TRUE); + BEGIN( DocLine ); + } + else + { + startCommentBlock(FALSE); + BEGIN( DocBlock ); + } + } <SkipCurlyEndDoc>"}" { //addToBody("}"); current = tempEntry; @@ -3694,6 +3721,10 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) baseName.resize(0); BEGIN( BasesProt ) ; } + else if (insideCS && strcmp(yytext,"where")==0) // C# type contraint + { + BEGIN( CSConstraint ); + } else { if (current->section == Entry::ENUM_SEC) @@ -3703,6 +3734,11 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) current->type += ' ' ; current->type += current->name ; current->name = yytext ; + + if (nameIsOperator(current->name)) + { + BEGIN( Operator ); + } } } <ClassVar>[(\[] { @@ -3722,6 +3758,15 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) BEGIN( FindMembers ); } } +<CSConstraint>"{" { + unput('{'); + BEGIN( ClassVar ); + } +<CSConstraint>\n { + yyLineNr++; + } +<CSConstraint>. { + } <ClassCategory>{ID} { current->name+=yytext; } @@ -3792,7 +3837,14 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) current->name = removeRedundantWhiteSpace(current->name); if (current->name.isEmpty() && !isTypedef) // anonymous compound { - current->name.sprintf("@%d",anonCount++); + if (current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces + { + current->name.sprintf("@%d",anonNSCount); + } + else + { + current->name.sprintf("@%d",anonCount++); + } } curlyCount=0; if (current_root && // not a nested struct inside an @interface section @@ -4591,6 +4643,7 @@ static void parseCompounds(Entry *rt) groupEnterCompound(yyFileName,yyLineNr,ce->name); scanYYlex() ; + g_lexInit=TRUE; //forceEndGroup(); groupLeaveCompound(yyFileName,yyLineNr,ce->name); @@ -4639,6 +4692,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) initParser(); groupEnterFile(yyFileName,yyLineNr); current = new Entry; + //printf("current=%p current_root=%p\n",current,current_root); int sec=guessSection(yyFileName); if (sec) { @@ -4659,6 +4713,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) } scanYYlex(); + g_lexInit=TRUE; if (YY_START==Comment) { @@ -4679,6 +4734,8 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) parseCompounds(rt); inputFile.close(); + + anonNSCount++; } } @@ -4712,6 +4769,7 @@ static void parsePrototype(const QCString &text) scanYYrestart( scanYYin ); BEGIN(Prototype); scanYYlex(); + g_lexInit=TRUE; current->name = current->name.stripWhiteSpace(); if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty()) @@ -4728,6 +4786,16 @@ static void parsePrototype(const QCString &text) //printf("**** parsePrototype end\n"); } +void scanFreeScanner() +{ +#if defined(YY_FLEX_SUBMINOR_VERSION) + if (g_lexInit) + { + scanYYlex_destroy(); + } +#endif +} + //static void handleGroupStartCommand(const char *header) //{ // memberGroupHeader=header; @@ -4783,7 +4851,6 @@ void CLanguageScanner::parsePrototype(const char *text) ::parsePrototype(text); } - //---------------------------------------------------------------------------- #if !defined(YY_FLEX_SUBMINOR_VERSION) diff --git a/src/translator_ru.h b/src/translator_ru.h index 19452b7..d4df826 100644 --- a/src/translator_ru.h +++ b/src/translator_ru.h @@ -1583,14 +1583,14 @@ class TranslatorRussian : public Translator /*! This is used to introduce a caller (or called-by) graph */ virtual QCString trCallerGraph() { - return "çÒÁÆ ×ÙÚÏ×Á ÆÕÎËÃÉÉ:"; + return decode( "çÒÁÆ ×ÙÚÏ×Á ÆÕÎËÃÉÉ:" ); } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration values */ virtual QCString trEnumerationValueDocumentation() - { return "üÌÅÍÅÎÔÙ ÐÅÒÅÞÉÓÌÅÎÉÊ"; } + { return decode( "üÌÅÍÅÎÔÙ ÐÅÒÅÞÉÓÌÅÎÉÊ" ); } }; diff --git a/src/util.cpp b/src/util.cpp index 0969ae8..8db8b80 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -706,40 +706,75 @@ QCString substTypedef(Definition *scope,FileDef *fileScope,const QCString &name) if (name.isEmpty()) return result; // lookup scope fragment in the symbol map - DefinitionList *dl = Doxygen::symbolMap->find(name); - if (dl==0) return result; // no matches + DefinitionIntf *di = Doxygen::symbolMap->find(name); + if (di==0) return result; // no matches - // search for the best match - DefinitionListIterator dli(*dl); - Definition *d; - int minDistance=10000; // init at "infinite" MemberDef *bestMatch=0; - for (dli.toFirst();(d=dli.current());++dli) // foreach definition + if (di->definitionType()==DefinitionIntf::TypeSymbolList) // multi symbols { - // only look at members - if (d->definitionType()==Definition::TypeMember) + // search for the best match + DefinitionListIterator dli(*(DefinitionList*)di); + Definition *d; + int minDistance=10000; // init at "infinite" + for (dli.toFirst();(d=dli.current());++dli) // foreach definition { - // that are also typedefs - MemberDef *md = (MemberDef *)d; - if (md->isTypedef()) // d is a typedef + // only look at members + if (d->definitionType()==Definition::TypeMember) { - // test accessibility of typedef within scope. - int distance = isAccessibleFromWithExpScope(scope,fileScope,d,""); - if (distance!=-1 && distance<minDistance) - // definition is accessible and a better match + // that are also typedefs + MemberDef *md = (MemberDef *)d; + if (md->isTypedef()) // d is a typedef { - minDistance=distance; - bestMatch = md; + // test accessibility of typedef within scope. + int distance = isAccessibleFromWithExpScope(scope,fileScope,d,""); + if (distance!=-1 && distance<minDistance) + // definition is accessible and a better match + { + minDistance=distance; + bestMatch = md; + } } } } } + else if (di->definitionType()==DefinitionIntf::TypeMember) // single symbol + { + Definition *d = (Definition*)di; + // that are also typedefs + MemberDef *md = (MemberDef *)di; + if (md->isTypedef()) // d is a typedef + { + // test accessibility of typedef within scope. + int distance = isAccessibleFromWithExpScope(scope,fileScope,d,""); + if (distance!=-1) // definition is accessible + { + bestMatch = md; + } + } + } if (bestMatch) result = bestMatch->typeString(); //printf("substTypedef(%s,%s)=%s\n",scope?scope->name().data():"<global>", // name.data(),result.data()); return result; } +static Definition *endOfPathIsUsedClass(SDict<Definition> *cl,const QCString &localName) +{ + if (cl) + { + SDict<Definition>::Iterator cli(*cl); + Definition *cd; + for (cli.toFirst();(cd=cli.current());++cli) + { + if (cd->localName()==localName) + { + return cd; + } + } + } + return 0; +} + /*! Starting with scope \a start, the string \a path is interpreted as * a part of a qualified scope name (e.g. A::B::C), and the scope is * searched. If found the scope definition is returned, otherwise 0 @@ -755,8 +790,25 @@ static Definition *followPath(Definition *start,FileDef *fileScope,const QCStrin { // try to resolve the part if it is a typedef QCString qualScopePart = substTypedef(current,fileScope,path.mid(is,l)); - current = current->findInnerCompound(qualScopePart); - if (current==0) break; // failed to follow the path + Definition *next = current->findInnerCompound(qualScopePart); + if (next==0) // failed to follow the path + { + if (current->definitionType()==Definition::TypeNamespace) + { + current = endOfPathIsUsedClass( + ((NamespaceDef *)current)->getUsedClasses(),qualScopePart); + } + else if (current->definitionType()==Definition::TypeFile) + { + current = endOfPathIsUsedClass( + ((FileDef *)current)->getUsedClasses(),qualScopePart); + } + if (current==0) break; + } + else // continue to follow scope + { + current = next; + } ps=is+l; } //printf("followPath(start=%s,path=%s) result=%s\n", @@ -791,16 +843,34 @@ bool accessibleViaUsingNamespace(const NamespaceSDict *nl, Definition *item, const QCString &explicitScopePart="") { + static QDict<void> visitedDict; if (nl) // check used namespaces for the class { NamespaceSDict::Iterator nli(*nl); NamespaceDef *und; for (nli.toFirst();(und=nli.current());++nli) { - //printf("Trying via used namespace %s\n",und->name().data()); + //printf("[Trying via used namespace %s\n",und->name().data()); Definition *sc = explicitScopePart.isEmpty() ? und : followPath(und,fileScope,explicitScopePart); - if (sc && item->getOuterScope()==sc) return TRUE; - //printf("Try via used namespace done\n"); + if (sc && item->getOuterScope()==sc) + { + //printf("] found it\n"); + return TRUE; + } + QCString key=und->name(); + if (und->getUsedNamespaces() && visitedDict.find(key)==0) + { + visitedDict.insert(key,(void *)0x08); + + if (accessibleViaUsingNamespace(und->getUsedNamespaces(),fileScope,item,explicitScopePart)) + { + //printf("] found it via recursion\n"); + return TRUE; + } + + visitedDict.remove(key); + } + //printf("] Try via used namespace done\n"); } } return FALSE; @@ -812,13 +882,17 @@ bool accessibleViaUsingNamespace(const NamespaceSDict *nl, */ int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item) { - //fprintf(stderr,"<isAccesibleFrom(scope=%s,item=%s itemScope=%s)\n", + //printf("<isAccesibleFrom(scope=%s,item=%s itemScope=%s)\n", // scope->name().data(),item->name().data(),item->getOuterScope()->name().data()); QCString key(40); key.sprintf("%p:%p:%p",scope,fileScope,item); static QDict<void> visitedDict; - if (visitedDict.find(key)) return -1; // already looked at this + if (visitedDict.find(key)) + { + //printf("> already found\n"); + return -1; // already looked at this + } visitedDict.insert(key,(void *)0x8); int result=0; // assume we found it @@ -826,7 +900,7 @@ int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item) if (item->getOuterScope()==scope) { - //fprintf(stderr,"> found it\n"); + //printf("> found it\n"); } else if (scope==Doxygen::globalScope) { @@ -835,17 +909,17 @@ int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item) SDict<Definition> *cl = fileScope->getUsedClasses(); if (accessibleViaUsingClass(cl,fileScope,item)) { - //fprintf(stderr,"> found via used class\n"); + //printf("> found via used class\n"); goto done; } NamespaceSDict *nl = fileScope->getUsedNamespaces(); if (accessibleViaUsingNamespace(nl,fileScope,item)) { - //fprintf(stderr,"> found via used namespace\n"); + //printf("> found via used namespace\n"); goto done; } } - //fprintf(stderr,"> reached global scope\n"); + //printf("> reached global scope\n"); result=-1; // not found in path to globalScope } else // keep searching @@ -858,19 +932,19 @@ int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item) SDict<Definition> *cl = nscope->getUsedClasses(); if (accessibleViaUsingClass(cl,fileScope,item)) { - //fprintf(stderr,"> found via used class\n"); + //printf("> found via used class\n"); goto done; } NamespaceSDict *nl = nscope->getUsedNamespaces(); if (accessibleViaUsingNamespace(nl,fileScope,item)) { - //fprintf(stderr,"> found via used namespace\n"); + //printf("> found via used namespace\n"); goto done; } } // repeat for the parent scope i=isAccessibleFrom(scope->getOuterScope(),fileScope,item); - //fprintf(stderr,"> result=%d\n",i); + //printf("> result=%d\n",i); result= (i==-1) ? -1 : i+1; } done: @@ -898,7 +972,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, static QDict<void> visitedDict; if (visitedDict.find(key)) return -1; // already looked at this visitedDict.insert(key,(void *)0x8); - + //printf("<isAccessibleFromWithExpScope(%s,%s,%s)\n",scope?scope->name().data():"<global>", // item?item->name().data():"<none>", // explicitScopePart.data()); @@ -930,10 +1004,9 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, for (cli.toFirst();(cd=cli.current());++cli) { //printf("Trying for class %s\n",cd->name().data()); - i = isAccessibleFromWithExpScope(scope,fileScope,item,cd->name()); - if (i!=-1) + if (cd==item) { - //printf("> found via explicit scope of used class\n"); + //printf("> class is used in this scope\n"); goto done; } } @@ -962,7 +1035,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, if (scope!=Doxygen::globalScope) { i = isAccessibleFromWithExpScope(scope->getOuterScope(),fileScope, - item,explicitScopePart); + item,explicitScopePart); } //printf("> result=%d\n",i); result = (i==-1) ? -1 : i+1; @@ -974,12 +1047,6 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, if (scope->definitionType()==Definition::TypeNamespace) { NamespaceDef *nscope = (NamespaceDef*)scope; - SDict<Definition> *cl = nscope->getUsedClasses(); - if (accessibleViaUsingClass(cl,fileScope,item,explicitScopePart)) - { - //printf("> found in used class\n"); - goto done; - } NamespaceSDict *nl = nscope->getUsedNamespaces(); if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) { @@ -991,12 +1058,6 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, { if (fileScope) { - SDict<Definition> *cl = fileScope->getUsedClasses(); - if (accessibleViaUsingClass(cl,fileScope,item,explicitScopePart)) - { - //printf("> found in used class\n"); - goto done; - } NamespaceSDict *nl = fileScope->getUsedNamespaces(); if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) { @@ -1010,10 +1071,23 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, else // continue by looking into the parent scope { int i=isAccessibleFromWithExpScope(scope->getOuterScope(),fileScope, - item,explicitScopePart); + item,explicitScopePart); //printf("> result=%d\n",i); result= (i==-1) ? -1 : i+1; } +#if 0 + if (scope!=Doxygen::globalScope) + { + int i=isAccessibleFromWithExpScope(scope->getOuterScope(),fileScope, + item,explicitScopePart); + //printf("> result=%d\n",i); + result= (i==-1) ? -1 : i+1; + } + else + { + result = -1; + } +#endif } done: visitedDict.remove(key); @@ -1027,6 +1101,145 @@ int computeQualifiedIndex(const QCString &name) return name.findRev("::",i==-1 ? name.length() : i); } +void getResolvedSymbol(Definition *scope, + FileDef *fileScope, + Definition *d, + const QCString &explicitScopePart, + int &minDistance, + ClassDef *&bestMatch, + MemberDef *&bestTypedef, + QCString &bestTemplSpec + ) +{ + //printf(" found type %x name=%s (%d/%d) d=%p\n", + // d->definitionType(),d->name().data(),count,dl->count(),d); + + // only look at classes and members + if (d->definitionType()==Definition::TypeClass || + (d->definitionType()==Definition::TypeMember && + (((MemberDef*)d)->isTypedef() || ((MemberDef*)d)->isEnumerate()) + ) + ) + { + g_visitedNamespaces.clear(); + // test accessibility of definition within scope. + int distance = isAccessibleFromWithExpScope(scope,fileScope,d,explicitScopePart); + //printf(" distance %s (%p) is %d\n",d->name().data(),d,distance); + if (distance!=-1) // definition is accessible + { + // see if we are dealing with a class or a typedef + if (d->definitionType()==Definition::TypeClass) // d is a class + { + ClassDef *cd = (ClassDef *)d; + //printf("cd=%s\n",cd->name().data()); + if (!cd->isTemplateArgument()) // skip classes that + // are only there to + // represent a template + // argument + { + //printf("is not a templ arg\n"); + if (distance<minDistance) // found a definition that is "closer" + { + minDistance=distance; + bestMatch = cd; + bestTypedef = 0; + bestTemplSpec.resize(0); + } + else if (distance==minDistance && + fileScope && bestMatch && + fileScope->getUsedNamespaces() && + d->getOuterScope()->definitionType()==Definition::TypeNamespace && + bestMatch->getOuterScope()==Doxygen::globalScope + ) + { + // in case the distance is equal it could be that a class X + // is defined in a namespace and in the global scope. When searched + // in the global scope the distance is 0 in both cases. We have + // to choose one of the definitions: we choose the one in the + // namespace if the fileScope imports namespaces and the definition + // found was in a namespace while the best match so far isn't. + // Just a non-perfect heuristic but it could help in some situations + // (kdecore code is an example). + minDistance=distance; + bestMatch = cd; + bestTypedef = 0; + bestTemplSpec.resize(0); + } + } + else + { + //printf(" is a template argument!\n"); + } + } + else if (d->definitionType()==Definition::TypeMember) + { + MemberDef *md = (MemberDef *)d; + //printf(" member isTypedef()=%d\n",md->isTypedef()); + if (md->isTypedef()) // d is a typedef + { + QCString args=md->argsString(); + if (args.isEmpty()) // do not expand "typedef t a[4];" + { + //printf(" found typedef!\n"); + + // we found a symbol at this distance, but if it didn't + // resolve to a class, we still have to make sure that + // something at a greater distance does not match, since + // that symbol is hidden by this one. + if (distance<minDistance) + { + QCString spec; + minDistance=distance; + MemberDef *enumType = 0; + ClassDef *cd = newResolveTypedef(fileScope,md,&enumType,&spec); + if (cd) // shouldn't be 0, but could in some weird cases + { + //printf(" bestTypeDef=%p spec=%s\n",md,spec.data()); + bestMatch = cd; + bestTypedef = md; + bestTemplSpec = spec; + } + else if (enumType) + { + //printf(" is enum\n"); + bestMatch = 0; + bestTypedef = enumType; + bestTemplSpec = ""; + } + else + { + //printf(" no match\n"); + } + } + else + { + //printf(" not the best match %d min=%d\n",distance,minDistance); + } + } + else + { + //printf(" not a simple typedef\n") + } + } + else if (md->isEnumerate()) + { + if (distance<minDistance) + { + minDistance=distance; + bestMatch = 0; + bestTypedef = md; + bestTemplSpec = ""; + } + } + } + } // if definition accessible + else + { + //printf(" Not accessible!\n"); + } + } // if definition is a class or member +} + /* Find the fully qualified class name refered to by the input class * or typedef name against the input scope. * Loops through scope and each of its parent scopes looking for a @@ -1034,11 +1247,11 @@ int computeQualifiedIndex(const QCString &name) * resolving typedefs. */ ClassDef *getResolvedClassRec(Definition *scope, - FileDef *fileScope, - const char *n, - MemberDef **pTypeDef, - QCString *pTemplSpec - ) + FileDef *fileScope, + const char *n, + MemberDef **pTypeDef, + QCString *pTemplSpec + ) { //printf("[getResolvedClassRec(%s,%s)\n",scope?scope->name().data():"<global>",n); QCString name=n; @@ -1061,19 +1274,19 @@ ClassDef *getResolvedClassRec(Definition *scope, return 0; // empty name } - DefinitionList *dl = Doxygen::symbolMap->find(name); + DefinitionIntf *di = Doxygen::symbolMap->find(name); //printf("Looking for symbol %s result=%p\n",name.data(),dl); - if (dl==0) + if (di==0) { return 0; } bool hasUsingStatements = - (fileScope && ((fileScope->getUsedNamespaces() && - fileScope->getUsedNamespaces()->count()>0) || - (fileScope->getUsedClasses() && - fileScope->getUsedClasses()->count()>0)) - ); + (fileScope && ((fileScope->getUsedNamespaces() && + fileScope->getUsedNamespaces()->count()>0) || + (fileScope->getUsedClasses() && + fileScope->getUsedClasses()->count()>0)) + ); //printf("hasUsingStatements=%d\n",hasUsingStatements); // Since it is often the case that the same name is searched in the same // scope over an over again (especially for the linked source code generation) @@ -1096,7 +1309,7 @@ ClassDef *getResolvedClassRec(Definition *scope, p+=nameLen; qstrcpy(p,explicitScopePart); p+=explicitPartLen; - + // if a file scope is given and it contains using statements we should // also use the file part in the key (as a class name can be in // two different namespaces and a using statement in a file can select @@ -1110,7 +1323,7 @@ ClassDef *getResolvedClassRec(Definition *scope, p+=fileScopeLen-1; } *p='\0'; - + LookupInfo *pval=Doxygen::lookupCache.find(key); //printf("Searching for %s result=%p\n",key.data(),pval); if (pval) @@ -1124,144 +1337,34 @@ ClassDef *getResolvedClassRec(Definition *scope, return pval->classDef; } else // not found yet; we already add a 0 to avoid the possibility of - // endless recursion. + // endless recursion. { Doxygen::lookupCache.insert(key,new LookupInfo); } ClassDef *bestMatch=0; - - //printf(" found %d symbol(s) with name %s\n",dl->count(),name.data()); - // now we look int the list of Definitions and determine which one is the "best" - DefinitionListIterator dli(*dl); - Definition *d; MemberDef *bestTypedef=0; QCString bestTemplSpec; int minDistance=10000; // init at "infinite" - int count=0; - for (dli.toFirst();(d=dli.current());++dli,++count) // foreach definition - { - //printf(" found type %x name=%s (%d/%d) d=%p\n", - // d->definitionType(),d->name().data(),count,dl->count(),d); - // only look at classes and members - if (d->definitionType()==Definition::TypeClass || - d->definitionType()==Definition::TypeMember) + if (di->definitionType()==DefinitionIntf::TypeSymbolList) + { + DefinitionListIterator dli(*(DefinitionList*)di); + Definition *d; + int count=0; + for (dli.toFirst();(d=dli.current());++dli,++count) // foreach definition { - g_visitedNamespaces.clear(); - // test accessibility of definition within scope. - int distance = isAccessibleFromWithExpScope(scope,fileScope,d,explicitScopePart); - //printf(" distance %s is %d\n",d->name().data(),distance); - if (distance!=-1) // definition is accessible - { - // see if we are dealing with a class or a typedef - if (d->definitionType()==Definition::TypeClass) // d is a class - { - ClassDef *cd = (ClassDef *)d; - //printf("cd=%s\n",cd->name().data()); - if (!cd->isTemplateArgument()) // skip classes that - // are only there to - // represent a template - // argument - { - //printf("is not a templ arg\n"); - if (distance<minDistance) // found a definition that is "closer" - { - minDistance=distance; - bestMatch = cd; - bestTypedef = 0; - bestTemplSpec.resize(0); - } - else if (distance==minDistance && - fileScope && bestMatch && - fileScope->getUsedNamespaces() && - d->getOuterScope()->definitionType()==Definition::TypeNamespace && - bestMatch->getOuterScope()==Doxygen::globalScope - ) - { - // in case the distance is equal it could be that a class X - // is defined in a namespace and in the global scope. When searched - // in the global scope the distance is 0 in both cases. We have - // to choose one of the definitions: we choose the one in the - // namespace if the fileScope imports namespaces and the definition - // found was in a namespace while the best match so far isn't. - // Just a non-perfect heuristic but it could help in some situations - // (kdecore code is an example). - minDistance=distance; - bestMatch = cd; - bestTypedef = 0; - bestTemplSpec.resize(0); - } - } - } - else if (d->definitionType()==Definition::TypeMember) - { - MemberDef *md = (MemberDef *)d; - //printf(" member isTypedef()=%d\n",md->isTypedef()); - if (md->isTypedef()) // d is a typedef - { - QCString args=md->argsString(); - if (args.isEmpty()) // do not expand "typedef t a[4];" - { - //printf(" found typedef!\n"); + getResolvedSymbol(scope,fileScope,d,explicitScopePart, + minDistance,bestMatch,bestTypedef,bestTemplSpec); + } + } + else + { + Definition *d = (Definition *)di; + getResolvedSymbol(scope,fileScope,d,explicitScopePart, + minDistance,bestMatch,bestTypedef,bestTemplSpec); + } - // we found a symbol at this distance, but if it didn't - // resolve to a class, we still have to make sure that - // something at a greater distance does not match, since - // that symbol is hidden by this one. - if (distance<minDistance) - { - QCString spec; - minDistance=distance; - MemberDef *enumType = 0; - ClassDef *cd = newResolveTypedef(fileScope,md,&enumType,&spec); - if (cd) // shouldn't be 0, but could in some weird cases - { - //printf(" bestTypeDef=%p spec=%s\n",md,spec.data()); - bestMatch = cd; - bestTypedef = md; - bestTemplSpec = spec; - } - else if (enumType) - { - //printf(" is enum\n"); - bestMatch = 0; - bestTypedef = enumType; - bestTemplSpec = ""; - } - else - { - //printf(" no match\n"); - } - } - else - { - //printf(" not the best match %d min=%d\n",distance,minDistance); - } - } - else - { - //printf(" not a simple typedef\n") - } - } - else if (md->isEnumerate()) - { - if (distance<minDistance) - { - minDistance=distance; - bestMatch = 0; - bestTypedef = md; - bestTemplSpec = ""; - } - } - } - } // if definition accessible - else - { - //printf(" Not accessible!\n"); - } - } // if definition is a class or member - } // foreach definition if (pTypeDef) { *pTypeDef = bestTypedef; @@ -1295,24 +1398,25 @@ ClassDef *getResolvedClassRec(Definition *scope, * match against the input name. */ ClassDef *getResolvedClass(Definition *scope, - FileDef *fileScope, - const char *n, - MemberDef **pTypeDef, - QCString *pTemplSpec, - bool mayBeUnlinkable, - bool mayBeHidden - ) + FileDef *fileScope, + const char *n, + MemberDef **pTypeDef, + QCString *pTemplSpec, + bool mayBeUnlinkable, + bool mayBeHidden + ) { g_resolvedTypedefs.clear(); if (scope==0 || (scope->definitionType()!=Definition::TypeClass && scope->definitionType()!=Definition::TypeNamespace - ) + ) || + (fileScope && fileScope->isJava() && QCString(n).find("::")!=-1) ) { scope=Doxygen::globalScope; } - //printf("getResolvedClass(scope=%s,file=%s,name=%s,mayUnlinkable=%d)\n", + //printf("------------ getResolvedClass(scope=%s,file=%s,name=%s,mayUnlinkable=%d)\n", // scope?scope->name().data():"<global>", // fileScope?fileScope->name().data():"<none>", // n, @@ -1342,7 +1446,7 @@ static bool findOperator(const QCString &s,int i) if (b==-1) return FALSE; // not found b+=8; while (b<i) // check if there are only spaces inbetween - // the operator and the > + // the operator and the > { if (!isspace((uchar)s.at(b))) return FALSE; b++; @@ -1386,37 +1490,37 @@ nextChar: else if (i<l-2 && c=='<' && // current char is a < (isId(s.at(i+1)) || isspace((uchar)s.at(i+1))) && // next char is an id char or space (i<8 || !findOperator(s,i)) // string in front is not "operator" - ) + ) { result+="< "; // insert extra space for layouting (nested) templates } else if (i>0 && c=='>' && // current char is a > - (isId(s.at(i-1)) || isspace((uchar)s.at(i-1)) || s.at(i-1)=='*' || s.at(i-1)=='&') && // prev char is an id char or space - (i<8 || !findOperator(s,i)) // string in front is not "operator" - ) + (isId(s.at(i-1)) || isspace((uchar)s.at(i-1)) || s.at(i-1)=='*' || s.at(i-1)=='&') && // prev char is an id char or space + (i<8 || !findOperator(s,i)) // string in front is not "operator" + ) { result+=" >"; // insert extra space for layouting (nested) templates } else if (i>0 && c==',' && !isspace((uchar)s.at(i-1)) - && ((i<l-1 && isId(s.at(i+1))) - || (i<l-2 && s.at(i+1)=='$' && isId(s.at(i+2))) // for PHP - || (i<l-3 && s.at(i+1)=='&' && s.at(i+2)=='$' && isId(s.at(i+3))))) // for PHP + && ((i<l-1 && isId(s.at(i+1))) + || (i<l-2 && s.at(i+1)=='$' && isId(s.at(i+2))) // for PHP + || (i<l-3 && s.at(i+1)=='&' && s.at(i+2)=='$' && isId(s.at(i+3))))) // for PHP { result+=", "; } else if (i>0 && - ((isId(s.at(i)) && s.at(i-1)==')') || - (s.at(i)=='\'' && s.at(i-1)==' ') - ) - ) + ((isId(s.at(i)) && s.at(i-1)==')') || + (s.at(i)=='\'' && s.at(i-1)==' ') + ) + ) { result+=' '; result+=s.at(i); } else if (c=='t' && csp==5 && - !(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ || s.at(i+1)==')' || - s.at(i+1)==',' || s.at(i+1)=='\0')) - // prevent const ::A from being converted to const::A + !(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ || s.at(i+1)==')' || + s.at(i+1)==',' || s.at(i+1)=='\0')) + // prevent const ::A from being converted to const::A { result+="t "; if (s.at(i+1)==' ') i++; @@ -1428,9 +1532,9 @@ nextChar: csp=0; } else if (c=='l' && vsp==7 && - !(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ || s.at(i+1)==')' || - s.at(i+1)==',' || s.at(i+1)=='\0')) - // prevent virtual ::A from being converted to virtual::A + !(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ || s.at(i+1)==')' || + s.at(i+1)==',' || s.at(i+1)=='\0')) + // prevent virtual ::A from being converted to virtual::A { result+="l "; if (s.at(i+1)==' ') i++; @@ -1442,17 +1546,17 @@ nextChar: vsp=0; } else if (!isspace((uchar)c) || - ( i>0 && i<l-1 && - (isId(s.at(i-1)) || s.at(i-1)==')' || s.at(i-1)==',' || s.at(i-1)=='>' || s.at(i-1)==']') - && (isId(s.at(i+1)) || (i<l-2 && s.at(i+1)=='$' && isId(s.at(i+2))) - || (i<l-3 && s.at(i+1)=='&' && s.at(i+2)=='$' && isId(s.at(i+3)))) - ) - ) + ( i>0 && i<l-1 && + (isId(s.at(i-1)) || s.at(i-1)==')' || s.at(i-1)==',' || s.at(i-1)=='>' || s.at(i-1)==']') + && (isId(s.at(i+1)) || (i<l-2 && s.at(i+1)=='$' && isId(s.at(i+2))) + || (i<l-3 && s.at(i+1)=='&' && s.at(i+2)=='$' && isId(s.at(i+3)))) + ) + ) { if (c=='*' || c=='&' || c=='@' || c=='$') { uint rl=result.length(); - if (rl>0 && (isId(result.at(rl-1)) || result.at(rl-1)=='>')) result+=' '; + if (rl>0 && (isId(result.at(rl-1)) || result.at(rl-1)=='>')) result+=' '; } result+=c; } @@ -1464,26 +1568,26 @@ nextChar: bool rightScopeMatch(const QCString &scope, const QCString &name) { return (name==scope || // equal - (scope.right(name.length())==name && // substring - scope.at(scope.length()-name.length()-1)==':' // scope - ) - ); + (scope.right(name.length())==name && // substring + scope.at(scope.length()-name.length()-1)==':' // scope + ) + ); } bool leftScopeMatch(const QCString &scope, const QCString &name) { return (name==scope || // equal - (scope.left(name.length())==name && // substring - scope.at(name.length())==':' // scope - ) - ); + (scope.left(name.length())==name && // substring + scope.at(name.length())==':' // scope + ) + ); } void linkifyText(const TextGeneratorIntf &out,Definition *scope, - FileDef *fileScope,const char *, - const char *text, bool autoBreak,bool external, - bool keepSpaces) + FileDef *fileScope,const char *, + const char *text, bool autoBreak,bool external, + bool keepSpaces) { //printf("`%s'\n",text); static QRegExp regExp("[a-z_A-Z][~a-z_A-Z0-9.:]*"); @@ -1501,8 +1605,8 @@ void linkifyText(const TextGeneratorIntf &out,Definition *scope, if (strLen==0) return; // read a word from the text string while ((newIndex=regExp.match(txtStr,index,&matchLen))!=-1 && - (newIndex==0 || !(txtStr.at(newIndex-1)>='0' && txtStr.at(newIndex-1)<='9')) // avoid matching part of hex numbers - ) + (newIndex==0 || !(txtStr.at(newIndex-1)>='0' && txtStr.at(newIndex-1)<='9')) // avoid matching part of hex numbers + ) { // add non-word part to the result floatingIndex+=newIndex-skipIndex; @@ -1512,7 +1616,7 @@ void linkifyText(const TextGeneratorIntf &out,Definition *scope, { if (txtStr.at(i)=='"') insideString=!insideString; } - + if (strLen>30 && floatingIndex>25 && autoBreak) // try to insert a split point { QCString splitText = txtStr.mid(skipIndex,newIndex-skipIndex); @@ -1581,7 +1685,7 @@ void linkifyText(const TextGeneratorIntf &out,Definition *scope, found=TRUE; } } - + QCString scopeName; if (scope && (scope->definitionType()==Definition::TypeClass || @@ -1631,7 +1735,7 @@ void linkifyText(const TextGeneratorIntf &out,Definition *scope, void writeExample(OutputList &ol,ExampleSDict *ed) { QCString exampleLine=theTranslator->trWriteList(ed->count()); - + //bool latexEnabled = ol.isEnabled(OutputGenerator::Latex); //bool manEnabled = ol.isEnabled(OutputGenerator::Man); //bool htmlEnabled = ol.isEnabled(OutputGenerator::Html); @@ -1653,7 +1757,7 @@ void writeExample(OutputList &ol,ExampleSDict *ed) // link for Html / man ol.writeObjectLink(0,e->file,e->anchor,e->name); ol.popGeneratorState(); - + ol.pushGeneratorState(); //if (latexEnabled) ol.enable(OutputGenerator::Latex); ol.disable(OutputGenerator::Man); @@ -1681,7 +1785,7 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType) while (a) { QCString type1 = useCanonicalType && !a->canType.isEmpty() ? - a->canType : a->type; + a->canType : a->type; QCString type2; int i=type1.find(")("); // hack to deal with function pointers if (i!=-1) @@ -1987,7 +2091,7 @@ QCString yearToString() int minClassDistance(ClassDef *cd,ClassDef *bcd,int level) { if (bcd->categoryOf()) // use class that is being extended in case of - // an Objective-C category + // an Objective-C category { bcd=bcd->categoryOf(); } @@ -2029,10 +2133,10 @@ int minClassDistance(ClassDef *cd,ClassDef *bcd,int level) #ifndef NEWMATCH // strip any template specifiers that follow className in string s static QCString trimTemplateSpecifiers( - const QCString &namespaceName, - const QCString &className, - const QCString &s -) + const QCString &namespaceName, + const QCString &className, + const QCString &s + ) { //printf("trimTemplateSpecifiers(%s,%s,%s)\n",namespaceName.data(),className.data(),s.data()); QCString scopeName=mergeScopes(namespaceName,className); @@ -2069,7 +2173,7 @@ static QCString trimTemplateSpecifiers( } //printf("result after specialization: %s\n",result.data()); - + QCString qualName=cd->qualifiedNameWithTemplateParameters(); //printf("QualifiedName = %s\n",qualName.data()); // We strip the template arguments following className (if any) @@ -2092,7 +2196,7 @@ static QCString trimTemplateSpecifiers( } } //printf("result=%s\n",result.data()); - + return result.stripWhiteSpace(); } @@ -2104,7 +2208,7 @@ static QCString trimTemplateSpecifiers( * @returns position on which string is found, or -1 if not found */ static int findScopePattern(const QCString &pattern,const QCString &s, - int p,int *len) + int p,int *len) { int sl=s.length(); int pl=pattern.length(); @@ -2158,7 +2262,7 @@ static int findScopePattern(const QCString &pattern,const QCString &s, } return -1; } - + static QCString trimScope(const QCString &name,const QCString &s) { int scopeOffset=name.length(); @@ -2168,7 +2272,7 @@ static QCString trimScope(const QCString &name,const QCString &s) QCString tmp; QCString scope=name.left(scopeOffset)+"::"; //printf("Trying with scope=`%s'\n",scope.data()); - + int i,p=0,l; while ((i=findScopePattern(scope,result,p,&l))!=-1) // for each occurrence { @@ -2198,8 +2302,8 @@ void trimBaseClassScope(BaseClassList *bcl,QCString &s,int level=0) if (spos!=-1) { s = s.left(spos)+s.right( - s.length()-spos-cd->name().length()-2 - ); + s.length()-spos-cd->name().length()-2 + ); } //printf("base class `%s'\n",cd->name().data()); if (cd->baseClasses()) @@ -2228,7 +2332,7 @@ static void trimNamespaceScope(QCString &t1,QCString &t2,const QCString &nsName) { QCString scope=t1.left(i1); replaceNamespaceAliases(scope,i1); - + int so=nsName.length(); do { @@ -2293,7 +2397,7 @@ static void stripIrrelevantString(QCString &target,const QCString &str) while ((i=target.find(str,p))!=-1) { bool isMatch = (i==0 || !isId(target.at(i-1))) && // not a character before str - (i+l==(int)target.length() || !isId(target.at(i+l))); // not a character after str + (i+l==(int)target.length() || !isId(target.at(i+l))); // not a character after str if (isMatch) { int i1=target.find('*',i+l); @@ -2320,18 +2424,18 @@ static void stripIrrelevantString(QCString &target,const QCString &str) /*! According to the C++ spec and Ivan Vecerina: - Parameter declarations that differ only in the presence or absence - of const and/or volatile are equivalent. + Parameter declarations that differ only in the presence or absence + of const and/or volatile are equivalent. - So the following example, show what is stripped by this routine - for const. The same is done for volatile. + So the following example, show what is stripped by this routine + for const. The same is done for volatile. - \code - const T param -> T param // not relevant - const T& param -> const T& param // const needed - T* const param -> T* param // not relevant - const T* param -> const T* param // const needed - \endcode + \code + const T param -> T param // not relevant + const T& param -> const T& param // const needed + T* const param -> T* param // not relevant + const T* param -> const T* param // const needed + \endcode */ void stripIrrelevantConstVolatile(QCString &s) { @@ -2350,10 +2454,10 @@ void stripIrrelevantConstVolatile(QCString &s) #ifndef NEWMATCH static bool matchArgument(const Argument *srcA,const Argument *dstA, - const QCString &className, - const QCString &namespaceName, - NamespaceSDict *usingNamespaces, - SDict<Definition> *usingClasses) + const QCString &className, + const QCString &namespaceName, + NamespaceSDict *usingNamespaces, + SDict<Definition> *usingClasses) { //printf("match argument start `%s|%s' <-> `%s|%s' using nsp=%p class=%p\n", // srcA->type.data(),srcA->name.data(), @@ -2372,7 +2476,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, QCString dstAName=dstA->name.stripWhiteSpace(); srcAType.stripPrefix("class "); dstAType.stripPrefix("class "); - + // allow distingishing "const A" from "const B" even though // from a syntactic point of view they would be two names of the same // type "const". This is not fool prove ofcourse, but should at least @@ -2397,7 +2501,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, dstAType+=dstA->name; dstAName.resize(0); } - + stripIrrelevantConstVolatile(srcAType); stripIrrelevantConstVolatile(dstAType); @@ -2410,7 +2514,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, { dstAType = dstAType.right(dstAType.length()-9); } - + srcAType = removeRedundantWhiteSpace(srcAType); dstAType = removeRedundantWhiteSpace(dstAType); @@ -2424,7 +2528,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (srcA->array!=dstA->array) // nomatch for char[] against char { NOMATCH - return FALSE; + return FALSE; } if (srcAType!=dstAType) // check if the argument only differs on name { @@ -2434,7 +2538,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, //printf("Trimming %s<->%s: %s\n",srcAType.data(),dstAType.data(),namespaceName.data()); //trimNamespaceScope(srcAType,dstAType,namespaceName); //printf("After Trimming %s<->%s\n",srcAType.data(),dstAType.data()); - + //QCString srcScope; //QCString dstScope; @@ -2486,20 +2590,20 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, //printf("2. srcA=%s|%s dstA=%s|%s\n",srcAType.data(),srcAName.data(), // dstAType.data(),dstAName.data()); - + if (!srcAName.isEmpty() && !dstA->type.isEmpty() && (srcAType+" "+srcAName)==dstAType) { MATCH - return TRUE; + return TRUE; } else if (!dstAName.isEmpty() && !srcA->type.isEmpty() && (dstAType+" "+dstAName)==srcAType) { MATCH - return TRUE; + return TRUE; } - + uint srcPos=0,dstPos=0; bool equal=TRUE; @@ -2517,7 +2621,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (srcPos==0 || dstPos==0) { NOMATCH - return FALSE; + return FALSE; } if (isId(srcAType.at(srcPos)) && isId(dstAType.at(dstPos))) { @@ -2526,7 +2630,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (!srcAName.isEmpty() || !dstAName.isEmpty()) { NOMATCH - return FALSE; + return FALSE; } // types only while (srcPos<srcATypeLen && isId(srcAType.at(srcPos))) srcPos++; @@ -2537,7 +2641,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, ) { NOMATCH - return FALSE; + return FALSE; } } else @@ -2554,7 +2658,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (srcPos!=srcATypeLen || dstPos!=dstATypeLen) { NOMATCH - return FALSE; + return FALSE; } } } @@ -2565,13 +2669,13 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (!dstAName.isEmpty()) // dst has its name separated from its type { NOMATCH - return FALSE; + return FALSE; } while (dstPos<dstAType.length() && isId(dstAType.at(dstPos))) dstPos++; if (dstPos!=dstAType.length()) { NOMATCH - return FALSE; // more than a difference in name -> no match + return FALSE; // more than a difference in name -> no match } } else // maybe dst has a name while src has not @@ -2581,7 +2685,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (dstPos!=dstAType.length() || !srcAName.isEmpty()) { NOMATCH - return FALSE; // nope not a name -> no match + return FALSE; // nope not a name -> no match } } } @@ -2592,13 +2696,13 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (!srcAName.isEmpty()) // src has its name separated from its type { NOMATCH - return FALSE; + return FALSE; } while (srcPos<srcAType.length() && isId(srcAType.at(srcPos))) srcPos++; if (srcPos!=srcAType.length()) { NOMATCH - return FALSE; // more than a difference in name -> no match + return FALSE; // more than a difference in name -> no match } } else // maybe src has a name while dst has not @@ -2608,13 +2712,13 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, if (srcPos!=srcAType.length() || !dstAName.isEmpty()) { NOMATCH - return FALSE; // nope not a name -> no match + return FALSE; // nope not a name -> no match } } } } MATCH - return TRUE; + return TRUE; } @@ -2626,9 +2730,9 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, * stored in the list should be equal. */ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, - const char *cl,const char *ns,bool checkCV, - NamespaceSDict *usingNamespaces, - SDict<Definition> *usingClasses) + const char *cl,const char *ns,bool checkCV, + NamespaceSDict *usingNamespaces, + SDict<Definition> *usingClasses) { QCString className=cl; QCString namespaceName=ns; @@ -2654,39 +2758,39 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, if (match) { MATCH - return TRUE; + return TRUE; } else { NOMATCH - return FALSE; + return FALSE; } } - + // handle special case with void argument if ( srcAl->count()==0 && dstAl->count()==1 && - dstAl->getFirst()->type=="void" ) + dstAl->getFirst()->type=="void" ) { // special case for finding match between func() and func(void) Argument *a=new Argument; a->type = "void"; srcAl->append(a); MATCH - return TRUE; + return TRUE; } if ( dstAl->count()==0 && srcAl->count()==1 && - srcAl->getFirst()->type=="void" ) + srcAl->getFirst()->type=="void" ) { // special case for finding match between func(void) and func() Argument *a=new Argument; a->type = "void"; dstAl->append(a); MATCH - return TRUE; + return TRUE; } - + if (srcAl->count() != dstAl->count()) { NOMATCH - return FALSE; // different number of arguments -> no match + return FALSE; // different number of arguments -> no match } if (checkCV) @@ -2694,12 +2798,12 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, if (srcAl->constSpecifier != dstAl->constSpecifier) { NOMATCH - return FALSE; // one member is const, the other not -> no match + return FALSE; // one member is const, the other not -> no match } if (srcAl->volatileSpecifier != dstAl->volatileSpecifier) { NOMATCH - return FALSE; // one member is volatile, the other not -> no match + return FALSE; // one member is volatile, the other not -> no match } } @@ -2713,11 +2817,11 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, usingNamespaces,usingClasses)) { NOMATCH - return FALSE; + return FALSE; } } MATCH - return TRUE; // all arguments match + return TRUE; // all arguments match } #endif @@ -2728,7 +2832,7 @@ static QCString resolveSymbolName(FileDef *fs,Definition *symbol,QCString &templ ASSERT(symbol!=0); if (symbol->definitionType()==Definition::TypeMember && ((MemberDef*)symbol)->isTypedef()) // if symbol is a typedef then try - // to resolve it + // to resolve it { MemberDef *md = 0; ClassDef *cd = newResolveTypedef(fs,(MemberDef*)symbol,&md,&templSpec); @@ -2763,15 +2867,15 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,QCString type); QCString getCanonicalTemplateSpec(Definition *d,FileDef *fs,const QCString& spec) { - QCString templSpec = spec.stripWhiteSpace(); - if (templSpec.isEmpty() || templSpec.at(0) != '<') return templSpec; - return "< " + extractCanonicalType(d,fs,templSpec.right(templSpec.length()-1)); + QCString templSpec = spec.stripWhiteSpace(); + if (templSpec.isEmpty() || templSpec.at(0) != '<') return templSpec; + return "< " + extractCanonicalType(d,fs,templSpec.right(templSpec.length()-1)); } static QCString getCanonicalTypeForIdentifier( - Definition *d,FileDef *fs,const QCString &word, - QCString *tSpec) + Definition *d,FileDef *fs,const QCString &word, + QCString *tSpec) { QCString symName,scope,result,templSpec,tmpName; //DefinitionList *defList=0; @@ -2795,7 +2899,7 @@ static QCString getCanonicalTypeForIdentifier( bool isTemplInst = cd && !templSpec.isEmpty(); if (!cd && !templSpec.isEmpty()) { - // class template specialization not known, look up class template + // class template specialization not known, look up class template cd = getResolvedClass(d,fs,word,&mType,&ts,TRUE); } @@ -2867,7 +2971,7 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,QCString type) // strip const and volatile keywords that are not relevant for the type stripIrrelevantConstVolatile(type); - + // strip leading keywords type.stripPrefix("class "); type.stripPrefix("struct "); @@ -2879,11 +2983,11 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,QCString type) //printf("extractCanonicalType(type=%s)\n",type.data()); static QRegExp id("[a-z_A-Z][:a-z_A-Z0-9]*"); - + QCString canType,templSpec,word; int i,p=0,pp=0; while ((i=extractClassNameFromType(type,p,word,templSpec))!=-1) - // foreach identifier in the type + // foreach identifier in the type { //printf(" i=%d p=%d\n",i,p); canType += type.mid(pp,i-pp); @@ -2892,8 +2996,8 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,QCString type) canType += getCanonicalTypeForIdentifier(d,fs,word,&templSpec); if (!templSpec.isEmpty()) // if we didn't use up the templSpec already - // (i.e. type is not a template specialization) - // then resolve any identifiers inside. + // (i.e. type is not a template specialization) + // then resolve any identifiers inside. { static QRegExp re("[a-z_A-Z][a-z_A-Z0-9]*"); int tp=0,tl,ti; @@ -2907,12 +3011,12 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,QCString type) } canType+=templSpec.right(templSpec.length()-tp); } - + pp=p; } canType += type.right(type.length()-pp); //printf("extractCanonicalType = %s->%s\n",type.data(),canType.data()); - + return removeRedundantWhiteSpace(canType); } @@ -2936,9 +3040,9 @@ static QCString extractCanonicalArgType(Definition *d,FileDef *fs,const Argument } static bool matchArgument2( - Definition *srcScope,FileDef *srcFileScope,Argument *srcA, - Definition *dstScope,FileDef *dstFileScope,Argument *dstA - ) + Definition *srcScope,FileDef *srcFileScope,Argument *srcA, + Definition *dstScope,FileDef *dstFileScope,Argument *dstA + ) { //printf(">> match argument: %s::`%s|%s' (%s) <-> %s::`%s|%s' (%s)\n", // srcScope ? srcScope->name().data() : "", @@ -2949,7 +3053,7 @@ static bool matchArgument2( if (srcA->array!=dstA->array) // nomatch for char[] against char { NOMATCH - return FALSE; + return FALSE; } QCString sSrcName = " "+srcA->name; QCString sDstName = " "+dstA->name; @@ -2980,27 +3084,27 @@ static bool matchArgument2( { dstA->canType = extractCanonicalArgType(dstScope,dstFileScope,dstA); } - + if (srcA->canType==dstA->canType) { MATCH - return TRUE; + return TRUE; } else { //printf(" Canonical types do not match [%s]<->[%s]\n", // srcA->canType.data(),dstA->canType.data()); NOMATCH - return FALSE; + return FALSE; } } // new algorithm for argument matching bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *srcAl, - Definition *dstScope,FileDef *dstFileScope,ArgumentList *dstAl, - bool checkCV - ) + Definition *dstScope,FileDef *dstFileScope,ArgumentList *dstAl, + bool checkCV + ) { ASSERT(srcScope!=0 && dstScope!=0); @@ -3010,39 +3114,39 @@ bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *sr if (match) { MATCH - return TRUE; + return TRUE; } else { NOMATCH - return FALSE; + return FALSE; } } - + // handle special case with void argument if ( srcAl->count()==0 && dstAl->count()==1 && - dstAl->getFirst()->type=="void" ) + dstAl->getFirst()->type=="void" ) { // special case for finding match between func() and func(void) Argument *a=new Argument; a->type = "void"; srcAl->append(a); MATCH - return TRUE; + return TRUE; } if ( dstAl->count()==0 && srcAl->count()==1 && - srcAl->getFirst()->type=="void" ) + srcAl->getFirst()->type=="void" ) { // special case for finding match between func(void) and func() Argument *a=new Argument; a->type = "void"; dstAl->append(a); MATCH - return TRUE; + return TRUE; } if (srcAl->count() != dstAl->count()) { NOMATCH - return FALSE; // different number of arguments -> no match + return FALSE; // different number of arguments -> no match } if (checkCV) @@ -3050,12 +3154,12 @@ bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *sr if (srcAl->constSpecifier != dstAl->constSpecifier) { NOMATCH - return FALSE; // one member is const, the other not -> no match + return FALSE; // one member is const, the other not -> no match } if (srcAl->volatileSpecifier != dstAl->volatileSpecifier) { NOMATCH - return FALSE; // one member is volatile, the other not -> no match + return FALSE; // one member is volatile, the other not -> no match } } @@ -3066,15 +3170,15 @@ bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *sr for (;(srcA=srcAli.current(),dstA=dstAli.current());++srcAli,++dstAli) { if (!matchArgument2(srcScope,srcFileScope,srcA, - dstScope,dstFileScope,dstA) + dstScope,dstFileScope,dstA) ) { NOMATCH - return FALSE; + return FALSE; } } MATCH - return TRUE; // all arguments match + return TRUE; // all arguments match } @@ -3232,13 +3336,13 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl,bool forceNameOverwr * file fd. */ bool getDefs(const QCString &scName,const QCString &memberName, - const char *args, - MemberDef *&md, - ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd, - bool forceEmptyScope, - FileDef *currentFile, - bool checkCV - ) + const char *args, + MemberDef *&md, + ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd, + bool forceEmptyScope, + FileDef *currentFile, + bool checkCV + ) { fd=0, md=0, cd=0, nd=0, gd=0; if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ @@ -3246,24 +3350,24 @@ bool getDefs(const QCString &scName,const QCString &memberName, QCString scopeName=scName; //printf("Search for name=%s args=%s in scope=%s\n", // memberName.data(),args,scopeName.data()); - + int is,im=0,pm=0; // strip common part of the scope from the scopeName while ((is=scopeName.findRev("::"))!=-1 && - (im=memberName.find("::",pm))!=-1 && - (scopeName.right(scopeName.length()-is-2)==memberName.mid(pm,im-pm)) - ) + (im=memberName.find("::",pm))!=-1 && + (scopeName.right(scopeName.length()-is-2)==memberName.mid(pm,im-pm)) + ) { scopeName=scopeName.left(is); pm=im+2; } //printf("result after scope corrections scope=%s name=%s\n", // scopeName.data(),memberName.data()); - + QCString mName=memberName; QCString mScope; if (memberName.left(9)!="operator " && // treat operator conversion methods - // as a special case + // as a special case (im=memberName.findRev("::"))!=-1 && im<(int)memberName.length()-2 // not A:: ) @@ -3271,12 +3375,12 @@ bool getDefs(const QCString &scName,const QCString &memberName, mScope=memberName.left(im); mName=memberName.right(memberName.length()-im-2); } - + // handle special the case where both scope name and member scope are equal if (mScope==scopeName) scopeName.resize(0); //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data()); - + MemberName *mn = Doxygen::memberNameSDict[mName]; //printf("mName=%s mn=%p\n",mName.data(),mn); if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty())) @@ -3299,7 +3403,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, ClassDef *fcd=0; // todo: fill in correct fileScope! if ((fcd=getResolvedClass(Doxygen::globalScope,0,className)) && // is it a documented class - fcd->isLinkable() + fcd->isLinkable() ) { //printf(" Found fcd=%p\n",fcd); @@ -3316,23 +3420,23 @@ bool getDefs(const QCString &scName,const QCString &memberName, { //if (mmd->isLinkable()) //{ - bool match=args==0 || - matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), - fcd,fcd->getFileDef(),argList, - checkCV - ); - //printf("match=%d\n",match); - if (match) + bool match=args==0 || + matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), + fcd,fcd->getFileDef(),argList, + checkCV + ); + //printf("match=%d\n",match); + if (match) + { + ClassDef *mcd=mmd->getClassDef(); + int m=minClassDistance(fcd,mcd); + if (m<mdist && mcd->isLinkable()) { - ClassDef *mcd=mmd->getClassDef(); - int m=minClassDistance(fcd,mcd); - if (m<mdist && mcd->isLinkable()) - { - mdist=m; - cd=mcd; - md=mmd; - } + mdist=m; + cd=mcd; + md=mmd; } + } //} } if (argList) @@ -3347,16 +3451,16 @@ bool getDefs(const QCString &scName,const QCString &memberName, { //if (mmd->isLinkable()) //{ - ClassDef *mcd=mmd->getClassDef(); - //printf(" >Class %s found\n",mcd->name().data()); - int m=minClassDistance(fcd,mcd); - if (m<mdist /* && mcd->isLinkable()*/ ) - { - //printf("Class distance %d\n",m); - mdist=m; - cd=mcd; - md=mmd; - } + ClassDef *mcd=mmd->getClassDef(); + //printf(" >Class %s found\n",mcd->name().data()); + int m=minClassDistance(fcd,mcd); + if (m<mdist /* && mcd->isLinkable()*/ ) + { + //printf("Class distance %d\n",m); + mdist=m; + cd=mcd; + md=mmd; + } //} } } @@ -3378,7 +3482,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, } } /* go to the parent scope */ - + if (scopeOffset==0) { scopeOffset=-1; @@ -3388,9 +3492,50 @@ bool getDefs(const QCString &scName,const QCString &memberName, scopeOffset=0; } } while (scopeOffset>=0); - + // unknown or undocumented scope } + if (mn && scopeName.isEmpty() && mScope.isEmpty()) // Maybe a related function? + { + MemberListIterator mmli(*mn); + MemberDef *mmd, *fuzzy_mmd = 0; + ArgumentList *argList = 0; + bool hasEmptyArgs = args && strcmp(args, "()") == 0; + + if (args) + stringToArgumentList(args, argList = new ArgumentList); + + for (mmli.toFirst(); (mmd = mmli.current()); ++mmli) + { + if (!mmd->isLinkable() || !mmd->isRelated() || !mmd->getClassDef()) + continue; + + if (!args) break; + + QCString className = mmd->getClassDef()->name(); + + if (matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),mmd->argumentList(), + Doxygen::globalScope,mmd->getFileDef(),argList, + checkCV + ) + ) break; + + if (!fuzzy_mmd && hasEmptyArgs) + fuzzy_mmd = mmd; + } + + if (argList) delete argList, argList = 0; + + mmd = mmd ? mmd : fuzzy_mmd; + + if (mmd) + { + md = mmd; + cd = mmd->getClassDef(); + return TRUE; + } + } + // maybe an namespace, file or group member ? //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n", @@ -3500,33 +3645,33 @@ bool getDefs(const QCString &scName,const QCString &memberName, { //if (md->isLinkable()) //{ - fd=md->getFileDef(); - gd=md->getGroupDef(); - //printf(" md->name()=`%s' md->args=`%s' fd=%p gd=%p\n", - // md->name().data(),args,fd,gd); - if ( - (gd && gd->isLinkable()) || (fd && fd->isLinkable()) - ) + fd=md->getFileDef(); + gd=md->getGroupDef(); + //printf(" md->name()=`%s' md->args=`%s' fd=%p gd=%p\n", + // md->name().data(),args,fd,gd); + if ( + (gd && gd->isLinkable()) || (fd && fd->isLinkable()) + ) + { + //printf(" fd=%p gd=%p args=`%s'\n",fd,gd,args); + bool match=TRUE; + ArgumentList *argList=0; + if (args && !md->isDefine() && strcmp(args,"()")!=0) { - //printf(" fd=%p gd=%p args=`%s'\n",fd,gd,args); - bool match=TRUE; - ArgumentList *argList=0; - if (args && !md->isDefine() && strcmp(args,"()")!=0) - { - argList=new ArgumentList; - stringToArgumentList(args,argList); - match=matchArguments2( - md->getOuterScope(),fd,md->argumentList(), - Doxygen::globalScope,fd,argList, - checkCV); - delete argList; argList=0; - } - if (match) - { - //printf("Found match!\n"); - members.append(md); - } + argList=new ArgumentList; + stringToArgumentList(args,argList); + match=matchArguments2( + md->getOuterScope(),fd,md->argumentList(), + Doxygen::globalScope,fd,argList, + checkCV); + delete argList; argList=0; } + if (match) + { + //printf("Found match!\n"); + members.append(md); + } + } //} } if (members.count()!=1 && args && !strcmp(args,"()")) @@ -3588,7 +3733,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, } } } - + // no nothing found return FALSE; } @@ -3608,7 +3753,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, * - if `nd' is non zero, the scope was a namespace pointed to by nd. */ bool getScopeDefs(const char *docScope,const char *scope, - ClassDef *&cd, NamespaceDef *&nd) + ClassDef *&cd, NamespaceDef *&nd) { cd=0;nd=0; @@ -3622,7 +3767,7 @@ bool getScopeDefs(const char *docScope,const char *scope, scopeName=scopeName.right(scopeName.length()-2); explicitGlobalScope=TRUE; } - + QCString docScopeName=docScope; int scopeOffset=explicitGlobalScope ? 0 : docScopeName.length(); @@ -3630,7 +3775,7 @@ bool getScopeDefs(const char *docScope,const char *scope, { QCString fullName=scopeName.copy(); if (scopeOffset>0) fullName.prepend(docScopeName.left(scopeOffset)+"::"); - + if ((cd=getClass(fullName)) && cd->isLinkable()) { return TRUE; // class link written => quit @@ -3648,7 +3793,7 @@ bool getScopeDefs(const char *docScope,const char *scope, scopeOffset=0; } } while (scopeOffset>=0); - + return FALSE; } @@ -3667,19 +3812,19 @@ static bool isLowerCase(QCString &s) * @post return value TRUE implies *resContext!=0 or *resMember!=0 */ bool resolveRef(/* in */ const char *scName, - /* in */ const char *name, - /* in */ bool inSeeBlock, - /* out */ Definition **resContext, - /* out */ MemberDef **resMember - ) + /* in */ const char *name, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ MemberDef **resMember + ) { //printf("resolveRef(scName=%s,name=%s,inSeeBlock=%d)\n",scName,name,inSeeBlock); - + QCString tsName = name; bool memberScopeFirst = tsName.find('#')!=-1; QCString fullName = substitute(tsName,"#","::"); fullName = removeRedundantWhiteSpace(substitute(fullName,".","::")); - + int bracePos=fullName.findRev('('); // reverse is needed for operator()(...) int endNamePos=bracePos!=-1 ? bracePos : fullName.length(); int scopePos=fullName.findRev("::",endNamePos); @@ -3699,7 +3844,7 @@ bool resolveRef(/* in */ const char *scName, } //printf("scName=%s fullName=%s\n",scName,fullName.data()); - + // check if this is a class or namespace reference if (scName!=fullName && getScopeDefs(scName,fullName,cd,nd)) { @@ -3724,14 +3869,14 @@ bool resolveRef(/* in */ const char *scName, } // continue search... } - + // extract userscope+name QCString nameStr=fullName.left(endNamePos); // extract arguments QCString argsStr; if (bracePos!=-1) argsStr=fullName.right(fullName.length()-bracePos); - + // strip template specifier // TODO: match against the correct partial template instantiation int templPos=nameStr.find('<'); @@ -3752,11 +3897,11 @@ bool resolveRef(/* in */ const char *scName, // check if nameStr is a member or global. //printf("getDefs(scope=%s,name=%s,args=%s)\n",scopeStr.data(),nameStr.data(),argsStr.data()); if (getDefs(scopeStr,nameStr,argsStr, - md,cd,fd,nd,gd, - scopePos==0 && !memberScopeFirst, - 0, - TRUE - ) + md,cd,fd,nd,gd, + scopePos==0 && !memberScopeFirst, + 0, + TRUE + ) ) { //printf("after getDefs md=%p cd=%p fd=%p nd=%p gd=%p\n",md,cd,fd,nd,gd); @@ -3832,10 +3977,10 @@ QCString linkToText(const char *link,bool isFileName) */ bool generateRef(OutputDocInterface &od,const char *scName, - const char *name,bool inSeeBlock,const char *rt) + const char *name,bool inSeeBlock,const char *rt) { //printf("generateRef(scName=%s,name=%s,rt=%s)\n",scName,name,rt); - + Definition *compound; MemberDef *md; @@ -3847,8 +3992,8 @@ bool generateRef(OutputDocInterface &od,const char *scName, if (md && md->isLinkable()) // link to member { od.writeObjectLink(md->getReference(), - md->getOutputFileBase(), - md->anchor(),linkText); + md->getOutputFileBase(), + md->anchor(),linkText); // generate the page reference (for LaTeX) if (!md->isReference()) { @@ -3867,8 +4012,8 @@ bool generateRef(OutputDocInterface &od,const char *scName, linkText=linkToText(rt,TRUE); } od.writeObjectLink(compound->getReference(), - compound->getOutputFileBase(), - 0,linkText); + compound->getOutputFileBase(), + 0,linkText); if (!compound->isReference()) { writePageRef(od,compound->getOutputFileBase(),0); @@ -3881,14 +4026,14 @@ bool generateRef(OutputDocInterface &od,const char *scName, } bool resolveLink(/* in */ const char *scName, - /* in */ const char *lr, - /* in */ bool inSeeBlock, - /* out */ Definition **resContext, - /* out */ QCString &resAnchor - ) + /* in */ const char *lr, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ QCString &resAnchor + ) { *resContext=0; - + QCString linkRef=lr; //printf("ResolveLink linkRef=%s\n",lr); FileDef *fd; @@ -3973,7 +4118,7 @@ bool resolveLink(/* in */ const char *scName, // returns TRUE if a link could be generated. bool generateLink(OutputDocInterface &od,const char *clName, - const char *lr,bool inSeeBlock,const char *lt) + const char *lr,bool inSeeBlock,const char *lt) { //printf("generateLink(clName=%s,lr=%s,lr=%s)\n",clName,lr,lt); Definition *compound; @@ -3995,7 +4140,7 @@ bool generateLink(OutputDocInterface &od,const char *clName, linkText=linkToText(lt,TRUE); } od.writeObjectLink(compound->getReference(), - compound->getOutputFileBase(),anchor,linkText); + compound->getOutputFileBase(),anchor,linkText); if (!compound->isReference()) { writePageRef(od,compound->getOutputFileBase(),anchor); @@ -4107,7 +4252,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) { cachedResult = new FindFileCacheElem(0,FALSE); } - + QCString name=convertToQCString(QDir::cleanDirPath(n)); QCString path; int slashPos; @@ -4203,7 +4348,7 @@ QCString substituteKeywords(const QCString &s,const char *title,const QCString & result = substitute(result,"$relpath$",relPath); return result; } - + //---------------------------------------------------------------------- /*! Returns the character index within \a name of the first prefix @@ -4303,16 +4448,16 @@ QCString escapeCharsInString(const char *name,bool allowDots) case ',': result+="_00"; break; case ' ': result+="_01"; break; default: - if (caseSenseNames || !isupper(c)) - { - result+=c; - } - else - { - result+="_"; - result+=tolower(c); - } - break; + if (caseSenseNames || !isupper(c)) + { + result+=c; + } + else + { + result+="_"; + result+=tolower(c); + } + break; } } return result; @@ -4445,8 +4590,8 @@ void createSubDirs(QDir &d) * namespace part (as large as possible) and a classname part. */ void extractNamespaceName(const QCString &scopeName, - QCString &className,QCString &namespaceName, - bool allowEmptyClass) + QCString &className,QCString &namespaceName, + bool allowEmptyClass) { int i,p; QCString clName=scopeName; @@ -4497,9 +4642,9 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te int si,pi=0; ClassDef *cd=0; while ( - (si=scope.find("::",pi))!=-1 && !getClass(scope.left(si)+templ) && - ((cd=getClass(scope.left(si)))==0 || cd->templateArguments()==0) - ) + (si=scope.find("::",pi))!=-1 && !getClass(scope.left(si)+templ) && + ((cd=getClass(scope.left(si)))==0 || cd->templateArguments()==0) + ) { //printf("Tried `%s'\n",(scope.left(si)+templ).data()); pi=si+2; @@ -4551,8 +4696,8 @@ QCString stripScope(const char *name) case '>': count++; break; case '<': count--; if (count<=0) done=TRUE; break; default: - //printf("c=%c count=%d\n",c,count); - break; + //printf("c=%c count=%d\n",c,count); + break; } } //printf("pos > = %d\n",p+1); @@ -4563,7 +4708,7 @@ QCString stripScope(const char *name) } //printf("stripScope(%s)=%s\n",name,name); return name; - + } /*! Convert nibble (range 0..15) to hex char */ @@ -4589,18 +4734,18 @@ QCString convertToXML(const char *s) case '\'': result+="'"; break; case '"': result+="""; break; default: - //if (c<0) - //{ <- this doesn't work for languages that use - // characters with codes beyond 255 - // result+=(QCString)"&#x" + - // nibbleToHex((((uchar)c)>>4)&0xf)+ - // nibbleToHex(c&0xf)+";"; - //} - //else - //{ - result+=c; - //} - break; + //if (c<0) + //{ <- this doesn't work for languages that use + // characters with codes beyond 255 + // result+=(QCString)"&#x" + + // nibbleToHex((((uchar)c)>>4)&0xf)+ + // nibbleToHex(c&0xf)+";"; + //} + //else + //{ + result+=c; + //} + break; } } return result; @@ -4622,10 +4767,10 @@ QCString getOverloadDocs() // "provided for convenience. It differs from the above " // "function only in what argument(s) it accepts."; } - + void addMembersToMemberGroup(MemberList *ml, - MemberGroupSDict **ppMemberGroupSDict, - Definition *context) + MemberGroupSDict **ppMemberGroupSDict, + Definition *context) { ASSERT(context!=0); //printf("addMemberToMemberGroup()\n"); @@ -4660,12 +4805,12 @@ void addMembersToMemberGroup(MemberList *ml, if (mg==0) { mg = new MemberGroup( - context, - groupId, - info->header, - info->doc, - info->docFile - ); + context, + groupId, + info->header, + info->doc, + info->docFile + ); (*ppMemberGroupSDict)->append(groupId,mg); } mg->insertMember(fmd); // insert in member group @@ -4693,12 +4838,12 @@ void addMembersToMemberGroup(MemberList *ml, if (mg==0) { mg = new MemberGroup( - context, - groupId, - info->header, - info->doc, - info->docFile - ); + context, + groupId, + info->header, + info->doc, + info->docFile + ); (*ppMemberGroupSDict)->append(groupId,mg); } md = ml->take(index); // remove from member list @@ -4777,9 +4922,9 @@ int extractClassNameFromType(const QCString &type,int &pos,QCString &name,QCStri * prevent recursive substitution. */ QCString substituteTemplateArgumentsInString( - const QCString &name, - ArgumentList *formalArgs, - ArgumentList *actualArgs) + const QCString &name, + ArgumentList *formalArgs, + ArgumentList *actualArgs) { //printf("substituteTemplateArgumentsInString(name=%s formal=%s actualArg=%s)\n", // name.data(),argListToString(formalArgs).data(),argListToString(actualArgs).data()); @@ -4817,23 +4962,23 @@ QCString substituteTemplateArgumentsInString( result += actArg->type+" "; } else // for case where the actual arg is something like "unsigned int" - // the "int" part is in actArg->name. + // the "int" part is in actArg->name. { result += actArg->type+" "+actArg->name+" "; } found=TRUE; } else if (formArg->name==n && actArg==0 && !formArg->defval.isEmpty() && - formArg->defval!=name /* to prevent recursion */ - ) + formArg->defval!=name /* to prevent recursion */ + ) { result += substituteTemplateArgumentsInString(formArg->defval,formalArgs,actualArgs)+" "; found=TRUE; } } else if (formArg->name==n && actArg==0 && !formArg->defval.isEmpty() && - formArg->defval!=name /* to prevent recursion */ - ) + formArg->defval!=name /* to prevent recursion */ + ) { result += substituteTemplateArgumentsInString(formArg->defval,formalArgs,actualArgs)+" "; found=TRUE; @@ -4894,8 +5039,8 @@ QList<ArgumentList> *copyArgumentLists(const QList<ArgumentList> *srcLists) * strip both unless A<T> or B<S> are specialized template classes. */ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, - bool parentOnly, - QCString *pLastScopeStripped) + bool parentOnly, + QCString *pLastScopeStripped) { QCString result; int p=0; @@ -4923,7 +5068,7 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, int si= fullName.find("::",e); if (parentOnly && si==-1) break; - // we only do the parent scope, so we stop here if needed + // we only do the parent scope, so we stop here if needed result+=fullName.mid(p,i-p); //printf(" trying %s\n",(result+fullName.mid(i,e-i)).data()); @@ -5036,13 +5181,13 @@ found: //---------------------------------------------------------------------------- PageDef *addRelatedPage(const char *name,const QCString &ptitle, - const QCString &doc, - QList<SectionInfo> * /*anchors*/, - const char *fileName,int startLine, - const QList<ListItemInfo> *sli, - GroupDef *gd, - TagInfo *tagInfo - ) + const QCString &doc, + QList<SectionInfo> * /*anchors*/, + const char *fileName,int startLine, + const QList<ListItemInfo> *sli, + GroupDef *gd, + TagInfo *tagInfo + ) { PageDef *pd=0; //printf("addRelatedPage(name=%s gd=%p)\n",name,gd); @@ -5059,7 +5204,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, baseName=baseName.left(baseName.length()-4); else if (baseName.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length()); - + QCString title=ptitle.stripWhiteSpace(); pd=new PageDef(fileName,startLine,baseName,doc,title); @@ -5081,7 +5226,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, Doxygen::pageSDict->append(baseName,pd); if (gd) gd->addPage(pd); - + if (!pd->title().isEmpty()) { //outputList->writeTitle(pi->name,pi->title); @@ -5116,8 +5261,8 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- void addRefItem(const QList<ListItemInfo> *sli, - const char *prefix, - const char *name,const char *title,const char *args) + const char *prefix, + const char *name,const char *title,const char *args) { //printf("addRefItem(sli=%p,prefix=%s,name=%s,title=%s,args=%s)\n",sli,prefix,name,title,args); if (sli) @@ -5179,7 +5324,7 @@ void addGroupListToTitle(OutputList &ol,Definition *d) { if (!first) { ol.docify(","); ol.writeNonBreakableSpace(1); } else first=FALSE; ol.writeObjectLink(gd->getReference(), - gd->getOutputFileBase(),0,gd->groupTitle()); + gd->getOutputFileBase(),0,gd->groupTitle()); } ol.docify("]"); ol.endSmall(); @@ -5377,18 +5522,18 @@ static void latin2ToLatex(QTextStream &t,unsigned char c) } void filterLatexString(QTextStream &t,const char *str, - bool insideTabbing,bool insidePre,bool insideItem) + bool insideTabbing,bool insidePre,bool insideItem) { static bool isCzech = theTranslator->idLanguage()=="czech"; static bool isJapanese = theTranslator->idLanguage()=="japanese" || - theTranslator->idLanguage()=="japanese-en"; + theTranslator->idLanguage()=="japanese-en"; static bool isKorean = theTranslator->idLanguage()=="korean" || - theTranslator->idLanguage()=="korean-en"; + theTranslator->idLanguage()=="korean-en"; static bool isRussian = theTranslator->idLanguage()=="russian"; static bool isUkrainian = theTranslator->idLanguage()=="ukrainian"; static bool isSlovene = theTranslator->idLanguage()=="solvene"; static bool isChinese = theTranslator->idLanguage()=="chinese" || - theTranslator->idLanguage()=="chinese-traditional"; + theTranslator->idLanguage()=="chinese-traditional"; static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2"; static bool isGreek = theTranslator->idLanguage()=="greek"; //printf("filterLatexString(%s)\n",str); @@ -5410,23 +5555,23 @@ void filterLatexString(QTextStream &t,const char *str, case '}': t << "\\}"; break; case '_': t << "\\_"; break; default: - { - // Some languages use wide characters - if (c>=128 && (isJapanese || isKorean || isChinese)) - { - t << (char)c; - if (*p) - { - c = *p++; - t << (char)c; - } - } - else - { - t << (char)c; - } - break; - } + { + // Some languages use wide characters + if (c>=128 && (isJapanese || isKorean || isChinese)) + { + t << (char)c; + if (*p) + { + c = *p++; + t << (char)c; + } + } + else + { + t << (char)c; + } + break; + } } } else @@ -5454,13 +5599,13 @@ void filterLatexString(QTextStream &t,const char *str, t << "["; break; case ']': if (pc=='[') t << "$\\,$"; - if (Config_getBool("PDF_HYPERLINKS") || insideItem) - t << "\\mbox{]}"; - else - t << "]"; + if (Config_getBool("PDF_HYPERLINKS") || insideItem) + t << "\\mbox{]}"; + else + t << "]"; break; case '-': if (*p=='>') - { t << " $\\rightarrow$ "; p++; } + { t << " $\\rightarrow$ "; p++; } else { t << (char)c; } break; @@ -5475,75 +5620,75 @@ void filterLatexString(QTextStream &t,const char *str, break; default: - { - // Some languages use wide characters - if (isJapanese || isKorean || isChinese) - { - if (c>=128) - { - t << (char)c; - if (*p) - { - c = *p++; - t << (char)c; - } - } - else // ascii char => see if we can insert a hypenation hint - { - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else if (isCzech || isRussian || isUkrainian || isSlovene) - { - if (c>=128) - { - t << (char)c; - } - else // ascii char => see if we can insert a hypenation hint - { - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else if (isGreek) - { - if (c<128) - { - t << "\\textlatin{" << (char)c << "}"; - } - else - { - t << (char)c; - } - } - else if (isLatin2) - { - if (c>=128) - { - latin2ToLatex(t,c); - } - else - { - // see if we can insert an hyphenation hint - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else // another language => assume latin1 charset - { - if (c>=128) - { - latin1ToLatex(t,c); - } - else - { - // see if we can insert an hyphenation hint - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - } + { + // Some languages use wide characters + if (isJapanese || isKorean || isChinese) + { + if (c>=128) + { + t << (char)c; + if (*p) + { + c = *p++; + t << (char)c; + } + } + else // ascii char => see if we can insert a hypenation hint + { + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else if (isCzech || isRussian || isUkrainian || isSlovene) + { + if (c>=128) + { + t << (char)c; + } + else // ascii char => see if we can insert a hypenation hint + { + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else if (isGreek) + { + if (c<128) + { + t << "\\textlatin{" << (char)c << "}"; + } + else + { + t << (char)c; + } + } + else if (isLatin2) + { + if (c>=128) + { + latin2ToLatex(t,c); + } + else + { + // see if we can insert an hyphenation hint + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else // another language => assume latin1 charset + { + if (c>=128) + { + latin1ToLatex(t,c); + } + else + { + // see if we can insert an hyphenation hint + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + } } } pc = c; @@ -5567,28 +5712,28 @@ QCString rtfFormatBmkStr(const char *name) QCString* tag = g_tagDict.find( key ); if ( !tag ) { - // This particular name has not yet been added - // to the list. Add it, associating it with the - // next tag value, and increment the next tag. - tag = new QCString( g_nextTag.copy() ); // Make sure to use a deep copy! - g_tagDict.insert( key, tag ); - - // This is the increment part - char* nxtTag = g_nextTag.data() + g_nextTag.length() - 1; - for ( unsigned int i = 0; i < g_nextTag.length(); ++i, --nxtTag ) - { - if ( ( ++(*nxtTag) ) > 'Z' ) - { - *nxtTag = 'A'; - } - else - { - // Since there was no carry, we can stop now - break; - } - } + // This particular name has not yet been added + // to the list. Add it, associating it with the + // next tag value, and increment the next tag. + tag = new QCString( g_nextTag.copy() ); // Make sure to use a deep copy! + g_tagDict.insert( key, tag ); + + // This is the increment part + char* nxtTag = g_nextTag.data() + g_nextTag.length() - 1; + for ( unsigned int i = 0; i < g_nextTag.length(); ++i, --nxtTag ) + { + if ( ( ++(*nxtTag) ) > 'Z' ) + { + *nxtTag = 'A'; + } + else + { + // Since there was no carry, we can stop now + break; + } + } } - + return *tag; } @@ -5703,7 +5848,7 @@ QCString stripLeadingAndTrailingEmptyLines(const QCString &s) } void stringToSearchIndex(const QCString &docBaseUrl,const QCString &title, - const QCString &str,bool priority,const QCString &anchor) + const QCString &str,bool priority,const QCString &anchor) { static bool searchEngine = Config_getBool("SEARCHENGINE"); if (searchEngine) @@ -5773,8 +5918,8 @@ bool checkIfTypedef(Definition *scope,FileDef *fileScope,const char *n) if (name.isEmpty()) return FALSE; // no name was given - DefinitionList *dl = Doxygen::symbolMap->find(name); - if (dl==0) + DefinitionIntf *di = Doxygen::symbolMap->find(name); + if (di==0) return FALSE; // could not find any matching symbols // mostly copied from getResolvedClassRec() @@ -5787,24 +5932,39 @@ bool checkIfTypedef(Definition *scope,FileDef *fileScope,const char *n) name = name.mid(qualifierIndex+2); } - // find the closest closest matching definition - DefinitionListIterator dli(*dl); - Definition *d; int minDistance = 10000; MemberDef *bestMatch = 0; - for (dli.toFirst();(d=dli.current());++dli) + + if (di->definitionType()==DefinitionIntf::TypeSymbolList) { - if (d->definitionType()==Definition::TypeMember) + // find the closest closest matching definition + DefinitionListIterator dli(*(DefinitionList*)di); + Definition *d; + for (dli.toFirst();(d=dli.current());++dli) { - g_visitedNamespaces.clear(); - int distance = isAccessibleFromWithExpScope(scope,fileScope,d,explicitScopePart); - if (distance!=-1 && distance<minDistance) + if (d->definitionType()==Definition::TypeMember) { - minDistance = distance; - bestMatch = (MemberDef *)d; + g_visitedNamespaces.clear(); + int distance = isAccessibleFromWithExpScope(scope,fileScope,d,explicitScopePart); + if (distance!=-1 && distance<minDistance) + { + minDistance = distance; + bestMatch = (MemberDef *)d; + } } } } + else if (di->definitionType()==Definition::TypeMember) + { + Definition *d = (Definition *)di; + g_visitedNamespaces.clear(); + int distance = isAccessibleFromWithExpScope(scope,fileScope,d,explicitScopePart); + if (distance!=-1 && distance<minDistance) + { + minDistance = distance; + bestMatch = (MemberDef *)d; + } + } if (bestMatch && bestMatch->isTypedef()) return TRUE; // closest matching symbol is a typedef diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index ebc1ced..2f751a9 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -39,6 +39,7 @@ #include <qdir.h> #include <qfile.h> #include <qtextstream.h> +#include <qintdict.h> // no debug info #define XML_DB(x) do {} while(0) @@ -61,6 +62,51 @@ static const char compound_xsd[] = //------------------ +class XmlSectionMapper : public QIntDict<char> +{ + public: + XmlSectionMapper() : QIntDict<char>(47) + { + insert(MemberList::pubTypes,"public-type"); + insert(MemberList::pubMethods,"public-func"); + insert(MemberList::pubAttribs,"public-attrib"); + insert(MemberList::pubSlots,"public-slot"); + insert(MemberList::signals,"signal"); + insert(MemberList::dcopMethods,"dcop-func"); + insert(MemberList::properties,"property"); + insert(MemberList::events,"event"); + insert(MemberList::pubStaticMethods,"public-static-func"); + insert(MemberList::pubStaticAttribs,"public-static-attrib"); + insert(MemberList::proTypes,"protected-type"); + insert(MemberList::proMethods,"protected-func"); + insert(MemberList::proAttribs,"protected-attrib"); + insert(MemberList::proSlots,"protected-slot"); + insert(MemberList::proStaticMethods,"protected-static-func"); + insert(MemberList::proStaticAttribs,"protected-static-attrib"); + insert(MemberList::pacTypes,"package-type"); + insert(MemberList::pacMethods,"package-func"); + insert(MemberList::pacAttribs,"package-attrib"); + insert(MemberList::pacStaticMethods,"package-static-func"); + insert(MemberList::pacStaticAttribs,"package-static-attrib"); + insert(MemberList::priTypes,"private-type"); + insert(MemberList::priMethods,"private-func"); + insert(MemberList::priAttribs,"private-attrib"); + insert(MemberList::priSlots,"private-slot"); + insert(MemberList::priStaticMethods,"private-static-func"); + insert(MemberList::priStaticAttribs,"private-static-attrib"); + insert(MemberList::friends,"friend"); + insert(MemberList::related,"related"); + insert(MemberList::decDefineMembers,"define"); + insert(MemberList::decProtoMembers,"prototype"); + insert(MemberList::decTypedefMembers,"typedef"); + insert(MemberList::decEnumMembers,"enum"); + insert(MemberList::decFuncMembers,"func"); + insert(MemberList::decVarMembers,"var"); + } +}; + +static XmlSectionMapper g_xmlSectionMapper; + inline void writeXMLString(QTextStream &t,const char *s) { @@ -346,6 +392,10 @@ class XMLCodeGenerator : public CodeOutputInterface if (extRef) m_external=extRef; } } + void linkableSymbol(int, const char *,Definition *,Definition *) + { + } + void finish() { if (m_insideCodeLine) endCodeLine(); @@ -1192,9 +1242,9 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) writeInnerClasses(cd->getInnerClasses(),t); writeTemplateList(cd,t); - if (cd->memberGroupSDict) + if (cd->getMemberGroupSDict()) { - MemberGroupSDict::Iterator mgli(*cd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1203,6 +1253,16 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) } } + QListIterator<MemberList> mli(cd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::detailedLists)==0) + { + generateXMLSection(cd,ti,t,ml,g_xmlSectionMapper.find(ml->listType())); + } + } +#if 0 generateXMLSection(cd,ti,t,cd->pubTypes,"public-type"); generateXMLSection(cd,ti,t,cd->pubMethods,"public-func"); generateXMLSection(cd,ti,t,cd->pubAttribs,"public-attrib"); @@ -1232,6 +1292,7 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) generateXMLSection(cd,ti,t,cd->priStaticAttribs,"private-static-attrib"); generateXMLSection(cd,ti,t,cd->friends,"friend"); generateXMLSection(cd,ti,t,cd->related,"related"); +#endif t << " <briefdescription>" << endl; writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); @@ -1311,12 +1372,12 @@ static void generateXMLForNamespace(NamespaceDef *nd,QTextStream &ti) writeXMLString(t,nd->name()); t << "</compoundname>" << endl; - writeInnerClasses(nd->classSDict,t); - writeInnerNamespaces(nd->namespaceSDict,t); + writeInnerClasses(nd->getClassSDict(),t); + writeInnerNamespaces(nd->getNamespaceSDict(),t); - if (nd->memberGroupSDict) + if (nd->getMemberGroupSDict()) { - MemberGroupSDict::Iterator mgli(*nd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1325,12 +1386,23 @@ static void generateXMLForNamespace(NamespaceDef *nd,QTextStream &ti) } } + QListIterator<MemberList> mli(nd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::declarationLists)==0) + { + generateXMLSection(nd,ti,t,ml,g_xmlSectionMapper.find(ml->listType())); + } + } +#if 0 generateXMLSection(nd,ti,t,&nd->decDefineMembers,"define"); generateXMLSection(nd,ti,t,&nd->decProtoMembers,"prototype"); generateXMLSection(nd,ti,t,&nd->decTypedefMembers,"typedef"); generateXMLSection(nd,ti,t,&nd->decEnumMembers,"enum"); generateXMLSection(nd,ti,t,&nd->decFuncMembers,"func"); generateXMLSection(nd,ti,t,&nd->decVarMembers,"var"); +#endif t << " <briefdescription>" << endl; writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription()); @@ -1437,18 +1509,18 @@ static void generateXMLForFile(FileDef *fd,QTextStream &ti) t << " </invincdepgraph>" << endl; } - if (fd->classSDict) + if (fd->getClassSDict()) { - writeInnerClasses(fd->classSDict,t); + writeInnerClasses(fd->getClassSDict(),t); } - if (fd->namespaceSDict) + if (fd->getNamespaceSDict()) { - writeInnerNamespaces(fd->namespaceSDict,t); + writeInnerNamespaces(fd->getNamespaceSDict(),t); } - if (fd->memberGroupSDict) + if (fd->getMemberGroupSDict()) { - MemberGroupSDict::Iterator mgli(*fd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*fd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1457,12 +1529,23 @@ static void generateXMLForFile(FileDef *fd,QTextStream &ti) } } + QListIterator<MemberList> mli(fd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::declarationLists)==0) + { + generateXMLSection(fd,ti,t,ml,g_xmlSectionMapper.find(ml->listType())); + } + } +#if 0 generateXMLSection(fd,ti,t,fd->decDefineMembers,"define"); generateXMLSection(fd,ti,t,fd->decProtoMembers,"prototype"); generateXMLSection(fd,ti,t,fd->decTypedefMembers,"typedef"); generateXMLSection(fd,ti,t,fd->decEnumMembers,"enum"); generateXMLSection(fd,ti,t,fd->decFuncMembers,"func"); generateXMLSection(fd,ti,t,fd->decVarMembers,"var"); +#endif t << " <briefdescription>" << endl; writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); @@ -1525,9 +1608,9 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) writeInnerPages(gd->getPages(),t); writeInnerGroups(gd->getSubGroups(),t); - if (gd->memberGroupSDict) + if (gd->getMemberGroupSDict()) { - MemberGroupSDict::Iterator mgli(*gd->memberGroupSDict); + MemberGroupSDict::Iterator mgli(*gd->getMemberGroupSDict()); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1536,12 +1619,23 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) } } + QListIterator<MemberList> mli(gd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberList::declarationLists)==0) + { + generateXMLSection(gd,ti,t,ml,g_xmlSectionMapper.find(ml->listType())); + } + } +#if 0 generateXMLSection(gd,ti,t,&gd->decDefineMembers,"define"); generateXMLSection(gd,ti,t,&gd->decProtoMembers,"prototype"); generateXMLSection(gd,ti,t,&gd->decTypedefMembers,"typedef"); generateXMLSection(gd,ti,t,&gd->decEnumMembers,"enum"); generateXMLSection(gd,ti,t,&gd->decFuncMembers,"func"); generateXMLSection(gd,ti,t,&gd->decVarMembers,"var"); +#endif t << " <briefdescription>" << endl; writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); |