diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 16 | ||||
-rw-r--r-- | src/classdef.h | 8 | ||||
-rw-r--r-- | src/code.l | 18 | ||||
-rw-r--r-- | src/config.l | 68 | ||||
-rw-r--r-- | src/defargs.l | 6 | ||||
-rw-r--r-- | src/definition.cpp | 2 | ||||
-rw-r--r-- | src/doc.l | 8 | ||||
-rw-r--r-- | src/dot.cpp | 3 | ||||
-rw-r--r-- | src/doxygen.cpp | 83 | ||||
-rw-r--r-- | src/doxygen.h | 3 | ||||
-rw-r--r-- | src/entry.h | 30 | ||||
-rw-r--r-- | src/htmlgen.cpp | 77 | ||||
-rw-r--r-- | src/htmlgen.h | 8 | ||||
-rw-r--r-- | src/htmlhelp.cpp | 10 | ||||
-rw-r--r-- | src/htmlhelp.h | 1 | ||||
-rw-r--r-- | src/index.cpp | 6 | ||||
-rw-r--r-- | src/latexgen.cpp | 10 | ||||
-rw-r--r-- | src/latexgen.h | 8 | ||||
-rw-r--r-- | src/mangen.h | 8 | ||||
-rw-r--r-- | src/memberdef.cpp | 54 | ||||
-rw-r--r-- | src/outputgen.h | 8 | ||||
-rw-r--r-- | src/outputlist.h | 16 | ||||
-rw-r--r-- | src/pre.l | 2 | ||||
-rw-r--r-- | src/rtfgen.h | 8 | ||||
-rw-r--r-- | src/scanner.l | 66 | ||||
-rw-r--r-- | src/translator.h | 367 | ||||
-rw-r--r-- | src/translator_br.h | 31 | ||||
-rw-r--r-- | src/translator_de.h | 13 | ||||
-rw-r--r-- | src/translator_es.h | 2 | ||||
-rw-r--r-- | src/translator_fr.h | 2 | ||||
-rw-r--r-- | src/translator_sk.h | 2 | ||||
-rw-r--r-- | src/util.cpp | 297 | ||||
-rw-r--r-- | src/util.h | 5 | ||||
-rw-r--r-- | src/xmlgen.cpp | 645 |
34 files changed, 1238 insertions, 653 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 6dbc086..0a600a2 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -103,6 +103,7 @@ ClassDef::ClassDef( m_templateMaster =0; m_templBaseClassNames = 0; m_artificial = FALSE; + m_isAbstract = FALSE; } // destroy the class definition @@ -453,6 +454,11 @@ void ClassDef::insertMember(MemberDef *md) } + if (md->virtualness()==Pure) + { + m_isAbstract=TRUE; + } + MemberInfo *mi = new MemberInfo((MemberDef *)md, md->protection(),md->virtualness(),FALSE); MemberNameInfo *mni=0; @@ -660,7 +666,10 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, if (a) ol.docify(", "); } ol.docify(">"); + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); ol.lineBreak(); + ol.popGeneratorState(); } ol.docify(type.lower()+" "+name); ol.endSubsubsection(); @@ -1186,8 +1195,11 @@ void ClassDef::writeDocumentation(OutputList &ol) ClassDef *innerCd; for (cli.toFirst();(innerCd=cli.current());++cli) { - msg("Generating docs for nested compound %s...\n",innerCd->name().data()); - innerCd->writeDocumentation(ol); + if (innerCd->isLinkableInProject() && innerCd->templateMaster()==0) + { + msg("Generating docs for nested compound %s...\n",innerCd->name().data()); + innerCd->writeDocumentation(ol); + } } } } diff --git a/src/classdef.h b/src/classdef.h index e662152..924c56f 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -195,6 +195,11 @@ class ClassDef : public Definition QCString qualifiedNameWithTemplateParameters( QList<ArgumentList> *actualParams=0) const; + /*! Returns TRUE if there is at least one pure virtual member in this + * class. + */ + bool isAbstract() const { return m_isAbstract; } + /* member lists by protection */ MemberList pubMembers; MemberList proMembers; @@ -402,6 +407,9 @@ class ClassDef : public Definition * the inheritance tree. */ bool m_artificial; + + /*! Is this an abstact class? */ + bool m_isAbstract; }; /*! \brief Class that contains information about a usage relation. @@ -328,7 +328,7 @@ static void addVariable() else { int i; - if ((getResolvedClass(g_cvd.type)) || (g_codeClassDict[g_cvd.type])) + if ((getResolvedClass(g_currentDefinition,g_cvd.type)) || (g_codeClassDict[g_cvd.type])) { //printf("adding variable `%s' `%s'\n",g_cvd.type.data(),g_cvd.name.data()); g_cvd.classScope=g_classScope; @@ -337,7 +337,7 @@ static void addVariable() else if ((i=g_cvd.type.find('<'))>0) { g_cvd.type = g_cvd.type.left(i); - if ((getResolvedClass(g_cvd.type)) || (g_codeClassDict[g_cvd.type.left(i)])) + if ((getResolvedClass(g_currentDefinition,g_cvd.type)) || (g_codeClassDict[g_cvd.type.left(i)])) { //printf("adding template type variable `%s' `%s'\n",g_cvd.type.data(),g_cvd.name.data()); g_cvd.classScope=g_classScope; @@ -359,7 +359,7 @@ static void addParameter() else { int i; - if ((getResolvedClass(g_cvd.type)) || (g_codeClassDict[g_cvd.type])) + if ((getResolvedClass(g_currentDefinition,g_cvd.type)) || (g_codeClassDict[g_cvd.type])) { //printf("adding parameter `%s' `%s'\n",g_cvd.type.data(),g_cvd.name.data()); g_cvd.classScope=g_classScope; @@ -368,7 +368,7 @@ static void addParameter() else if ((i=g_cvd.type.find('<'))>0) { g_cvd.type = g_cvd.type.left(i); - if ((getResolvedClass(g_cvd.type)) || (g_codeClassDict[g_cvd.type.left(i)])) + if ((getResolvedClass(g_currentDefinition,g_cvd.type)) || (g_codeClassDict[g_cvd.type.left(i)])) { //printf("adding template type parameter `%s' `%s'\n",g_cvd.type.data(),g_cvd.name.data()); g_cvd.classScope=g_classScope; @@ -409,10 +409,10 @@ static void generateClassLink(OutputDocInterface &ol,char *clName,int *clNameLen QCString className=clName; if (clNameLen) *clNameLen=0; if (className.isEmpty()) return; - ClassDef *cd=getResolvedClass(className); + ClassDef *cd=getResolvedClass(g_currentDefinition,className); if (cd==0 && (i=className.find('<'))!=-1) { - cd=getResolvedClass(className.left(i)); + cd=getResolvedClass(g_currentDefinition,className.left(i)); } if (cd && cd->isLinkable()) { @@ -458,11 +458,11 @@ static ClassDef *stripClassName(const char *s) //printf("g_classScope=`%s' clName=`%s'\n",g_classScope.data(),clName.data()); if (!g_classScope.isEmpty()) { - cd=getResolvedClass(g_classScope+"::"+clName); + cd=getResolvedClass(g_currentDefinition,g_classScope+"::"+clName); } if (cd==0) { - cd=getResolvedClass(clName); + cd=getResolvedClass(g_currentDefinition,clName); } if (cd) { @@ -632,7 +632,7 @@ static void generateMemberLink(OutputDocInterface &ol,const char *varName, } else { - ClassDef *vcd = getResolvedClass(g_classScope); + ClassDef *vcd = getResolvedClass(g_currentDefinition,g_classScope); if (vcd && vcd->isLinkable()) { //printf("Found class %s for variable `%s'\n",g_classScope.data(),varName); diff --git a/src/config.l b/src/config.l index 583195c..3a887a6 100644 --- a/src/config.l +++ b/src/config.l @@ -2165,28 +2165,68 @@ void Config::create() // The IMAGE_PATTERNS tag is now officially obsolete. } - -bool Config::parse(const char *fn) +static QCString configFileToString(const char *name) { - QFileInfo fi( fn ); - if (!fi.exists()) + if (name==0 || name[0]==0) return 0; + QFile f; + + bool fileOpened=FALSE; + if (name[0]=='-' && name[1]==0) // read from stdin { - return FALSE; + fileOpened=f.open(IO_ReadOnly,stdin); + if (fileOpened) + { + const int bSize=4096; + QCString contents(bSize); + int totalSize=0; + int size; + while ((size=f.readBlock(contents.data()+totalSize,bSize))==bSize) + { + totalSize+=bSize; + contents.resize(totalSize+bSize); + } + totalSize+=size+2; + contents.resize(totalSize); + contents.at(totalSize-2)='\n'; // to help the scanner + contents.at(totalSize-1)='\0'; + return contents; + } } - QFile f( fn ); - if (!f.open(IO_ReadOnly)) + else // read from file { - return FALSE; + QFileInfo fi(name); + if (!fi.exists() || !fi.isFile()) + { + config_err("Error: file `%s' not found\n",name); + return ""; + } + f.setName(name); + fileOpened=f.open(IO_ReadOnly); + if (fileOpened) + { + int fsize=f.size(); + QCString contents(fsize+2); + f.readBlock(contents.data(),fsize); + if (fsize==0 || contents[fsize-1]=='\n') + contents[fsize]='\0'; + else + contents[fsize]='\n'; // to help the scanner + contents[fsize+1]='\0'; + f.close(); + return contents; + } } - // read file into a string buffer - int fsize = fi.size(); - QCString contents(fsize+1); // add room for \0 terminator - if (f.readBlock(contents.data(),fsize)!=fsize) + if (!fileOpened) { - return FALSE; + config_err("Error: cannot open file `%s' for reading\n",name); } - contents[fsize]='\0'; + return ""; +} + +bool Config::parse(const char *fn) +{ + QCString contents = configFileToString(fn); config = Config::instance(); inputString = contents.data(); inputPosition = 0; diff --git a/src/defargs.l b/src/defargs.l index ebdb6ad..3fa6e65 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -262,12 +262,12 @@ ID [a-z_A-Z][a-z_A-Z0-9]* a->attrib = g_curArgAttrib.copy(); if (i>=0 && g_curArgTypeName.at(i)!=':') { // type contains a name - a->type = g_curArgTypeName.left(i+1).stripWhiteSpace(); + a->type = removeRedundantWhiteSpace(g_curArgTypeName.left(i+1)); a->name = g_curArgTypeName.right(g_curArgTypeName.length()-i-1); } else // assume only the type was specified, try to determine name later { - a->type = g_curArgTypeName.stripWhiteSpace(); + a->type = removeRedundantWhiteSpace(g_curArgTypeName); } a->array = removeRedundantWhiteSpace(g_curArgArray); a->defval = g_curArgDefValue.copy(); @@ -365,7 +365,6 @@ void stringToArgumentList(const char *argsString,ArgumentList* &al) if (al==0) return; if (argsString==0) return; g_inputString = argsString; - //printf("stringToArgumentList(%s)\n",argsString); g_inputPosition = 0; g_curArgTypeName.resize(0); g_curArgDefValue.resize(0); @@ -374,6 +373,7 @@ void stringToArgumentList(const char *argsString,ArgumentList* &al) defargsYYrestart( defargsYYin ); BEGIN( Start ); defargsYYlex(); + //printf("stringToArgumentList(%s) result=%s\n",argsString,argListToString(al).data()); } extern "C" { // some bogus code to keep the compiler happy diff --git a/src/definition.cpp b/src/definition.cpp index f17d980..e4ea9c3 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -50,7 +50,7 @@ Definition::Definition(const char *df,int dl, m_todoId=0; m_testId=0; m_bugId=0; - m_outerScope=0; + m_outerScope=Doxygen::globalScope; } Definition::~Definition() @@ -2050,10 +2050,10 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) <DocScan>"</"{TR}{ATTR}">" <DocScan>"<"{TD}{ATTR}">" { if (curTable) curTable->newElem(); } <DocScan>"</"{TD}{ATTR}">" -<DocScan>"<"{OL}{ATTR}">" { outDoc->startEnumList(); +<DocScan>"<"{OL}{ATTR}">"{BN}* { outDoc->startEnumList(); currentListIndent.push("O"); } -<DocScan>"</"{OL}{ATTR}">" { +<DocScan>"</"{OL}{ATTR}">"{BN}* { if (currentListIndent.isEmpty()) { warn(yyFileName,yyLineNr, @@ -2072,10 +2072,10 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) currentListIndent.pop(); } } -<DocScan>"<"{UL}{ATTR}">" { outDoc->startItemList(); +<DocScan>"<"{UL}{ATTR}">"{BN}* { outDoc->startItemList(); currentListIndent.push("U"); } -<DocScan>"</"{UL}{ATTR}">" { +<DocScan>"</"{UL}{ATTR}">"{BN}* { if (currentListIndent.isEmpty()) { warn(yyFileName,yyLineNr, diff --git a/src/dot.cpp b/src/dot.cpp index 20666e6..88e0571 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -97,7 +97,8 @@ static bool convertMapFile(QTextStream &t,const char *mapName) if ((dest=Doxygen::tagDestinationDict[refPtr])) t << *dest << "/"; } t << urlPtr << "\" shape=\"rect\" coords=\"" - << x1 << "," << y1 << "," << x2 << "," << y2 << "\">" << endl; + << x1 << "," << y1 << "," << x2 << "," << y2 << "\"" + << " alt=\"\">" << endl; } } } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 01a22f2..a0dd54c 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -98,7 +98,7 @@ StringDict Doxygen::aliasDict(257); // aliases FileNameDict *Doxygen::includeNameDict; // include names FileNameDict *Doxygen::exampleNameDict; // examples FileNameDict *Doxygen::imageNameDict; // images -StringDict Doxygen::typedefDict(1009); // all typedefs +//TypedefDict Doxygen::typedefDict(1009); // all typedefs StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases StringDict Doxygen::tagDestinationDict(257); // all tag locations // a member group @@ -140,7 +140,7 @@ void clearAll() Doxygen::includeNameDict->clear(); Doxygen::exampleNameDict->clear(); Doxygen::imageNameDict->clear(); - Doxygen::typedefDict.clear(); + //Doxygen::typedefDict.clear(); Doxygen::groupDict.clear(); Doxygen::formulaDict.clear(); Doxygen::formulaNameDict.clear(); @@ -172,7 +172,7 @@ void statistics() fprintf(stderr,"--- aliasDict stats ----\n"); Doxygen::aliasDict.statistics(); fprintf(stderr,"--- typedefDict stats ----\n"); - Doxygen::typedefDict.statistics(); + //Doxygen::typedefDict.statistics(); fprintf(stderr,"--- namespaceAliasDict stats ----\n"); Doxygen::namespaceAliasDict.statistics(); fprintf(stderr,"--- groupDict stats ----\n"); @@ -937,9 +937,6 @@ static void buildClassList(Entry *root) Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName); if (d==0) { - // TODO: Due to the order in which the tag file is written - // a nested class can be found before its parent! - // //warn(root->fileName,root->startLine, // "Warning: Internal inconsistency: scope for class %s not " // "found!\n",fullName.data() @@ -1263,8 +1260,6 @@ static void findUsingDeclarations(Entry *root) } } - - //---------------------------------------------------------------------- static MemberDef *addVariableToClass( @@ -1401,6 +1396,7 @@ static MemberDef *addVariableToClass( //TODO: insert FileDef instead of filename strings. cd->insertUsedFile(root->fileName); + root->section = Entry::EMPTY_SEC; return md; } @@ -1569,6 +1565,7 @@ static MemberDef *addVariableToFile( Doxygen::functionNameDict.insert(name,mn); Doxygen::functionNameList.append(mn); } + root->section = Entry::EMPTY_SEC; return md; } @@ -1983,6 +1980,7 @@ static void buildMemberList(Entry *root) cd->insertUsedFile(root->fileName); addMemberToGroups(root,md); + root->section = Entry::EMPTY_SEC; } else if (root->parent && !(root->parent->section & Entry::COMPOUND_MASK) && @@ -2176,6 +2174,7 @@ static void buildMemberList(Entry *root) Doxygen::functionNameList.append(mn); } addMemberToGroups(root,md); + root->section = Entry::EMPTY_SEC; } else { @@ -2397,28 +2396,6 @@ static void replaceNamespaceAliases(QCString &scope,int i) //printf("replaceNamespaceAliases() result=%s\n",scope.data()); } -static QCString resolveTypeDef(const QCString &name) -{ - QCString typeName; - if (!name.isEmpty()) - { - QCString *subst = Doxygen::typedefDict[name]; - if (subst) - { - int count=0; - typeName=*subst; - QCString *newSubst; - while ((newSubst=Doxygen::typedefDict[typeName]) && count<10) - { - if (typeName==*newSubst) break; // prevent lock-up - typeName=*newSubst; - count++; - } - } - } - return typeName; -} - /*! make a dictionary of all template arguments of class cd * that are part of the base class name. * Example: A template class A with template arguments <R,S,T> @@ -2507,7 +2484,7 @@ static void findUsedClassesForClass(Entry *root, //printf("extractClassNameFromType(%s)\n",type.data()); while (!found && extractClassNameFromType(type,pos,usedClassName,templSpec)) { - QCString typeName = resolveTypeDef(usedClassName); + QCString typeName = resolveTypeDef(masterCd,usedClassName); QCString usedName = usedClassName+templSpec; if (!typeName.isEmpty()) { @@ -2566,14 +2543,14 @@ static void findUsedClassesForClass(Entry *root, QCString scopeName = scope ? scope->qualifiedName().data() : 0; if (!scopeName.isEmpty()) { - usedCd=getResolvedClass(scopeName+"::"+usedName,0,&templSpec); - if (usedCd==0) usedCd=getResolvedClass(scopeName+"::"+usedClassName,0,&templSpec); + usedCd=getResolvedClass(masterCd,scopeName+"::"+usedName,0,&templSpec); + if (usedCd==0) usedCd=getResolvedClass(masterCd,scopeName+"::"+usedClassName,0,&templSpec); //printf("Search for class %s result=%p\n",(scopeName+"::"+usedName).data(),usedCd); } else { - usedCd=getResolvedClass(usedName,0,&templSpec); - if (usedCd==0) usedCd=getResolvedClass(usedClassName,0,&templSpec); + usedCd=getResolvedClass(masterCd,usedName,0,&templSpec); + if (usedCd==0) usedCd=getResolvedClass(masterCd,usedClassName,0,&templSpec); //printf("Search for class %s result=%p\n",usedName.data(),usedCd); } if (scope) scope=scope->getOuterScope(); @@ -2735,17 +2712,19 @@ static bool findClassRelation( //printf("scopePrefix=`%s' bi->name=`%s'\n", // scopeName.left(scopeOffset).data(),bi->name.data()); - QCString baseClassName=stripTemplateSpecifiersFromScope - (removeRedundantWhiteSpace(bi->name)); + QCString baseClassName=bi->name; if (scopeOffset>0) { baseClassName.prepend(scopeName.left(scopeOffset)+"::"); } + baseClassName=stripTemplateSpecifiersFromScope + (removeRedundantWhiteSpace(baseClassName)); bool baseClassIsTypeDef; QCString templSpec; - ClassDef *baseClass=getResolvedClass(baseClassName,&baseClassIsTypeDef,&templSpec); + ClassDef *baseClass=getResolvedClass(cd,baseClassName,&baseClassIsTypeDef,&templSpec); + //printf("baseClassName=%s baseClass=%p cd=%p\n",baseClassName.data(),baseClass,cd); //printf(" baseClassName=`%s' baseClass=%s templSpec=%s\n", - // baseClassName.data(), + // baseClassName.data(), // baseClass?baseClass->name().data():"<none>", // templSpec.data() // ); @@ -2787,7 +2766,7 @@ static bool findClassRelation( { templSpec=baseClassName.mid(i,e-i); baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e); - baseClass=getResolvedClass(baseClassName); + baseClass=getResolvedClass(cd,baseClassName); //printf("baseClass=%p -> baseClass=%s templSpec=%s\n", // baseClass,baseClassName.data(),templSpec.data()); } @@ -2799,7 +2778,7 @@ static bool findClassRelation( { // replace any namespace aliases replaceNamespaceAliases(baseClassName,i); - baseClass=getResolvedClass(baseClassName); + baseClass=getResolvedClass(cd,baseClassName); found=baseClass!=0 && baseClass!=cd; } @@ -2818,7 +2797,7 @@ static bool findClassRelation( for (nli.toFirst() ; (nd=nli.current()) && !found ; ++nli) { QCString fName = nd->name()+"::"+baseClassName; - found = (baseClass=getResolvedClass(fName))!=0 && baseClass!=cd && + found = (baseClass=getResolvedClass(cd,fName))!=0 && baseClass!=cd && root->name!=fName; } } @@ -2844,7 +2823,7 @@ static bool findClassRelation( { NamespaceList *nl = nd->getUsedNamespaces(); QCString fName = nd->name()+"::"+baseClassName; - found = (baseClass=getResolvedClass(fName))!=0 && root->name!=fName; + found = (baseClass=getResolvedClass(cd,fName))!=0 && root->name!=fName; if (nl) // try to prepend any of the using namespace scopes. { NamespaceListIterator nli(*nl); @@ -2852,7 +2831,7 @@ static bool findClassRelation( for (nli.toFirst() ; (nd=nli.current()) && !found ; ++nli) { fName = nd->name()+"::"+baseClassName; - found = (baseClass=getResolvedClass(fName))!=0 && baseClass!=cd && + found = (baseClass=getResolvedClass(cd,fName))!=0 && baseClass!=cd && root->name!=fName; } } @@ -3849,13 +3828,13 @@ static void findMember(Entry *root, if (!funcDecl.isEmpty() && funcDecl[0]!=' ') funcDecl.prepend(" "); // remove some superfluous spaces - funcDecl=substitute( - substitute( - substitute(funcDecl,"~ ","~"), - ":: ","::" - ), - " ::","::" - ); + funcDecl= substitute( + substitute( + substitute(funcDecl,"~ ","~"), + ":: ","::" + ), + " ::","::" + ); // extract information from the declarations parseFuncDecl(funcDecl,scopeName,classTempList,funcType,funcName, @@ -7005,7 +6984,7 @@ void parseInput() msg("Building class list...\n"); buildClassList(root); findUsingDeclarations(root); - + msg("Building example list...\n"); buildExampleList(root); diff --git a/src/doxygen.h b/src/doxygen.h index 47310b8..8b80676 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -49,6 +49,7 @@ class StringDict : public QDict<QCString> virtual ~StringDict() {} }; + extern QCString spaces; /*! \brief This class serves as a namespace for global variables used by doxygen. @@ -78,7 +79,7 @@ class Doxygen static QTextStream tagFile; static SectionDict sectionDict; static FileNameList inputNameList; - static StringDict typedefDict; + //static TypedefDict typedefDict; static StringDict namespaceAliasDict; static GroupList groupList; static GroupDict groupDict; diff --git a/src/entry.h b/src/entry.h index 476fea5..3a68808 100644 --- a/src/entry.h +++ b/src/entry.h @@ -289,17 +289,10 @@ class Entry const char *groupdoccmd() const { switch( this->groupdoctype ) { - case GROUPDOC_NORMAL: - return "\\defgroup"; - break; - case GROUPDOC_ADD: - return "\\addgroup"; - break; - case GROUPDOC_WEAK: - return "\\weakgroup"; - break; - default: - return "unknown group command"; + case GROUPDOC_NORMAL: return "\\defgroup"; break; + case GROUPDOC_ADD: return "\\addgroup"; break; + case GROUPDOC_WEAK: return "\\weakgroup"; break; + default: return "unknown group command"; } } Grouping::GroupPri_t groupingpri() const @@ -308,17 +301,10 @@ class Entry return Grouping::GROUPING_LOWEST; } switch( this->groupdoctype ) { - case GROUPDOC_NORMAL: - return Grouping::GROUPING_AUTO_DEF; - break; - case GROUPDOC_ADD: - return Grouping::GROUPING_AUTO_ADD; - break; - case GROUPDOC_WEAK: - return Grouping::GROUPING_AUTO_WEAK; - break; - default: - return Grouping::GROUPING_LOWEST; + case GROUPDOC_NORMAL: return Grouping::GROUPING_AUTO_DEF; break; + case GROUPDOC_ADD: return Grouping::GROUPING_AUTO_ADD; break; + case GROUPDOC_WEAK: return Grouping::GROUPING_AUTO_WEAK; break; + default: return Grouping::GROUPING_LOWEST; } } private: diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 117b8ac..da43e85 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -48,7 +48,8 @@ static const char *defaultStyleSheet = "DL.el { margin-left: -1cm }\n" "DIV.fragment { width: 100%; border: none; background-color: #eeeeee }\n" "DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }\n" - "TD.md { background-color: #f2f2ff }\n" + "TD.md { background-color: #f2f2ff; font-weight: bold; }\n" + "TD.mdname { background-color: #f2f2ff; font-weight: bold; font-style: italic }\n" "DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold }\n" "DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }\n" "FONT.keyword { color: #008000 }\n" @@ -160,6 +161,7 @@ void HtmlGenerator::writeFooterFile(QFile &file) void HtmlGenerator::startFile(const char *name,const char *, const char *title,bool external) { + //printf("HtmlGenerator::startFile(%s)\n",name); QCString fileName=name; lastTitle=title; if (fileName.right(5)!=".html") fileName+=".html"; @@ -870,13 +872,13 @@ void HtmlGenerator::startMemberDocPrefixItem() { DBG_HTML(t << "<!-- startMemberDocPrefixItem -->" << endl;) t << " <tr>" << endl; - t << " <td colspan=\"2\"><b>" << endl; + t << " <td class=\"md\" colspan=\"4\">" << endl; } void HtmlGenerator::endMemberDocPrefixItem() { DBG_HTML(t << "<!-- endMemberDocPrefixItem -->" << endl;) - t << " </b></td>" << endl; + t << " </td>" << endl; t << " </tr>" << endl; } @@ -884,51 +886,86 @@ void HtmlGenerator::startMemberDocName() { DBG_HTML(t << "<!-- startMemberDocName -->" << endl;) t << " <tr>" << endl; - t << " <td nowrap valign=\"top\"><b> " << endl; + t << " <td class=\"md\" nowrap valign=\"top\"> " << endl; } void HtmlGenerator::endMemberDocName() { DBG_HTML(t << "<!-- endMemberDocName -->" << endl;) t << endl; - t << " </b></td>" << endl; + t << " </td>" << endl; } -void HtmlGenerator::startParameter(bool first) +void HtmlGenerator::startParameterList() +{ + DBG_HTML(t << "<!-- startParameterList -->" << endl;) + t << " <td class=\"md\">( </td>" << endl; +} + +void HtmlGenerator::startParameterType(bool first) { if (first) { - DBG_HTML(t << "<!-- startFirstParameter -->" << endl;) - t << " <td valign=\"bottom\"><b>" << endl; + DBG_HTML(t << "<!-- startFirstParameterType -->" << endl;) + t << " <td class=\"md\">"; } else { - DBG_HTML(t << "<!-- startParameter -->" << endl;) + DBG_HTML(t << "<!-- startParameterType -->" << endl;) t << " <tr>" << endl; t << " <td></td>" << endl; - t << " <td><b>" << endl; + t << " <td></td>" << endl; + t << " <td class=\"md\">"; } } -void HtmlGenerator::endParameter(bool first) +void HtmlGenerator::endParameterType() { - if (first) + DBG_HTML(t << "<!-- endParameterType -->" << endl;) + t << " </td>" << endl; +} + +void HtmlGenerator::startParameterName() +{ + DBG_HTML(t << "<!-- startParameterName -->" << endl;) + t << " <td class=\"mdname\">"; +} + +void HtmlGenerator::endParameterName(bool last,bool emptyList) +{ + DBG_HTML(t << "<!-- endParameterName -->" << endl;) + if (last) { - DBG_HTML(t << "<!-- endFirstParameter -->" << endl;) - t << endl; - t << " </b></td>" << endl; - //t << " <td width=\"300\"><img src=\"null.gif\"></td>" << endl; - t << " </tr>" << endl; + if (emptyList) + { + t << " </td>" << endl; + t << " <td class=\"md\">) </td>" << endl; + t << " <td class=\"md\">"; + } + else + { + t << " </td>" << endl; + t << " </tr>" << endl; + t << " <tr>" << endl; + t << " <td></td>" << endl; + t << " <td class=\"md\">) </td>" << endl; + t << " <td class=\"md\" colspan=\"2\">"; + } } else { - DBG_HTML(t << "<!-- endParameter -->" << endl;) - t << endl; - t << " </b></td>" << endl; + t << " </td>" << endl; t << " </tr>" << endl; } } +void HtmlGenerator::endParameterList() +{ + DBG_HTML(t << "<!-- endParameterList -->" << endl;) + t << " </td>" << endl; + t << " </tr>" << endl; +} + void HtmlGenerator::endMemberDoc() { DBG_HTML(t << "<!-- endMemberDoc -->" << endl;) diff --git a/src/htmlgen.h b/src/htmlgen.h index e334572..a471433 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -232,8 +232,12 @@ class HtmlGenerator : public OutputGenerator void endMemberDocPrefixItem(); void startMemberDocName(); void endMemberDocName(); - void startParameter(bool first); - void endParameter(bool last); + void startParameterType(bool first); + void endParameterType(); + void startParameterName(); + void endParameterName(bool last,bool emptyList); + void startParameterList(); + void endParameterList(); void startFontClass(const char *s) { t << "<font class=\"" << s << "\">"; } void endFontClass() { t << "</font>"; } diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index 482b53a..e024585 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -231,7 +231,7 @@ HtmlHelp *HtmlHelp::theInstance = 0; * The object has to be \link initialize() initialized\endlink before it can * be used. */ -HtmlHelp::HtmlHelp() +HtmlHelp::HtmlHelp() : indexFileDict(1009) { /* initial depth */ dc = 0; @@ -330,7 +330,7 @@ void HtmlHelp::createProjectFile() while (s) { t << s << endl; - s=indexFiles.next(); + s = indexFiles.next(); } f.close(); } @@ -342,7 +342,11 @@ void HtmlHelp::createProjectFile() void HtmlHelp::addIndexFile(const char *s) { - indexFiles.append(s); + if (indexFileDict.find(s)==0) + { + indexFiles.append(s); + indexFileDict.insert(s,(void *)0x8); + } } /*! Finalizes the HTML help. This will finish and close the diff --git a/src/htmlhelp.h b/src/htmlhelp.h index affadb2..319e25d 100644 --- a/src/htmlhelp.h +++ b/src/htmlhelp.h @@ -87,6 +87,7 @@ class HtmlHelp HtmlHelpIndex *index; int dc; QStrList indexFiles; + QDict<void> indexFileDict; static HtmlHelp *theInstance; }; diff --git a/src/index.cpp b/src/index.cpp index 624e190..2f149dd 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -871,6 +871,8 @@ void writeFileIndex(OutputList &ol) { path=stripFromPath(fd->getPath().copy()); } + QCString fullName=fd->name(); + if (!path.isEmpty()) fullName.prepend(path+"/"); // --------------- LaTeX/RTF only ------------------------- if (doc) @@ -907,11 +909,11 @@ void writeFileIndex(OutputList &ol) ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); if (hasHtmlHelp) { - htmlHelp->addContentsItem(FALSE,fd->name(),fd->getOutputFileBase()); + htmlHelp->addContentsItem(FALSE,fullName,fd->getOutputFileBase()); } if (hasFtvHelp) { - ftvHelp->addContentsItem(FALSE,fd->getReference(),fd->getOutputFileBase(),0,fd->name()); + ftvHelp->addContentsItem(FALSE,fd->getReference(),fd->getOutputFileBase(),0,fullName); } } else diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 3031384..fb7777e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -606,9 +606,13 @@ void LatexGenerator::endIndexSection(IndexSections is) } break; case isMainPage: - t << "}\n\\label{index}"; - if (Config_getBool("PDF_HYPERLINKS")) t << "\\hypertarget{index}{}"; - t << "\\input{index}\n"; + { + QCString indexName="index"; + if (Config_getBool("GENERATE_TREEVIEW")) indexName="main"; + t << "}\n\\label{index}"; + if (Config_getBool("PDF_HYPERLINKS")) t << "\\hypertarget{index}{}"; + t << "\\input{" << indexName << "}\n"; + } break; case isPackageIndex: t << "}\n\\input{packages}\n"; diff --git a/src/latexgen.h b/src/latexgen.h index 08c9370..2e2c8e4 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -239,8 +239,12 @@ class LatexGenerator : public OutputGenerator void endMemberDocPrefixItem() {} void startMemberDocName() {} void endMemberDocName() {} - void startParameter(bool) {} - void endParameter(bool) {} + void startParameterType(bool) {} + void endParameterType() {} + void startParameterName() {} + void endParameterName(bool,bool) {} + void startParameterList() {} + void endParameterList() {} void startFontClass(const char *) {} void endFontClass() {} diff --git a/src/mangen.h b/src/mangen.h index ba362fd..4d0f774 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -220,8 +220,12 @@ class ManGenerator : public OutputGenerator void endMemberDocPrefixItem() {} void startMemberDocName() {} void endMemberDocName() {} - void startParameter(bool) {} - void endParameter(bool) {} + void startParameterType(bool) {} + void endParameterType() {} + void startParameterName() {} + void endParameterName(bool,bool) {} + void startParameterList() {} + void endParameterList() {} void startFontClass(const char *) {} void endFontClass() {} diff --git a/src/memberdef.cpp b/src/memberdef.cpp index a91f821..3b22fd7 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -75,8 +75,18 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, ArgumentList *argList=md->argumentList(); if (argList==0) return; // member has no function like argument list if (!md->isDefine()) ol.docify(" "); + + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.endMemberDocName(); + ol.startParameterList(); + ol.enableAll(); + ol.disable(OutputGenerator::Html); ol.docify("("); // start argument list ol.endMemberDocName(); + ol.popGeneratorState(); + //printf("===> name=%s isDefine=%d\n",md->name().data(),md->isDefine()); + Argument *a=argList->first(); QCString cName; //if (md->scopeDefTemplateArguments()) @@ -106,10 +116,10 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, //printf("~~~ %s cName=%s\n",md->name().data(),cName.data()); //if (!md->isDefine()) ol.startParameter(TRUE); else ol.docify(" "); - ol.startParameter(TRUE); bool first=TRUE; while (a) { + if (!md->isDefine() || first) ol.startParameterType(first); QRegExp re(")("); int vp; if (!a->attrib.isEmpty()) // argument has an IDL attribute @@ -128,6 +138,11 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, if (!cName.isEmpty()) n=addTemplateNames(n,cd->name(),cName); linkifyText(TextGeneratorOLImpl(ol),scopeName,md->name(),n); } + if (!md->isDefine()) + { + ol.endParameterType(); + ol.startParameterName(); + } if (!a->name.isEmpty()) // argument has a name { ol.docify(" "); @@ -146,7 +161,8 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, if (vp!=-1) // write the part of the argument type // that comes after the name { - linkifyText(TextGeneratorOLImpl(ol),scopeName,md->name(),a->type.right(a->type.length()-vp)); + linkifyText(TextGeneratorOLImpl(ol),scopeName, + md->name(),a->type.right(a->type.length()-vp)); } if (!a->defval.isEmpty()) // write the default value { @@ -161,17 +177,30 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.docify(", "); // there are more arguments if (!md->isDefine()) { - ol.endParameter(first); - ol.startParameter(FALSE); + ol.endParameterName(FALSE,FALSE); + ol.startParameterType(FALSE); } } first=FALSE; } ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + //if (!first) ol.writeString(" "); + ol.docify(")"); // end argument list + ol.enableAll(); ol.disableAllBut(OutputGenerator::Html); - if (!first) ol.writeString(" "); + if (!md->isDefine()) + { + if (first) ol.startParameterName(); + ol.endParameterName(TRUE,argList->count()<2); + } + else + { + ol.endParameterType(); + ol.startParameterName(); + ol.endParameterName(TRUE,TRUE); + } ol.popGeneratorState(); - ol.docify(")"); // end argument list if (argList->constSpecifier) { ol.docify(" const"); @@ -250,6 +279,12 @@ MemberDef::MemberDef(const char *df,int dl, m_defTmpArgLists=0; initLines=0; type=t; + if (mt==Typedef && type.left(8)=="typedef ") type=type.mid(8); + if (type.left(7)=="struct ") type=type.right(type.length()-7); + if (type.left(6)=="class " ) type=type.right(type.length()-6); + if (type.left(6)=="union " ) type=type.right(type.length()-6); + type=removeRedundantWhiteSpace(type); + args=a; args=removeRedundantWhiteSpace(args); if (type.isEmpty()) decl=name()+args; else decl=type+" "+name()+args; @@ -635,6 +670,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } QCString ltype(type); + if (mtype==Typedef) ltype.prepend("typedef "); // strip `static' keyword from ltype if (ltype.left(7)=="static ") ltype=ltype.right(ltype.length()-7); // strip `friend' keyword from ltype @@ -1092,7 +1128,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.docify("]"); ol.endTypewriter(); } - if (!isDefine()) ol.endParameter(TRUE); + if (!isDefine() && argList) ol.endParameterList(); ol.endMemberDoc(); ol.endDoxyAnchor(cfname,anchor()); ol.startIndent(); @@ -1108,6 +1144,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ) ) { + //printf("md=%s initLines=%d init=`%s'\n",name().data(),initLines,init.data()); ol.startBold(); if (mtype==Define) parseText(ol,theTranslator->trDefineValue()); @@ -1439,7 +1476,8 @@ bool MemberDef::isLinkableInProject() const ((hasDocumentation() && !isReference()) ) && (prot!=Private || Config_getBool("EXTRACT_PRIVATE")) && // not a private class member - (classDef!=0 || Config_getBool("EXTRACT_STATIC") || !isStatic()); // not a static file/namespace member + (classDef!=0 || Config_getBool("EXTRACT_STATIC") || + !isStatic()); // not a static file/namespace member } bool MemberDef::isLinkable() const diff --git a/src/outputgen.h b/src/outputgen.h index d8c7917..7253c11 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -357,8 +357,12 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endMemberDocPrefixItem() = 0; virtual void startMemberDocName() = 0; virtual void endMemberDocName() = 0; - virtual void startParameter(bool) = 0; - virtual void endParameter(bool) = 0; + virtual void startParameterType(bool) = 0; + virtual void endParameterType() = 0; + virtual void startParameterName() = 0; + virtual void endParameterName(bool,bool) = 0; + virtual void startParameterList() = 0; + virtual void endParameterList() = 0; protected: QTextStream fs; diff --git a/src/outputlist.h b/src/outputlist.h index c19d5d5..065144a 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -399,10 +399,18 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startMemberDocName); } void endMemberDocName() { forall(&OutputGenerator::endMemberDocName); } - void startParameter(bool first) - { forall(&OutputGenerator::startParameter,first); } - void endParameter(bool last) - { forall(&OutputGenerator::endParameter,last); } + void startParameterType(bool first) + { forall(&OutputGenerator::startParameterType,first); } + void endParameterType() + { forall(&OutputGenerator::endParameterType); } + void startParameterName() + { forall(&OutputGenerator::startParameterName); } + void endParameterName(bool last,bool emptyList) + { forall(&OutputGenerator::endParameterName,last,emptyList); } + void startParameterList() + { forall(&OutputGenerator::startParameterList); } + void endParameterList() + { forall(&OutputGenerator::endParameterList); } void startFontClass(const char *c) { forall(&OutputGenerator::startFontClass,c); } @@ -859,7 +859,7 @@ void addDefine() while ((c=*p++) && (c==' ' || c=='\t')) k++; g_defLitText=g_defLitText.mid(l+1,k-l-1)+g_defLitText.stripWhiteSpace(); } - md->setInitializer(g_defLitText); + md->setInitializer(g_defLitText.stripWhiteSpace()); //md->setDefFile(g_yyFileName); //md->setDefLine(g_yyLineNr); diff --git a/src/rtfgen.h b/src/rtfgen.h index 9dcfb70..d2189a8 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -223,8 +223,12 @@ class RTFGenerator : public OutputGenerator void endMemberDocPrefixItem() {} void startMemberDocName() {} void endMemberDocName() {} - void startParameter(bool) {} - void endParameter(bool) {} + void startParameterType(bool) {} + void endParameterType() {} + void startParameterName() {} + void endParameterName(bool,bool) {} + void startParameterList() {} + void endParameterList() {} void startFontClass(const char *) {} void endFontClass() {} diff --git a/src/scanner.l b/src/scanner.l index 54128b2..239af2e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -329,6 +329,7 @@ static void checkDocs() } } +#if 0 static QCString extractName(const QCString &s) { //static const QRegExp id("[a-z_A-Z][a-z_A-Z0-9]*"); @@ -354,6 +355,7 @@ static QCString extractName(const QCString &s) ) l--; return removeRedundantWhiteSpace(result.left(l+1)); } +#endif static void setContext() { @@ -1459,16 +1461,18 @@ TITLE [tT][iI][tT][lL][eE] current->type=current->type.simplifyWhiteSpace(); current->args=current->args.simplifyWhiteSpace(); current->name=current->name.stripWhiteSpace(); - if (!current->name.isEmpty() && current->type.left(8)=="typedef ") - { - // add typedef to dictionary - QCString dest = extractName(current->type.right(current->type.length()-8)); - if (Doxygen::typedefDict[current->name]==0 && !dest.isEmpty()) - { - //printf("1>>>>>>>>>> adding %s->%s\n",current->name.data(),dest.data()); - Doxygen::typedefDict.insert(current->name, new QCString(dest)); - } - } + //if (!current->name.isEmpty() && current->type.left(8)=="typedef ") + //{ + // // add typedef to dictionary + // QCString dest = extractName(current->type.right(current->type.length()-8)); + // if (Doxygen::typedefDict[current->name]==0 && !dest.isEmpty()) + // { + // //printf("1>>>>>>>>>> adding %s->%s\n",current->name.data(),dest.data()); + // QCString scope; + // if (current_root->section & Entry::SCOPE_MASK) scope=current_root->name; + // Doxygen::typedefDict.insert(current->name, new TypedefInfo(dest,scope)); + // } + //} current->section = Entry::VARIABLE_SEC ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1714,16 +1718,18 @@ TITLE [tT][iI][tT][lL][eE] //if (!current->name.isEmpty() && current->name[0]!='@' && // current->parent->section & Entry::COMPOUND_MASK) // varEntry->type+=current->parent->name+"::"; - if (isTypedef) - { - varEntry->type.prepend("typedef "); - //printf("current->name = %s %s\n",current->name.data(),msName.data()); - if (!current->name.isEmpty() && current->name.at(0)!='@') - { - //printf("2>>>>>>>>>> adding %s->%s\n",msName.data(),current->name.data()); - Doxygen::typedefDict.insert(msName,new QCString(current->name)); - } - } + //if (isTypedef) + //{ + // varEntry->type.prepend("typedef "); + // //printf("current->name = %s %s\n",current->name.data(),msName.data()); + // if (!current->name.isEmpty() && current->name.at(0)!='@') + // { + // //printf("2>>>>>>>>>> adding %s->%s\n",msName.data(),current->name.data()); + // QCString scope; + // if (current_root->section & Entry::SCOPE_MASK) scope=current_root->name; + // Doxygen::typedefDict.insert(msName,new TypedefInfo(current->name,scope)); + // } + //} varEntry->type+=current->name+msType; varEntry->fileName = yyFileName; varEntry->startLine = yyLineNr; @@ -2397,15 +2403,17 @@ TITLE [tT][iI][tT][lL][eE] } else { - if (isTypedef) - { - //QCString dest = extractName(current->name); - //printf("3>>>>>>>>>> adding %s->%s\n",yytext,current->name.data()); - Doxygen::typedefDict.insert(yytext,new QCString(current->name)); - //current->extends->append( - // new BaseInfo(yytext,Public,Normal) - // ); - } + //if (isTypedef) + //{ + // //QCString dest = extractName(current->name); + // //printf("3>>>>>>>>>> adding %s->%s\n",yytext,current->name.data()); + // QCString scope; + // if (current_root->section & Entry::SCOPE_MASK) scope=current_root->name; + // Doxygen::typedefDict.insert(yytext,new TypedefInfo(current->name,scope)); + // //current->extends->append( + // // new BaseInfo(yytext,Public,Normal) + // // ); + //} current->type += ' ' ; current->type += current->name ; current->name = yytext ; diff --git a/src/translator.h b/src/translator.h index c216deb..81fd7ff 100644 --- a/src/translator.h +++ b/src/translator.h @@ -53,353 +53,125 @@ class Translator */ virtual QCString updateNeededMessage() { return ""; } - + // Please, have a look at comments inside the translator_en.h file + // to learn the meaning of the following methods. The translator_en.h + // file contains the TranslatorEnglish implementation, which is + // always up-to-date (by definition). + // --- Language control methods ------------------- - /*! Used for identification of the language. - * See the comment for the translator_en.h method implementation - * for details. - */ virtual QCString idLanguage() = 0; - - /*! Used to get the command(s) for the language support. - * See the comment for the translator_en.h method implementation - * for details. - */ virtual QCString latexLanguageSupportCommand() = 0; - - /*! return the language charset. This will be used for the HTML output */ virtual QCString idLanguageCharset() = 0; // --- Language translation methods ------------------- - /*! used in the compound documentation before a list of related functions. */ virtual QCString trRelatedFunctions() = 0; - - /*! subscript for the related functions. */ virtual QCString trRelatedSubscript() = 0; - - /*! header that is put before the detailed description of files, classes and namespaces. */ virtual QCString trDetailedDescription() = 0; - - /*! header that is put before the list of typedefs. */ virtual QCString trMemberTypedefDocumentation() = 0; - - /*! header that is put before the list of enumerations. */ virtual QCString trMemberEnumerationDocumentation() = 0; - - /*! header that is put before the list of member functions. */ virtual QCString trMemberFunctionDocumentation() = 0; - - /*! header that is put before the list of member attributes. */ virtual QCString trMemberDataDocumentation() = 0; - - /*! this is the text of a link put after brief descriptions. */ virtual QCString trMore() = 0; - - /*! put in the class documentation */ virtual QCString trListOfAllMembers() = 0; - - /*! used as the title of the "list of all members" page of a class */ virtual QCString trMemberList() = 0; - - /*! this is the first part of a sentence that is followed by a class name */ virtual QCString trThisIsTheListOfAllMembers() = 0; - - /*! this is the remainder of the sentence after the class name */ virtual QCString trIncludingInheritedMembers() = 0; - - /*! this is put at the author sections at the bottom of man pages. - * parameter s is name of the project name. - */ virtual QCString trGeneratedAutomatically(const char *s) = 0; - - virtual QCString trEnumName() = 0; - - /*! put after an enum value in the list of all members */ virtual QCString trEnumValue() = 0; - - /*! put after an undocumented member in the list of all members */ virtual QCString trDefinedIn() = 0; // quick reference sections - /*! This is put above each page as a link to the list of all groups of - * compounds or files (see the \\group command). - */ virtual QCString trModules() = 0; - - /*! This is put above each page as a link to the class hierarchy */ virtual QCString trClassHierarchy() = 0; - - /*! This is put above each page as a link to the list of annotated classes */ virtual QCString trCompoundList() = 0; - - /*! This is put above each page as a link to the list of documented files */ virtual QCString trFileList() = 0; - - /*! This is put above each page as a link to the list of all verbatim headers */ virtual QCString trHeaderFiles() = 0; - - /*! This is put above each page as a link to all members of compounds. */ virtual QCString trCompoundMembers() = 0; - - /*! This is put above each page as a link to all members of files. */ virtual QCString trFileMembers() = 0; - - /*! This is put above each page as a link to all related pages. */ virtual QCString trRelatedPages() = 0; - - /*! This is put above each page as a link to all examples. */ virtual QCString trExamples() = 0; - - /*! This is put above each page as a link to the search engine. */ virtual QCString trSearch() = 0; - - /*! This is an introduction to the class hierarchy. */ virtual QCString trClassHierarchyDescription() = 0; - - /*! This is an introduction to the list with all files. */ virtual QCString trFileListDescription(bool extractAll) = 0; - - /*! This is an introduction to the annotated compound list. */ virtual QCString trCompoundListDescription() = 0; - - /*! This is an introduction to the page with all class members. */ virtual QCString trCompoundMembersDescription(bool extractAll) = 0; - - /*! This is an introduction to the page with all file members. */ virtual QCString trFileMembersDescription(bool extractAll) = 0; - - /*! This is an introduction to the page with the list of all header files. */ virtual QCString trHeaderFilesDescription() = 0; - - /*! This is an introduction to the page with the list of all examples */ virtual QCString trExamplesDescription() = 0; - - /*! This is an introduction to the page with the list of related pages */ virtual QCString trRelatedPagesDescription() = 0; - - /*! This is an introduction to the page with the list of class/file groups */ virtual QCString trModulesDescription() = 0; - - /*! This sentences is used in the annotated class/file lists if no brief - * description is given. - */ virtual QCString trNoDescriptionAvailable() = 0; // index titles (the project name is prepended for these) - - /*! This is used in HTML as the title of index.html. */ virtual QCString trDocumentation() = 0; - - /*! This is used in LaTeX as the title of the chapter with the - * index of all groups. - */ virtual QCString trModuleIndex() = 0; - - /*! This is used in LaTeX as the title of the chapter with the - * class hierarchy. - */ virtual QCString trHierarchicalIndex() = 0; - - /*! This is used in LaTeX as the title of the chapter with the - * annotated compound index. - */ virtual QCString trCompoundIndex() = 0; - - /*! This is used in LaTeX as the title of the chapter with the - * list of all files. - */ virtual QCString trFileIndex() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all groups. - */ virtual QCString trModuleDocumentation() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all classes, structs and unions. - */ virtual QCString trClassDocumentation() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all files. - */ virtual QCString trFileDocumentation() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all examples. - */ virtual QCString trExampleDocumentation() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all related pages. - */ virtual QCString trPageDocumentation() = 0; - - /*! This is used in LaTeX as the title of the document */ virtual QCString trReferenceManual() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of defines - */ virtual QCString trDefines() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of function prototypes - */ virtual QCString trFuncProtos() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of typedefs - */ virtual QCString trTypedefs() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of enumerations - */ virtual QCString trEnumerations() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of (global) functions - */ virtual QCString trFunctions() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of (global) variables - */ virtual QCString trVariables() = 0; - - /*! This is used in the documentation of a file as a header before the - * list of (global) variables - */ virtual QCString trEnumerationValues() = 0; - - /*! This is used in the documentation of a file before the list of - * documentation blocks for defines - */ virtual QCString trDefineDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for function prototypes - */ virtual QCString trFunctionPrototypeDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for typedefs - */ virtual QCString trTypedefDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for enumeration types - */ virtual QCString trEnumerationTypeDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for enumeration values - */ virtual QCString trEnumerationValueDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for functions - */ virtual QCString trFunctionDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace before the list - * of documentation blocks for variables - */ virtual QCString trVariableDocumentation() = 0; - - /*! This is used in the documentation of a file/namespace/group before - * the list of links to documented compounds - */ virtual QCString trCompounds() = 0; - - /*! This is used in the standard footer of each page and indicates when - * the page was generated - */ virtual QCString trGeneratedAt(const char *date,const char *projName) = 0; - - /*! This is part of the sentence used in the standard footer of each page. - */ virtual QCString trWrittenBy() = 0; - - /*! this text is put before a class diagram */ virtual QCString trClassDiagram(const char *clName) = 0; - - /*! this text is generated when the \\internal command is used. */ virtual QCString trForInternalUseOnly() = 0; - - /*! this text is generated when the \\reimp command is used. */ virtual QCString trReimplementedForInternalReasons() = 0; - - /*! this text is generated when the \\warning command is used. */ virtual QCString trWarning() = 0; - - /*! this text is generated when the \\bug command is used. */ virtual QCString trBugsAndLimitations() = 0; - - /*! this text is generated when the \\version command is used. */ virtual QCString trVersion() = 0; - - /*! this text is generated when the \\date command is used. */ virtual QCString trDate() = 0; - - /*! this text is generated when the \\return command is used. */ virtual QCString trReturns() = 0; - - /*! this text is generated when the \\sa command is used. */ virtual QCString trSeeAlso() = 0; - - /*! this text is generated when the \\param command is used. */ virtual QCString trParameters() = 0; - - /*! this text is generated when the \\exception command is used. */ virtual QCString trExceptions() = 0; - - /*! this text is used in the title page of a LaTeX document. */ virtual QCString trGeneratedBy() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990307 ////////////////////////////////////////////////////////////////////////// - /*! used as the title of page containing all the index of all namespaces. */ virtual QCString trNamespaceList() = 0; - - /*! used as an introduction to the namespace list */ virtual QCString trNamespaceListDescription(bool extractAll) = 0; - - /*! used in the class documentation as a header before the list of all - * friends of a class - */ virtual QCString trFriends() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990405 ////////////////////////////////////////////////////////////////////////// - /*! used in the class documentation as a header before the list of all - * related classes - */ virtual QCString trRelatedFunctionDocumentation() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - /*! used as the title of the HTML page of a class/struct/union */ virtual QCString trCompoundReference(const char *clName, ClassDef::CompoundType compType, bool isTemplate) = 0; - /*! used as the title of the HTML page of a file */ virtual QCString trFileReference(const char *fileName) = 0; - - /*! used as the title of the HTML page of a namespace */ virtual QCString trNamespaceReference(const char *namespaceName) = 0; virtual QCString trPublicMembers() = 0; @@ -412,86 +184,36 @@ class Translator virtual QCString trPrivateMembers() = 0; virtual QCString trPrivateSlots() = 0; virtual QCString trStaticPrivateMembers() = 0; - - /*! this function is used to produce a comma-separated list of items. - * Use generateMarker(i) to indicate where item i should be put. - */ virtual QCString trWriteList(int numEntries) = 0; - - /*! used in class documentation to produce a list of base classes, - * if class diagrams are disabled. - */ virtual QCString trInheritsList(int numEntries) = 0; - - /*! used in class documentation to produce a list of super classes, - * if class diagrams are disabled. - */ virtual QCString trInheritedByList(int numEntries) = 0; - - /*! used in member documentation blocks to produce a list of - * members that are hidden by this one. - */ virtual QCString trReimplementedFromList(int numEntries) = 0; - - /*! used in member documentation blocks to produce a list of - * all member that overwrite the implementation of this member. - */ virtual QCString trReimplementedInList(int numEntries) = 0; - - /*! This is put above each page as a link to all members of namespaces. */ virtual QCString trNamespaceMembers() = 0; - - /*! This is an introduction to the page with all namespace members */ virtual QCString trNamespaceMemberDescription(bool extractAll) = 0; - - /*! This is used in LaTeX as the title of the chapter with the - * index of all namespaces. - */ virtual QCString trNamespaceIndex() = 0; - - /*! This is used in LaTeX as the title of the chapter containing - * the documentation of all namespaces. - */ virtual QCString trNamespaceDocumentation() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990522 ////////////////////////////////////////////////////////////////////////// - /*! This is used in the documentation before the list of all - * namespaces in a file. - */ virtual QCString trNamespaces() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990728 ////////////////////////////////////////////////////////////////////////// - /*! This is put at the bottom of a class documentation page and is - * followed by a list of files that were used to generate the page. - */ virtual QCString trGeneratedFromFiles(ClassDef::CompoundType compType, - bool single) = 0; - - /*! This is in the (quick) index as a link to the alphabetical compound - * list. - */ + bool single) = 0; virtual QCString trAlphabeticalList() = 0; ////////////////////////////////////////////////////////////////////////// // new since 0.49-990901 ////////////////////////////////////////////////////////////////////////// - /*! This is used as the heading text for the retval command. */ virtual QCString trReturnValues() = 0; - - /*! This is in the (quick) index as a link to the main page (index.html) - */ virtual QCString trMainPage() = 0; - - /*! This is used in references to page that are put in the LaTeX - * documentation. It should be an abbreviation of the word page. - */ virtual QCString trPageAbbreviation() = 0; ////////////////////////////////////////////////////////////////////////// @@ -499,9 +221,7 @@ class Translator ////////////////////////////////////////////////////////////////////////// virtual QCString trSources() = 0; - virtual QCString trDefinedAtLineInSourceFile() = 0; - virtual QCString trDefinedInSourceFile() = 0; ////////////////////////////////////////////////////////////////////////// @@ -514,34 +234,15 @@ class Translator // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// - /*! this text is put before a collaboration diagram */ virtual QCString trCollaborationDiagram(const char *clName) = 0; - - /*! this text is put before an include dependency graph */ virtual QCString trInclDepGraph(const char *fName) = 0; - - /*! header that is put before the list of constructor/destructors. */ virtual QCString trConstructorDocumentation() = 0; - - /*! Used in the file documentation to point to the corresponding sources. */ virtual QCString trGotoSourceCode() = 0; - - /*! Used in the file sources to point to the corresponding documentation. */ virtual QCString trGotoDocumentation() = 0; - - /*! Text for the \\pre command */ virtual QCString trPrecondition() = 0; - - /*! Text for the \\post command */ virtual QCString trPostcondition() = 0; - - /*! Text for the \\invariant command */ virtual QCString trInvariant() = 0; - - /*! Text shown before a multi-line variable/enum initialization */ virtual QCString trInitialValue() = 0; - - /*! Text used the source code in the file index */ virtual QCString trCode() = 0; virtual QCString trGraphicalHierarchy() = 0; @@ -568,10 +269,7 @@ class Translator // new since 1.1.3 ////////////////////////////////////////////////////////////////////////// - /*! Used as a marker that is put before a \\todo item */ virtual QCString trTodo() = 0; - - /*! Used as the header of the todo list */ virtual QCString trTodoList() = 0; ////////////////////////////////////////////////////////////////////////// @@ -588,98 +286,61 @@ class Translator // new since 1.1.5 ////////////////////////////////////////////////////////////////////////// - /*! title of the graph legend page */ virtual QCString trLegendTitle() = 0; - - /*! page explaining how the dot graph's should be interpreted */ virtual QCString trLegendDocs() = 0; - - /*! text for the link to the legend page */ virtual QCString trLegend() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// - /*! Used as a marker that is put before a test item */ virtual QCString trTest() = 0; - - /*! Used as the header of the test list */ virtual QCString trTestList() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.1 ////////////////////////////////////////////////////////////////////////// - /*! Used as a section header for KDE-2 IDL methods */ virtual QCString trDCOPMethods() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.2 ////////////////////////////////////////////////////////////////////////// - /*! Used as a section header for IDL properties */ virtual QCString trProperties() = 0; - - /*! Used as a section header for IDL property documentation */ virtual QCString trPropertyDocumentation() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.4 ////////////////////////////////////////////////////////////////////////// - /*! Used for Java interfaces in the summary section of Java packages */ virtual QCString trInterfaces() = 0; - - /*! Used for Java classes in the summary section of Java packages */ virtual QCString trClasses() = 0; - - /*! Used as the title of a Java package */ virtual QCString trPackage(const char *name) = 0; - - /*! Title of the package index page */ virtual QCString trPackageList() = 0; - - /*! The description of the package index page */ virtual QCString trPackageListDescription() = 0; - - /*! The link name in the Quick links header for each page */ virtual QCString trPackages() = 0; - - /*! Used as a chapter title for Latex & RTF output */ virtual QCString trPackageDocumentation() = 0; - - /*! Text shown before a multi-line define */ virtual QCString trDefineValue() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.5 ////////////////////////////////////////////////////////////////////////// - /*! Used as a marker that is put before a \\bug item */ virtual QCString trBug() = 0; - - /*! Used as the header of the bug list */ virtual QCString trBugList() = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.2.6 ////////////////////////////////////////////////////////////////////////// - /*! Used as ansicpg for RTF file */ virtual QCString trRTFansicp() = 0; - - /*! Used as ansicpg for RTF fcharset */ virtual QCString trRTFCharSet() = 0; - - /*! Used as header RTF general index */ virtual QCString trRTFGeneralIndex() = 0; - /*! The following are used for translation of the word that will - * possibly be followed by a single name or by a list of names - * of the category. - */ - virtual QCString trClass(bool first_capital, bool singular) = 0; + // Translation of the word + + virtual QCString trClass(bool first_capital, bool singular) = 0; virtual QCString trFile(bool first_capital, bool singular) = 0; virtual QCString trNamespace(bool first_capital, bool singular) = 0; virtual QCString trGroup(bool first_capital, bool singular) = 0; @@ -688,14 +349,10 @@ class Translator virtual QCString trField(bool first_capital, bool singular) = 0; virtual QCString trGlobal(bool first_capital, bool singular) = 0; - - ////////////////////////////////////////////////////////////////////////// - // new since 1.2.7 - ////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +// new since 1.2.7 +////////////////////////////////////////////////////////////////////////// - /*! This text is generated when the \\author command is used and - * for the author section in man pages. - */ virtual QCString trAuthor(bool first_capital, bool singular) = 0; }; diff --git a/src/translator_br.h b/src/translator_br.h index 3d1e30f..8446771 100644 --- a/src/translator_br.h +++ b/src/translator_br.h @@ -12,9 +12,8 @@ * * Brazilian Portuguese version by * Fabio "FJTC" Jun Takada Chino <chino@grad.icmc.sc.usp.br> - * Version: 1.2.6.1 (2001/04/13) + * Version: 1.2.8.2 (2001/07/24) */ - #ifndef TRANSLATOR_BR_H #define TRANSLATOR_BR_H @@ -33,8 +32,9 @@ class TranslatorBrazilian: public Translator */ virtual QCString idLanguage() { + /* I'm not sure if it is correct. I did not found the documentation + of BabelPackage. If you know the right string, please contact me. */ return "portuges"; - /* I'm not sure if it is correct. I did not found the documentation of BabelPackage*/ } /*! Used to get the command(s) for the language support. This method @@ -47,10 +47,6 @@ class TranslatorBrazilian: public Translator return "Brazilian"; } - /*! returns the name of the package that is included by LaTeX */ - virtual QCString latexBabelPackage() - { return ""; } - /*! return the language charset. This will be used for the HTML output */ virtual QCString idLanguageCharset() { @@ -138,12 +134,6 @@ class TranslatorBrazilian: public Translator virtual QCString trDefinedIn() { return "definida em"; } - /*! put as in introduction in the verbatim header file of a class. - * parameter f is the name of the include file. - */ - virtual QCString trVerbatimText(const char *f) - { return (QCString)"Este é o texto original do arquivo "+f+"."; } - // quick reference sections /*! This is put above each page as a link to the list of all groups of @@ -417,10 +407,6 @@ class TranslatorBrazilian: public Translator virtual QCString trEnumerationValues() { return "Valores Enumerados"; } - /*! This is used in man pages as the author section. */ - virtual QCString trAuthor() - { return "Autor"; } - /*! This is used in the documentation of a file before the list of * documentation blocks for defines */ @@ -478,12 +464,6 @@ class TranslatorBrazilian: public Translator } } - /*! This is used in the documentation of a group before the list of - * links to documented files - */ - virtual QCString trFiles() - { return "Arquivos"; } - /*! This is used in the standard footer of each page and indicates when * the page was generated */ @@ -531,10 +511,6 @@ class TranslatorBrazilian: public Translator virtual QCString trDate() { return "Data"; } - /*! this text is generated when the \\author command is used. */ - virtual QCString trAuthors() - { return "Autor(es)"; } - /*! this text is generated when the \\return command is used. */ virtual QCString trReturns() { return "Retorna"; } @@ -1322,6 +1298,5 @@ and if (!singular) result+="es"; return result; } - }; #endif diff --git a/src/translator_de.h b/src/translator_de.h index 65a5fe6..8e95779 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -49,6 +49,9 @@ // - Update for "new since 1.2.7-20010524" version: // removed trAuthors(), trAuthor(), added trAuthor(bool, bool) // +// 2001/07/24 Jens Seidel (jensseidel@users.sourceforge.net) +// - trClassDocumentation() updated as in the English translator. +// // Todo: // - translation of all Config_getBool("OPTIMIZE_OUTPUT_FOR_C") // strings (see translator_en.h) @@ -334,7 +337,12 @@ class TranslatorGerman : public Translator * the documentation of all classes, structs and unions. */ virtual QCString trClassDocumentation() - { return "Klassen-Dokumentation"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + return "Datenstruktur-Dokumentation"; + else + return "Klassen-Dokumentation"; + } /* This is used in LaTeX as the title of the chapter containing * the documentation of all files. @@ -990,7 +998,8 @@ class TranslatorGerman : public Translator return "Erklärung des Graphen"; } - /* page explaining how the dot graph's should be interpreted */ + /* page explaining how the dot graph's should be interpreted + The %A in the text below are to prevent link to classes called "A". */ virtual QCString trLegendDocs() { return diff --git a/src/translator_es.h b/src/translator_es.h index 88f4fb7..7da4ebe 100644 --- a/src/translator_es.h +++ b/src/translator_es.h @@ -1092,6 +1092,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_2_7 /*! Used as ansicpg for RTF file * * The following table shows the correlation of Charset name, Charset Value and + * <pre> * Codepage number: * Charset Name Charset Value(hex) Codepage number * ------------------------------------------------------ @@ -1110,6 +1111,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_2_7 * HANGEUL_CHARSET 129 (x81) 949 * GB2313_CHARSET 134 (x86) 936 * CHINESEBIG5_CHARSET 136 (x88) 950 + * </pre> * */ virtual QCString trRTFansicp() diff --git a/src/translator_fr.h b/src/translator_fr.h index c7a7f3f..bb3d415 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -16,7 +16,7 @@ * The translation into French was provided by * Christophe Bordeux (bordeux@lig.di.epfl.ch) * and after version 1.2.0 by Xavier Outhier (xouthier@yahoo.fr) - * member of of the non for profit association D2SET (http://www.d2set.org, + * member of the non for profit association D2SET (http://www.d2set.org, * d2set@d2set.org). */ diff --git a/src/translator_sk.h b/src/translator_sk.h index 4cb840f..5cb8621 100644 --- a/src/translator_sk.h +++ b/src/translator_sk.h @@ -34,7 +34,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_2_7 } public: - // --- Language contol methods ------------------- + // --- Language control methods ------------------- virtual QCString idLanguage() { return "slovak"; } diff --git a/src/util.cpp b/src/util.cpp index 52045cb..576e1c1 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -332,6 +332,77 @@ int guessSection(const char *name) return 0; } +QCString resolveTypeDef(Definition *d,const QCString &name) +{ + //printf("resolveTypeDef(%s,%s)\n",d ? d->name().data() : "<none>",name.data()); + QCString result; + if (name.isEmpty()) return result; + Definition *mContext=d; + MemberDef *md=0; + while (mContext && md==0) + { + MemberNameDict *mnd=0; + if (mContext->definitionType()==Definition::TypeClass) + { + mnd=&Doxygen::memberNameDict; + } + else + { + mnd=&Doxygen::functionNameDict; + } + MemberName *mn=mnd->find(name); + if (mn) + { + MemberNameIterator mni(*mn); + MemberDef *tmd=0; + for (;(tmd=mni.current());++mni) + { + //printf("Found member %s scope=%p mContext=%p\n",tmd->name().data(), + // tmd->getOuterScope(),mContext); + if (tmd->isTypedef() && tmd->getOuterScope()==mContext) + { + md=tmd; + } + } + } + mContext=mContext->getOuterScope(); + } + if (md) + { + //printf("Found typedef name `%s' in scope `%s' value=`%s'\n", + // name.data(),d->name().data(),md->typeString() + // ); + result=md->typeString(); + } + else + { + //printf("Typedef `%s' not found in scope `%s'!\n", + // name.data(),d ? d->name().data() : "<global>"); + } + return result; + +#if 0 + QCString typeName; + if (!name.isEmpty()) + { + TypedefInfo *ti = Doxygen::typedefDict[name]; + if (ti) + { + int count=0; + typeName=ti->value; + TypedefInfo *newTi; + while ((newTi=Doxygen::typedefDict[typeName]) && count<10) + { + if (typeName==newTi->value) break; // prevent lock-up + typeName=newTi->value; + count++; + } + } + } + return typeName; +#endif +} + /*! Get a class definition given its name. * Returns 0 if the class is not found. */ @@ -366,32 +437,54 @@ NamespaceDef *getResolvedNamespace(const char *name) } } -ClassDef *getResolvedClass(const char *n,bool *pIsTypeDef,QCString *pTemplSpec) +ClassDef *getResolvedClass( + Definition *scope, + const char *n, + bool *pIsTypeDef, + QCString *pTemplSpec + ) { + //printf("getResolvedClass(%s,%s)\n",scope ? scope->name().data() : "<none>", + // n); QCString name = n; if (name.isEmpty()) return 0; + if (scope==0) scope=Doxygen::globalScope; int i = name.findRev("::"); - QCString *subst = 0; - if (i!=-1) subst = Doxygen::typedefDict[name.right(name.length()-i-2)]; - if (subst==0) subst = Doxygen::typedefDict[name],i=-1; - if (subst) // there is a typedef with this name + //QCString subst = 0; + //if (i!=-1) subst = Doxygen::typedefDict[name.right(name.length()-i-2)]; + //if (subst==0) subst = Doxygen::typedefDict[name],i=-1; + //if (subst) // there is a typedef with this name + QCString subst; + if (i!=-1) + { + subst = resolveTypeDef(scope,name.right(name.length()-i-2)); + } + else + { + subst = resolveTypeDef(scope,name); + } + + if (!subst.isEmpty()) { if (pIsTypeDef) *pIsTypeDef=TRUE; //printf("getResolvedClass `%s'->`%s'\n",name.data(),subst->data()); - if (*subst==name) // avoid resolving typedef struct foo foo; + if (subst==name) // avoid resolving typedef struct foo foo; { return Doxygen::classSDict.find(name); } int count=0; // recursion detection guard - QCString *newSubst; - QCString typeName = *subst; + QCString newSubst; + QCString typeName = subst; if (i!=-1) typeName.prepend(name.left(i)+"::"); - while ((newSubst=Doxygen::typedefDict[typeName]) && count<10) + while (!(newSubst=resolveTypeDef(scope,typeName)).isEmpty() + && count<10) { - if (typeName==*newSubst) - return Doxygen::classSDict.find(subst->data()); // for breaking typedef struct A A; + if (typeName==newSubst) + { + return Doxygen::classSDict.find(subst); // for breaking typedef struct A A; + } subst=newSubst; - typeName=*newSubst; + typeName=newSubst; if (i!=-1) typeName.prepend(name.left(i)+"::"); count++; } @@ -437,15 +530,19 @@ static bool findOperator(const QCString &s,int i) return TRUE; } +static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; + QCString removeRedundantWhiteSpace(const QCString &s) { if (s.isEmpty()) return s; QCString result; uint i; uint l=s.length(); + uint csp=0; for (i=0;i<l;i++) { char c=s.at(i); + if (csp<6 && c==constScope[csp]) csp++; else csp=0; if (i<l-2 && c=='<' && // current char is a < (isId(s.at(i+1)) || isspace(s.at(i+1))) && // next char is an id char or space (i<8 || !findOperator(s,i)) // string in front is not "operator" @@ -469,6 +566,11 @@ QCString removeRedundantWhiteSpace(const QCString &s) result+=' '; result+=s.at(i); } + else if (c==':' && csp==6) + { + result+=" :"; + csp=0; + } else if (!isspace(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)==']') && @@ -914,46 +1016,24 @@ int minClassDistance(ClassDef *cd,ClassDef *bcd,int level) // strip any template specifiers that follow className in string s static QCString trimTemplateSpecifiers(const QCString &className,const QCString &s) { - // first we resolve any defines - //int i=0,p,l; - //QCString result; - //QRegExp r("[A-Z_a-z][A-Z_a-z0-9]*"); - //while ((p=r.match(s,i,&l))!=-1) - //{ - // if (p>i) result+=s.mid(i,p-i); - // result+=resolveDefines(s.mid(p,l)); - // i=p+l; - //} - //if (i<(int)s.length()) result+=s.mid(i,s.length()-i); - + //printf("trimTemplateSpecifiers(%s,%s)\n",className.data(),s.data()); + ClassDef *cd=getClass(className); + if (cd==0) return s; + + QCString qualName=cd->qualifiedNameWithTemplateParameters(); + //printf("QualifiedName = %s\n",qualName.data()); // We strip the template arguments following className (if any) - QCString result=s.copy(); - int l=className.length(); - if (l>0) // there is a class name + QCString result=s; + if (!qualName.isEmpty()) // there is a class name { int i,p=0; - while ((i=result.find(className,p))!=-1) // class name is in the argument type + // TODO: also try smaller parts of the qualName, since we + // could be inside a namespace or class. + while ((i=result.find(qualName,p))!=-1) // class name is in the argument type { - uint s=i+l; - if (s<result.length() && result.at(s)=='<') // class has template args - { - int b=1; - uint e=s+1; - while (b>0 && e<result.length()) // find matching > - { - if (result.at(e)=='<') b++; - else if (result.at(e)=='>') b--; - e++; - } - // remove template argument - result=result.left(s)+result.right(result.length()-e); - if (result.length()>s && (result.at(s)=='*' || result.at(s)=='&')) - { - // insert a space to keep the argument in the canonical form - result=result.left(s)+" "+result.right(result.length()-s); - } - } - p=i+l; + int ql=qualName.length(); + result=result.left(i)+cd->name()+result.right(result.length()-i-ql); + p=i+cd->name().length(); } } return result; @@ -981,6 +1061,7 @@ static QCString trimScope(const QCString &name,const QCString &s) scopeOffset=name.findRev("::",scopeOffset-1); result = tmp; } while (scopeOffset>0); + //printf("trimScope(name=%s,scope=%s)=%s\n",name.data(),s.data(),result.data()); return result; } @@ -1085,6 +1166,23 @@ void stripIrrelevantConstVolatile(QCString &s) } } +#if 0 // should be done differently +static QCString resolveTypeDefs(const QCString &s) +{ + QCString result; + static QRegExp re("[a-z_A-Z][a-z_A-Z0-9]*"); + int p=0,l,i; + while ((i=re.match(s,p,&l))!=-1) + { + result += s.mid(p,i-p); + result += resolveTypeDef(s.mid(i,l)); + p=i+l; + } + result+=s.right(s.length()-p); + return result; +} +#endif + // a bit of debug support for matchArguments #define MATCH #define NOMATCH @@ -1097,6 +1195,15 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, NamespaceList *usingNamespaces, ClassList *usingClasses) { + //printf("match argument start %s:%s <-> %s:%s\n", + // srcA->type.data(),srcA->name.data(), + // dstA->type.data(),dstA->name.data()); + + // TODO: resolve any typedefs names that are part of srcA->type + // before matching. This should use className and namespaceName + // and usingNamespaces and usingClass to determine which typedefs + // are in-scope, so it will not be very efficient :-( + QCString srcAType=trimTemplateSpecifiers(className,srcA->type); QCString dstAType=trimTemplateSpecifiers(className,dstA->type); if (srcAType.left(6)=="class ") srcAType=srcAType.right(srcAType.length()-6); @@ -1106,21 +1213,34 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, // 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 // catch the most common cases. - if (srcAType=="const" && !srcA->name.isEmpty()) + if ((srcAType=="const" || srcAType=="volatile") && !srcA->name.isEmpty()) { srcAType+=" "; srcAType+=srcA->name; } - if (dstAType=="const" && !dstA->name.isEmpty()) + if ((dstAType=="const" || dstAType=="volatile") && !dstA->name.isEmpty()) { dstAType+=" "; dstAType+=dstA->name; } - //printf("scope=`%s': `%s' <=> `%s'\n",className.data(),srcAType.data(),dstAType.data()); + if (srcA->name=="const" || srcA->name=="volatile") + { + srcAType+=srcA->name; + } + if (dstA->name=="const" || dstA->name=="volatile") + { + dstAType+=dstA->name; + } stripIrrelevantConstVolatile(srcAType); stripIrrelevantConstVolatile(dstAType); + //srcAType=stripTemplateSpecifiersFromScope(srcAType,FALSE); + //dstAType=stripTemplateSpecifiersFromScope(dstAType,FALSE); + + //printf("srcA=%s:%s dstA=%s:%s\n",srcAType.data(),srcA->name.data(), + // dstAType.data(),dstA->name.data()); + if (srcA->array!=dstA->array) // nomatch for char[] against char { NOMATCH @@ -1132,7 +1252,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, // remove a namespace scope that is only in one type // (assuming a using statement was used) trimNamespaceScope(srcAType,dstAType); - + //QCString srcScope; //QCString dstScope; @@ -1192,7 +1312,8 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA, MATCH return TRUE; } - //printf("srcA=%s::%s dstA=%s::%s\n",srcAType.data(),srcA->name.data(), + + //printf("2. srcA=%s:%s dstA=%s:%s\n",srcAType.data(),srcA->name.data(), // dstAType.data(),dstA->name.data()); uint srcPos=0,dstPos=0; @@ -1309,10 +1430,28 @@ static void mergeArgument(Argument *srcA,Argument *dstA, NamespaceList *usingNamespaces, ClassList *usingClasses) { + //printf("merge argument start %s:%s <-> %s:%s\n", + // srcA->type.data(),srcA->name.data(), + // dstA->type.data(),dstA->name.data()); + + if ((srcA->type=="const" || srcA->type=="volatile") && !srcA->name.isEmpty()) + { + srcA->type+=" "; + srcA->type+=srcA->name; + srcA->name.resize(0); + } + if ((dstA->type=="const" || dstA->type=="volatile") && !dstA->name.isEmpty()) + { + dstA->type+=" "; + dstA->type+=dstA->name; + dstA->name.resize(0); + } + QCString srcAType=trimTemplateSpecifiers(className,srcA->type); QCString dstAType=trimTemplateSpecifiers(className,dstA->type); if (srcAType.left(6)=="class ") srcAType=srcAType.right(srcAType.length()-6); if (dstAType.left(6)=="class ") dstAType=dstAType.right(dstAType.length()-6); + stripIrrelevantConstVolatile(srcAType); stripIrrelevantConstVolatile(dstAType); @@ -1324,6 +1463,7 @@ static void mergeArgument(Argument *srcA,Argument *dstA, // (assuming a using statement was used) trimNamespaceScope(srcAType,dstAType); + //QCString srcScope; //QCString dstScope; @@ -1376,14 +1516,14 @@ static void mergeArgument(Argument *srcA,Argument *dstA, { srcA->type=srcAType+" "+srcA->name; srcA->name.resize(0); - return; + goto done; } else if (!dstA->name.isEmpty() && !srcA->type.isEmpty() && (dstAType+" "+dstA->name)==srcAType) { dstA->type=dstAType+" "+dstA->name; dstA->name.resize(0); - return; + goto done; } //printf("srcA=%s::%s dstA=%s::%s\n",srcAType.data(),srcA->name.data(), // dstAType.data(),dstA->name.data()); @@ -1465,7 +1605,7 @@ static void mergeArgument(Argument *srcA,Argument *dstA, srcA->type=srcAType.left(startPos).stripWhiteSpace(); } } - return; + goto done; } //printf("match exactly\n"); if (srcA->name.isEmpty() && dstA->name.isEmpty()) @@ -1491,6 +1631,10 @@ static void mergeArgument(Argument *srcA,Argument *dstA, { dstA->name = srcA->name.copy(); } +done: + //printf("merge argument result %s:%s <-> %s:%s\n", + // srcA->type.data(),srcA->name.data(), + // dstA->type.data(),dstA->name.data()); return; } @@ -1632,23 +1776,26 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl) //printf("Defval changing `%s'->`%s'\n",dstA->defval.data(),srcA->defval.data()); dstA->defval=srcA->defval.copy(); } - if (srcA->name.isEmpty() && !dstA->name.isEmpty()) + if (srcA->type==dstA->type) { - //printf("type: `%s':=`%s'\n",srcA->type.data(),dstA->type.data()); - //printf("name: `%s':=`%s'\n",srcA->name.data(),dstA->name.data()); - srcA->type = dstA->type.copy(); - srcA->name = dstA->name.copy(); - } - else if (!srcA->name.isEmpty() && dstA->name.isEmpty()) - { - //printf("type: `%s':=`%s'\n",dstA->type.data(),srcA->type.data()); - //printf("name: `%s':=`%s'\n",dstA->name.data(),srcA->name.data()); - dstA->type = srcA->type.copy(); - dstA->name = dstA->name.copy(); - } - else if (!srcA->name.isEmpty() && !dstA->name.isEmpty()) - { - srcA->name = dstA->name.copy(); + if (srcA->name.isEmpty() && !dstA->name.isEmpty()) + { + //printf("type: `%s':=`%s'\n",srcA->type.data(),dstA->type.data()); + //printf("name: `%s':=`%s'\n",srcA->name.data(),dstA->name.data()); + srcA->type = dstA->type.copy(); + srcA->name = dstA->name.copy(); + } + else if (!srcA->name.isEmpty() && dstA->name.isEmpty()) + { + //printf("type: `%s':=`%s'\n",dstA->type.data(),srcA->type.data()); + //printf("name: `%s':=`%s'\n",dstA->name.data(),srcA->name.data()); + dstA->type = srcA->type.copy(); + dstA->name = dstA->name.copy(); + } + else if (!srcA->name.isEmpty() && !dstA->name.isEmpty()) + { + srcA->name = dstA->name.copy(); + } } int i1=srcA->type.find("::"), i2=dstA->type.find("::"), @@ -1766,7 +1913,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, //printf("Trying class scope %s\n",className.data()); ClassDef *fcd=0; - if ((fcd=getResolvedClass(className)) && // is it a documented class + if ((fcd=getResolvedClass(Doxygen::globalScope,className)) && // is it a documented class fcd->isLinkable() ) { @@ -2002,7 +2149,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, bmd = 0; break; } - if (!(md->isStatic())) bmd = md; + if (!(md->isStatic()) || Config_getBool("EXTRACT_STATIC")) bmd = md; } if (bmd) md=bmd; } @@ -2195,7 +2342,7 @@ bool generateRef(OutputDocInterface &od,const char *scName, if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd,gd, scopePos==0 && !memberScopeFirst)) { - //printf("after getDefs nd=%p\n",nd); + //printf("after getDefs md=%p cd=%p fd=%p nd=%p gd=%p\n",md,cd,fd,nd,gd); QCString anchor; if (md->isLinkable()) anchor = md->anchor(); QCString cName,aName; @@ -41,6 +41,7 @@ class NamespaceList; class ClassList; class MemberGroupList; class MemberGroupDict; +class Definition; //-------------------------------------------------------------------- @@ -104,7 +105,8 @@ extern QCString substituteClassNames(const QCString &s); extern QCString substitute(const char *s,const char *src,const char *dst); extern QCString resolveDefines(const char *n); extern ClassDef *getClass(const char *key); -extern ClassDef *getResolvedClass(const char *key, +extern ClassDef *getResolvedClass(Definition *scope, + const char *key, bool *pIsTypeDef=0, QCString *pTemplSpec=0); extern NamespaceDef *getResolvedNamespace(const char *key); @@ -157,6 +159,7 @@ ArgumentList *copyArgumentList(const ArgumentList *src); QList<ArgumentList> *copyArgumentLists(const QList<ArgumentList> *srcLists); QCString stripTemplateSpecifiersFromScope(const QCString &fullName, bool parentOnly=TRUE); +QCString resolveTypeDef(Definition *d,const QCString &name); #endif diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 4bb20e0..8b9ed39 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -26,12 +26,14 @@ #include "classlist.h" #include "util.h" #include "defargs.h" +#include "outputgen.h" +#include "doc.h" #include <qdir.h> #include <qfile.h> #include <qtextstream.h> -static void writeXMLString(QTextStream &t,const char *s) +static inline void writeXMLString(QTextStream &t,const char *s) { t << convertToXML(s); } @@ -75,6 +77,629 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf QTextStream &m_t; }; +template<class T> class ValStack +{ + public: + ValStack() : m_values(10), m_sp(0), m_size(10) {} + virtual ~ValStack() {} + ValStack(const ValStack &s) + { + m_values=s.m_values.copy(); + m_sp=s.m_sp; + m_size=s.m_size; + } + ValStack &operator=(const ValStack &s) + { + m_values=s.m_values.copy(); + m_sp=s.m_sp; + m_size=s.m_size; + return *this; + } + void push(T v) + { + m_sp++; + if (m_sp>=m_size) + { + m_size+=10; + m_values.resize(m_size); + } + m_values[m_sp]=v; + } + T pop() + { + ASSERT(m_sp!=0); + return m_values[m_sp--]; + } + T& top() + { + ASSERT(m_sp!=0); + return m_values[m_sp]; + } + bool isEmpty() + { + return m_sp==0; + } + + private: + QArray<T> m_values; + int m_sp; + int m_size; +}; + +/*! This class is used by the documentation parser. + * Its methods are called when some XML text or markup + * needs to be written. + */ +class XMLGenerator : public OutputDocInterface +{ + public: + + // helper functions + + void startParMode() + { + if (!m_inParStack.isEmpty() && !m_inParStack.top()) + { + m_inParStack.top() = TRUE; + m_t << "<para>" << endl; + } + else if (m_inParStack.isEmpty()) + { + m_inParStack.push(TRUE); + m_t << "<para>" << endl; + } + } + void endParMode() + { + if (!m_inParStack.isEmpty() && m_inParStack.top()) + { + m_inParStack.top() = FALSE; + m_t << "</para>" << endl; + } + } + void startNestedPar() + { + m_inParStack.push(FALSE); + } + void endNestedPar() + { + if (m_inParStack.pop()) + { + m_t << "</para>" << endl; + } + } + + // Standard generator functions to be implemented by all generators + + void docify(const char *s) + { + startParMode(); + writeXMLString(m_t,s); + } + void writeChar(char c) + { + startParMode(); + char s[2];s[0]=c;s[1]=0; + docify(s); + } + void writeString(const char *text) + { + startParMode(); + m_t << text; + } + void startItemList() + { + m_t << "<itemizedlist>" << endl;; + m_inListStack.push(TRUE); + } + void startEnumList() + { + m_t << "<orderedlist>"; + m_inListStack.push(TRUE); + } + void writeListItem() + { + if (!m_inListStack.isEmpty() && m_inListStack.top()) // first element + { + m_inListStack.top()=FALSE; + } + else // not first element, end previous element first + { + endParMode(); + endNestedPar(); + m_t << "</listitem>" << endl; + } + m_t << "<listitem>"; + startNestedPar(); + } + void endItemList() + { + if (!m_inListStack.isEmpty() && !m_inListStack.pop()) // first element + { + endParMode(); + endNestedPar(); + m_t << "</listitem>" << endl; + } + m_t << "</itemizedlist>" << endl; + } + void endEnumList() + { + if (!m_inListStack.isEmpty() && !m_inListStack.pop()) // first element + { + endParMode(); + m_t << "</listitem>" << endl; + endNestedPar(); + } + m_t << "</orderedlist>" << endl; + } + void newParagraph() + { + endParMode(); + startParMode(); + } + void startBold() + { + startParMode(); + m_t << "<bold>"; // non DocBook + } + void endBold() + { + m_t << "</bold>"; // non DocBook + } + void startTypewriter() + { + startParMode(); + m_t << "<computeroutput>"; + } + void endTypewriter() + { + m_t << "</computeroutput>"; + } + void startEmphasis() + { + startParMode(); + m_t << "<emphasis>"; + } + void endEmphasis() + { + m_t << "</emphasis>"; + } + void startCodeFragment() + { + endParMode(); + m_t << "<programlisting>"; + } + void endCodeFragment() + { + m_t << "</programlisting>"; + } + void startPreFragment() + { + endParMode(); + m_t << "<programlisting>"; + } + void endPreFragment() + { + m_t << "</programlisting>"; + } + void writeRuler() + { + endParMode(); + m_t << "<hruler/>"; + } + void startDescription() + { + m_t << "<variablelist>"; + m_inListStack.push(TRUE); + } + void endDescription() + { + if (!m_inListStack.isEmpty() && !m_inListStack.pop()) // first element + { + endNestedPar(); + m_t << "</listitem>" << endl; + } + m_t << "</variablelist>"; + if (!m_inListStack.isEmpty()) m_inListStack.pop(); + } + void startDescItem() + { + if (!m_inListStack.isEmpty() && m_inListStack.top()) // first element + { + m_inListStack.top()=FALSE; + } + else // not first element, end previous element first + { + endNestedPar(); + m_t << "</listitem>"; + } + m_t << "<varlistentry><term>"; + } + void endDescItem() + { + m_t << "</term></varlistentry><listitem>"; + startNestedPar(); + } + void startDescList() + { + m_t << "<simplesect><title>"; + } + void endDescList() + { + endNestedPar(); + m_t << "</simplesect>"; + } + void startParamList() + { + m_t << "<parameterlist><title>"; // non DocBook + // TODO: what kind of list + // param, retval, exception + m_inParamList = TRUE; + } + void endParamList() + { + m_inParamList = FALSE; + m_t << "</parameterlist>"; + } + void endDescTitle() + { + m_t << "</title>"; + if (!m_inParamList) startNestedPar(); + } + void writeDescItem() { } + void startDescTable() { } + void endDescTable() { } + void startDescTableTitle() + { + m_t << "<parametername>"; // non docbook + } + void endDescTableTitle() + { + m_t << "</parametername>"; // non docbook + } + void startDescTableData() + { + m_t << "<parameterdescription>"; // non docbook + startNestedPar(); + } + void endDescTableData() + { + endNestedPar(); + m_t << "</parameterdescription>"; // non docbook + } + void lineBreak() + { + m_t << "<linebreak/>"; // non docbook + } + void writeNonBreakableSpace(int num) + { + int i;for (i=0;i<num;i++) m_t << "<nonbreakablespace/>"; // non docbook + } + + //// TODO: translate these as well.... + + void writeObjectLink(const char *ref,const char *file, + const char *anchor, const char *text) + { + if (ref) // TODO: add support for external references + { + docify(text); + } + else + { + writeXMLLink(m_t,file,anchor,text); + } + } + void writeCodeLink(const char *ref,const char *file, + const char *anchor,const char *text) + { + if (ref) // TODO: add support for external references + { + docify(text); + } + else + { + writeXMLLink(m_t,file,anchor,text); + } + } + void startHtmlLink(const char *url) + { + m_t << "<ulink url=\"" << url << "\">"; + } + void endHtmlLink() + { + m_t << "</ulink>"; + } + void writeMailLink(const char *url) + { + m_t << "<email>"; + docify(url); + m_t << "</email>"; + } + void startSection(const char *id,const char *,bool) + { + m_t << "<sect1 id=\"" << id << "\">"; + } + void endSection(const char *,bool) + { + m_t << "</sect1>"; + } + void startSubsection() + { + m_t << "<sect2>"; + } + void endSubsection() + { + m_t << "</sect2>"; + } + void startSubsubsection() + { + m_t << "<sect3>"; + } + void endSubsubsection() + { + m_t << "</sect3>"; + } + void startCenter() + { + m_t << "<center>"; // non docbook + } + void endCenter() + { + m_t << "</center>"; // non docbook + } + void startSmall() + { + m_t << "<small>"; // non docbook + } + void endSmall() + { + m_t << "</small>"; // non docbook + } + void startSubscript() + { + m_t << "<subscript>"; + } + void endSubscript() + { + m_t << "</subscript>"; + } + void startSuperscript() + { + m_t << "<superscript>"; + } + void endSuperscript() + { + m_t << "</superscript>"; + } + void startTable(int cols) + { + m_t << "<table><tgroup cols=\"" << cols << "\"><tbody>\n"; + } + void endTable() + { + m_t << "</row>\n</tbody></tgroup></table>"; + } + void nextTableRow() + { + m_t << "<row><entry>"; + } + void endTableRow() + { + m_t << "</row>" << endl; + } + void nextTableColumn() + { + m_t << "<entry>"; + } + void endTableColumn() + { + m_t << "</entry>"; + } + + void writeQuote() { m_t << "\""; } + void writeCopyright() { m_t << "©"; } + void writeUmlaut(char c) { m_t << "&" << c << "uml;"; } + void writeAcute(char c) { m_t << "&" << c << "acute;"; } + void writeGrave(char c) { m_t << "&" << c << "grave;"; } + void writeCirc(char c) { m_t << "&" << c << "circ;"; } + void writeTilde(char c) { m_t << "&" << c << "tilde;"; } + void writeRing(char c) { m_t << "&" << c << "ring;"; } + void writeSharpS() { m_t << "ß"; } + void writeCCedil(char c) { m_t << "&" << c << "cedil;"; } + + void startTitle() + { + m_t << "<title>"; + } + void endTitle() + { + m_t << "</title>" << endl; + } + void writeAnchor(const char *id,const char *name) + { + m_t << "<anchor id=\"" << id << "_" << name << "\"/>"; + } + void writeSectionRef(const char *,const char *id, + const char *name,const char *text) + { + m_t << "<link linkend=\"" << id << "_" << name << "\">"; + docify(text); + m_t << "</link>"; + } + void writeSectionRefItem(const char *,const char *,const char *) + { + m_t << "(writeSectionRefItem)"; + } + void addIndexItem(const char *primaryie,const char *secondaryie) + { + m_t << "<indexentry><primaryie>"; + docify(primaryie); + m_t << "</primaryie><secondaryie>"; + docify(secondaryie); + m_t << "</secondaryie></indexentry>"; + } + void writeFormula(const char *id,const char *text) + { + m_t << "<formula id=\"" << id << "\">"; // non Docbook + docify(text); + m_t << "</formula>"; + } + void startImage(const char *name,const char *size,bool caption) + { + m_t << "<image name=\"" << name << "\" size=\"" << size + << "\" caption=\"" << (caption ? "1" : "0") << "\">"; // non docbook + } + void endImage(bool) + { + m_t << "</image>"; + } + void startTextLink(const char *name,const char *anchor) + { + m_t << "<ulink url=\"" << name << "#" << anchor << "\">"; + } + void endTextLink() + { + m_t << "<ulink>"; + } + void startPageRef() + { + } + void endPageRef(const char *,const char *) + { + } + void startCodeLine() + { + m_t << "<linenumber>"; // non DocBook + } + void endCodeLine() + { + m_t << "</linenumber>"; // non DocBook + } + void startCodeAnchor(const char *id) + { + m_t << "<anchor id=\"" << id << "\">"; + } + void endCodeAnchor() + { + m_t << "</anchor>"; + } + void startFontClass(const char *colorClass) + { + m_t << "<highlight class=\"" << colorClass << "\""; // non DocBook + } + void endFontClass() + { + m_t << "</highlight>"; // non DocBook + } + void codify(const char *text) + { + docify(text); + } + + // Generator specific functions + + /*! Create a clone of this generator. Uses the copy constructor */ + OutputDocInterface *clone() + { + return new XMLGenerator(this); + } + /*! Append the output written to generator \a g to this generator */ + void append(const OutputDocInterface *g) + { + const XMLGenerator *xg = (const XMLGenerator *)g; + + //if (m_inPar && !mifgen->m_inParStart) + //{ + // endParMode(); + //} + //else if (!m_inPar && mifgen->m_inParStart) + //{ + // startParMode(); + //} + //printf("Appending \n>>>>\n`%s'\n<<<<\n and \n>>>>\n`%s'\n<<<<\n",getContents().data(),mifgen->getContents().data()); + m_t << xg->getContents(); + m_inParStack = xg->m_inParStack; + m_inListStack = xg->m_inListStack; + m_inParamList = xg->m_inParamList; + } + /*! constructor. + */ + XMLGenerator() + { + m_b.setBuffer(m_a); + m_b.open( IO_WriteOnly ); + m_t.setDevice(&m_b); + m_t.setEncoding(QTextStream::Latin1); + } + /*! copy constructor */ + XMLGenerator(const XMLGenerator *xg) + { + m_b.setBuffer(m_a); + m_b.open( IO_WriteOnly ); + m_t.setDevice(&m_b); + m_t.setEncoding(QTextStream::Latin1); + + // copy state variables + m_inParStack = xg->m_inParStack; + m_inListStack = xg->m_inListStack; + m_inParamList = xg->m_inParamList; + } + /*! destructor */ + virtual ~XMLGenerator() + { + } + /*! Returns the output written to this generator as a string */ + QCString getContents() const + { + QCString s; + s.resize(m_a.size()+1); + memcpy(s.data(),m_a.data(),m_a.size()); + s.at(m_a.size())='\0'; + return s; + } + + private: + // only one destination stream, so these do not have to be implemented + void pushGeneratorState() {} + void popGeneratorState() {} + void disableAllBut(OutputGenerator::OutputType) {} + void enableAll() {} + void disableAll() {} + void disable(OutputGenerator::OutputType) {} + void enable(OutputGenerator::OutputType) {} + bool isEnabled(OutputGenerator::OutputType) { return TRUE; } + + QTextStream m_t; + QByteArray m_a; + QBuffer m_b; + + ValStack<bool> m_inParStack; + ValStack<bool> m_inListStack; + bool m_inParamList; +}; + +void writeXMLDocBlock(QTextStream &t, + const QCString &fileName, + int lineNr, + const QCString &scope, + const QCString &name, + const QCString &text) +{ + XMLGenerator *xmlGen = new XMLGenerator; + parseDoc(*xmlGen, + fileName, // input definition file + lineNr, // input definition line + scope, // scope (which should not be linked to) + name, // member (which should not be linked to) + text // actual text + ); + xmlGen->endParMode(); + t << xmlGen->getContents(); + delete xmlGen; +} + + void generateXMLForMember(MemberDef *md,QTextStream &t,Definition *def) { @@ -235,6 +860,12 @@ void generateXMLForMember(MemberDef *md,QTextStream &t,Definition *def) } } } + t << " <briefdescription>" << endl; + writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(),scopeName,md->name(),md->briefDescription()); + t << " </briefdescription>" << endl; + t << " <detaileddescription>" << endl; + writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(),scopeName,md->name(),md->documentation()); + t << " </detaileddescription>" << endl; t << " </memberdef>" << endl; } @@ -370,6 +1001,12 @@ void generateXMLForClass(ClassDef *cd,QTextStream &t) generateXMLClassSection(cd,t,&cd->related,"related"); //t << " </sectionlist>" << endl; } + t << " <briefdescription>" << endl; + writeXMLDocBlock(t,cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->briefDescription()); + t << " </briefdescription>" << endl; + t << " <detaileddescription>" << endl; + writeXMLDocBlock(t,cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->documentation()); + t << " </detaileddescription>" << endl; t << " </compounddef>" << endl; } @@ -411,6 +1048,12 @@ void generateXMLForFile(FileDef *fd,QTextStream &t) generateXMLFileSection(fd,t,&fd->decVarMembers,"var"); //t << " </sectionlist>" << endl; } + t << " <briefdescription>" << endl; + writeXMLDocBlock(t,fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription()); + t << " </briefdescription>" << endl; + t << " <detaileddescription>" << endl; + writeXMLDocBlock(t,fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation()); + t << " </detaileddescription>" << endl; t << " </compounddef>" << endl; } |