diff options
author | mueller <mueller@afe2bf4a-e733-0410-8a33-86f594647bc7> | 1999-12-15 19:26:45 (GMT) |
---|---|---|
committer | mueller <mueller@afe2bf4a-e733-0410-8a33-86f594647bc7> | 1999-12-15 19:26:45 (GMT) |
commit | a6cb7ef1dc7c3d6b6ff949646b9b2deda3fc0bf3 (patch) | |
tree | bec2e27efcff1ecb747c25b00bb9fea1e068d151 /src | |
parent | 719f0a35063be88eddcc4ed8fe7a940de47ef20c (diff) | |
download | Doxygen-a6cb7ef1dc7c3d6b6ff949646b9b2deda3fc0bf3.zip Doxygen-a6cb7ef1dc7c3d6b6ff949646b9b2deda3fc0bf3.tar.gz Doxygen-a6cb7ef1dc7c3d6b6ff949646b9b2deda3fc0bf3.tar.bz2 |
mods for doxygen-0.49-990522
Diffstat (limited to 'src')
44 files changed, 2170 insertions, 772 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 079252d..50cd54c 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -37,7 +37,7 @@ static QString stripExtension(const char *fName) } // constructs a new class definition -ClassDef::ClassDef(const char *nm,int ct,const char *ref,const char *fName) +ClassDef::ClassDef(const char *nm,CompoundType ct,const char *ref,const char *fName) : Definition(removeRedundantWhiteSpace(nm)) { //name=n; @@ -155,7 +155,7 @@ void ClassDef::insertMember(const MemberDef *md) if (md->isFriend() || md->protection()!=Private || extractPrivateFlag) { MemberInfo *mi = new MemberInfo((MemberDef *)md,Public,Normal); - MemberNameInfo *mni; + MemberNameInfo *mni=0; if ((mni=(*allMemberNameInfoDict)[md->name()])) { mni->append(mi); @@ -232,8 +232,9 @@ void ClassDef::writeDocumentation(OutputList &ol) pageTitle+=pageType+" Reference"; startFile(ol,fileName,pageTitle); startTitle(ol); - ol.docify(name()+" "+pageType.right(pageType.length()-1)+" "); - parseDoc(ol,0,0,theTranslator->trReference()); + //ol.docify(name()+" "+pageType.right(pageType.length()-1)+" "); + //parseText(ol,theTranslator->trReference()); + parseText(ol,theTranslator->trCompoundReference(name(),compType)); endTitle(ol,name()); // write brief description @@ -244,8 +245,8 @@ void ClassDef::writeDocumentation(OutputList &ol) ol+=briefOutput; ol.writeString(" \n"); ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); - parseDoc(ol,0,0,theTranslator->trMore()); + ol.startTextLink(0,"_details"); + parseText(ol,theTranslator->trMore()); ol.endTextLink(); ol.enableAll(); } @@ -286,7 +287,41 @@ void ClassDef::writeDocumentation(OutputList &ol) int count; if ((count=inherits->count())>0) { - parseDoc(ol,0,0,theTranslator->trInherits()+" "); + //parseText(ol,theTranslator->trInherits()+" "); + + QString inheritLine = theTranslator->trInheritsList(inherits->count()); + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in inheritLine with links to the classes + while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1) + { + parseText(ol,inheritLine.mid(index,newIndex-index)); + bool ok; + uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + BaseClassDef *bcd=inherits->at(entryIndex); + if (ok && bcd) + { + ClassDef *cd=bcd->classDef; + if (cd->hasDocumentation() || cd->isReference()) + { + if (genTagFile.length()>0) tagFile << cd->getOutputFileBase() << "?"; + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()+bcd->templSpecifiers); + } + else + { + ol.docify(cd->name()); + } + } + else + { + err("Error: invalid marker %d in inherits list!\n",entryIndex); + } + index=newIndex+matchLen; + } + parseText(ol,inheritLine.right(inheritLine.length()-index)); + ol.newParagraph(); + +#if 0 BaseClassDef *bcd=inherits->first(); while (bcd) { @@ -305,13 +340,13 @@ void ClassDef::writeDocumentation(OutputList &ol) if (bcd) { if (inherits->at()==count-1) - parseDoc(ol,0,0," "+theTranslator->trAnd()+" "); + parseText(ol," "+theTranslator->trAnd()+" "); else ol.writeString(", "); } } ol.writeString("."); - ol.newParagraph(); +#endif } if (genTagFile.length()>0) tagFile << " \"" << fileName << ".html\"\n"; @@ -319,7 +354,36 @@ void ClassDef::writeDocumentation(OutputList &ol) // write subclasses if ((count=inheritedBy->count())>0) { - parseDoc(ol,0,0,theTranslator->trInheritedBy()+" "); + QString inheritLine = theTranslator->trInheritedByList(inheritedBy->count()); + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in inheritLine with links to the classes + while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1) + { + parseText(ol,inheritLine.mid(index,newIndex-index)); + bool ok; + uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + BaseClassDef *bcd=inheritedBy->at(entryIndex); + if (ok && bcd) + { + ClassDef *cd=bcd->classDef; + if (cd->hasDocumentation() || cd->isReference()) + { + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()); + } + else + { + ol.docify(cd->name()); + } + writeInheritanceSpecifier(ol,bcd); + } + index=newIndex+matchLen; + } + parseText(ol,inheritLine.right(inheritLine.length()-index)); + ol.newParagraph(); + +#if 0 + parseText(ol,theTranslator->trInheritedBy()+" "); BaseClassDef *bcd=inheritedBy->first(); while (bcd) { @@ -337,13 +401,14 @@ void ClassDef::writeDocumentation(OutputList &ol) if (bcd) { if (inheritedBy->at()==count-1) - parseDoc(ol,0,0," "+theTranslator->trAnd()+" "); + parseText(ol," "+theTranslator->trAnd()+" "); else ol.writeString(", "); } } ol.writeString("."); ol.newParagraph(); +#endif } if (classDiagramFlag) ol.enableAll(); @@ -376,7 +441,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ClassDiagram diagram(this); // create a diagram of this class. ol.startClassDiagram(); ol.disable(OutputGenerator::Man); - parseDoc(ol,name(),0,theTranslator->trClassDiagram(name())); + parseText(ol,theTranslator->trClassDiagram(name())); ol.enable(OutputGenerator::Man); ol.endClassDiagram(diagram,fileName,name()); } @@ -386,40 +451,45 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(memListFileName,0); - parseDoc(ol,0,0,theTranslator->trListOfAllMembers()); + parseText(ol,theTranslator->trListOfAllMembers()); ol.endTextLink(); ol.enableAll(); } // write member groups - writeMemberDecs(ol,this,0,0,"Public Members",0,&pubMembers); - writeMemberDecs(ol,this,0,0,"Public Slots",0,&pubSlots); - writeMemberDecs(ol,this,0,0,"Signals",0,&signals); - writeMemberDecs(ol,this,0,0,"Static Public Members",0,&pubStaticMembers); - writeMemberDecs(ol,this,0,0,"Protected Members",0,&proMembers); - writeMemberDecs(ol,this,0,0,"Protected Slots",0,&proSlots); - writeMemberDecs(ol,this,0,0,"Static Protected Members",0,&proStaticMembers); + ol.startMemberSections(); + writeMemberDecs(ol,this,0,0,theTranslator->trPublicMembers(),0,&pubMembers); + writeMemberDecs(ol,this,0,0,theTranslator->trPublicSlots(),0,&pubSlots); + writeMemberDecs(ol,this,0,0,theTranslator->trSignals(),0,&signals); + writeMemberDecs(ol,this,0,0,theTranslator->trStaticPublicMembers(),0,&pubStaticMembers); + writeMemberDecs(ol,this,0,0,theTranslator->trProtectedMembers(),0,&proMembers); + writeMemberDecs(ol,this,0,0,theTranslator->trProtectedSlots(),0,&proSlots); + writeMemberDecs(ol,this,0,0,theTranslator->trStaticProtectedMembers(),0,&proStaticMembers); if (extractPrivateFlag) { - writeMemberDecs(ol,this,0,0,"Private Members",0,&priMembers); - writeMemberDecs(ol,this,0,0,"Private Slots",0,&priSlots); - writeMemberDecs(ol,this,0,0,"Static Private Members",0,&priStaticMembers); + writeMemberDecs(ol,this,0,0,theTranslator->trPrivateMembers(),0,&priMembers); + writeMemberDecs(ol,this,0,0,theTranslator->trPrivateSlots(),0,&priSlots); + writeMemberDecs(ol,this,0,0,theTranslator->trStaticPrivateMembers(),0,&priStaticMembers); } - writeMemberDecs(ol,this,0,0,"Friends",0,&friends); + writeMemberDecs(ol,this,0,0,theTranslator->trFriends(),0,&friends); writeMemberDecs(ol,this,0,0, theTranslator->trRelatedFunctions(), theTranslator->trRelatedSubscript(), &related ); + ol.endMemberSections(); // write detailed description bool exampleFlag=hasExamples(); if (!briefDescription().isEmpty() || !documentation().isEmpty() || exampleFlag) { ol.writeRuler(); - ol.writeAnchor("details"); + bool latexOn = ol.isEnabled(OutputGenerator::Latex); + if (latexOn) ol.disable(OutputGenerator::Latex); + ol.writeAnchor("_details"); + if (latexOn) ol.enable(OutputGenerator::Latex); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trDetailedDescription()); + parseText(ol,theTranslator->trDetailedDescription()); ol.endGroupHeader(); if (tempArgs) // class is a template { @@ -460,11 +530,11 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.startDescList(); ol.startBold(); - parseDoc(ol,0,0,theTranslator->trExamples()+": "); + parseText(ol,theTranslator->trExamples()+": "); ol.endBold(); ol.endDescTitle(); ol.writeDescItem(); - writeExample(ol); + writeExample(ol,exampleList); //ol.endDescItem(); ol.endDescList(); } @@ -489,7 +559,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trMemberTypedefDocumentation()); + parseText(ol,theTranslator->trMemberTypedefDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&pubMembers,name(),MemberDef::Typedef); @@ -507,7 +577,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trMemberEnumerationDocumentation()); + parseText(ol,theTranslator->trMemberEnumerationDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&pubMembers,name(),MemberDef::Enumeration); @@ -525,7 +595,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerationValueDocumentation()); + parseText(ol,theTranslator->trEnumerationValueDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&pubMembers,name(),MemberDef::EnumValue); @@ -548,7 +618,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trMemberFunctionDocumentation()); + parseText(ol,theTranslator->trMemberFunctionDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&pubMembers,name(),MemberDef::Function); @@ -570,7 +640,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trRelatedFunctionDocumentation()); + parseText(ol,theTranslator->trRelatedFunctionDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&friends,name(),MemberDef::Friend); writeMemberDocs(ol,&related,name(),MemberDef::Function); @@ -586,7 +656,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trMemberDataDocumentation()); + parseText(ol,theTranslator->trMemberDataDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,&pubMembers,name(),MemberDef::Variable); @@ -603,41 +673,57 @@ void ClassDef::writeDocumentation(OutputList &ol) // write the list of used files (Html and LaTeX only) ol.disable(OutputGenerator::Man); ol.writeRuler(); - parseDoc(ol,0,0, - theTranslator->trGeneratedFrom(pageType.lower(), + parseText(ol,theTranslator->trGeneratedFrom(pageType.lower(), files.count()==1)); - ol.startItemList(); - + + bool first=TRUE; const char *file = files.first(); while (file) { - QFileInfo fi(file); - ol.writeListItem(); - FileDef *fd; bool ambig; - if ((fd=findFileDef(&inputNameDict,fi.absFilePath(),ambig)) - && fd->hasDocumentation()) - { - ol.writeObjectLink(fd->getReference(),fd->diskName(),0, - fi.fileName()); - } - else + FileDef *fd=findFileDef(&inputNameDict,file,ambig); + if (fd) { - ol.docify(fi.fileName()); + if (first) + { + first=FALSE; + ol.startItemList(); + } + + ol.writeListItem(); + QString path=fd->getPath().copy(); + if (fullPathNameFlag) + { + // strip part of the path + if (path.left(stripFromPath.length())==stripFromPath) + { + path=path.right(path.length()-stripFromPath.length()); + } + ol.docify(path); + } + + if (fd->hasDocumentation()) + { + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, + fd->name()); + } + else + { + ol.docify(fd->name()); + } } file=files.next(); } + if (!first) ol.endItemList(); - ol.endItemList(); - ol.enable(OutputGenerator::Man); - // write Author section (Man only) + ol.enable(OutputGenerator::Man); ol.disableAllBut(OutputGenerator::Man); ol.writeString("\n"); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trAuthor()); + parseText(ol,theTranslator->trAuthor()); ol.endGroupHeader(); - parseDoc(ol,0,0,theTranslator->trGeneratedAutomatically(projectName)); + parseText(ol,theTranslator->trGeneratedAutomatically(projectName)); ol.enableAll(); endFile(ol); @@ -651,13 +737,11 @@ void ClassDef::writeMemberList(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); startFile(ol,memListFileName,theTranslator->trMemberList()); startTitle(ol); - parseDoc(ol,name(),0,name()+" "+theTranslator->trMemberList()); + parseText(ol,name()+" "+theTranslator->trMemberList()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trThisIsTheListOfAllMembers()); - ol.writeString(" "); + parseText(ol,theTranslator->trThisIsTheListOfAllMembers()); ol.writeObjectLink(reference,fileName,0,name()); - ol.writeString(", "); - parseDoc(ol,0,0,theTranslator->trIncludingInheritedMembers()); + parseText(ol,theTranslator->trIncludingInheritedMembers()); ol.startItemList(); @@ -702,14 +786,14 @@ void ClassDef::writeMemberList(OutputList &ol) { QString name=mi->ambiguityResolutionScope+md->name(); ol.writeListItem(); - ol.writeObjectLink(cd->getReference(),cd->classFile(), + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), md->anchor(),name); if ( md->isFunction() || md->isSignal() || md->isSlot() ) ol.docify(md->argsString()); else if (md->isEnumerate()) - parseDoc(ol,0,0," "+theTranslator->trEnumName()); + parseText(ol," "+theTranslator->trEnumName()); else if (md->isEnumValue()) - parseDoc(ol,0,0," "+theTranslator->trEnumValue()); + parseText(ol," "+theTranslator->trEnumValue()); else if (md->isTypedef()) ol.docify(" typedef"); else if (md->isFriend() && !strcmp(md->typeString(),"friend class")) @@ -725,16 +809,16 @@ void ClassDef::writeMemberList(OutputList &ol) if ( md->isFunction() || md->isSignal() || md->isSlot() ) ol.docify(md->argsString()); else if (md->isEnumerate()) - parseDoc(ol,0,0," "+theTranslator->trEnumName()); + parseText(ol," "+theTranslator->trEnumName()); else if (md->isEnumValue()) - parseDoc(ol,0,0," "+theTranslator->trEnumValue()); + parseText(ol," "+theTranslator->trEnumValue()); else if (md->isTypedef()) ol.docify(" typedef"); ol.writeString(" ("); - parseDoc(ol,0,0,theTranslator->trDefinedIn()+" "); + parseText(ol,theTranslator->trDefinedIn()+" "); if (cd->isVisible()) { - ol.writeObjectLink(cd->getReference(),cd->classFile(),0,cd->name()); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()); } else { @@ -792,9 +876,9 @@ void ClassDef::writeIncludeFile(OutputList &ol) startTitle(ol); QString n=incName.copy(); if (incName.isNull()) n=incFile->name(); - parseDoc(ol,0,0,n); + parseText(ol,n); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trVerbatimText(incFile->name())); + parseText(ol,theTranslator->trVerbatimText(incFile->name())); ol.writeRuler(); ol.startCodeFragment(); parseCode(ol,n,fileToString(incFile->absFilePath()),FALSE,0); @@ -829,9 +913,31 @@ bool ClassDef::hasExamples() return exampleList->count()>0; } +#if 0 // write the list of all examples that are use this class. void ClassDef::writeExample(OutputList &ol) { + QString exampleLine=theTranslator->trWriteList(exampleList->count()); + + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in inheritLine with links to the classes + while ((newIndex=marker.match(exampleLine,index,&matchLen))!=-1) + { + bool ok; + parseText(ol,exampleLine.mid(index,newIndex-index)); + uint entryIndex = exampleLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + Example *e=exampleList->at(entryIndex); + if (ok && e) + { + ol.writeObjectLink(0,e->file,e->anchor,e->name); + } + index=newIndex+matchLen; + } + parseText(ol,exampleLine.right(exampleLine.length()-index)); + ol.writeString("."); + +#if 0 Example *e=exampleList->first(); while (e) { @@ -840,13 +946,15 @@ void ClassDef::writeExample(OutputList &ol) if (e) { if (exampleList->at()==(int)exampleList->count()-1) - parseDoc(ol,0,0," "+theTranslator->trAnd()+" "); + parseText(ol," "+theTranslator->trAnd()+" "); else ol.writeString(", "); } } ol.writeString("."); +#endif } +#endif void ClassDef::setTemplateArguments(ArgumentList *al) { diff --git a/src/classdef.h b/src/classdef.h index 8fe0f21..d5fc466 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -49,10 +49,11 @@ class ClassDef : public Definition Union=Entry::UNION_SEC }; - ClassDef(const char *name,int ct,const char *ref=0,const char *fName=0); + ClassDef(const char *name,CompoundType ct,const char *ref=0,const char *fName=0); ~ClassDef(); - QString classFile() const { return fileName; } - int compoundType() const { return compType; } + //QString classFile() const { return fileName; } + QString getOutputFileBase() const { return fileName; } + CompoundType compoundType() const { return compType; } const char *memberListFileName() const { return memListFileName; } void insertBaseClass(ClassDef *,Protection p,Specifier s,const char *t=0); BaseClassList *baseClasses() { return inherits; } @@ -75,7 +76,7 @@ class ClassDef : public Definition void writeIncludeFile(OutputList &ol); bool addExample(const char *anchor,const char *name, const char *file); bool hasExamples(); - void writeExample(OutputList &ol); + //void writeExample(OutputList &ol); void setProtection(Protection p) { prot=p; } Protection protection() const { return prot; } bool isVisible() @@ -130,7 +131,7 @@ class ClassDef : public Definition QString reference; ExampleList *exampleList; ExampleDict *exampleDict; - int compType; + CompoundType compType; Protection prot; }; @@ -173,16 +173,19 @@ static void generateClassLink(OutputList &ol,const char *clName) if (exampleBlock) { QString anchor; - anchor.sprintf("a%d",anchorCount); + anchor.sprintf("_a%d",anchorCount); //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),exampleName.data(), // exampleFile.data()); if (cd->addExample(anchor,exampleName,exampleFile)) { + bool latexOn = ol.isEnabled(OutputGenerator::Latex); + if (latexOn) ol.disable(OutputGenerator::Latex); ol.writeAnchor(anchor); + if (latexOn) ol.enable(OutputGenerator::Latex); anchorCount++; } } - ol.writeCodeLink(cd->getReference(),cd->classFile(),0,className); + ol.writeCodeLink(cd->getReference(),cd->getOutputFileBase(),0,className); } else { @@ -193,13 +196,14 @@ static void generateClassLink(OutputList &ol,const char *clName) static bool getLink(const char *className, const char *memberName,OutputList &result) { - MemberDef *md; - ClassDef *cd; - FileDef *fd; + MemberDef *md; + ClassDef *cd; + FileDef *fd; + NamespaceDef *nd; QString m=memberName; QString c=className; //printf("Trying `%s'::`%s'\n",c.data(),m.data()); - if (getDefs(m,c,"()",md,cd,fd) && + if (getDefs(m,c,"()",md,cd,fd,nd) && (md->hasDocumentation() || md->isReference())) { //printf("Found!\n"); @@ -217,13 +221,19 @@ static bool getLink(const char *className, } if (cd) { - result.writeCodeLink(cd->getReference(),cd->classFile(), + result.writeCodeLink(cd->getReference(),cd->getOutputFileBase(), + md->anchor(),memberName); + return TRUE; + } + else if (nd) + { + result.writeCodeLink(nd->getReference(),nd->getOutputFileBase(), md->anchor(),memberName); return TRUE; } else if (fd) { - result.writeCodeLink(fd->getReference(),fd->diskName(), + result.writeCodeLink(fd->getReference(),fd->getOutputFileBase(), md->anchor(),memberName); return TRUE; } @@ -363,7 +373,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]* if ((fd=findFileDef(&inputNameDict,yytext,ambig)) && fd->hasDocumentation()) { - code->writeCodeLink(0,fd->diskName(),0,yytext); + code->writeCodeLink(0,fd->getOutputFileBase(),0,yytext); } else { diff --git a/src/config.h b/src/config.h index 6269e85..492f356 100644 --- a/src/config.h +++ b/src/config.h @@ -41,6 +41,7 @@ extern QString genTagFile; // the tag file to generate extern QString inputFilter; // a filter command that is applied to input files extern QString paperType; // the page type to generate docs for extern QString stripFromPath; // the string to strip from the file path +extern QString manExtension; // extension the man page files extern QStrList includePath; // list of include paths extern QStrList examplePath; // list of example paths extern QStrList inputSources; // list of input files @@ -76,5 +77,6 @@ extern bool repeatBriefFlag; // repeat brief descriptions. extern bool internalDocsFlag; // determines what happens to internal docs. extern bool caseSensitiveNames; // determines if output can be mixed case. extern bool verbatimHeaderFlag; // enable/disable generation of verb headers. +extern bool htmlAlignMemberFlag; // align members in HTML using tables. #endif diff --git a/src/config.l b/src/config.l index 232f531..0545f32 100644 --- a/src/config.l +++ b/src/config.l @@ -62,6 +62,7 @@ QString inputFilter; QString paperType; QString outputLanguage; QString stripFromPath; +QString manExtension; QStrList includePath; QStrList examplePath; QStrList inputSources; @@ -72,31 +73,32 @@ QStrList tagFileList; QStrList extDocPathList; QStrList predefined; QStrList extraPackageList; -bool quietFlag = FALSE; -bool warningFlag = FALSE; -bool recursiveFlag = FALSE; -bool allExtFlag = FALSE; -bool searchEngineFlag = FALSE; -bool extractAllFlag = FALSE; -bool extractPrivateFlag = FALSE; -bool noIndexFlag = FALSE; -bool hideMemberFlag = FALSE; -bool hideClassFlag = FALSE; -bool macroExpansionFlag = FALSE; -bool onlyPredefinedFlag = FALSE; -bool fullPathNameFlag = FALSE; -bool compactLatexFlag = FALSE; -bool internalDocsFlag = FALSE; -bool caseSensitiveNames = FALSE; -bool generateHtml = TRUE; -bool generateLatex = TRUE; -bool generateMan = TRUE; -bool preprocessingFlag = TRUE; -bool briefMemDescFlag = TRUE; -bool searchIncludeFlag = TRUE; -bool classDiagramFlag = TRUE; -bool repeatBriefFlag = TRUE; -bool verbatimHeaderFlag = TRUE; +bool quietFlag = FALSE; +bool warningFlag = FALSE; +bool recursiveFlag = FALSE; +bool allExtFlag = FALSE; +bool searchEngineFlag = FALSE; +bool extractAllFlag = FALSE; +bool extractPrivateFlag = FALSE; +bool noIndexFlag = FALSE; +bool hideMemberFlag = FALSE; +bool hideClassFlag = FALSE; +bool macroExpansionFlag = FALSE; +bool onlyPredefinedFlag = FALSE; +bool fullPathNameFlag = FALSE; +bool compactLatexFlag = FALSE; +bool internalDocsFlag = FALSE; +bool caseSensitiveNames = FALSE; +bool generateHtml = TRUE; +bool generateLatex = TRUE; +bool generateMan = TRUE; +bool preprocessingFlag = TRUE; +bool briefMemDescFlag = TRUE; +bool searchIncludeFlag = TRUE; +bool classDiagramFlag = TRUE; +bool repeatBriefFlag = TRUE; +bool verbatimHeaderFlag = TRUE; +bool htmlAlignMemberFlag = TRUE; /* ----------------------------------------------------------------- * @@ -162,7 +164,8 @@ static int yyread(char *buf,int max_size) <Start>"INPUT_FILTER"[ \t]*"=" { BEGIN(GetString); s=&inputFilter; } <Start>"PAPER_TYPE"[ \t]*"=" { BEGIN(GetString); s=&paperType; } <Start>"OUTPUT_LANGUAGE"[ \t]*"=" { BEGIN(GetString); s=&outputLanguage; } -<Start>"STRIP_FROM_PATH"[ \t]*"=" { BEGIN(GetString); s=&stripFromPath; } +<Start>"STRIP_FROM_PATH"[ \t]*"=" { BEGIN(GetString); s=&stripFromPath; } +<Start>"MAN_EXTENSION"[ \t]*"=" { BEGIN(GetString); s=&manExtension; } <Start>"INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePath; elemStr=""; } <Start>"EXAMPLE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&examplePath; elemStr=""; } <Start>"INPUT"[ \t]*"=" { BEGIN(GetStrList); l=&inputSources; elemStr=""; } @@ -198,6 +201,7 @@ static int yyread(char *buf,int max_size) <Start>"INTERNAL_DOCS"[ \t]*"=" { BEGIN(GetBool); b=&internalDocsFlag; } <Start>"CASE_SENSE_NAMES"[ \t]*"=" { BEGIN(GetBool); b=&caseSensitiveNames; } <Start>"VERBATIM_HEADERS"[ \t]*"=" { BEGIN(GetBool); b=&verbatimHeaderFlag; } +<Start>"HTML_ALIGN_MEMBERS"[ \t]*"=" { BEGIN(GetBool); b=&htmlAlignMemberFlag; } <Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); } <GetString,GetBool>\n { yyLineNr++; BEGIN(Start); } <GetStrList>\n { @@ -636,6 +640,15 @@ void writeTemplateConfig(QFile *f,bool sl) if (!sl) { t << "\n"; + t << "# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,\n"; + t << "# files or namespaces will be aligned in HTML using tables. If set to\n"; + t << "# NO a bullet list will be used.\n"; + t << "\n"; + } + t << "HTML_ALIGN_MEMBERS = YES\n"; + if (!sl) + { + t << "\n"; t << "#---------------------------------------------------------------------------\n"; t << "# configuration options related to the LaTeX output\n"; t << "#---------------------------------------------------------------------------\n"; @@ -704,6 +717,15 @@ void writeTemplateConfig(QFile *f,bool sl) if (!sl) { t << "\n"; + t << "# The MAN_EXTENSION tag determines the extension that is added to\n"; + t << "# the generated man pages (default is the subroutine's section .3)\n"; + t << "\n"; + } + t << "MAN_EXTENSION = .3\n"; + + if (!sl) + { + t << "\n"; t << "#---------------------------------------------------------------------------\n"; t << "# Configuration options related to the preprocessor \n"; t << "#---------------------------------------------------------------------------\n"; @@ -870,6 +892,12 @@ void checkConfig() // projectName[0]=toupper(projectName[0]); //} + // set default man page extension if non is given by the user + if (manExtension.isEmpty()) + { + manExtension=".3"; + } + paperType = paperType.lower().stripWhiteSpace(); if (paperType.isEmpty()) { diff --git a/src/definition.cpp b/src/definition.cpp index 535612b..328bebe 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -16,6 +16,17 @@ #include <ctype.h> #include "definition.h" +#include "doxygen.h" + +Definition::Definition(const char *name,const char *b,const char *d) +{ + n=name; brief=b; doc=d; sectionList=0; +} + +Definition::~Definition() +{ + delete sectionList; +} QString Definition::nameToFile(const char *name) { @@ -42,3 +53,22 @@ QString Definition::nameToFile(const char *name) } return result; } + +void Definition::addSectionsToDefinition(QList<QString> *anchorList) +{ + if (!anchorList) return; + QString *s=anchorList->first(); + while (s) + { + SectionInfo *si=0; + if (!s->isEmpty() && (si=sectionDict[*s])) + { + //printf("Add section `%s' to definition `%s'\n", + // si->label.data(),n.data()); + if (sectionList==0) sectionList = new SectionList; + sectionList->append(si); + si->definition = this; + } + s=anchorList->next(); + } +} diff --git a/src/definition.h b/src/definition.h index 2dbee89..48301bc 100644 --- a/src/definition.h +++ b/src/definition.h @@ -18,19 +18,22 @@ #define DEFINITION_H #include <qstring.h> +#include <qlist.h> #include "config.h" +#include "section.h" /*! The common base class of all definitions. */ class Definition { public: //! create a new definition - Definition(const char *name,const char *b=0,const char *d=0) - { n=name; brief=b; doc=d; } + Definition(const char *name,const char *b=0,const char *d=0); //! destroys the definition - virtual ~Definition() {} + virtual ~Definition(); //! returns the name of the definition QString name() const { return n; } + //! returns the base name of the output file that contains this definition. + virtual QString getOutputFileBase() const = 0; //! returns the detailed description of this definition QString documentation() const { return doc; } //! returns the brief description of this definition @@ -55,10 +58,13 @@ class Definition { return !doc.isNull() || !brief.isNull() || extractAllFlag; } QString nameToFile(const char *name); + void addSectionsToDefinition(QList<QString> *anchorList); + private: QString n; // name of the definition QString brief; // brief description QString doc; // detailed description + SectionList *sectionList; // list of all sections }; #endif diff --git a/src/diagram.cpp b/src/diagram.cpp index 0fd30a5..87d5488 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -152,7 +152,7 @@ static void writeMapArea(QTextStream &t,ClassDef *cd,int x,int y,int w,int h) { t << "<area "; if (cd->getReference()) t << "doxygen=\"" << cd->getReference() << ":\" "; - t << "href=\"" << cd->classFile() << ".html\" "; + t << "href=\"" << cd->getOutputFileBase() << ".html\" "; t << "ALT=\"" << cd->name(); t << "\" shape=\"rect\" coords=\"" << x << "," << y << ","; t << x+w << "," << y+h << "\">" << endl; @@ -187,7 +187,7 @@ QString DiagramItem::label() const QString DiagramItem::fileName() const { - return classDef->classFile(); + return classDef->getOutputFileBase(); } int DiagramItem::avgChildPos() const diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 3d641ef..8c11c0b 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -60,6 +60,7 @@ PageList exampleList; // list of all example files PageList pageList; // list of all related documentation pages MemberNameList memberNameList; // list of class member + related functions MemberNameList functionNameList; // list of all unrelated functions +//MemberNameList namespaceNameList; // list of namespace members; FileNameList inputNameList; // list of all input files StringList inputFiles; FileList includeFiles; @@ -71,8 +72,9 @@ PageDict pageDict(1009); // dictionary of all doc pages PageDict exampleDict(1009); // dictionary of all examples ClassDict classDict(1009); // dictionary of all documented classes NamespaceDict namespaceDict(257); // dictionary of all documented namespaces -MemberNameDict memberNameDict(10007); // dictionary of all member names +MemberNameDict memberNameDict(10007); // dictionary of all class member names MemberNameDict functionNameDict(10007); // dictionary of all functions +//MemberNameDict namespaceNameDict(10007);// dictionaty of all namespace member names StringDict substituteDict(1009); // dictionary of class name substitutes SectionDict sectionDict(257); // dictionary of all page sections FileNameDict inputNameDict(1009); // dictionary of sections @@ -100,6 +102,7 @@ int documentedMembers; int documentedFiles; int documentedGroups; int documentedNamespaces; +int documentedNamespaceMembers; QTextStream tagFile; @@ -140,6 +143,7 @@ void buildGroupList(Entry *root) gd = new GroupDef(root->name,root->type); gd->setBriefDescription(root->brief); gd->setDocumentation(root->doc); + gd->addSectionsToDefinition(root->anchors); groupList.inSort(gd); groupDict.insert(root->name,gd); } @@ -207,6 +211,7 @@ void buildFileList(Entry *root) { fd->setDocumentation(root->doc); fd->setBriefDescription(root->brief); + fd->addSectionsToDefinition(root->anchors); QListIterator<QString> sli(*root->groups); QString *s; for (;(s=sli.current());++sli) @@ -290,7 +295,7 @@ void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) cd->setIncludeFile(fd); // set include supplied name cd->setIncludeName(root->includeName); - fd->setIncludeName((QString)cd->classFile()+"-include"); + fd->setIncludeName(cd->getOutputFileBase()+"-include"); if (includeDict[fd->absFilePath()]==0) // include not inserted earlier { includeFiles.inSort(fd); @@ -409,6 +414,7 @@ void buildClassList(Entry *root) { cd->setDocumentation(root->doc); cd->setBriefDescription(root->brief); + cd->addSectionsToDefinition(root->anchors); cd->setName(fullName); // change name to match docs } } @@ -429,7 +435,7 @@ void buildClassList(Entry *root) ) // new class { - int sec=ClassDef::Class; + ClassDef::CompoundType sec=ClassDef::Class; switch(root->section) { case Entry::UNION_SEC: @@ -445,6 +451,7 @@ void buildClassList(Entry *root) //printf("new ClassDef tempArgList=%p\n",root->tArgList); cd->setTemplateArguments(root->tArgList); cd->setProtection(root->protection); + cd->addSectionsToDefinition(root->anchors); QListIterator<QString> sli(*root->groups); QString *s; @@ -519,6 +526,7 @@ void buildNamespaceList(Entry *root) { nd->setDocumentation(root->doc); nd->setName(fullName); // change name to match docs + nd->addSectionsToDefinition(root->anchors); } else if (!nd->documentation().isEmpty() && root->doc.length()>0) { @@ -539,14 +547,16 @@ void buildNamespaceList(Entry *root) } } } - else if (root->doc.length()>0 || + else /* if (root->doc.length()>0 || root->brief.length()>0 || extractAllFlag - ) + ) + */ { NamespaceDef *nd=new NamespaceDef(fullName); nd->setDocumentation(root->doc); // copy docs to definition nd->setBriefDescription(root->brief); + nd->addSectionsToDefinition(root->anchors); QListIterator<QString> sli(*root->groups); QString *s; @@ -639,12 +649,14 @@ void buildVarList(Entry *root) bool stat=root->stat; ClassDef *cd=0; Entry *p = root->parent; - while ((p->section & Entry::COMPOUND_MASK)) + while ((p->section & Entry::COMPOUND_MASK) || + p->section==Entry::NAMESPACE_SEC) { if (p->name.length()>0 && p->name[0]!='@') { if (!scope.isEmpty()) scope.prepend("::"); scope.prepend(p->name); + break; } p=p->parent; } @@ -652,6 +664,7 @@ void buildVarList(Entry *root) //printf("scope=%s\n",scope.data()); int ni; +#if 0 if ((ni=root->name.findRev("::"))!=-1) { if (scope.length()>0) scope+="::"; @@ -659,8 +672,18 @@ void buildVarList(Entry *root) name=root->name.right(root->name.length()-ni-2); stat=TRUE; } +#endif + + if ((ni=root->name.findRev("::"))!=-1) goto nextMember; + /* skip this member, because it is a + * static variable definition (always?), which will be + * found in a class scope as well, but then we know the + * correct protection level, so only then it will be + * inserted in the correct list! + */ MemberDef::MemberType mtype; +// NamespaceDef *nd = 0; QString type=root->type.stripWhiteSpace(); if (type=="@") mtype=MemberDef::EnumValue; @@ -715,11 +738,28 @@ void buildVarList(Entry *root) if (mn) { MemberDef *md=mn->first(); - while (md) + while (md && !found) { if (md->memberClass()==cd) // member already in the scope { addMemberDocs(root,md,def,FALSE); + +#if 0 + // always trust the most protected scope, so adjust if needed + // This is needed to properly place static private variables, + // which are defined in a `public' scope. + printf("Checking protection level\n"); + if (root->protection==Private || md->protection()!=Private) + { + printf("Set to private\n"); + md->setProtection(Private); + } + else if (root->protection==Protected && md->protection()==Public) + { + printf("Set to protected\n"); + md->setProtection(Protected); + } +#endif found=TRUE; } md=mn->next(); @@ -737,6 +777,7 @@ void buildVarList(Entry *root) md->setDocumentation(root->doc); md->setBriefDescription(root->brief); md->setDefinition(def); + md->addSectionsToDefinition(root->anchors); // add the member to the global list if (mn) @@ -761,6 +802,56 @@ void buildVarList(Entry *root) cd->insertUsedFile(root->fileName); } } +#if 0 + else if (scope.length()>0 && name.length()>0 && (nd=namespaceDict[scope])) + { + Debug::print(Debug::Variables,0, + " namespace variable:\n" + " type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d\n", + root->type.data(), + scope.data(), + name.data(), + root->args.data(), + root->protection + ); + // new global variable, enum value or typedef + MemberDef *md=new MemberDef(root->type,name,root->args,0, + Public, Normal,root->stat,FALSE, + mtype,0,0); + md->setDefFile(root->fileName); + md->setDefLine(root->startLine); + md->setDocumentation(root->doc); + md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); + QString def; + nd->insertMember(md); + md->setNamespace(nd); + if (root->type.length()>0) + { + def=root->type+" "+nd->name()+"::"+name+root->args; + } + else + { + def=nd->name()+"::"+name+root->args; + } + if (def.left(7)=="static ") def=def.right(def.length()-7); + md->setDefinition(def); + + MemberName *mn; + // add member definition to the list of globals + if ((mn=namespaceNameDict[name])) + { + mn->inSort(md); + } + else + { + mn = new MemberName(name); + mn->inSort(md); + namespaceNameDict.insert(name,mn); + namespaceNameList.inSort(mn); + } + } +#endif else if (name.length()>0) // global variable { Debug::print(Debug::Variables,0, @@ -781,6 +872,7 @@ void buildVarList(Entry *root) md->setDefLine(root->startLine); md->setDocumentation(root->doc); md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); QString def; // see if the function is inside a namespace @@ -850,6 +942,7 @@ void buildVarList(Entry *root) } } } +nextMember: EntryListIterator eli(*root->sublist); Entry *e; for (;(e=eli.current());++eli) @@ -925,6 +1018,7 @@ void buildMemberList(Entry *root) md->setDefLine(root->startLine); md->setDocumentation(root->doc); md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); QString def; if (root->relates.length()>0 || isFriend) { @@ -1048,6 +1142,7 @@ void buildMemberList(Entry *root) { md->setBriefDescription(root->brief); } + md->addSectionsToDefinition(root->anchors); } md=mn->next(); } @@ -1067,6 +1162,7 @@ void buildMemberList(Entry *root) md->setDocumentation(root->doc); md->setBriefDescription(root->brief); md->setPrototype(root->proto); + md->addSectionsToDefinition(root->anchors); QString def; if (root->type.length()>0) { @@ -1357,8 +1453,9 @@ void computeClassRelations(Entry *root) } else // base class not documented { - //printf("Found undocumented base class %s\n",bi->name.data()); NamespaceDef *nd=cd->getNamespace(); + //printf("Found undocumented base class `%s' namespace scope=`%s'\n", + // bi->name.data(),nd ? nd->name().data() : "<none>"); if (nd && (baseClass=getClass(nd->name()+"::"+baseClassName))) // class is defined inside namespace { @@ -1369,7 +1466,7 @@ void computeClassRelations(Entry *root) } else // undocumented base class { - baseClass=new ClassDef(bi->name,Entry::CLASS_SEC); + baseClass=new ClassDef(bi->name,ClassDef::Class); // add base class to this class cd->insertBaseClass(baseClass,bi->prot,bi->virt,templSpec); // add this class as super class to the base class @@ -1523,6 +1620,7 @@ void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl, } md->setDefFile(root->fileName); md->setDefLine(root->startLine); + md->addSectionsToDefinition(root->anchors); if (cd) cd->insertUsedFile(root->fileName); } @@ -1676,21 +1774,23 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded, else scopeName=related.copy(); } - else if (scopeName.isEmpty() && related.isEmpty() && root->parent && + else if (/*scopeName.isEmpty() &&*/ related.isEmpty() && root->parent && !root->parent->name.isNull()) { Entry *p=root->parent; while (p) // get full scope as class name { + //printf("++++++ scope=`%s'\n",p->name.data()); if (((p->section & Entry::COMPOUND_MASK) || p->section == Entry::NAMESPACE_SEC ) && !p->name.isEmpty() && p->name[0]!='@' ) { + if (scopeName.left(p->name.length())==p->name) + break; // scope already present, so stop now + // prepend name to scope if (!scopeName.isEmpty()) scopeName.prepend("::"); scopeName.prepend(p->name); - break; // stop here because the class name already contains - // the whole scope! } p=p->parent; } @@ -1906,6 +2006,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded, md->setDefFile(root->fileName); md->setDefLine(root->startLine); md->setPrototype(root->proto); + md->addSectionsToDefinition(root->anchors); mn->inSort(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); @@ -1970,6 +2071,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded, md->setDefFile(root->fileName); md->setDefLine(root->startLine); md->setPrototype(root->proto); + md->addSectionsToDefinition(root->anchors); mn->inSort(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); @@ -2014,7 +2116,7 @@ void findMember(Entry *root,QString funcDecl,QString related,bool overloaded, void findMemberDocumentation(Entry *root) { int i,l; - QRegExp re("([a-zA-Z0-9: ]*[ *]+[ ]*"); + QRegExp re("([a-zA-Z0-9: ]*\\*+[ \\*]*"); Debug::print(Debug::FindMembers,0, "root->type=`%s' root->name=`%s' root->args=`%s'\n", root->type.data(),root->name.data(),root->args.data() @@ -2026,7 +2128,7 @@ void findMemberDocumentation(Entry *root) root->type=root->type.left(i+l); isFunc=FALSE; } - else if (root->name.find(re)!=-1 && root->name.find("operator")!=-1) + else if (root->name.find(re)!=-1 && root->name.find("operator")==-1) // func ptr entered with \fn, \var or \typedef { isFunc=FALSE; @@ -2151,6 +2253,7 @@ void findEnums(Entry *root) if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd); md->setDefFile(root->fileName); md->setDefLine(root->startLine); + md->addSectionsToDefinition(root->anchors); if (nd) { md->setDefinition(nd->name()+"::"+name); @@ -2301,6 +2404,7 @@ void findEnumDocumentation(Entry *root) { md->setBriefDescription(root->brief); } + md->addSectionsToDefinition(root->anchors); found=TRUE; } md=mn->next(); @@ -2319,6 +2423,7 @@ void findEnumDocumentation(Entry *root) { md->setDocumentation(root->doc); md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); found=TRUE; } } @@ -2338,6 +2443,49 @@ void findEnumDocumentation(Entry *root) } } +// seach for each enum (member or function) in mnl if it has documented +// enum values. +static void findDEV(const MemberNameList &mnl) +{ + MemberName *mn; + MemberNameListIterator mnli(mnl); + // for each member name + for (mnli.toFirst();(mn=mnli.current());++mnli) + { + MemberDef *md; + MemberNameIterator mni(*mn); + // for each member definition + for (mni.toFirst();(md=mni.current());++mni) + { + if (md->isEnumerate()) // member is an enum + { + QList<MemberDef> *fmdl = md->enumFieldList(); + int documentedEnumValues=0; + if (fmdl) // enum has values + { + MemberDef *fmd=fmdl->first(); + // for each enum value + while (fmd) + { + if (fmd->hasDocumentation()) documentedEnumValues++; + fmd=fmdl->next(); + } + } + // at least one enum value is documented + if (documentedEnumValues>0) md->setDocumentedEnumValues(TRUE); + } + } + } +} + +// seach for each enum (member or function) if it has documented enum +// values. +void findDocumentedEnumValues() +{ + findDEV(memberNameList); + findDEV(functionNameList); +} + //---------------------------------------------------------------------- // recursive function: // returns TRUE iff class definition `bcd' represents an (in)direct base @@ -2695,6 +2843,7 @@ void findDefineDocumentation(Entry *root) md->setDocumentation(root->doc); if (md->briefDescription().isEmpty()) md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); } md=mn->next(); } @@ -2715,6 +2864,7 @@ void findDefineDocumentation(Entry *root) md->setDocumentation(root->doc); if (md->briefDescription().isEmpty()) md->setBriefDescription(root->brief); + md->addSectionsToDefinition(root->anchors); } } md=mn->next(); @@ -2769,6 +2919,7 @@ void buildPageList(Entry *root) baseName=baseName.left(baseName.length()-5); pi=new PageInfo(baseName, root->doc, root->args.stripWhiteSpace()); + setFileNameForSections(root->anchors,root->name); pageList.append(pi); pageDict.insert(baseName,pi); if (pi->title.length()>0) @@ -2779,8 +2930,11 @@ void buildPageList(Entry *root) else pageName=pi->name.lower(); //outputList->writeTitle(pi->name,pi->title); - SectionInfo *si=new SectionInfo(pageName+".html", - pi->name,pi->title,FALSE); + + // a page name is a label as well! + SectionInfo *si=new SectionInfo( + pi->name,pi->title,SectionInfo::Section); + si->fileName=pageName+".html"; //printf("Adding section info %s\n",pi->name.data()); sectionDict.insert(pi->name,si); } @@ -2796,6 +2950,26 @@ void buildPageList(Entry *root) } //---------------------------------------------------------------------------- + +void resolveUserReferences() +{ + QDictIterator<SectionInfo> sdi(sectionDict); + SectionInfo *si; + for (;(si=sdi.current());++sdi) + { + if (si->definition) + { + //printf("si=`%s' def=`%s' file=`%s'\n", + // si->label.data(), + // si->definition->name().data(), + // si->definition->getOutputFileBase().data()); + si->fileName=si->definition->getOutputFileBase().copy(); + } + } +} + + +//---------------------------------------------------------------------------- // generate all separate documentation pages void generatePageDocs() @@ -2803,14 +2977,7 @@ void generatePageDocs() PageInfo *pi=pageList.first(); while (pi) { - if (!pi->title.isEmpty()) - { - msg("Generating docs for page %s...\n",pi->title.data()); - } - else - { - msg("Generating docs for page %s...\n",pi->name.data()); - } + msg("Generating docs for page %s...\n",pi->name.data()); outputList->disable(OutputGenerator::Man); QString pageName; if (caseSensitiveNames) @@ -2850,6 +3017,7 @@ void buildExampleList(Entry *root) else { PageInfo *pi=new PageInfo(root->name,root->doc,root->args); + setFileNameForSections(root->anchors,root->name); exampleList.inSort(pi); exampleDict.insert(root->name,pi); } @@ -3166,6 +3334,7 @@ void readFiles(BufStr &output) s=inputFiles.next(); } // *p++='\0'; + output.addChar('\n'); /* to prevent problems under Windows ? */ output.addChar(0); //printf("Output after preprocessing:\n---------\n%s\n----------\n",output.data()); //printf("Final length = %d\n",p-output.data()); @@ -3206,7 +3375,7 @@ int readDir(QFileInfo *fi, else if (cfi->isFile() && patternMatch(cfi,patList) && !patternMatch(cfi,exclPatList)) { - totalSize+=cfi->size()+cfi->absFilePath().length()+3; + totalSize+=cfi->size()+cfi->absFilePath().length()+4; QString name=cfi->fileName(); if (fnDict) { @@ -3306,7 +3475,7 @@ int readFileOrDirectory(const char *s, } else if (fi.isFile()) { - totalSize+=fi.size()+fi.absFilePath().length()+3; //readFile(&fi,fiList,input); + totalSize+=fi.size()+fi.absFilePath().length()+4; //readFile(&fi,fiList,input); //fiList->inSort(new FileInfo(fi)); QString name=fi.fileName(); if (fnDict) @@ -3646,16 +3815,19 @@ int main(int argc,char **argv) msg("Searching for enumerations...\n"); findEnums(root); findEnumDocumentation(root); - // msg("Searching for function prototypes...\n"); // findPrototypes(root); // may introduce new members ! msg("Searching for member function documentation...\n"); findMemberDocumentation(root); // may introduce new members ! + msg("Freeing entry tree\n"); delete root; + msg("Determining which enums are documented\n"); + findDocumentedEnumValues(); + msg("Computing member references...\n"); computeMemberReferences(); @@ -3678,18 +3850,22 @@ int main(int argc,char **argv) // If the result is 0 we do not generate the lists and omit the // corresponding links in the index. msg("Counting data structures...\n"); - annotatedClasses = countAnnotatedClasses(); - hierarchyClasses = countClassHierarchy(); - documentedMembers = countMemberList(); - documentedFunctions = countFunctionList(); - documentedFiles = countFileList(); - documentedGroups = countGroupList(); - documentedNamespaces = countNamespaceList(); + annotatedClasses = countAnnotatedClasses(); + hierarchyClasses = countClassHierarchy(); + documentedMembers = countClassMembers(); + documentedFunctions = countFileMembers(); + documentedFiles = countFiles(); + documentedGroups = countGroups(); + documentedNamespaces = countNamespaces(); + documentedNamespaceMembers = countNamespaceMembers(); // compute the shortest possible names of all files // without loosing the uniqueness of the file names. msg("Generating disk names...\n"); inputNameList.generateDiskNames(); + + msg("Resolving user defined references...\n"); + resolveUserReferences(); msg("Generating example documentation...\n"); generateExampleDocs(); @@ -3715,9 +3891,12 @@ int main(int argc,char **argv) msg("Generating example index...\n"); writeExampleIndex(*outputList); - msg("Generating function index...\n"); - writeFunctionIndex(*outputList); + msg("Generating file member index...\n"); + writeFileMemberIndex(*outputList); + msg("Generating namespace member index...\n"); + writeNamespaceMemberIndex(*outputList); + // msg("Generating define index...\n"); // writeDefineIndex(*outputList); @@ -3730,17 +3909,17 @@ int main(int argc,char **argv) msg("Generating style sheet...\n"); outputList->writeStyleInfo(0); // write first part outputList->disableAllBut(OutputGenerator::Latex); - parseDoc(*outputList,0,0, + parseText(*outputList, theTranslator->trGeneratedAt(dateToString(TRUE),projectName) ); outputList->writeStyleInfo(1); // write second part - parseDoc(*outputList,0,0, theTranslator->trWrittenBy()); + parseText(*outputList,theTranslator->trWrittenBy()); outputList->writeStyleInfo(2); // write third part - parseDoc(*outputList,0,0, + parseText(*outputList, theTranslator->trGeneratedAt(dateToString(TRUE),projectName) ); outputList->writeStyleInfo(3); // write fourth part - parseDoc(*outputList,0,0, theTranslator->trWrittenBy()); + parseText(*outputList,theTranslator->trWrittenBy()); outputList->writeStyleInfo(4); // write last part outputList->enableAll(); diff --git a/src/doxygen.h b/src/doxygen.h index 05ca854..005ac7e 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -28,6 +28,7 @@ #include "define.h" #include "namespacedef.h" #include "formula.h" +#include "section.h" struct PageInfo { @@ -72,23 +73,12 @@ class BufStr : public QString const int spareRoom; // 10Kb extra room to avoid frequent resizing }; -struct SectionInfo -{ - SectionInfo(const char *n,const char *l,const char *t,bool sub) - { pageName=n; label=l; title=t; isSubsection=sub; } - QString pageName; - QString label; - QString title; - bool isSubsection; -}; - typedef QList<QString> StringList; typedef QDict<MemberDef> MemberDict; typedef QDict<ClassDef> ClassDict; typedef QDict<FileDef> FileDict; typedef QDict<QString> StringDict; typedef QDict<PageInfo> PageDict; -typedef QDict<SectionInfo> SectionDict; typedef QDict<GroupDef> GroupDict; extern const char * getOverloadDocs(); @@ -118,6 +108,7 @@ extern FileList includeFiles; extern StringDict typedefDict; extern GroupList groupList; extern NamespaceList namespaceList; +extern NamespaceDict namespaceDict; extern FormulaList formulaList; extern FormulaDict formulaDict; extern FormulaDict formulaNameDict; @@ -130,5 +121,6 @@ extern int documentedDefines; extern int documentedFiles; extern int documentedGroups; extern int documentedNamespaces; +extern int documentedNamespaceMembers; #endif diff --git a/src/doxygen.pro b/src/doxygen.pro index e6dd3c0..21e2ea5 100644 --- a/src/doxygen.pro +++ b/src/doxygen.pro @@ -14,7 +14,7 @@ # TMake project file for doxygen TEMPLATE = doxygen.t -CONFIG = console qt warn_on release #debug +CONFIG = console qt warn_on release #debug HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ membername.h index.h memberlist.h definition.h \ entry.h logos.h instdox.h message.h code.h \ diff --git a/src/doxytag.l b/src/doxytag.l index 4f9fac1..0c70dc6 100644 --- a/src/doxytag.l +++ b/src/doxytag.l @@ -251,7 +251,8 @@ QString unhtmlify(const char *str) } <SearchWords>[a-z_A-Z0-9]+ { docAnchor = yytext; - if (docAnchor=="details") + if (docAnchor=="details" || + docAnchor=="_details") { docRefName=className.copy(); addReference(); diff --git a/src/entry.cpp b/src/entry.cpp index 2520fa3..51724ce 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -29,6 +29,8 @@ Entry::Entry() extends->setAutoDelete(TRUE); groups = new QList<QString>; groups->setAutoDelete(TRUE); + anchors = new QList<QString>; + anchors->setAutoDelete(TRUE); argList = new ArgumentList; argList->setAutoDelete(TRUE); //printf("Entry::Entry() tArgList=0\n"); @@ -66,6 +68,8 @@ Entry::Entry(const Entry &e) extends->setAutoDelete(TRUE); groups = new QList<QString>; groups->setAutoDelete(TRUE); + anchors = new QList<QString>; + anchors->setAutoDelete(TRUE); argList = new ArgumentList; argList->setAutoDelete(TRUE); //printf("Entry::Entry(copy) tArgList=0\n"); @@ -94,6 +98,12 @@ Entry::Entry(const Entry &e) { groups->append(new QString(*s)); } + + QListIterator<QString> sli2(*e.anchors); + for (;(s=sli2.current());++sli2) + { + anchors->append(new QString(*s)); + } // deep copy argument list QListIterator<Argument> ali(*e.argList); @@ -128,6 +138,7 @@ Entry::~Entry() delete sublist; delete extends; delete groups; + delete anchors; delete argList; //printf("Entry::~Entry() tArgList=%p\n",tArgList); delete tArgList; @@ -177,6 +188,7 @@ void Entry::reset() sublist->clear(); extends->clear(); groups->clear(); + anchors->clear(); argList->clear(); if (tArgList) { delete tArgList; tArgList=0; } } @@ -211,6 +223,13 @@ int Entry::getSize() size+=s->length()+1; s=groups->next(); } + s=anchors->first(); + while (s) + { + size+=sizeof(QLNode); + size+=s->length()+1; + s=anchors->next(); + } Entry *e=sublist->first(); while (e) { diff --git a/src/entry.h b/src/entry.h index 40624d8..a302955 100644 --- a/src/entry.h +++ b/src/entry.h @@ -140,6 +140,7 @@ class Entry QList<Entry> *sublist; // entries that are children of this one QList<BaseInfo> *extends; // list of base classes QList<QString> *groups; // list of groups this entry belongs to + QList<QString> *anchors; // list of anchors defined in this entry QString fileName; // file this entry was extracted from int startLine; // start line of entry in the source int num; diff --git a/src/filedef.cpp b/src/filedef.cpp index 54266a5..7921bf7 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -69,7 +69,7 @@ void FileDef::writeDocumentation(OutputList &ol) QString pageTitle=name()+" File Reference"; startFile(ol,diskname,pageTitle); startTitle(ol); - ol.docify(pageTitle); + parseText(ol,theTranslator->trFileReference(name())); endTitle(ol,name()); //ol.newParagraph(); @@ -86,8 +86,8 @@ void FileDef::writeDocumentation(OutputList &ol) ol+=briefOutput; ol.writeString(" \n"); ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); - parseDoc(ol,0,0,theTranslator->trMore()); + ol.startTextLink(0,"_details"); + parseText(ol,theTranslator->trMore()); ol.endTextLink(); ol.enableAll(); } @@ -96,6 +96,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.enable(OutputGenerator::Man); ol.writeSynopsis(); + ol.startMemberSections(); if (classList->count()>0) { ClassDef *cd=classList->first(); @@ -111,7 +112,7 @@ void FileDef::writeDocumentation(OutputList &ol) if (!found) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trCompounds()); + parseText(ol,theTranslator->trCompounds()); ol.endMemberHeader(); ol.startMemberList(); found=TRUE; @@ -124,10 +125,11 @@ void FileDef::writeDocumentation(OutputList &ol) case ClassDef::Union: ol.writeString("union"); break; } ol.writeString(" "); + ol.insertMemberAlign(); if (cd->hasDocumentation()) { ol.writeObjectLink(cd->getReference(), - cd->classFile(), + cd->getOutputFileBase(), 0, cd->name() ); @@ -146,6 +148,7 @@ void FileDef::writeDocumentation(OutputList &ol) } writeMemberDecs(ol,0,0,this,0,0,memList); + ol.endMemberSections(); //doc=doc.stripWhiteSpace(); //int bl=brief.length(); @@ -153,9 +156,12 @@ void FileDef::writeDocumentation(OutputList &ol) if (!briefDescription().isEmpty() || !documentation().isEmpty()) { ol.writeRuler(); - ol.writeAnchor("details"); + bool latexOn = ol.isEnabled(OutputGenerator::Latex); + if (latexOn) ol.disable(OutputGenerator::Latex); + ol.writeAnchor("_details"); + if (latexOn) ol.enable(OutputGenerator::Latex); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trDetailedDescription()); + parseText(ol,theTranslator->trDetailedDescription()); ol.endGroupHeader(); if (!briefDescription().isEmpty()) { @@ -177,7 +183,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trDefineDocumentation()); + parseText(ol,theTranslator->trDefineDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Define); } @@ -186,7 +192,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trFunctionPrototypeDocumentation()); + parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Prototype); } @@ -195,7 +201,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trTypedefDocumentation()); + parseText(ol,theTranslator->trTypedefDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Typedef); } @@ -204,7 +210,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerationTypeDocumentation()); + parseText(ol,theTranslator->trEnumerationTypeDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Enumeration); } @@ -213,7 +219,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerationValueDocumentation()); + parseText(ol,theTranslator->trEnumerationValueDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::EnumValue); } @@ -222,7 +228,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trFunctionDocumentation()); + parseText(ol,theTranslator->trFunctionDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Function); } @@ -231,7 +237,7 @@ void FileDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trVariableDocumentation()); + parseText(ol,theTranslator->trVariableDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Variable); } @@ -239,9 +245,9 @@ void FileDef::writeDocumentation(OutputList &ol) // write Author section (Man only) ol.disableAllBut(OutputGenerator::Man); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trAuthor()); + parseText(ol,theTranslator->trAuthor()); ol.endGroupHeader(); - parseDoc(ol,0,0,theTranslator->trGeneratedAutomatically(projectName)); + parseText(ol,theTranslator->trGeneratedAutomatically(projectName)); ol.enableAll(); endFile(ol); } diff --git a/src/filedef.h b/src/filedef.h index 36ce9cb..ca95e20 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -62,7 +62,8 @@ class FileDef : public Definition } /*! Returns nameString with all slashes replaced by underscores. */ - const char *diskName() const { return diskname; } + //const char *diskName() const { return diskname; } + QString getOutputFileBase() const { return diskname; } /*! Returns the absolute path including the file name. */ QString absFilePath() const { return filepath; } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 6a2d79b..924199e 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -90,20 +90,20 @@ void GroupDef::writeDocumentation(OutputList &ol) ol+=briefOutput; ol.writeString(" \n"); ol.disable(OutputGenerator::Latex); - ol.startTextLink(0,"details"); - parseDoc(ol,0,0,theTranslator->trMore()); + ol.startTextLink(0,"_details"); + parseText(ol,theTranslator->trMore()); ol.enable(OutputGenerator::Latex); } if (fileList->count()>0) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trFiles()); + parseText(ol,theTranslator->trFiles()); ol.endMemberHeader(); ol.startIndexList(); FileDef *fd=fileList->first(); while (fd) { - ol.writeStartAnnoItem("file ",fd->diskName(),0,fd->name()); + ol.writeStartAnnoItem("file ",fd->getOutputFileBase(),0,fd->name()); ol.writeEndAnnoItem(fd->name()); fd=fileList->next(); } @@ -112,7 +112,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (classList->count()>0) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trCompounds()); + parseText(ol,theTranslator->trCompounds()); ol.endMemberHeader(); ol.startIndexList(); ClassDef *cd=classList->first(); @@ -125,7 +125,7 @@ void GroupDef::writeDocumentation(OutputList &ol) case ClassDef::Struct: type="struct"; break; case ClassDef::Union: type="union"; break; } - ol.writeStartAnnoItem(type,cd->classFile(),0,cd->name()); + ol.writeStartAnnoItem(type,cd->getOutputFileBase(),0,cd->name()); ol.writeEndAnnoItem(cd->name()); cd=classList->next(); } @@ -136,9 +136,12 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!briefDescription().isEmpty() || !documentation().isEmpty()) { ol.writeRuler(); - ol.writeAnchor("details"); + bool latexOn = ol.isEnabled(OutputGenerator::Latex); + if (latexOn) ol.disable(OutputGenerator::Latex); + ol.writeAnchor("_details"); + if (latexOn) ol.enable(OutputGenerator::Latex); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trDetailedDescription()); + parseText(ol,theTranslator->trDetailedDescription()); ol.endGroupHeader(); // repeat brief description if (!briefDescription().isEmpty()) diff --git a/src/groupdef.h b/src/groupdef.h index 421b701..a8bc562 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -35,7 +35,8 @@ class GroupDef : public Definition public: GroupDef(const char *name,const char *title); ~GroupDef(); - const char *groupFile() const { return fileName; } + //const char *groupFile() const { return fileName; } + QString getOutputFileBase() const { return fileName; } const char *groupTitle() const { return title; } void addFile(const FileDef *def); void addClass(const ClassDef *def); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 4ab337f..8c5b50a 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -51,77 +51,10 @@ void HtmlGenerator::init() writeLogo(htmlOutputDir); } -//void HtmlGenerator::generateExternalIndex() -//{ -// //printf("Generating external index...\n"); -// QFile f; -// f.setName(htmlOutputDir+"/header.html"); -// if (f.open(IO_WriteOnly)) -// { -// QTextStream tt(&f); -// if (header.length()==0) -// { -// tt << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" -// "<html><head><meta name=\"robots\" content=\"noindex\">\n" -// "<title>Doxysearch</title>\n" -// "</head><body bgcolor=\"#ffffff\">\n"; -// } -// else -// { -// tt << header; -// } -// if (!noIndexFlag) -// { -// tt << "<center>"; -// if (documentedGroups>0) -// tt << "<a doxygen=\"_doc:\" href=\"/modules.html\">Modules</a> "; -// if (hierarchyClasses>0) -// tt << "<a doxygen=\"_doc:\" href=\"/hierarchy.html\">Class hierarchy</a> "; -// if (annotatedClasses>0) -// tt << "<a doxygen=\"_doc:\" href=\"/annotated.html\">Compound list</a> "; -// if (documentedFiles>0) -// tt << "<a doxygen=\"_doc:\" href=\"/files.html\">File list</a> "; -// if (includeFiles.count()>0) -// tt << "<a doxygen=\"_doc:\" href=\"/headers.html\">Header files</a> "; -// if (documentedMembers>0) -// tt << "<a doxygen=\"_doc:\" href=\"/functions.html\">Compound Members</a> "; -// if (documentedFunctions>0) -// tt << "<a doxygen=\"_doc:\" href=\"/globals.html\">File Members</a> "; -// if (pageList.count()>0) -// tt << "<a doxygen=\"_doc:\" href=\"/pages.html\">Related Pages</a> "; -// if (exampleList.count()>0) -// tt << "<a doxygen=\"_doc:\" href=\"/examples.html\">Examples</a> "; -// if (searchEngineFlag) -// tt << "<a doxygen=\"_cgi:\" href=\"\">Search</a>"; -// tt << endl << "</center><hr>" << endl; -// } -// } -// f.close(); -// -// f.setName(htmlOutputDir+"/footer.html"); -// if (f.open(IO_WriteOnly)) -// { -// QTextStream tt(&f); -// if (footer.length()==0) -// { -// tt << "<hr><address><small>Generated at " << dateToString(TRUE); -// if (projectName.length()>0) tt << " for " << projectName; -// tt << " by <a href=\"http://www.stack.nl/~dimitri/doxygen/index.html\">" -// "doxygen</a> written by <a href=" -// "\"mailto:dimitri@stack.nl\">Dimitri van Heesch</a>, © " -// "1997-1999</small></address>\n</body>\n</html>\n"; -// } -// else -// { -// tt << footer; -// } -// } -// f.close(); -//} - void HtmlGenerator::startFile(const char *name,const char *title,bool external) { QString fileName=name; + lastTitle=title; if (fileName.right(5)!=".html") fileName+=".html"; startPlainFile(fileName); if (header.length()==0) @@ -139,34 +72,14 @@ void HtmlGenerator::startFile(const char *name,const char *title,bool external) } else { - t << header; + t << substitute( + substitute( + substitute(header,"$title",lastTitle), + "$datetime",dateToString(TRUE) + ), + "$date",dateToString(FALSE) + ); } - -// if (!noIndexFlag) -// { -// t << "<center>"; -// if (documentedGroups>0) -// t << "<a href=\"modules.html\">Modules</a> "; -// if (hierarchyClasses>0) -// t << "<a href=\"hierarchy.html\">Class hierarchy</a> "; -// if (annotatedClasses>0) -// t << "<a href=\"annotated.html\">Compound list</a> "; -// if (documentedFiles>0) -// t << "<a href=\"files.html\">File list</a> "; -// if (includeFiles.count()>0) -// t << "<a href=\"headers.html\">Header files</a> "; -// if (documentedMembers>0) -// t << "<a href=\"functions.html\">Compound Members</a> "; -// if (documentedFunctions>0) -// t << "<a href=\"globals.html\">File Members</a> "; -// if (pageList.count()>0) -// t << "<a href=\"pages.html\">Related Pages</a> "; -// if (exampleList.count()>0) -// t << "<a href=\"examples.html\">Examples</a> "; -// if (searchEngineFlag) -// t << "<a doxygen=\"_cgi:\" href=\"\">Search</a>"; -// t << endl << "</center><hr>" << endl; -// } } void HtmlGenerator::startQuickIndexItem(const char *s,const char *l) @@ -189,7 +102,13 @@ void HtmlGenerator::writeFooter(int part,bool external) if (footer.length()==0) t << "<hr><address><small>"; else - t << footer; + t << substitute( + substitute( + substitute(footer,"$title",lastTitle), + "$datetime",dateToString(TRUE) + ), + "$date",dateToString(FALSE) + ); break; case 1: if (footer.length()==0) @@ -219,24 +138,6 @@ void HtmlGenerator::writeFooter(int part,bool external) void HtmlGenerator::endFile() { -// if (footer.length()==0) -// { -// t << "<hr><address><small>Generated at " << dateToString(TRUE); -// if (projectName.length()>0) -// { -// t << " for "; -// docify(projectName); -// } -// t << " by <a href=\"http://www.stack.nl/~dimitri/doxygen/index.html\">" -// "<img src=\"doxygen.gif\" alt=\"doxygen\" align=center border=0 " -// "width=118 height=53></a> written by <a href=" -// "\"mailto:dimitri@stack.nl\">Dimitri van Heesch</a>, © " -// "1997-1999</small></address>\n</body>\n</html>\n"; -// } -// else -// { -// t << footer; -// } endPlainFile(); } @@ -250,45 +151,6 @@ void HtmlGenerator::endProjectNumber() t << "</h3>"; } -//void HtmlGenerator::writeIndex() -//{ -// startFile("index.html","Main Index"); -// t << "<h1 align=center>"; -// docify(projectName); -// t << " Documentation</h1>" -// << "<p>" << endl << "<p>" << endl; -// if (!projectNumber.isEmpty()) -// { -// t << "<h3 align=center>"; -// docify(projectNumber); -// t << "</h3>\n<p>\n<p>\n"; -// } -// if (noIndexFlag) -// { -// t << "<ul>" << endl; -// if (hierarchyClasses>0) -// t << "<li><a href=\"hierarchy.html\">Class hierarchy</a>" << endl; -// if (annotatedClasses>0) -// t << "<li><a href=\"annotated.html\">Compound list</a>" << endl; -// if (documentedFiles>0) -// t << "<li><a href=\"files.html\">File list</a>" << endl; -// if (includeFiles.count()>0) -// t << "<li><a href=\"headers.html\">Header files</a>" << endl; -// if (documentedMembers>0) -// t << "<li><a href=\"functions.html\">Compound Members</a>" << endl; -// if (documentedFunctions>0) -// t << "<li><a href=\"globals.html\">File Members</a>" << endl; -// if (pageList.count()>0) -// t << "<li><a href=\"pageList.html\">Related Pages</a>" << endl; -// if (exampleList.count()>0) -// t << "<li><a href=\"examples.html\">Examples</a>" << endl; -// if (searchEngineFlag) -// t << "<li><a doxygen=\"_cgi:\" href=\"\">Search</a>" << endl; -// t << "</ul>" << endl; -// } -// endFile(); -//} - void HtmlGenerator::writeStyleInfo(int part) { if (part==0) @@ -414,9 +276,9 @@ void HtmlGenerator::writeSectionRef(const char *name,const char *lab, { QString refName=name; if (refName.right(5)!=".html") refName+=".html"; - t << ""<a href=\"" << refName << "#" << lab << "\">"; + t << "<a href=\"" << refName << "#" << lab << "\">"; docify(title); - t << "</a>""; + t << "</a>"; } void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab, @@ -429,12 +291,12 @@ void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab, t << "</a>"; } -//void HtmlGenerator::docify(const char *str) -//{ -// docifyStatic(t,str); -//} +void HtmlGenerator::writeSectionRefAnchor(const char *name,const char *lab, + const char *title) +{ + writeSectionRef(name,lab,title); +} -//void HtmlGenerator::docifyStatic(QTextStream &t,const char *str) void HtmlGenerator::docify(const char *str) { if (str) @@ -510,3 +372,121 @@ void HtmlGenerator::writeFormula(const char *n,const char *text) t << "<img align=\"top\" src=\"" << n << "\">" << endl; if (text && text[0]=='\\') t << "</center></p>" << endl; } + +void HtmlGenerator::startMemberList() +{ + if (htmlAlignMemberFlag) + { + //t << endl << "<p><table border=0 cellspacing=2 cellpadding=0>" << endl; + } + else + { + t << "<ul>" << endl; + } +} + +void HtmlGenerator::endMemberList() +{ + if (htmlAlignMemberFlag) + { + //t << "</table>" << endl; + } + else + { + t << "</ul>" << endl; + } +} + +void HtmlGenerator::startMemberItem() +{ + if (htmlAlignMemberFlag) + { + t << "<tr><td align=right valign=top>"; + } + else + { + t << "<li>"; + } +} + +void HtmlGenerator::insertMemberAlign() +{ + if (htmlAlignMemberFlag) + { + t << "</td><td valign=top>"; + } +} + +void HtmlGenerator::endMemberItem() +{ + if (htmlAlignMemberFlag) + { + t << "</td></tr>"; + } + t << endl; +} + +void HtmlGenerator::startMemberDescription() +{ + if (htmlAlignMemberFlag) + { + t << "<tr><td></td><td><font size=-1><em>"; + } + else + { + t << "<dl class=\"el\"><dd><font size=-1><em>"; + } +} + +void HtmlGenerator::endMemberDescription() +{ + if (htmlAlignMemberFlag) + { + t << "</em></font><br><br></td></tr>" << endl; + } + else + { + t << "</em></font></dl>"; + } +} + +void HtmlGenerator::startMemberSections() +{ + if (htmlAlignMemberFlag) + { + t << "<table border=0 cellpadding=0 cellspacing=1>" << endl; + } +} + +void HtmlGenerator::endMemberSections() +{ + if (htmlAlignMemberFlag) + { + t << "</table>" << endl; + } +} + +void HtmlGenerator::startMemberHeader() +{ + if (htmlAlignMemberFlag) + { + t << "<tr><td colspan=2><br><h2>"; + } + else + { + startGroupHeader(); + } +} + +void HtmlGenerator::endMemberHeader() +{ + if (htmlAlignMemberFlag) + { + t << "</h2></td></tr>" << endl; + } + else + { + endGroupHeader(); + } +} + diff --git a/src/htmlgen.h b/src/htmlgen.h index c8a5223..556a334 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -81,18 +81,23 @@ class HtmlGenerator : public OutputGenerator void endGroupHeader(); void writeListItem() { t << "<li>"; } - void startMemberHeader() { startGroupHeader(); } - void endMemberHeader() { endGroupHeader(); } - void startMemberList() { t << "<ul>" << endl; } - void endMemberList() { t << "</ul>" << endl; } - void startMemberItem() { t << "<li>"; } - void endMemberItem() { t << endl; } + void startMemberSections(); + void endMemberSections(); + void startMemberHeader(); + void endMemberHeader(); + void startMemberList(); + void endMemberList(); + void startMemberItem(); + void insertMemberAlign(); + void endMemberItem(); + void startMemberDescription(); + void endMemberDescription(); void writeRuler() { t << "<hr>"; } void writeAnchor(const char *name) { t << "<a name=\"" << name <<"\"></a>"; } void startCodeFragment() { t << "<div class=\"fragment\"><pre>"; } - void endCodeFragment() { t << "</div></pre>"; } + void endCodeFragment() { t << "</pre></div>"; } void writeBoldString(const char *text) { t << "<b>"; docify(text); t << "</b>"; } void startEmphasis() { t << "<em>"; } @@ -111,6 +116,7 @@ class HtmlGenerator : public OutputGenerator void writeDoxyAnchor(const char *clName,const char *anchor, const char *name); void writeLatexSpacing() {} + void writeLatexLabel(const char *,const char *) {} void writeStartAnnoItem(const char *type,const char *file, const char *path,const char *name); void writeEndAnnoItem(const char *) { t << endl; } @@ -139,8 +145,6 @@ class HtmlGenerator : public OutputGenerator void writeGrave(char c) { t << "&" << c << "grave;"; } void writeCirc(char c) { t << "&" << c << "circ;"; } void writeTilde(char c) { t << "&" << c << "tilde;"; } - void startMemberDescription() { t << "<dl class=\"el\"><dd><font size=-1><em>"; } - void endMemberDescription() { t << "</em></font></dl>"; } void startDescList() { t << "<dl compact><dt>" << endl; } void endDescTitle() {} void writeDescItem() { t << "<dd>" << endl; } @@ -148,6 +152,7 @@ class HtmlGenerator : public OutputGenerator void writeSection(const char *,const char *,bool); void writeSectionRef(const char *,const char *,const char *); void writeSectionRefItem(const char *,const char *,const char *); + void writeSectionRefAnchor(const char *,const char *,const char *); void addToIndex(const char *,const char *) {} void startIndent() { t << "<div class=\"in\">" << endl; } void endIndent() { t << "</div>" << endl; } @@ -166,6 +171,7 @@ class HtmlGenerator : public OutputGenerator private: QString header; QString footer; + QString lastTitle; HtmlGenerator &operator=(const HtmlGenerator &g); HtmlGenerator(const HtmlGenerator &g); diff --git a/src/index.cpp b/src/index.cpp index d472542..dcd457f 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -147,7 +147,7 @@ void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper) //printf("Passed...\n"); if (cd->hasDocumentation() || cd->isReference()) { - ol.writeIndexItem(cd->getReference(),cd->classFile(),cd->name()); + ol.writeIndexItem(cd->getReference(),cd->getOutputFileBase(),cd->name()); if (cd->isReference()) { ol.startTypewriter(); @@ -191,7 +191,7 @@ void writeClassHierarchy(OutputList &ol) } if (cd->hasDocumentation() || cd->isReference()) { - ol.writeIndexItem(cd->getReference(),cd->classFile(),cd->name()); + ol.writeIndexItem(cd->getReference(),cd->getOutputFileBase(),cd->name()); if (cd->isReference()) { ol.startTypewriter(); @@ -236,9 +236,9 @@ void writeHierarchicalIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"hierarchy","Hierarchical Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trClassHierarchy()); + parseText(ol,projectName+" "+theTranslator->trClassHierarchy()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trClassHierarchyDescription()); + parseText(ol,theTranslator->trClassHierarchyDescription()); ol.newParagraph(); writeClassHierarchy(ol); endFile(ol); @@ -247,7 +247,7 @@ void writeHierarchicalIndex(OutputList &ol) //---------------------------------------------------------------------------- -int countFileList() +int countFiles() { int count=0; FileNameListIterator fnli(inputNameList); @@ -272,10 +272,10 @@ void writeFileIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"files","File Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trFileList()); + parseText(ol,projectName+" "+theTranslator->trFileList()); endTitle(ol,0); ol.newParagraph(); - parseDoc(ol,0,0,theTranslator->trFileListDescription(extractAllFlag)); + parseText(ol,theTranslator->trFileListDescription(extractAllFlag)); ol.newParagraph(); ol.startIndexList(); @@ -299,7 +299,7 @@ void writeFileIndex(OutputList &ol) } ol.writeStartAnnoItem("file", - fd->diskName(), + fd->getOutputFileBase(), path, fd->name() ); @@ -314,7 +314,7 @@ void writeFileIndex(OutputList &ol) else { ol.startEmphasis(); - parseDoc(ol,0,0,theTranslator->trNoDescriptionAvailable()); + parseText(ol,theTranslator->trNoDescriptionAvailable()); ol.endEmphasis(); } ol.docify(")"); @@ -330,15 +330,14 @@ void writeFileIndex(OutputList &ol) } //---------------------------------------------------------------------------- - -int countNamespaceList() +int countNamespaces() { int count=0; NamespaceListIterator nli(namespaceList); NamespaceDef *nd; for (;(nd=nli.current());++nli) { - if (nd->hasDocumentation()) count++; + if (!nd->getReference() && nd->hasDocumentation()) count++; } return count; } @@ -351,19 +350,19 @@ void writeNamespaceIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"namespaces","Namespace Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trNamespaceList()); + parseText(ol,projectName+" "+theTranslator->trNamespaceList()); endTitle(ol,0); ol.newParagraph(); - parseDoc(ol,0,0,theTranslator->trNamespaceListDescription(extractAllFlag)); + parseText(ol,theTranslator->trNamespaceListDescription(extractAllFlag)); ol.newParagraph(); ol.startIndexList(); NamespaceDef *nd=namespaceList.first(); while (nd) { - if (nd->hasDocumentation()) + if (!nd->getReference() && nd->hasDocumentation()) { - ol.writeStartAnnoItem("namespace",nd->namespaceFile(),0,nd->name()); + ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name()); ol.docify(" ("); if (nd->briefDescription()) { @@ -375,7 +374,7 @@ void writeNamespaceIndex(OutputList &ol) else { ol.startEmphasis(); - parseDoc(ol,0,0,theTranslator->trNoDescriptionAvailable()); + parseText(ol,theTranslator->trNoDescriptionAvailable()); ol.endEmphasis(); } ol.docify(")"); @@ -433,7 +432,7 @@ void writeAnnotatedClassList(OutputList &ol) case ClassDef::Union: type="union"; break; default: type="unknown"; break; // an error } - ol.writeStartAnnoItem(type,cd->classFile(),0,cd->name()); + ol.writeStartAnnoItem(type,cd->getOutputFileBase(),0,cd->name()); ol.docify(" ("); if (cd->briefDescription()) { @@ -445,7 +444,7 @@ void writeAnnotatedClassList(OutputList &ol) else { ol.startEmphasis(); - parseDoc(ol,0,0,theTranslator->trNoDescriptionAvailable()); + parseText(ol,theTranslator->trNoDescriptionAvailable()); ol.endEmphasis(); } ol.docify(")"); @@ -466,9 +465,9 @@ void writeAnnotatedIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"annotated","Annotated Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trCompoundList()); + parseText(ol,projectName+" "+theTranslator->trCompoundList()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trCompoundListDescription()); + parseText(ol,theTranslator->trCompoundListDescription()); writeAnnotatedClassList(ol); endFile(ol); ol.enable(OutputGenerator::Man); @@ -522,7 +521,7 @@ void writeMemberList(OutputList &ol) ol.docify(": "); else ol.docify(", "); - ol.writeObjectLink(cd->getReference(),cd->classFile(),md->anchor(), + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),md->anchor(), cd->name()); count++; prevName=cd->name(); @@ -537,7 +536,7 @@ void writeMemberList(OutputList &ol) //---------------------------------------------------------------------------- -int countMemberList() +int countClassMembers() { int count=0; MemberName *mn=memberNameList.first(); @@ -575,9 +574,9 @@ void writeMemberIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); startFile(ol,"functions","Compound Member Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trCompoundMembers()); + parseText(ol,projectName+" "+theTranslator->trCompoundMembers()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trCompoundMembersDescription(extractAllFlag)); + parseText(ol,theTranslator->trCompoundMembersDescription(extractAllFlag)); writeMemberList(ol); endFile(ol); ol.enable(OutputGenerator::Latex); @@ -586,7 +585,7 @@ void writeMemberIndex(OutputList &ol) //---------------------------------------------------------------------------- -void writeFunctionList(OutputList &ol) +void writeFileMemberList(OutputList &ol) { ol.startItemList(); MemberName *mn=functionNameList.first(); @@ -639,7 +638,7 @@ void writeFunctionList(OutputList &ol) //if ((s=baseName.findRev("/"))!=-1) // baseName=baseName.right(baseName.length()-s-1); ol.writeObjectLink(fd->getReference(), - fd->diskName(),md->anchor(), baseName); + fd->getOutputFileBase(),md->anchor(), baseName); count++; prevName=fd->name(); } @@ -653,7 +652,89 @@ void writeFunctionList(OutputList &ol) //---------------------------------------------------------------------------- -int countFunctionList() +void writeNamespaceMemberList(OutputList &ol) +{ + ol.startItemList(); + MemberName *mn=functionNameList.first(); + while (mn) + { + MemberDef *md=mn->first(); + bool found=FALSE; + while (md && !found) + { + NamespaceDef *nd=md->getNamespace(); + if (nd && nd->hasDocumentation() && + !md->isReference() && + md->hasDocumentation() && + !md->name().isEmpty() && + md->name()[0]!='@') found=TRUE; + else + md=mn->next(); + } + if (found) // member is documented and in a documented namespace + { + ol.writeListItem(); + ol.docify(md->name()); + if (md->isFunction()) ol.docify("()"); + ol.writeString("\n"); + + int count=0; + md=mn->first(); + QString prevName; + while (md) + { + NamespaceDef *nd=md->getNamespace(); + if (nd && nd->hasDocumentation() && + !md->isReference() && + md->hasDocumentation() && + !md->name().isEmpty() && md->name()[0]!='@' + ) + { + if (count==0) + ol.docify(": "); + else + ol.docify(", "); + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), + md->anchor(),nd->name()); + count++; + } + md=mn->next(); + } + } + mn=functionNameList.next(); + } + ol.endItemList(); +} + +//---------------------------------------------------------------------------- + +int countNamespaceMembers() +{ + int count=0; + MemberName *mn=functionNameList.first(); + while (mn) + { + MemberDef *md=mn->first(); + bool found=FALSE; + while (md && !found) + { + if (md->getNamespace() && + !md->isReference() && md->hasDocumentation() && + !md->name().isEmpty() && md->name()[0]!='@' + ) + found=TRUE; + else + md=mn->next(); + } + if (found) count++; + mn=functionNameList.next(); + } + return count; +} + +//---------------------------------------------------------------------------- + +int countFileMembers() { int count=0; MemberName *mn=functionNameList.first(); @@ -665,7 +746,7 @@ int countFunctionList() while (md && !found) { if (!md->isReference() && md->hasDocumentation() && - md->name()[0]!='@' && + !md->name().isEmpty() && md->name()[0]!='@' && (((fd=md->getFileDef()) && fd->hasDocumentation()) || ((fd=md->getFileDec()) && fd->hasDocumentation()) @@ -683,17 +764,35 @@ int countFunctionList() //---------------------------------------------------------------------------- -void writeFunctionIndex(OutputList &ol) +void writeFileMemberIndex(OutputList &ol) { if (documentedFunctions==0) return; ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Latex); startFile(ol,"globals","File Member Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trFileMembers()); + parseText(ol,projectName+" "+theTranslator->trFileMembers()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trFileMembersDescription(extractAllFlag)); - writeFunctionList(ol); + parseText(ol,theTranslator->trFileMembersDescription(extractAllFlag)); + writeFileMemberList(ol); + endFile(ol); + ol.enable(OutputGenerator::Latex); + ol.enable(OutputGenerator::Man); +} + +//---------------------------------------------------------------------------- + +void writeNamespaceMemberIndex(OutputList &ol) +{ + if (documentedNamespaceMembers==0) return; + ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Latex); + startFile(ol,"namespacemembers","Namespace Member Index"); + startTitle(ol); + parseText(ol,projectName+" "+theTranslator->trNamespaceMembers()); + endTitle(ol,0); + parseText(ol,theTranslator->trNamespaceMemberDescription(extractAllFlag)); + writeNamespaceMemberList(ol); endFile(ol); ol.enable(OutputGenerator::Latex); ol.enable(OutputGenerator::Man); @@ -736,9 +835,9 @@ void writeHeaderIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); startFile(ol,"headers","Header File Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trHeaderFiles()); + parseText(ol,projectName+" "+theTranslator->trHeaderFiles()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trHeaderFilesDescription()); + parseText(ol,theTranslator->trHeaderFilesDescription()); writeHeaderFileList(ol); endFile(ol); ol.enable(OutputGenerator::Latex); @@ -753,9 +852,9 @@ void writeExampleIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"examples","Example Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trExamples()); + parseText(ol,projectName+" "+theTranslator->trExamples()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trExamplesDescription()); + parseText(ol,theTranslator->trExamplesDescription()); ol.startIndexList(); PageInfo *pi=exampleList.first(); while (pi) @@ -788,18 +887,25 @@ void writePageIndex(OutputList &ol) startTitle(ol); ol.docify(projectName+" "+theTranslator->trRelatedPages()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trRelatedPagesDescription()); + parseText(ol,theTranslator->trRelatedPagesDescription()); ol.startIndexList(); PageInfo *pi=pageList.first(); while (pi) { - QString pageName; + QString pageName,pageTitle; + if (caseSensitiveNames) pageName=pi->name.copy(); else pageName=pi->name.lower(); + + if (pi->title.isEmpty()) + pageTitle=pi->name; + else + pageTitle=pi->title; + ol.writeListItem(); - ol.writeObjectLink(0,pageName,0,pi->name); + ol.writeObjectLink(0,pageName,0,pageTitle); ol.writeString("\n"); pi=pageList.next(); } @@ -810,7 +916,7 @@ void writePageIndex(OutputList &ol) //---------------------------------------------------------------------------- -int countGroupList() +int countGroups() { int count=0; GroupListIterator gli(groupList); @@ -835,7 +941,7 @@ void writeGroupList(OutputList &ol) if (gd->countMembers()>0) { ol.startDescItem(); - ol.startTextLink(gd->groupFile(),0); + ol.startTextLink(gd->getOutputFileBase(),0); parseDoc(ol,0,0,gd->groupTitle()); ol.endTextLink(); ol.endDescItem(); @@ -854,9 +960,9 @@ void writeGroupIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,"modules","Module Index"); startTitle(ol); - parseDoc(ol,0,0,projectName+" "+theTranslator->trModules()); + parseText(ol,projectName+" "+theTranslator->trModules()); endTitle(ol,0); - parseDoc(ol,0,0,theTranslator->trModulesDescription()); + parseText(ol,theTranslator->trModulesDescription()); writeGroupList(ol); endFile(ol); ol.enable(OutputGenerator::Man); @@ -880,7 +986,7 @@ void writeIndex(OutputList &ol) ol.startFile("index","Main Index",FALSE); if (!noIndexFlag) writeQuickLinks(ol,TRUE); ol.startTitleHead(); - parseDoc(ol,0,0,projPrefix+theTranslator->trDocumentation()); + parseText(ol,projPrefix+theTranslator->trDocumentation()); ol.endTitleHead(0); ol.newParagraph(); if (!projectNumber.isEmpty()) @@ -897,7 +1003,7 @@ void writeIndex(OutputList &ol) ol.enable(OutputGenerator::Latex); ol.startFile("refman",0,FALSE); ol.startIndexSection(isTitlePageStart); - parseDoc(ol,0,0,projPrefix+theTranslator->trReferenceManual()); + parseText(ol,projPrefix+theTranslator->trReferenceManual()); if (!projectNumber.isEmpty()) { ol.startProjectNumber(); @@ -906,60 +1012,72 @@ void writeIndex(OutputList &ol) } ol.endIndexSection(isTitlePageStart); ol.startIndexSection(isTitlePageAuthor); - parseDoc(ol,0,0,theTranslator->trGeneratedBy()); + parseText(ol,theTranslator->trGeneratedBy()); ol.endIndexSection(isTitlePageAuthor); if (documentedGroups>0) { ol.startIndexSection(isModuleIndex); - parseDoc(ol,0,0,projPrefix+theTranslator->trModuleIndex()); + parseText(ol,projPrefix+theTranslator->trModuleIndex()); ol.endIndexSection(isModuleIndex); } + if (documentedNamespaces>0) + { + ol.startIndexSection(isNamespaceIndex); + parseText(ol,projPrefix+theTranslator->trNamespaceIndex()); + ol.endIndexSection(isNamespaceIndex); + } if (hierarchyClasses>0) { ol.startIndexSection(isClassHierarchyIndex); - parseDoc(ol,0,0,projPrefix+theTranslator->trHierarchicalIndex()); + parseText(ol,projPrefix+theTranslator->trHierarchicalIndex()); ol.endIndexSection(isClassHierarchyIndex); } if (annotatedClasses>0) { ol.startIndexSection(isCompoundIndex); - parseDoc(ol,0,0,projPrefix+theTranslator->trCompoundIndex()); + parseText(ol,projPrefix+theTranslator->trCompoundIndex()); ol.endIndexSection(isCompoundIndex); } if (documentedFiles>0) { ol.startIndexSection(isFileIndex); - parseDoc(ol,0,0,projPrefix+theTranslator->trFileIndex()); + parseText(ol,projPrefix+theTranslator->trFileIndex()); ol.endIndexSection(isFileIndex); } if (documentedGroups>0) { ol.startIndexSection(isModuleDocumentation); - parseDoc(ol,0,0,projPrefix+theTranslator->trModuleDocumentation()); + parseText(ol,projPrefix+theTranslator->trModuleDocumentation()); ol.endIndexSection(isModuleDocumentation); } + if (documentedNamespaces>0) + { + ol.startIndexSection(isNamespaceDocumentation); + parseText(ol,projPrefix+theTranslator->trNamespaceDocumentation()); + ol.endIndexSection(isNamespaceDocumentation); + } if (annotatedClasses>0) { ol.startIndexSection(isClassDocumentation); - parseDoc(ol,0,0,projPrefix+theTranslator->trClassDocumentation()); + parseText(ol,projPrefix+theTranslator->trClassDocumentation()); ol.endIndexSection(isClassDocumentation); } if (documentedFiles>0) { ol.startIndexSection(isFileDocumentation); - parseDoc(ol,0,0,projPrefix+theTranslator->trFileDocumentation()); + parseText(ol,projPrefix+theTranslator->trFileDocumentation()); ol.endIndexSection(isFileDocumentation); } if (exampleList.count()>0) { ol.startIndexSection(isExampleDocumentation); - parseDoc(ol,0,0,projPrefix+theTranslator->trExampleDocumentation()); + parseText(ol,projPrefix+theTranslator->trExampleDocumentation()); ol.endIndexSection(isExampleDocumentation); } if (pageList.count()>0) { ol.startIndexSection(isPageDocumentation); - parseDoc(ol,0,0,projPrefix+theTranslator->trPageDocumentation()); + parseText(ol,projPrefix+theTranslator->trPageDocumentation()); ol.endIndexSection(isPageDocumentation); } ol.endIndexSection(isEndIndex); diff --git a/src/index.h b/src/index.h index 5b3cc67..0091f6a 100644 --- a/src/index.h +++ b/src/index.h @@ -25,10 +25,12 @@ enum IndexSections isTitlePageStart, isTitlePageAuthor, isModuleIndex, + isNamespaceIndex, isClassHierarchyIndex, isCompoundIndex, isFileIndex, isModuleDocumentation, + isNamespaceDocumentation, isClassDocumentation, isFileDocumentation, isExampleDocumentation, @@ -50,16 +52,18 @@ void writeHeaderIndex(OutputList &ol); void writeHeaderFileList(OutputList &ol); void writeExampleIndex(OutputList &ol); void writePageIndex(OutputList &ol); -void writeFunctionIndex(OutputList &ol); +void writeFileMemberIndex(OutputList &ol); void writeGroupIndex(OutputList &ol); void writeNamespaceIndex(OutputList &ol); +void writeNamespaceMemberIndex(OutputList &ol); int countClassHierarchy(); -int countMemberList(); -int countFunctionList(); -int countFileList(); -int countGroupList(); -int countNamespaceList(); +int countClassMembers(); +int countFileMembers(); +int countFiles(); +int countGroups(); +int countNamespaces(); int countAnnotatedClasses(); +int countNamespaceMembers(); #endif diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 50ec496..2f2f62b 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -172,6 +172,10 @@ void LatexGenerator::startIndexSection(IndexSections is) if (compactLatexFlag) t << "\\section"; else t << "\\chapter"; t << "{"; //Module Index}\n" break; + case isNamespaceIndex: + if (compactLatexFlag) t << "\\section"; else t << "\\chapter"; + t << "{"; //Namespace Index}\" + break; case isClassHierarchyIndex: if (compactLatexFlag) t << "\\section"; else t << "\\chapter"; t << "{"; //Hierarchical Index}\n" @@ -200,17 +204,28 @@ void LatexGenerator::startIndexSection(IndexSections is) } } break; + case isNamespaceDocumentation: + { + NamespaceDef *nd=namespaceList.first(); + bool found=FALSE; + while (nd && !found) + { + if (nd->hasDocumentation()) + { + if (compactLatexFlag) t << "\\section"; else t << "\\chapter"; + t << "{"; // Namespace Documentation}\n": + found=TRUE; + } + nd=namespaceList.next(); + } + } + break; case isClassDocumentation: { ClassDef *cd=classList.first(); bool found=FALSE; while (cd && !found) { - //if (cd->classFile()[0]!='@' && !cd->getReference() && - // (cd->hasDocumentation() || !hideClassFlag) && - // (cd->protection()!=Private || extractPrivateFlag) - // ) - if (!cd->isReference() && cd->isVisible()) { if (compactLatexFlag) t << "\\section"; else t << "\\chapter"; @@ -282,6 +297,9 @@ void LatexGenerator::endIndexSection(IndexSections is) case isModuleIndex: t << "}\n\\input{modules}\n"; break; + case isNamespaceIndex: + t << "}\n\\input{namespaces}\n"; + break; case isClassHierarchyIndex: t << "}\n\\input{hierarchy}\n"; break; @@ -299,7 +317,7 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (gd->hasDocumentation() || gd->countMembers()>0) { - t << "}\n\\input{" << gd->groupFile() << "}\n"; + t << "}\n\\input{" << gd->getOutputFileBase() << "}\n"; found=TRUE; } gd=groupList.next(); @@ -309,12 +327,36 @@ void LatexGenerator::endIndexSection(IndexSections is) if (gd->hasDocumentation() || gd->countMembers()>0) { if (compactLatexFlag) t << "\\input"; else t << "\\include"; - t << "{" << gd->groupFile() << "}\n"; + t << "{" << gd->getOutputFileBase() << "}\n"; } gd=groupList.next(); } } break; + case isNamespaceDocumentation: + { + NamespaceDef *nd=namespaceList.first(); + bool found=FALSE; + while (nd && !found) + { + if (nd->hasDocumentation() || nd->countMembers()>0) + { + t << "}\n\\input{" << nd->getOutputFileBase() << "}\n"; + found=TRUE; + } + nd=namespaceList.next(); + } + while (nd) + { + if (nd->hasDocumentation() || nd->countMembers()>0) + { + if (compactLatexFlag) t << "\\input"; else t << "\\include"; + t << "{" << nd->getOutputFileBase() << "}\n"; + } + nd=namespaceList.next(); + } + } + break; case isClassDocumentation: { ClassDef *cd=classList.first(); @@ -327,7 +369,7 @@ void LatexGenerator::endIndexSection(IndexSections is) // ) if (!cd->isReference() && cd->isVisible()) { - t << "}\n\\input{" << cd->classFile() << "}\n"; + t << "}\n\\input{" << cd->getOutputFileBase() << "}\n"; found=TRUE; } cd=classList.next(); @@ -341,7 +383,7 @@ void LatexGenerator::endIndexSection(IndexSections is) if (!cd->isReference() && cd->isVisible()) { if (compactLatexFlag) t << "\\input"; else t << "\\include"; - t << "{" << cd->classFile() << "}\n"; + t << "{" << cd->getOutputFileBase() << "}\n"; } cd=classList.next(); } @@ -360,13 +402,13 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (isFirst) { - t << "}\n\\input{" << fd->diskName() << "}\n"; + t << "}\n\\input{" << fd->getOutputFileBase() << "}\n"; isFirst=FALSE; } else { if (compactLatexFlag) t << "\\input" ; else t << "\\include"; - t << "{" << fd->diskName() << "}\n"; + t << "{" << fd->getOutputFileBase() << "}\n"; } } fd=fn->next(); @@ -670,6 +712,11 @@ void LatexGenerator::writeDoxyAnchor(const char *clname,const char *anchor,const t << "}" << endl; } +void LatexGenerator::writeLatexLabel(const char *clName,const char *anchor) +{ + writeDoxyAnchor(clName,anchor,0); +} + void LatexGenerator::addToIndex(const char *s1,const char *s2) { if (s1) @@ -709,6 +756,15 @@ void LatexGenerator::writeSectionRefItem(const char *,const char *lab, t << "}{\\ref{" << lab << "}}" << endl; } +void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab, + const char *title) +{ + startBold(); + docify(title); + endBold(); + t << " (p. \\pageref{" << lab << "})" << endl; +} + //void LatexGenerator::docify(const char *str) //{ // docifyStatic(t,str); diff --git a/src/latexgen.h b/src/latexgen.h index 5a3dd1c..5cabe66 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -79,17 +79,20 @@ class LatexGenerator : public OutputGenerator void endGroupHeader(); void writeListItem() { t << "\\item " << endl; } + void startMemberSections() {} + void endMemberSections() {} void startMemberHeader() { startGroupHeader(); } void endMemberHeader() { endGroupHeader(); } void startMemberList() { t << "\\begin{CompactItemize}" << endl; } void endMemberList() { t << "\\end{CompactItemize}" << endl; } void startMemberItem() { t << "\\item " << endl; } void endMemberItem() { t << endl; } + void insertMemberAlign() {} void writeRuler() { t << "\\vspace{0.4cm}\\hrule\\vspace{0.2cm}"; } - void writeAnchor(const char *) {} + void writeAnchor(const char *name) { t << "\\label{" << name << "}" << endl; } void startCodeFragment() { t << "\\small\\begin{verbatim}"; } - void endCodeFragment() { t << "\\end{verbatim}\\normalsize "; } + void endCodeFragment() { t << "\\end{verbatim}\\normalsize " << endl; } void writeBoldString(const char *text) { t << "{\\bf "; docify(text); t << "}"; } void startEmphasis() { t << "{\\em "; } @@ -99,13 +102,14 @@ class LatexGenerator : public OutputGenerator void startDescription() { t << "\\begin{description}" << endl; } void endDescription() { t << "\\end{description}" << endl; } void startDescItem() { t << "\\item["; } - void endDescItem() { t << "]"; } + void endDescItem() { t << "]" << endl; } void lineBreak() { t << "\\par\n"; } void startMemberDoc(const char *,const char *,const char *); void endMemberDoc() { t << "}"; } void writeDoxyAnchor(const char *,const char *,const char *); void writeChar(char c); void writeLatexSpacing() { t << "\\hspace{0.3cm}"; } + void writeLatexLabel(const char *scope,const char *anchor); void writeStartAnnoItem(const char *type,const char *file, const char *path,const char *name); void writeEndAnnoItem(const char *name); @@ -148,11 +152,12 @@ class LatexGenerator : public OutputGenerator void endMemberDescription() { t << "\\item\\end{CompactList}"; } void startDescList() { t << "\\begin{Desc}\\item["; } void endDescTitle() { t << "]"; } - void writeDescItem() { t << "\\par "; } + void writeDescItem() { t << "\\par" << endl; } void endDescList() { t << "\\end{Desc}"; } void writeSection(const char *,const char *,bool); void writeSectionRef(const char *,const char *,const char *); void writeSectionRefItem(const char *,const char *,const char *); + void writeSectionRefAnchor(const char *,const char *,const char *); void addToIndex(const char *,const char *); void startIndent() {} void endIndent() {} diff --git a/src/mangen.cpp b/src/mangen.cpp index 55bf8c7..d1bc4c6 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -78,7 +78,7 @@ void ManGenerator::startFile(const char *name,const char *,bool) { fileName=fileName.left(i); } - if (fileName.right(2)!=".3") fileName+=".3"; + if (fileName.right(2)!=manExtension) fileName+=manExtension; startPlainFile(fileName); firstCol=TRUE; } diff --git a/src/mangen.h b/src/mangen.h index d091782..bcc9034 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -77,8 +77,11 @@ class ManGenerator : public OutputGenerator void endTypewriter() { t << "\\fR"; firstCol=FALSE; } void startGroupHeader(); void endGroupHeader(); + void startMemberSections() {} + void endMemberSections() {} void startMemberHeader(); void endMemberHeader(); + void insertMemberAlign() {} void writeListItem(); void startMemberList() { t << "\n.in +1c"; firstCol=FALSE; } void endMemberList() { t << "\n.in -1c"; firstCol=FALSE; } @@ -107,6 +110,7 @@ class ManGenerator : public OutputGenerator void endMemberDoc() {} void writeDoxyAnchor(const char *clName,const char *anchor,const char *name); void writeLatexSpacing() {} + void writeLatexLabel(const char *,const char *) {} void writeStartAnnoItem(const char *type,const char *file, const char *path,const char *name); void writeEndAnnoItem(const char *) { t << endl; firstCol=TRUE; } @@ -144,6 +148,7 @@ class ManGenerator : public OutputGenerator void writeSection(const char *,const char *,bool) {} void writeSectionRef(const char *,const char *,const char *) {} void writeSectionRefItem(const char *,const char *,const char *) {} + void writeSectionRefAnchor(const char *,const char *,const char *) {} void addToIndex(const char *,const char *) {} void startIndent() {} void endIndent() {} diff --git a/src/memberdef.cpp b/src/memberdef.cpp index f96a2d6..bd440c3 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -20,6 +20,7 @@ #include "membername.h" #include "doxygen.h" #include "util.h" +#include "message.h" /*! Creates a new member definition. * Members can be function/variables/enums/etc. inside a class or inside a @@ -159,7 +160,7 @@ bool MemberDef::hasExamples() return exampleList->count()>0; } - +#if 0 void MemberDef::writeExample(OutputList &ol) { Example *e=exampleList->first(); @@ -177,4 +178,27 @@ void MemberDef::writeExample(OutputList &ol) } ol.writeString("."); } +#endif +QString MemberDef::getOutputFileBase() const +{ + if (classDef) + { + return classDef->getOutputFileBase(); + } + else if (fileDef) + { + return fileDef->getOutputFileBase(); + } + else if (fileDec) + { + return fileDec->getOutputFileBase(); + } + else if (nspace) + { + return nspace->getOutputFileBase(); + } + warn("Warning: Internal inconsistency: member %s does not belong to any\n" + " container!\n",name().data()); + return "dummy"; +} diff --git a/src/memberdef.h b/src/memberdef.h index fba76f8..67a9aa9 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -55,6 +55,7 @@ class MemberDef : public Definition const ArgumentList *al); ~MemberDef(); + QString getOutputFileBase() const; const char *declaration() const { return decl; } const char *definition() const { return def; } const char *typeString() const { return type; } @@ -72,6 +73,7 @@ class MemberDef : public Definition void setFileDef(FileDef *fd) { fileDef=fd; } void setFileDec(FileDef *fd) { fileDec=fd; } void setAnchor(const char *a) { ref=a; } + void setProtection(Protection p) { prot=p; } FileDef *getFileDef() { return fileDef; } FileDef *getFileDec() { return fileDec; } void setMemberClass(ClassDef *cd) { classDef=cd; } @@ -105,8 +107,9 @@ class MemberDef : public Definition // example related members bool addExample(const char *anchor,const char *name,const char *file); - void writeExample(OutputList &ol); + //void writeExample(OutputList &ol); bool hasExamples(); + ExampleList *getExampleList() const { return exampleList; } // prototype related members const char *getDefFile() { return defFile; } diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 4d7cc73..e9fa8b0 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -43,7 +43,10 @@ void MemberList::countDecMembers() if ((!hideMemberFlag || md->hasDocumentation()) && (!hideMemberFlag || !md->documentation().isEmpty() || briefMemDescFlag || repeatBriefFlag - ) || extractAllFlag + ) || extractAllFlag || + (md->isEnumerate() && + md->hasDocumentedEnumValues() + ) ) { switch(md->memberType()) diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 9d055b2..bde86c6 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -22,12 +22,14 @@ #include "classdef.h" #include "classlist.h" #include "memberlist.h" +#include "doxygen.h" -NamespaceDef::NamespaceDef(const char *name) : Definition(name) +NamespaceDef::NamespaceDef(const char *name,const char *ref) : Definition(name) { fileName="namespace_"+nameToFile(name); classList = new ClassList; memList = new MemberList; + reference=ref; } NamespaceDef::~NamespaceDef() @@ -61,18 +63,21 @@ void NamespaceDef::writeDocumentation(OutputList &ol) QString pageTitle=name()+" Namespace Reference"; startFile(ol,fileName,pageTitle); startTitle(ol); - ol.docify(pageTitle); + //ol.docify(pageTitle); + parseText(ol,theTranslator->trNamespaceReference(name())); endTitle(ol,name()); + if (genTagFile.length()>0) tagFile << "%" << name() << ":\n"; + OutputList briefOutput(&ol); if (briefDescription()) { - parseDoc(briefOutput,0,0,briefDescription()); + parseDoc(briefOutput,name(),0,briefDescription()); ol+=briefOutput; ol.writeString(" \n"); ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); - parseDoc(ol,0,0,theTranslator->trMore()); + ol.startTextLink(0,"_details"); + parseText(ol,theTranslator->trMore()); ol.endTextLink(); ol.enableAll(); } @@ -81,6 +86,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.enable(OutputGenerator::Man); ol.writeSynopsis(); + ol.startMemberSections(); if (classList->count()>0) { ClassDef *cd=classList->first(); @@ -92,7 +98,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) if (!found) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trCompounds()); + parseText(ol,theTranslator->trCompounds()); ol.endMemberHeader(); ol.startMemberList(); found=TRUE; @@ -111,13 +117,14 @@ void NamespaceDef::writeDocumentation(OutputList &ol) case ClassDef::Union: ol.writeString("union"); break; } ol.writeString(" "); + ol.insertMemberAlign(); if (cd->hasDocumentation()) { ol.writeObjectLink(cd->getReference(), - cd->classFile(), - 0, - clName - ); + cd->getOutputFileBase(), + 0, + clName + ); } else { @@ -133,13 +140,17 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } writeMemberDecs(ol,0,this,0,0,0,memList); + ol.endMemberSections(); if (!briefDescription().isEmpty() || !documentation().isEmpty()) { ol.writeRuler(); - ol.writeAnchor("details"); + bool latexOn = ol.isEnabled(OutputGenerator::Latex); + if (latexOn) ol.disable(OutputGenerator::Latex); + ol.writeAnchor("_details"); + if (latexOn) ol.enable(OutputGenerator::Latex); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trDetailedDescription()); + parseText(ol,theTranslator->trDetailedDescription()); ol.endGroupHeader(); if (!briefDescription().isEmpty()) { @@ -148,7 +159,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } if (!documentation().isEmpty()) { - parseDoc(ol,0,0,documentation()+"\n"); + parseDoc(ol,name(),0,documentation()+"\n"); ol.newParagraph(); } } @@ -159,7 +170,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trFunctionPrototypeDocumentation()); + parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Prototype); } @@ -168,7 +179,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trTypedefDocumentation()); + parseText(ol,theTranslator->trTypedefDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Typedef); } @@ -177,7 +188,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerationTypeDocumentation()); + parseText(ol,theTranslator->trEnumerationTypeDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Enumeration); } @@ -186,7 +197,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerationValueDocumentation()); + parseText(ol,theTranslator->trEnumerationValueDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::EnumValue); } @@ -195,7 +206,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trFunctionDocumentation()); + parseText(ol,theTranslator->trFunctionDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Function); } @@ -204,7 +215,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { ol.writeRuler(); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trVariableDocumentation()); + parseText(ol,theTranslator->trVariableDocumentation()); ol.endGroupHeader(); writeMemberDocs(ol,memList,name(),MemberDef::Variable); } @@ -212,9 +223,15 @@ void NamespaceDef::writeDocumentation(OutputList &ol) // write Author section (Man only) ol.disableAllBut(OutputGenerator::Man); ol.startGroupHeader(); - parseDoc(ol,0,0,theTranslator->trAuthor()); + parseText(ol,theTranslator->trAuthor()); ol.endGroupHeader(); - parseDoc(ol,0,0,theTranslator->trGeneratedAutomatically(projectName)); + parseText(ol,theTranslator->trGeneratedAutomatically(projectName)); ol.enableAll(); endFile(ol); } + +int NamespaceDef::countMembers() +{ + memList->countDocMembers(); + return memList->totalCount()+classList->count(); +} diff --git a/src/namespacedef.h b/src/namespacedef.h index 9da6b2c..f888f43 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -31,16 +31,20 @@ class MemberDef; class NamespaceDef : public Definition { public: - NamespaceDef(const char *name); + NamespaceDef(const char *name,const char *ref=0); ~NamespaceDef(); - QString namespaceFile() const { return fileName; } + //QString namespaceFile() const { return fileName; } + QString getOutputFileBase() const { return fileName; } void insertUsedFile(const char *fname); void writeDocumentation(OutputList &ol); void insertClass(ClassDef *cd); void insertMember(MemberDef *md); void computeAnchors(); + int countMembers(); + const char *getReference() { return reference; } private: + QString reference; QString fileName; QStrList files; ClassList *classList; diff --git a/src/outputgen.h b/src/outputgen.h index 457dd80..5b9f981 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -84,12 +84,15 @@ class OutputGenerator virtual void endGroupHeader() = 0; virtual void writeListItem() = 0; + virtual void startMemberSections() = 0; + virtual void endMemberSections() = 0; virtual void startMemberHeader() = 0; virtual void endMemberHeader() = 0; virtual void startMemberList() = 0; virtual void endMemberList() = 0; virtual void startMemberItem() = 0; virtual void endMemberItem() = 0; + virtual void insertMemberAlign() = 0; virtual void writeRuler() = 0; virtual void writeAnchor(const char *name) = 0; @@ -103,6 +106,7 @@ class OutputGenerator virtual void endMemberDoc() = 0; virtual void writeDoxyAnchor(const char *clName,const char *anchor,const char *name) = 0; virtual void writeLatexSpacing() = 0; + virtual void writeLatexLabel(const char *clName,const char *anchor) = 0; virtual void writeStartAnnoItem(const char *type,const char *file, const char *path,const char *name) = 0; virtual void writeEndAnnoItem(const char *name) = 0; @@ -144,6 +148,7 @@ class OutputGenerator virtual void writeSection(const char *,const char *,bool) = 0; virtual void writeSectionRef(const char *,const char *,const char *) = 0; virtual void writeSectionRefItem(const char *,const char *,const char *) = 0; + virtual void writeSectionRefAnchor(const char *,const char *,const char *) = 0; virtual void lineBreak() = 0; virtual void addToIndex(const char *s1,const char *s2) = 0; virtual void startIndent() = 0; diff --git a/src/outputlist.h b/src/outputlist.h index 2c57dad..6f73271 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -129,6 +129,10 @@ class OutputList { forall(&OutputGenerator::endGroupHeader); } void writeListItem() { forall(&OutputGenerator::writeListItem); } + void startMemberSections() + { forall(&OutputGenerator::startMemberSections); } + void endMemberSections() + { forall(&OutputGenerator::endMemberSections); } void startMemberHeader() { forall(&OutputGenerator::startMemberHeader); } void endMemberHeader() @@ -141,6 +145,8 @@ class OutputList { forall(&OutputGenerator::startMemberItem); } void endMemberItem() { forall(&OutputGenerator::endMemberItem); } + void insertMemberAlign() + { forall(&OutputGenerator::insertMemberAlign); } void writeRuler() { forall(&OutputGenerator::writeRuler); } void writeAnchor(const char *name) @@ -165,6 +171,8 @@ class OutputList { forall(&OutputGenerator::writeDoxyAnchor,clName,anchor,name); } void writeLatexSpacing() { forall(&OutputGenerator::writeLatexSpacing); } + void writeLatexLabel(const char *scope,const char *anchor) + { forall(&OutputGenerator::writeLatexLabel,scope,anchor); } void startDescription() { forall(&OutputGenerator::startDescription); } void endDescription() @@ -251,6 +259,8 @@ class OutputList { forall(&OutputGenerator::writeSectionRef,page,lab,title); } void writeSectionRefItem(const char *page,const char *lab, const char *title) { forall(&OutputGenerator::writeSectionRefItem,page,lab,title); } + void writeSectionRefAnchor(const char *page,const char *lab, const char *title) + { forall(&OutputGenerator::writeSectionRefAnchor,page,lab,title); } void addToIndex(const char *s1,const char *s2) { forall(&OutputGenerator::addToIndex,s1,s2); } void writeSynopsis() @@ -1160,11 +1160,11 @@ BN [ \t\r\n] <SkipCommand>. <SkipLine>[^/\n]+ <SkipLine>. -<SkipLine>"//" { +<SkipLine,SkipCommand,SkipCPPBlock>"//" { lastCPPContext=YY_START; BEGIN(RemoveCPPComment); } -<SkipLine>"/*" { +<SkipLine,SkipCommand,SkipCPPBlock>"/*" { lastCContext=YY_START; BEGIN(RemoveCComment); } diff --git a/src/scanner.h b/src/scanner.h index 59d5966..acebd5f 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -31,4 +31,5 @@ extern void parseDoc(OutputList &ol,const char *clName, const char *memName, const QString &docString); extern void parseExample(OutputList &ol,const QString &docString, const char *fileName); +extern void parseText(OutputList &ol,const QString &txtString); #endif diff --git a/src/scanner.l b/src/scanner.l index 0beadae..9737ff1 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -76,6 +76,7 @@ static int lastCodeState; static int lastAfterDocContext; static int lastGroupContext; static int lastFormulaContext; +static int lastAnchorContext; static int nextDefContext; static Protection protection; static Protection baseProt; @@ -120,7 +121,8 @@ static char afterDocTerminator; static int tmpDocType; static QString sectionLabel; static QString sectionTitle; -static bool isSubsection; +static SectionInfo::SectionType + sectionType; static QString funcPtrType; static QString templateStr; static QString baseName; @@ -184,7 +186,6 @@ static void initParser() inParBlock = FALSE; firstSeeArg = FALSE; javaDocSee = FALSE; - isSubsection = FALSE; } //----------------------------------------------------------------------------- @@ -532,12 +533,19 @@ static void addSection() { //printf("New section pageName=%s label=%s title=%s\n", // current->name.data(),sectionLabel.data(),sectionTitle.data()); - SectionInfo *si=new SectionInfo(current->name, - sectionLabel,sectionTitle,isSubsection); - sectionDict.insert(sectionLabel,si); + if (sectionLabel.isEmpty()) return; + if (sectionDict[sectionLabel]==0) + { + SectionInfo *si=new SectionInfo(sectionLabel,sectionTitle,sectionType); + sectionDict.insert(sectionLabel,si); + current->anchors->append(new QString(sectionLabel)); + } + else + { + warn("Warning: Duplicate label %s found!\n",sectionLabel.data()); + } } - // Adds a formula text to the list/dictionary of formulas if it was // not already added. Returns the label of the formula. static QString addFormula() @@ -710,6 +718,7 @@ VAR [vV][aA][rR] %x MemberSpec %x MemberSpecSkip %x SkipVerbatim +%x Text %x DocScan %x DocParam %x DocException @@ -742,6 +751,8 @@ VAR [vV][aA][rR] %x DocVerbInc %x DocIndexWord %x DocRef +%x DocRefArg +%x DocRefArgStart %x DocRefItem %x DocRefItemName %x SectionLabel @@ -756,6 +767,7 @@ VAR [vV][aA][rR] %x DocSkipHtmlComment %x ReadFormulaShort %x ReadFormulaLong +%x AnchorLabel %% @@ -798,13 +810,13 @@ VAR [vV][aA][rR] <DocScan>"<!--" { BEGIN(DocSkipHtmlComment); } <DocSkipHtmlComment>"--"[!]?">" { BEGIN(DocScan); } <DocSkipHtmlComment>. -<DocScan>"©" { outDoc->writeCopyright(); } -<DocScan>""" { outDoc->writeQuote(); } -<DocScan>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } -<DocScan>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } -<DocScan>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } -<DocScan>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } -<DocScan>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } +<DocScan,Text>"©" { outDoc->writeCopyright(); } +<DocScan,Text>""" { outDoc->writeQuote(); } +<DocScan,Text>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } +<DocScan,Text>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } +<DocScan,Text>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } +<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } +<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } <DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" { QString envvar=&yytext[2]; envvar=envvar.left(envvar.length()-1); @@ -914,7 +926,7 @@ VAR [vV][aA][rR] outDoc->writeFormula(formName,formula->getFormulaText()); } } -<DocIndexWord>[^\n\t ]+ { +<DocIndexWord>[^\n]+ { //printf("Adding %s to index\n",yytext); outDoc->addToIndex(yytext,0); BEGIN(DocScan); @@ -1124,7 +1136,7 @@ VAR [vV][aA][rR] outDoc->docify(" - "); BEGIN(DocScan); } -<DocScan>("\\"|"@")"section "{ID}"\n" { +<DocScan>"\\section "{ID}"\n" { QString secName=&yytext[9]; // skip "\section " secName=secName.left(secName.length()-1); // remove \n //printf("SectionName %s found\n",secName.data()); @@ -1132,7 +1144,17 @@ VAR [vV][aA][rR] if ((sec=sectionDict[secName])) { //printf("Title %s\n",sec->title.data()); - outDoc->writeSection(sec->label,sec->title,sec->isSubsection); + outDoc->writeSection(sec->label,sec->title, + sec->type==SectionInfo::Subsection); + } + } +<DocScan>"\\anchor "{ID}"\n" { + QString secName=&yytext[8]; + secName=secName.left(secName.length()-1); + SectionInfo *sec; + if ((sec=sectionDict[secName])) + { + outDoc->writeAnchor(sec->label); } } <DocScan>"\\ref" { @@ -1146,7 +1168,19 @@ VAR [vV][aA][rR] SectionInfo *sec; if ((sec=sectionDict[ref])) { - outDoc->writeSectionRef(sec->pageName,sec->label,sec->title); + QString text; + if (sec->title.isEmpty()) + text=sec->label; + else + text=sec->title; + if (sec->type==SectionInfo::Anchor) + { + outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + } + else + { + outDoc->writeSectionRef(sec->fileName,sec->label,text); + } } else { @@ -1155,6 +1189,35 @@ VAR [vV][aA][rR] } BEGIN(DocScan); } +<DocRefName>{ID}/{B}+"\"" { + sectionRef=yytext; + BEGIN(DocRefArgStart); + } +<DocRefArgStart>"\"" { + BEGIN(DocRefArg); + } +<DocRefArg>[^\"\n]+[\n\"] { + yytext[yyleng-1]='\0'; + QString text=substitute(yytext,"\\\\","\\"); + SectionInfo *sec; + if ((sec=sectionDict[sectionRef])) + { + if (sec->type==SectionInfo::Anchor) + { + outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + } + else + { + outDoc->writeSectionRef(sec->fileName,sec->label,text); + } + } + else + { + warn("Warning: reference to unknown section %s!\n",sectionRef.data()); + outDoc->writeBoldString("unknown reference!"); + } + BEGIN(DocScan); + } <DocRefItem>{ID} { sectionRef=yytext; BEGIN(DocRefItemName); @@ -1163,7 +1226,7 @@ VAR [vV][aA][rR] SectionInfo *sec; if ((sec=sectionDict[sectionRef])) { - outDoc->writeSectionRefItem(sec->pageName,sec->label,yytext); + outDoc->writeSectionRefItem(sec->fileName,sec->label,yytext); } else { @@ -1271,6 +1334,10 @@ VAR [vV][aA][rR] <DocKeyEnd>("\\"|"@")"until"{BN}+ { BEGIN(DocUntilKey); } <DocKeyEnd>("\\"|"@")"skipline"{BN}+ { BEGIN(DocSkiplineKey); } <DocKeyEnd>\n +<DocKeyEnd><<EOF>> { + if (!firstLine) outDoc->endCodeFragment(); + yyterminate(); + } <DocKeyEnd>. { unput(*yytext); if (!firstLine) outDoc->endCodeFragment(); @@ -1462,7 +1529,7 @@ VAR [vV][aA][rR] <DocScan>{BN}+ { outDoc->writeChar(' '); } -<DocCode,DocEmphasis,DocBold,DocScan>. { +<DocCode,DocEmphasis,DocBold,DocScan,Text>. { outDoc->writeChar(*yytext); } <NextSemi>"{" { BEGIN(SkipBlock); } @@ -1472,6 +1539,9 @@ VAR [vV][aA][rR] else BEGIN( NextSemi ) ; } +<NextSemi>"'"\\[0-7]{1,3}"'" +<NextSemi>"'"\\."'" +<NextSemi>"'"."'" <NextSemi>\" { lastStringContext=NextSemi; BEGIN(SkipString); @@ -1556,6 +1626,9 @@ VAR [vV][aA][rR] /* <FindMembers>"inline" */ +<FindMembers>{BN}+ { + lineCount(); + } <FindMembers>{B}*"static"{BN}+ { //current->type += " static "; current->stat = TRUE; lineCount(); @@ -2081,8 +2154,8 @@ VAR [vV][aA][rR] } <MemberSpecSkip>"," { BEGIN(MemberSpec); } <MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); } -<Curly>\n { current->program += yytext ; - yyLineNr++ ; +<Curly>{BN}+ { current->program += yytext ; + lineCount() ; } <Curly>. { current->program += yytext ; } @@ -2404,7 +2477,9 @@ VAR [vV][aA][rR] //BEGIN( FindMembers ) ; BEGIN( lastCurlyContext ) ; } -<SkipCurly>\'.\' +<SkipCurly>"'"\\[0-7]{1,3}"'" +<SkipCurly>"'"\\."'" +<SkipCurly>"'"."'" <SkipCurly>\" { lastStringContext=SkipCurly; BEGIN( SkipString ); @@ -2538,15 +2613,16 @@ VAR [vV][aA][rR] ); BEGIN( Curly ) ; } -<Comment>\n { current->program += yytext ; - yyLineNr++ ; +<Comment>{BN}+ { current->program += yytext ; + lineCount() ; } <Comment>"/*" { current->program += yytext ; } <Comment>"//" { current->program += yytext ; } -<Comment>. { current->program += *yytext ; } +<Comment>[^\n\*]+ { current->program += yytext ; } <Comment>.*"*/" { current->program += yytext ; BEGIN( Curly ) ; } +<Comment>. { current->program += *yytext ; } <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator>("//"{B}*)?"/*!" { removeSlashes=(yytext[1]=='/'); @@ -2596,7 +2672,7 @@ VAR [vV][aA][rR] current->inside = current_root->name+"::"; BEGIN( LineDoc ); } -<FindMembers>"extern"{BN}+"\"C"("++")?"\""{BN}+("{")? +<FindMembers>"extern"{BN}+"\"C"("++")?"\""{BN}*("{")? <FindMembers>"{" { current->type.resize(0); current->name.resize(0); @@ -2846,13 +2922,18 @@ VAR [vV][aA][rR] current->doc+=yytext; } <PageDoc>("\\"|"@")"section"{B}+ { - isSubsection=FALSE; + sectionType=SectionInfo::Section; BEGIN(SectionLabel); } <PageDoc>("\\"|"@")"subsection"{B}+ { - isSubsection=TRUE; + sectionType=SectionInfo::Subsection; BEGIN(SectionLabel); } +<Doc,PageDoc,JavaDoc,ClassDoc>("\\"|"@")anchor{B}+ { + lastAnchorContext = YY_START; + sectionType=SectionInfo::Anchor; + BEGIN(AnchorLabel); + } <Doc,PageDoc,JavaDoc,ClassDoc>"\\\\verbatim"/[^a-z_A-Z0-9] { current->doc+="\\\\verbatim"; } @@ -2861,6 +2942,9 @@ VAR [vV][aA][rR] current->doc+="\\verbatim"; BEGIN(SkipVerbatim); } +<Doc,PageDoc,JavaDoc,ClassDoc>"\\addindex"{B}+[^\n]+ { + current->doc+=yytext; + } <Doc,PageDoc,JavaDoc,ClassDoc>"\\\\code"/[^a-z_A-Z0-9] { current->doc+="\\\\code"; } @@ -2928,7 +3012,13 @@ VAR [vV][aA][rR] <SkipCode>. { current->doc+=*yytext; } -<SectionLabel>[a-z_A-Z0-9]+ { +<AnchorLabel>{ID} { + sectionLabel=yytext; + addSection(); + current->doc += "\\anchor "+sectionLabel+"\n"; + BEGIN(lastAnchorContext); + } +<SectionLabel>{ID} { sectionLabel=yytext; sectionTitle.resize(0); BEGIN(SectionTitle); @@ -3220,15 +3310,18 @@ void scanString(const char *s) { const char *oldInputString = inputString; int oldInputPosition = inputPosition; + int oldRule = YY_START; YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE)); inputString = s; inputPosition = 0; + BEGIN( Text ); scanYYlex(); yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(oldBuffer); inputString = oldInputString; inputPosition = oldInputPosition; + BEGIN( oldRule ); } //---------------------------------------------------------------------------- @@ -3308,6 +3401,7 @@ void parseMain(Entry *rt) global_root = rt; current = new Entry; inputString = rt->program; + //printf("parseDoc=`%s'\n",inputString); inputPosition = 0; ifCount=0; scanYYrestart( scanYYin ); @@ -3367,6 +3461,21 @@ void parseDoc(OutputList &ol,const char *clName, //---------------------------------------------------------------------------- +void parseText(OutputList &ol,const QString &txtString) +{ + inputString = txtString; + outDoc = new OutputList(&ol); + inputPosition = 0; + scanYYrestart( scanYYin ); + BEGIN( Text ); + scanYYlex(); + ol+=*outDoc; + delete outDoc; + return; +} + +//---------------------------------------------------------------------------- + void parseExample(OutputList &ol,const QString &docString, const char *fileName) { diff --git a/src/section.h b/src/section.h new file mode 100644 index 0000000..fc287ae --- /dev/null +++ b/src/section.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * $Id$ + * + * + * Copyright (C) 1997-1999 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * All output generated with Doxygen is not covered by this license. + * + */ + +#ifndef SECTION_H +#define SECTION_H + +#include <qlist.h> +#include <qdict.h> +#include <qstring.h> + +class Definition; + +struct SectionInfo +{ + enum SectionType { Section, Subsection, Anchor }; + SectionInfo(const char *l,const char *t,SectionType st) + { label=l; title=t; type=st; definition=0; } + QString fileName; + QString label; + QString title; + SectionType type; + Definition *definition; +}; + +class SectionList : public QList<SectionInfo> +{ +}; + +class SectionDict : public QDict<SectionInfo> +{ + public: + SectionDict(int size) : QDict<SectionInfo>(size) {} +}; + +#endif @@ -25,6 +25,7 @@ #include "classdef.h" #include "filedef.h" +#include "namespacedef.h" #include "memberdef.h" #include "doxygen.h" #include "util.h" @@ -36,12 +37,14 @@ static int yyLineNr; static QString className; static QString fileName; +static QString namespaceName; static QString tagName; static QString memberName; static QString anchorName; static QString argString; static ClassDef *cd; static FileDef *fd; +static NamespaceDef *nd; static void addClass(const char *name,const char *fileName) { @@ -50,6 +53,7 @@ static void addClass(const char *name,const char *fileName) { cd = new ClassDef(name,ClassDef::Class,tagName,fileName); fd = 0; + nd = 0; classList.inSort(cd); classDict.insert(className,cd); } @@ -72,10 +76,27 @@ static void addFile(const char *name) inputNameDict.insert(name,mn); } cd = 0; + nd = 0; //fileList.inSort(fd); //fileDict.insert(fileName,fd); } +static void addNamespace(const char *name) +{ + if ((nd=namespaceDict[name])==0) + { + // TODO: we assume that each namespace is limited to a single tagfile. + // since namespace are open, this need not to be the case. As a result + // namespace may contain members that are located in + // different namespaces! + nd = new NamespaceDef(name,tagName); + namespaceList.inSort(nd); + namespaceDict.insert(name,nd); + } + cd = 0; + fd = 0; +} + static void addMember(const char *name,const char *anchor,const char *args) { //printf("adding member %s\n",name); @@ -87,21 +108,24 @@ static void addMember(const char *name,const char *anchor,const char *args) md=new MemberDef(0,name,args,0,Public,Normal,FALSE,FALSE, MemberDef::Function,0,0); md->setReference(anchor); - if (cd) + if (cd) // member of a class { - //md=new MemberDef(cd,name,args,anchor,tagName); md->setMemberClass(cd); cd->insertMember(md); - //printf("Adding member %s %s to class\n",name,args); mnd=&memberNameDict; mnl=&memberNameList; } - else + else if (nd) // member of a namespace + { + md->setNamespace(nd); + nd->insertMember(md); + mnd=&functionNameDict; + mnl=&functionNameList; + } + else // member of a file { - //md=new MemberDef(&unrelatedClass,name,args,anchor,tagName); md->setFileDef(fd); fd->insertMember(md); - //printf("Adding global member %s %s\n",name,args); mnd=&functionNameDict; mnl=&functionNameList; } @@ -130,6 +154,7 @@ static void addMember(const char *name,const char *anchor,const char *args) ID [a-z_A-Z][a-z_A-Z0-9]* FILE [a-z_A-Z0-9\.\-\+\:\\\/]+ +SCOPE ({ID}"::")*{ID} %x Pass1 %x Pass2 @@ -139,18 +164,22 @@ FILE [a-z_A-Z0-9\.\-\+\:\\\/]+ %x ClassName1 %x ClassName2 %x FileName +%x NamespaceName %x BaseClasses %x ClassFile1 %x ClassFile2 %% -<Pass1>^">" { +<Pass1>^">" { // start of a class BEGIN(ClassName1); } -<Pass1>^"&" { +<Pass1>^"&" { // start of a file BEGIN(FileName); } +<Pass1>^"%" { // start of a namespace + BEGIN(NamespaceName); + } <Pass1>^[~a-z_A-Z][^ \n]*/" " { memberName=yytext; BEGIN(AnchorName); @@ -175,7 +204,12 @@ FILE [a-z_A-Z0-9\.\-\+\:\\\/]+ addFile(yytext); BEGIN(Pass1); } -<ClassName1>{ID}/":" { +<NamespaceName>{SCOPE}/":" { + namespaceName=yytext; + addNamespace(yytext); + BEGIN(Pass1); + } +<ClassName1>{SCOPE}/":" { className=yytext; BEGIN(ClassFile1); } diff --git a/src/translator.h b/src/translator.h index 55b6eaf..6f69c9b 100644 --- a/src/translator.h +++ b/src/translator.h @@ -18,32 +18,67 @@ #define TRANSLATOR_H #include <qstring.h> +#include "classdef.h" +#include "util.h" class Translator { public: - virtual QString latexBabelPackage() - { return ""; } - virtual QString trInherits() + //-------------------------------------------------------------------- + // NOTICE: + // the following functions are now obsolete: these are no longer used and + // will disappear in future versions. You do not have to translate them! + virtual QString trInherits() { return "Inherits"; } - virtual QString trAnd() + virtual QString trAnd() { return "and"; } - virtual QString trInheritedBy() + virtual QString trInheritedBy() { return "Inherited By"; } + virtual QString trReference() + { return "Reference"; } + virtual QString trReimplementedFrom() + { return "Reimplemented from"; } + virtual QString trReimplementedIn() + { return "Reimplemented in"; } + virtual QString trIncludeFile() + { return "Include File"; } + virtual QString trNamespaces() + { return "Namespace List"; } + // end of obsolete functions + //-------------------------------------------------------------------- + + virtual QString latexBabelPackage() + // returns the name of the package that is included by LaTeX + { return ""; } + virtual QString trRelatedFunctions() + // used in the compound documentation before a list of related functions. { return "Related Functions"; } + virtual QString trRelatedSubscript() + // subscript for the related functions. { return "(Note that these are not member functions.)"; } + virtual QString trDetailedDescription() + // header that is put before the detailed description of files, classes and namespaces. { return "Detailed Description"; } + virtual QString trMemberTypedefDocumentation() + // header that is put before the list of typedefs. { return "Member Typedef Documentation"; } + virtual QString trMemberEnumerationDocumentation() + // header that is put before the list of enumerations. { return "Member Enumeration Documentation"; } + virtual QString trMemberFunctionDocumentation() + // header that is put before the list of member functions. { return "Member Function Documentation"; } + virtual QString trMemberDataDocumentation() + // header that is put before the list of member attributes. { return "Member Data Documentation"; } + virtual QString trGeneratedFrom(const char *s,bool single) { // here s is one of " Class", " Struct" or " Union" // single is true implies a single file @@ -52,62 +87,92 @@ class Translator if (single) result+=":"; else result+="s:"; return result; } - virtual QString trMore() + + virtual QString trMore() + // this is the text of a link put after brief descriptions. { return "More..."; } - virtual QString trReference() - { return "Reference"; } + virtual QString trListOfAllMembers() + // put in the class documentation { return "List of all members."; } + virtual QString trMemberList() + // used as the title of the "list of all members" page of a class { return "Member List"; } + virtual QString trThisIsTheListOfAllMembers() - { return "This is the complete list of members for"; } + // this is the first part of a sentence that is followed by a class name + { return "This is the complete list of members for "; } virtual QString trIncludingInheritedMembers() - { return "including all inherited members."; } + // this is the remainder of the sentence after the class name + { return ", including all inherited members."; } + virtual QString trGeneratedAutomatically(const char *s) + // this is put at the author sections at the bottom of man pages. + // parameter s is name of the project name. { QString result="Generated automatically by Doxygen"; if (s) result+=(QString)" for "+s; result+=" from the source code."; return result; } + virtual QString trEnumName() + // put after an enum name in the list of all members { return "enum name"; } + virtual QString trEnumValue() + // put after an enum value in the list of all members { return "enum value"; } + virtual QString trDefinedIn() + // put after an undocumented member in the list of all members { return "defined in"; } - virtual QString trIncludeFile() - { return "Include File"; } + virtual QString trVerbatimText(const char *f) + // put as in introduction in the verbatim header file of a class. + // parameter f is the name of the include file. { return (QString)"This is the verbatim text of the "+f+" include file."; } - + // quick reference sections virtual QString trModules() + // This is put above each page as a link to the list of all groups of + // compounds or files (see the \group command). { return "Modules"; } virtual QString trClassHierarchy() + // This is put above each page as a link to the class hierarchy { return "Class Hierarchy"; } virtual QString trCompoundList() + // This is put above each page as a link to the list of annotated classes { return "Compound List"; } virtual QString trFileList() + // This is put above each page as a link to the list of documented files { return "File List"; } virtual QString trHeaderFiles() + // This is put above each page as a link to the list of all verbatim headers { return "Header Files"; } virtual QString trCompoundMembers() + // This is put above each page as a link to all members of compounds. { return "Compound Members"; } virtual QString trFileMembers() + // This is put above each page as a link to all members of files. { return "File Members"; } virtual QString trRelatedPages() + // This is put above each page as a link to all related pages. { return "Related Pages"; } virtual QString trExamples() + // This is put above each page as a link to all examples. { return "Examples"; } virtual QString trSearch() + // This is put above each page as a link to the search engine. { return "Search"; } - + virtual QString trClassHierarchyDescription() + // This is an introduction to the class hierarchy. { return "This inheritance list is sorted roughly, " "but not completely, alphabetically:"; } virtual QString trFileListDescription(bool extractAll) + // This is an introduction to the list with all files. { QString result="Here is a list of all "; if (!extractAll) result+="documented "; @@ -115,10 +180,12 @@ class Translator return result; } virtual QString trCompoundListDescription() + // This is an introduction to the annotated compound list { return "Here are the classes, structs and " "unions with brief descriptions:"; } virtual QString trCompoundMembersDescription(bool extractAll) + // This is an introduction to the page with all class members { QString result="Here is a list of all "; if (!extractAll) result+="documented "; @@ -130,6 +197,7 @@ class Translator return result; } virtual QString trFileMembersDescription(bool extractAll) + // This is an introduction to the page with all file members { QString result="Here is a list of all "; if (!extractAll) result+="documented "; @@ -141,76 +209,134 @@ class Translator return result; } virtual QString trHeaderFilesDescription() + // This is an introduction to the page with the list of all header files { return "Here are the header files that make up the API:"; } virtual QString trExamplesDescription() + // This is an introduction to the page with the list of all examples { return "Here is a list of all examples:"; } virtual QString trRelatedPagesDescription() + // This is an introduction to the page with the list of related pages { return "Here is a list of all related documentation pages:"; } virtual QString trModulesDescription() + // This is an introduction to the page with the list of class/file groups { return "Here is a list of all modules:"; } virtual QString trNoDescriptionAvailable() + // This sentences is used in the annotated class/file lists if no brief + // description is given. { return "No description available"; } + // index titles (the project name is prepended for these) virtual QString trDocumentation() + // This is used in HTML as the title of index.html. { return "Documentation"; } virtual QString trModuleIndex() + // This is used in LaTeX as the title of the chapter with the + // index of all groups. { return "Module Index"; } virtual QString trHierarchicalIndex() + // This is used in LaTeX as the title of the chapter with the + // class hierarchy. { return "Hierarchical Index"; } virtual QString trCompoundIndex() + // This is used in LaTeX as the title of the chapter with the + // annotated compound index { return "Compound Index"; } virtual QString trFileIndex() + // This is used in LaTeX as the title of the chapter with the + // list of all files. { return "File Index"; } virtual QString trModuleDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all groups. { return "Module Documentation"; } virtual QString trClassDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all classes, structs and unions. { return "Class Documentation"; } virtual QString trFileDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all files. { return "File Documentation"; } virtual QString trExampleDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all examples. { return "Example Documentation"; } virtual QString trPageDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all related pages. { return "Page Documentation"; } virtual QString trReferenceManual() + // This is used in LaTeX as the title of the document { return "Reference Manual"; } virtual QString trDefines() + // This is used in the documentation of a file as a header before the + // list of defines { return "Defines"; } virtual QString trFuncProtos() + // This is used in the documentation of a file as a header before the + // list of function prototypes { return "Function Prototypes"; } virtual QString trTypedefs() + // This is used in the documentation of a file as a header before the + // list of typedefs { return "Typedefs"; } virtual QString trEnumerations() + // This is used in the documentation of a file as a header before the + // list of enumerations { return "Enumerations"; } virtual QString trFunctions() + // This is used in the documentation of a file as a header before the + // list of (global) functions { return "Functions"; } virtual QString trVariables() + // This is used in the documentation of a file as a header before the + // list of (global) variables { return "Variables"; } virtual QString trEnumerationValues() + // This is used in the documentation of a file as a header before the + // list of (global) variables { return "Enumeration values"; } - virtual QString trReimplementedFrom() - { return "Reimplemented from"; } - virtual QString trReimplementedIn() - { return "Reimplemented in"; } + virtual QString trAuthor() + // This is used in man pages as the author section. { return "Author"; } + virtual QString trDefineDocumentation() + // This is used in the documentation of a file before the list of + // documentation blocks for defines { return "Define Documentation"; } virtual QString trFunctionPrototypeDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for function prototypes { return "Function Prototype Documentation"; } virtual QString trTypedefDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for typedefs { return "Typedef Documentation"; } virtual QString trEnumerationTypeDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for enumeration types { return "Enumeration Type Documentation"; } virtual QString trEnumerationValueDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for enumeration values { return "Enumeration Value Documentation"; } virtual QString trFunctionDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for functions { return "Function Documentation"; } virtual QString trVariableDocumentation() + // This is used in the documentation of a file/namespace before the list + // of documentation blocks for variables { return "Variable Documentation"; } virtual QString trCompounds() + // This is used in the documentation of a file/namespace/group before + // the list of links to documented compounds { return "Compounds"; } virtual QString trFiles() + // This is used in the documentation of a group before the list of + // links to documented files { return "Files"; } virtual QString trGeneratedAt(const char *date,const char *projName) @@ -226,42 +352,56 @@ class Translator } virtual QString trClassDiagram(const char *clName) + // this text is put before a class diagram { return (QString)"Class diagram for "+clName; } virtual QString trForInternalUseOnly() + // this text is generated when the \internal command is used. { return "For internal use only."; } virtual QString trReimplementedForInternalReasons() + // this text is generated when the \reimp command is used. { return "Reimplemented for internal reasons; the API is not affected."; } virtual QString trWarning() + // this text is generated when the \warning command is used. { return "Warning"; } virtual QString trBugsAndLimitations() + // this text is generated when the \bug command is used. { return "Bugs and limitations"; } virtual QString trVersion() + // this text is generated when the \version command is used. { return "Version"; } virtual QString trDate() + // this text is generated when the \date command is used. { return "Date"; } virtual QString trAuthors() + // this text is generated when the \author command is used. { return "Author(s)"; } virtual QString trReturns() + // this text is generated when the \return command is used. { return "Returns"; } virtual QString trSeeAlso() + // this text is generated when the \sa command is used. { return "See also"; } virtual QString trParameters() + // this text is generated when the \param command is used. { return "Parameters"; } virtual QString trExceptions() + // this text is generated when the \exception command is used. { return "Exceptions"; } + virtual QString trGeneratedBy() + // this text is used in the title page of a LaTeX document. { return "Generated by"; } // new since 0.49-990307 - virtual QString trNamespaces() - { return "Namespaces"; } virtual QString trNamespaceList() + // used as the title of page containing all the index of all namespaces. { return "Namespace List"; } virtual QString trNamespaceListDescription(bool extractAll) + // used as an introduction to the namespace list { QString result="Here is a list of all "; if (!extractAll) result+="documented "; @@ -269,12 +409,147 @@ class Translator return result; } virtual QString trFriends() + // used in the class documentation as a header before the list of all + // friends of a class { return "Friends"; } - // new since 0.49-990405 +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990405 +////////////////////////////////////////////////////////////////////////// virtual QString trRelatedFunctionDocumentation() + // used in the class documentation as a header before the list of all + // related classes { return "Friends And Related Function Documentation"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990425 +////////////////////////////////////////////////////////////////////////// + + virtual QString trCompoundReference(const char *clName, + ClassDef::CompoundType compType) + // used as the title of the HTML page of a class/struct/union + { + QString result=(QString)clName+" "; + switch(compType) + { + case ClassDef::Class: result+=" Class"; break; + case ClassDef::Struct: result+=" Struct"; break; + case ClassDef::Union: result+=" Union"; break; + } + result+=" Reference"; + return result; + } + virtual QString trFileReference(const char *fileName) + // used as the title of the HTML page of a file + { + QString result=fileName; + result+=" File Reference"; + return result; + } + virtual QString trNamespaceReference(const char *namespaceName) + // used as the title of the HTML page of a namespace + { + QString result=namespaceName; + result+=" Namespace Reference"; + return result; + } + + // these are for the member sections of a class, struct or union + virtual QString trPublicMembers() + { return "Public Members"; } + virtual QString trPublicSlots() + { return "Public Slots"; } + virtual QString trSignals() + { return "Signals"; } + virtual QString trStaticPublicMembers() + { return "Static Public Members"; } + virtual QString trProtectedMembers() + { return "Protected Members"; } + virtual QString trProtectedSlots() + { return "Protected Slots"; } + virtual QString trStaticProtectedMembers() + { return "Static Protected Members"; } + virtual QString trPrivateMembers() + { return "Private Members"; } + virtual QString trPrivateSlots() + { return "Private Slots"; } + virtual QString trStaticPrivateMembers() + { return "Static Private Members"; } + // end of member sections + + virtual QString trWriteList(int numEntries) + { + // this function is used to produce a comma-separated list of items. + // use generateMarker(i) to indicate where item i should be put. + QString result; + int i; + // the inherits list contain `numEntries' classes + for (i=0;i<numEntries;i++) + { + // use generateMarker to generate placeholders for the class links! + result+=generateMarker(i); // generate marker for entry i in the list + // (order is left to right) + + if (i!=numEntries-1) // not the last entry, so we need a separator + { + if (i<numEntries-2) // not the fore last entry + result+=", "; + else // the fore last entry + result+=", and "; + } + } + return result; + } + + virtual QString trInheritsList(int numEntries) + // used in class documentation to produce a list of base classes, + // if class diagrams are disabled. + { + return "Inherits "+trWriteList(numEntries)+"."; + } + virtual QString trInheritedByList(int numEntries) + // used in class documentation to produce a list of super classes, + // if class diagrams are disabled. + { + return "Inherited by "+trWriteList(numEntries)+"."; + } + virtual QString trReimplementedFromList(int numEntries) + // used in member documentation blocks to produce a list of + // members that are hidden by this one. + { + return "Reimplemented from "+trWriteList(numEntries)+"."; + } + virtual QString trReimplementedInList(int numEntries) + { + // used in member documentation blocks to produce a list of + // all member that overwrite the implementation of this member. + return "Reimplemented in "+trWriteList(numEntries)+"."; + } + + virtual QString trNamespaceMembers() + // This is put above each page as a link to all members of namespaces. + { return "Namespace Members"; } + virtual QString trNamespaceMemberDescription(bool extractAll) + // This is an introduction to the page with all namespace members + { + QString result="Here is a list of all "; + if (!extractAll) result+="documented "; + result+="namespace members with links to "; + if (extractAll) + result+="the namespace documentation for each member:"; + else + result+="the namespaces they belong to:"; + return result; + } + virtual QString trNamespaceIndex() + // This is used in LaTeX as the title of the chapter with the + // index of all namespaces. + { return "Namespace Index"; } + virtual QString trNamespaceDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all namespaces. + { return "Namespace Documentation"; } }; #endif diff --git a/src/translator_fr.h b/src/translator_fr.h index cd78053..319f156 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -255,7 +255,7 @@ class TranslatorFrench : public Translator virtual QString trNamespaces() { return "Namespaces"; } virtual QString trNamespaceList() - { return "List des Namespaces"; } + { return "Liste des Namespaces"; } virtual QString trNamespaceListDescription(bool extractAll) { QString result="Liste de tous les namespaces "; @@ -265,6 +265,11 @@ class TranslatorFrench : public Translator } virtual QString trFriends() { return "Friends"; } + + // new since 0.49-990405 + + virtual QString trRelatedFunctionDocumentation() + { return "Documentation des fonctions amies et associées"; } }; #endif diff --git a/src/translator_nl.h b/src/translator_nl.h index 25e7ed4..c9a96bc 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -24,12 +24,6 @@ class TranslatorDutch : public Translator public: QString latexBabelPackage() { return "dutch"; } - QString trInherits() - { return "Erft over van"; } - QString trAnd() - { return "en"; } - QString trInheritedBy() - { return "Wordt overgeërfd door"; } QString trRelatedFunctions() { return "Gerelateerde functies"; } QString trRelatedSubscript() @@ -55,8 +49,6 @@ class TranslatorDutch : public Translator } QString trMore() { return "Meer..."; } - QString trReference() - { return "Referentie"; } QString trListOfAllMembers() { return "Lijst van alle members."; } QString trMemberList() @@ -64,7 +56,7 @@ class TranslatorDutch : public Translator QString trThisIsTheListOfAllMembers() { return "Dit is de complete lijst van alle members voor"; } QString trIncludingInheritedMembers() - { return "inclusief alle overgeërfde members."; } + { return ", inclusief alle overgeërfde members."; } QString trGeneratedAutomatically(const char *s) { QString result="Automatisch gegenereerd door Doxygen"; if (s) result+=(QString)" voor "+s; @@ -77,8 +69,6 @@ class TranslatorDutch : public Translator { return "enum waarde"; } QString trDefinedIn() { return "gedefinieerd in"; } - QString trIncludeFile() - { return "Include File"; } QString trVerbatimText(const char *f) { return (QString)"Dit is de letterlijke tekst van de include file "+f+"."; } QString trModules() @@ -182,10 +172,6 @@ class TranslatorDutch : public Translator { return "Variabelen"; } QString trEnumerationValues() { return "Enumeratie waarden"; } - QString trReimplementedFrom() - { return "Nieuwe implementatie van"; } - QString trReimplementedIn() - { return "Opnieuw geïmplementeerd in"; } QString trAuthor() { return "auteur"; } QString trDefineDocumentation() @@ -246,10 +232,10 @@ class TranslatorDutch : public Translator QString trGeneratedBy() { return "Gegenereerd door"; } - // new since 0.49-990307 +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990307 +////////////////////////////////////////////////////////////////////////// - QString trNamespaces() - { return "Namespaces"; } QString trNamespaceList() { return "Namespace Lijst"; } QString trNamespaceListDescription(bool extractAll) @@ -261,6 +247,142 @@ class TranslatorDutch : public Translator } QString trFriends() { return "Friends"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990405 +////////////////////////////////////////////////////////////////////////// + + QString trRelatedFunctionDocumentation() + { return "Documentatie van friends en gerelateerde functies"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990425 +////////////////////////////////////////////////////////////////////////// + + virtual QString trCompoundReference(const char *clName, + ClassDef::CompoundType compType) + // used as the title of the HTML page of a class/struct/union + { + QString result=(QString)clName+" "; + switch(compType) + { + case ClassDef::Class: result+=" Class"; break; + case ClassDef::Struct: result+=" Struct"; break; + case ClassDef::Union: result+=" Union"; break; + } + result+=" Referentie"; + return result; + } + virtual QString trFileReference(const char *fileName) + // used as the title of the HTML page of a file + { + QString result=fileName; + result+=" File Referentie"; + return result; + } + virtual QString trNamespaceReference(const char *namespaceName) + // used as the title of the HTML page of a namespace + { + QString result=namespaceName; + result+=" Namespace Referentie"; + return result; + } + + // these are for the member sections of a class, struct or union + virtual QString trPublicMembers() + { return "Public Members"; } + virtual QString trPublicSlots() + { return "Public Slots"; } + virtual QString trSignals() + { return "Signals"; } + virtual QString trStaticPublicMembers() + { return "Static Public Members"; } + virtual QString trProtectedMembers() + { return "Protected Members"; } + virtual QString trProtectedSlots() + { return "Protected Slots"; } + virtual QString trStaticProtectedMembers() + { return "Static Protected Members"; } + virtual QString trPrivateMembers() + { return "Private Members"; } + virtual QString trPrivateSlots() + { return "Private Slots"; } + virtual QString trStaticPrivateMembers() + { return "Static Private Members"; } + // end of member sections + + virtual QString trWriteList(int numEntries) + { + // this function is used to produce a comma-separated list of items. + // use generateMarker(i) to indicate where item i should be put. + QString result; + int i; + // the inherits list contain `numEntries' classes + for (i=0;i<numEntries;i++) + { + // use generateMarker to generate placeholders for the class links! + result+=generateMarker(i); // generate marker for entry i in the list + // (order is left to right) + + if (i!=numEntries-1) // not the last entry, so we need a separator + { + if (i<numEntries-2) // not the fore last entry + result+=", "; + else // the fore last entry + result+=" en "; + } + } + return result; + } + + virtual QString trInheritsList(int numEntries) + // used in class documentation to produce a list of base classes, + // if class diagrams are disabled. + { + return "Erft over van "+trWriteList(numEntries)+"."; + } + virtual QString trInheritedByList(int numEntries) + // used in class documentation to produce a list of super classes, + // if class diagrams are disabled. + { + return "Wordt overgeërfd door "+trWriteList(numEntries)+"."; + } + virtual QString trReimplementedFromList(int numEntries) + // used in member documentation blocks to produce a list of + // members that are hidden by this one. + { + return "Nieuwe implementatie van "+trWriteList(numEntries)+"."; + } + virtual QString trReimplementedInList(int numEntries) + { + // used in member documentation blocks to produce a list of + // all member that overwrite the implementation of this member. + return "Opnieuw geïmplementeerd in "+trWriteList(numEntries)+"."; + } + + virtual QString trNamespaceMembers() + // This is put above each page as a link to all members of namespaces. + { return "Namespace Members"; } + virtual QString trNamespaceMemberDescription(bool extractAll) + // This is an introduction to the page with all namespace members + { + QString result="Hier is een lijst van alle "; + if (!extractAll) result+="gedocumenteerde "; + result+="namespace members met links naar "; + if (extractAll) + result+="de namespace documentatie voor iedere member:"; + else + result+="de namespaces waartoe ze behoren:"; + return result; + } + virtual QString trNamespaceIndex() + // This is used in LaTeX as the title of the chapter with the + // index of all namespaces. + { return "Namespace Index"; } + virtual QString trNamespaceDocumentation() + // This is used in LaTeX as the title of the chapter containing + // the documentation of all namespaces. + { return "Namespace Documentatie"; } }; #endif diff --git a/src/translator_se.h b/src/translator_se.h index 15b6c18..4f24e0f 100644 --- a/src/translator_se.h +++ b/src/translator_se.h @@ -14,6 +14,14 @@ * */ +/*------------------------------------------------------------------------- +Svensk översättning av: +Samuel Hägglund <sahag96@ite.mh.se> +Xet Erixon <xet@xeqt.com> + +Skicka gärna synpunkter. +--------------------------------------------------------------------------*/ + #ifndef TRANSLATOR_SE_H #define TRANSLATOR_SE_H @@ -35,34 +43,32 @@ class TranslatorSwedish : public Translator QString trRelatedSubscript() { return "(Observera att dessa inte är medlemsfunktioner)"; } QString trDetailedDescription() - { return "Utökad beskrivning"; } + { return "Detaljerad beskrivning"; } QString trMemberTypedefDocumentation() - { return "Har inte en aning..."; } + { return "Dokumentation över typdefinierade medlemmar"; } QString trMemberEnumerationDocumentation() - { return "Uppräknad dokumentation???"; } - QString trEnumerationValueDocumentation() - { return "Documentatie van enumeratie waarden"; } + { return "Dokumentation över egenuppräknande medlemmar"; } QString trMemberFunctionDocumentation() - { return "Dokumentation av medlemsfunktioner"; } + { return "Dokumentation över medlemsfunktioner"; } QString trMemberDataDocumentation() - { return "Dokumentation av datamedlemmar"; } + { return "Dokumentation över datamedlemmar"; } QString trGeneratedFrom(const char *s,bool single) { - QString result=(QString)"Dokumentationen för detta"+s+ - " är skapad ur följande fil"; - if (single) result+=":"; else result+="s:"; + QString result=(QString)"Dokumentationen för denna"+s+ + " är skapad utifrån följande fil"; + if (single) result+=":"; else result+="er:"; return result; } QString trMore() - { return "Fler..."; } + { return "Mer..."; } QString trReference() - { return "Hänvisning?"; } + { return "Referens"; } QString trListOfAllMembers() { return "Lista över alla medlemmar."; } QString trMemberList() { return "Medlemslista"; } QString trThisIsTheListOfAllMembers() - { return "Det här är en fullständig lista av medlemmar för?"; } + { return "Det här är en fullständig lista över medlemmar för"; } QString trIncludingInheritedMembers() { return "med alla ärvda medlemmar."; } QString trGeneratedAutomatically(const char *s) @@ -72,29 +78,29 @@ class TranslatorSwedish : public Translator return result; } QString trEnumName() - { return "enum namn?"; } + { return "enum namn"; } QString trEnumValue() - { return "enum värde?"; } + { return "enum värde"; } QString trDefinedIn() { return "deklarerad i"; } QString trIncludeFile() - { return "Include Fil"; } + { return "Inkluderingsfil"; } QString trVerbatimText(const char *f) - { return (QString)"Detta är den ordagranna texten av "+f+" include fil."; } + { return (QString)"Detta är den ordagranna texten från inkluderingsfilen"+f; } QString trModules() - { return "Moduler?"; } + { return "Moduler"; } QString trClassHierarchy() - { return "Klasshierarki?"; } + { return "Klasshierarki"; } QString trCompoundList() - { return "Inhägnad lista???"; } + { return "Sammansatt klasslista"; } QString trFileList() { return "Fillista"; } QString trHeaderFiles() { return "Headerfiler"; } QString trCompoundMembers() - { return "Inhägnade medlemmar??"; } + { return "Sammansatta klassmedlemmar"; } QString trFileMembers() - { return "Filmedlemmar???"; } + { return "Filmedlemmar"; } QString trRelatedPages() { return "Besläktade sidor"; } QString trExamples() @@ -102,8 +108,8 @@ class TranslatorSwedish : public Translator QString trSearch() { return "Sök"; } QString trClassHierarchyDescription() - { return "Denna lista över arv är grovsorterad, men inte helt " - "i alfabetisk ordning:"; + { return "Denna lista över arv är grovt, men inte helt, " + "sorterad i alfabetisk ordning:"; } QString trFileListDescription(bool extractAll) { @@ -113,8 +119,8 @@ class TranslatorSwedish : public Translator return result; } QString trCompoundListDescription() - { return "Här följer klasserna, structs och " - "unions? med en kort beskrivning:"; + { return "Här följer klasserna, structerna och " + "unionerna med en kort beskrivning:"; } QString trCompoundMembersDescription(bool extractAll) { @@ -129,18 +135,18 @@ class TranslatorSwedish : public Translator { QString result="Här följer en lista över alla "; if (!extractAll) result+="dokumenterade "; - result+="filmedlemmar? med länkar till "; + result+="filmedlemmar med länkar till "; if (extractAll) result+="dokumentationsfilen för varje medlem:"; else result+="filerna som de tillhör:"; return result; } QString trHeaderFilesDescription() - { return "Här följer headerfilerna som API:n består av???:"; } + { return "Här följer headerfilerna som API:n består av:"; } QString trExamplesDescription() { return "Här följer en lista med alla exempel:"; } QString trRelatedPagesDescription() - { return "Här följer en lista med alla relevanta? dokumentationssidor:"; } - QString trModulesDescription() + { return "Här följer en lista över alla relaterade dokumentationssidor:"; +} QString trModulesDescription() { return "Här följer en lista över alla moduler:"; } QString trNoDescriptionAvailable() { return "Beskrivning saknas"; } @@ -148,11 +154,11 @@ class TranslatorSwedish : public Translator QString trDocumentation() { return "Dokumentation"; } QString trModuleIndex() - { return "Module Index"; } + { return "Modul Index"; } QString trHierarchicalIndex() { return "Hierarkiskt Index"; } QString trCompoundIndex() - { return "Compound Index"; } + { return "Sammansatt Index"; } QString trFileIndex() { return "Fil Index"; } QString trModuleDocumentation() @@ -169,39 +175,41 @@ class TranslatorSwedish : public Translator { return "Uppslagsbok"; } QString trDefines() - { return "Definerar"; } + { return "Definitioner"; } QString trFuncProtos() { return "Funktionsprototyper"; } QString trTypedefs() - { return "Typedefs"; } + { return "Typdefinitioner"; } QString trEnumerations() - { return "Uppräkning???"; } + { return "Egenuppräknande typer"; } QString trFunctions() { return "Funktioner"; } QString trVariables() { return "Variabler"; } QString trEnumerationValues() - { return "Enum värden??"; } + { return "Egenuppräknade värden"; } QString trReimplementedFrom() - { return "Återanvänd från???"; } + { return "Återanvänd från"; } QString trReimplementedIn() - { return "Återanvänd i??"; } + { return "Återanvänd i"; } QString trAuthor() { return "Författare"; } QString trDefineDocumentation() - { return "Definiera dokumentation"; } + { return "Dokumentation över definitioner"; } QString trFunctionPrototypeDocumentation() { return "Dokumentation över funktionsprototyper"; } QString trTypedefDocumentation() - { return "Dokumentation över typedefs"; } + { return "Dokumentation över typdefinitioner"; } QString trEnumerationTypeDocumentation() - { return "Dokumentation över enum typer"; } + { return "Dokumentation över egenuppräknande typer (enum)"; } + QString trEnumerationValueDocumentation() + { return "Dokumentation över egenuppräknande typers värden"; } QString trFunctionDocumentation() { return "Dokumentation över funktioner"; } QString trVariableDocumentation() { return "Dokumentation över variabler"; } QString trCompounds() - { return "Compounds??"; } + { return "Sammansättning"; } QString trFiles() { return "Filer"; } QString trGeneratedAt(const char *date,const char *projName) @@ -217,12 +225,12 @@ class TranslatorSwedish : public Translator } QString trClassDiagram(const char *clName) { - return (QString)"Klass diagram för "+clName; + return (QString)"Klass-diagram för "+clName; } QString trForInternalUseOnly() { return "Endast för internt bruk."; } QString trReimplementedForInternalReasons() - { return "Omskriven av interna orsaker???; " + { return "Omskriven av intern anledning ; " "API:n påverkas inte."; } QString trWarning() diff --git a/src/util.cpp b/src/util.cpp index 6b4578d..9064b2e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -37,6 +37,12 @@ bool isId(char c) return c=='_' || isalnum(c); } +QString generateMarker(int id) +{ + QString result; + result.sprintf("@%d\n",id); + return result; +} // try to determine if this files is a source or a header file by looking // at the extension (5 variations are allowed in both upper and lower case) @@ -197,6 +203,7 @@ static void linkifyText(OutputList &ol,const char *clName,const char *name,const ClassDef *cd=0; FileDef *fd=0; MemberDef *md=0; + NamespaceDef *nd=0; // check if `word' is a documented class name if (word.length()>0 && word!=name && word!=clName) @@ -206,24 +213,29 @@ static void linkifyText(OutputList &ol,const char *clName,const char *name,const // add link to the result if (cd->isVisible()) { - result.writeObjectLink(cd->getReference(),cd->classFile(),0,word); + result.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,word); } else { result.docify(word); } } - else if (getDefs(word,clName,0,md,cd,fd) && md->hasDocumentation()) + else if (getDefs(word,clName,0,md,cd,fd,nd) && md->hasDocumentation()) { if (cd && cd->isVisible() && !md->isFunction()) // word is a member of cd { result.writeObjectLink(cd->getReference(), - cd->classFile(),md->anchor(),word); + cd->getOutputFileBase(),md->anchor(),word); + } + else if (nd && nd->hasDocumentation()) + { + result.writeObjectLink(nd->getReference(), + nd->getOutputFileBase(),md->anchor(),word); } else if (fd && fd->hasDocumentation()) // word is a global in file fd { result.writeObjectLink(fd->getReference(), - fd->diskName(),md->anchor(),word); + fd->getOutputFileBase(),md->anchor(),word); } else // add word to the result { @@ -313,6 +325,28 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, } } +void writeExample(OutputList &ol,ExampleList *el) +{ + QString exampleLine=theTranslator->trWriteList(el->count()); + + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in inheritLine with links to the classes + while ((newIndex=marker.match(exampleLine,index,&matchLen))!=-1) + { + bool ok; + parseText(ol,exampleLine.mid(index,newIndex-index)); + uint entryIndex = exampleLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + Example *e=el->at(entryIndex); + if (ok && e) ol.writeObjectLink(0,e->file,e->anchor,e->name); + index=newIndex+matchLen; + } + parseText(ol,exampleLine.right(exampleLine.length()-index)); + ol.writeString("."); +} + + + QString argListToString(ArgumentList *al) { QString result; @@ -335,11 +369,14 @@ static void writeLink(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd,MemberDef *md,const char *name) { if (nd) - ol.writeObjectLink(0 /*TODO: references */,nd->namespaceFile(),md->anchor(),name); + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), + md->anchor(),name); else if (fd) - ol.writeObjectLink(fd->getReference(),fd->diskName(),md->anchor(),name); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(), + md->anchor(),name); else - ol.writeObjectLink(cd->getReference(),cd->classFile(),md->anchor(),name); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), + md->anchor(),name); } static void warnForUndocumentedMember(MemberDef *md) @@ -388,77 +425,84 @@ void writeQuickLinks(OutputList &ol,bool compact,bool ext) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"modules.html"); - parseDoc(ol,0,0,theTranslator->trModules()); + parseText(ol,theTranslator->trModules()); ol.endQuickIndexItem(); } if (documentedNamespaces>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"namespaces.html"); - parseDoc(ol,0,0,theTranslator->trNamespaces()); + parseText(ol,theTranslator->trNamespaceList()); ol.endQuickIndexItem(); } if (hierarchyClasses>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"hierarchy.html"); - parseDoc(ol,0,0,theTranslator->trClassHierarchy()); + parseText(ol,theTranslator->trClassHierarchy()); ol.endQuickIndexItem(); } if (annotatedClasses>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"annotated.html"); - parseDoc(ol,0,0,theTranslator->trCompoundList()); + parseText(ol,theTranslator->trCompoundList()); ol.endQuickIndexItem(); } if (documentedFiles>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"files.html"); - parseDoc(ol,0,0,theTranslator->trFileList()); + parseText(ol,theTranslator->trFileList()); ol.endQuickIndexItem(); } if (includeFiles.count()>0 && verbatimHeaderFlag) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"headers.html"); - parseDoc(ol,0,0,theTranslator->trHeaderFiles()); + parseText(ol,theTranslator->trHeaderFiles()); ol.endQuickIndexItem(); } + if (documentedNamespaceMembers>0) + { + if (!compact) ol.writeListItem(); + ol.startQuickIndexItem(extLink,absPath+"namespacemembers.html"); + parseText(ol,theTranslator->trNamespaceMembers()); + ol.endQuickIndexItem(); + } if (documentedMembers>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"functions.html"); - parseDoc(ol,0,0,theTranslator->trCompoundMembers()); + parseText(ol,theTranslator->trCompoundMembers()); ol.endQuickIndexItem(); } if (documentedFunctions>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"globals.html"); - parseDoc(ol,0,0,theTranslator->trFileMembers()); + parseText(ol,theTranslator->trFileMembers()); ol.endQuickIndexItem(); } if (pageList.count()>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"pages.html"); - parseDoc(ol,0,0,theTranslator->trRelatedPages()); + parseText(ol,theTranslator->trRelatedPages()); ol.endQuickIndexItem(); } if (exampleList.count()>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,absPath+"examples.html"); - parseDoc(ol,0,0,theTranslator->trExamples()); + parseText(ol,theTranslator->trExamples()); ol.endQuickIndexItem(); } if (searchEngineFlag) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem("_cgi:",""); - parseDoc(ol,0,0,theTranslator->trSearch()); + parseText(ol,theTranslator->trSearch()); ol.endQuickIndexItem(); } if (compact) @@ -489,7 +533,7 @@ void endFile(OutputList &ol,bool external) ol.writeFooter(0,external); // write the footer if (footerFile.length()==0) { - parseDoc(ol,0,0,theTranslator->trGeneratedAt( + parseText(ol,theTranslator->trGeneratedAt( dateToString(TRUE), projectName )); @@ -497,7 +541,7 @@ void endFile(OutputList &ol,bool external) ol.writeFooter(1,external); // write the link to the picture if (footerFile.length()==0) { - parseDoc(ol,0,0,theTranslator->trWrittenBy()); + parseText(ol,theTranslator->trWrittenBy()); } ol.writeFooter(2,external); // end the footer if (latexEnabled) ol.enable(OutputGenerator::Latex); @@ -516,7 +560,7 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd, md->documentation().isEmpty() && !briefMemDescFlag && !repeatBriefFlag - ) + ) ) return; QString type=md->typeString(); QRegExp r("@[0-9]+"); @@ -539,14 +583,24 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd, else if (fd) cname=fd->name(); // If there is no detailed description we need to write the anchor here. - if (!md->detailsAreVisible() && !extractAllFlag) + bool detailsVisible = md->detailsAreVisible(); + if (!detailsVisible && !extractAllFlag) { - ol.writeDoxyAnchor(cname,md->anchor(),md->name()); + QString doxyName=md->name().copy(); + if (!cname.isEmpty()) doxyName.prepend(cname+"::"); + ol.writeDoxyAnchor(cname,md->anchor(),doxyName); ol.addToIndex(md->name(),cname); ol.addToIndex(cname,md->name()); ol.docify("\n"); } - + else if (!detailsVisible) // when extractAll it true we have to write + // a index reference and label in LaTeX because + // detailed section not shown in LaTeX + { + ol.addToIndex(md->name(),cname); + ol.addToIndex(cname,md->name()); + ol.writeLatexLabel(cname,md->anchor()); + } ol.startMemberItem(); // write type @@ -564,6 +618,8 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd, QString name=md->name().copy(); if (type.length()>0) ol.writeString(" "); + ol.insertMemberAlign(); + // write name if ( extractAllFlag || (md->briefDescription().isEmpty() || !briefMemDescFlag) && @@ -610,7 +666,7 @@ static void writeMemberDef(OutputList &ol, ClassDef *cd, NamespaceDef *nd, ol.docify(" "); ol.startTextLink(0,md->anchor()); //ol.writeObjectLink(0,0,md->anchor()," More..."); - parseDoc(ol,0,0,theTranslator->trMore()); + parseText(ol,theTranslator->trMore()); ol.endTextLink(); ol.startEmphasis(); ol.enableAll(); @@ -634,11 +690,13 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (title) { ol.startMemberHeader(); - parseDoc(ol,0,0,title); + parseText(ol,title); ol.endMemberHeader(); } - if (subtitle) ol.writeString(subtitle); - + if (subtitle) + { + parseText(ol,subtitle); + } if (!fd && !nd) ol.startMemberList(); MemberDef *md; @@ -646,7 +704,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (fd && ml->defineCount()>0) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trDefines()); + parseText(ol,theTranslator->trDefines()); ol.endMemberHeader(); ol.startMemberList(); MemberListIterator mli(*ml); @@ -663,7 +721,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if ((fd || nd) && ml->protoCount()>0) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trFuncProtos()); + parseText(ol,theTranslator->trFuncProtos()); ol.startMemberList(); MemberListIterator mli(*ml); for ( ; (md=mli.current()); ++mli ) @@ -678,7 +736,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (fd || nd) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trTypedefs()); + parseText(ol,theTranslator->trTypedefs()); ol.endMemberHeader(); //ol.writeMemberHeader("Typedefs"); ol.startMemberList(); @@ -697,36 +755,21 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (fd || nd) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trEnumerations()); + parseText(ol,theTranslator->trEnumerations()); ol.endMemberHeader(); ol.startMemberList(); } MemberListIterator mli(*ml); for ( ; (md=mli.current()) ; ++mli ) { - bool hasDocs=md->hasDocumentation(); + /*bool hasDocs=md->hasDocumentation();*/ QString type=md->typeString(); type=type.stripWhiteSpace(); - if (md->isEnumerate() && (hasDocs || !hideMemberFlag)) + if (md->isEnumerate() /*&& (hasDocs || !hideMemberFlag)*/) { - // see if there are any documented enum values - // we need this info to decide if we need to generate a link. - QList<MemberDef> *fmdl=md->enumFieldList(); - int documentedEnumValues=0; - if (fmdl) - { - MemberDef *fmd=fmdl->first(); - while (fmd) - { - if (fmd->hasDocumentation()) documentedEnumValues++; - fmd=fmdl->next(); - } - } - if (documentedEnumValues>0) md->setDocumentedEnumValues(TRUE); - if (!hideMemberFlag || // do not hide undocumented members or !md->documentation().isEmpty() || // member has detailed descr. or - documentedEnumValues>0 || // member has documented enum vales. + md->hasDocumentedEnumValues() || // member has documented enum vales. briefMemDescFlag || // brief descr. is shown or repeatBriefFlag // brief descr. is repeated. ) @@ -739,7 +782,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, { if (extractAllFlag || (md->briefDescription().isEmpty() || !briefMemDescFlag) && - (!md->documentation().isEmpty() || documentedEnumValues>0 || + (!md->documentation().isEmpty() || md->hasDocumentedEnumValues() || (!md->briefDescription().isEmpty() && !briefMemDescFlag && repeatBriefFlag @@ -760,6 +803,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, } typeDecl.docify("{ "); + QList<MemberDef> *fmdl=md->enumFieldList(); if (fmdl) { MemberDef *fmd=fmdl->first(); @@ -798,6 +842,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, { ol.startMemberItem(); ol.writeString("enum "); + ol.insertMemberAlign(); ol+=typeDecl; ol.endMemberItem(); //QString brief=md->briefDescription(); @@ -807,14 +852,14 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, ol.startMemberDescription(); parseDoc(ol,cd?cd->name().data():0, md->name().data(),md->briefDescription()); - if (!md->documentation().isEmpty() || documentedEnumValues>0) + if (!md->documentation().isEmpty() || md->hasDocumentedEnumValues()) { ol.disableAllBut(OutputGenerator::Html); ol.endEmphasis(); ol.docify(" "); ol.startTextLink(0,md->anchor()); //ol.writeObjectLink(0,0,md->anchor()," More..."); - parseDoc(ol,0,0,theTranslator->trMore()); + parseText(ol,theTranslator->trMore()); ol.endTextLink(); ol.startEmphasis(); ol.enableAll(); @@ -838,7 +883,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (fd || nd) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trFunctions()); + parseText(ol,theTranslator->trFunctions()); ol.endMemberHeader(); ol.startMemberList(); } @@ -873,6 +918,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, { ol.startMemberItem(); ol.docify("class "); + ol.insertMemberAlign(); ol.writeObjectLink(0,0,md->anchor(),md->name()); ol.endMemberItem(); } @@ -880,13 +926,15 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, { ol.startMemberItem(); ol.docify("class "); - ol.writeObjectLink(cd->getReference(),cd->classFile(),0,cd->name()); + ol.insertMemberAlign(); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()); ol.endMemberItem(); } else if (!hideMemberFlag) // no documentation { ol.startMemberItem(); ol.docify("class "); + ol.insertMemberAlign(); ol.writeBoldString(md->name()); ol.endMemberItem(); } @@ -901,7 +949,7 @@ void writeMemberDecs(OutputList &ol,ClassDef *cd,NamespaceDef *nd, FileDef *fd, if (fd || nd) { ol.startMemberHeader(); - parseDoc(ol,0,0,theTranslator->trVariables()); + parseText(ol,theTranslator->trVariables()); ol.endMemberHeader(); ol.startMemberList(); } @@ -1109,11 +1157,11 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, { ol.newParagraph(); ol.startBold(); - parseDoc(ol,0,0,theTranslator->trEnumerationValues()); + parseText(ol,theTranslator->trEnumerationValues()); //ol.writeBoldString("Enumeration values:"); ol.docify(":"); ol.endBold(); - ol.startMemberList(); + ol.startItemList(); } ol.writeDoxyAnchor(cname,fmd->anchor(),fmd->name()); ol.addToIndex(fmd->name(),cname); @@ -1141,7 +1189,7 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, fmd=fmdl->next(); } } - if (!first) { ol.endMemberList(); ol.writeChar('\n'); } + if (!first) { ol.endItemList(); ol.writeChar('\n'); } } MemberDef *bmd=md->reimplements(); @@ -1159,33 +1207,49 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, // write class that contains a member that is reimplemented by this one ClassDef *bcd = bmd->memberClass(); ol.newParagraph(); - parseDoc(ol,0,0,theTranslator->trReimplementedFrom()); - //ol.writeString("Reimplemented from "); - ol.docify(" "); - if (bmd->hasDocumentation()) + //parseText(ol,theTranslator->trReimplementedFrom()); + //ol.docify(" "); + + QString reimplFromLine = theTranslator->trReimplementedFromList(1); + int markerPos = reimplFromLine.find("@0"); + if (markerPos!=-1) // should always pass this. { - ol.writeObjectLink(bcd->getReference(),bcd->classFile(), - bmd->anchor(),bcd->name()); - if ( - !bcd->isReference() && - //(bcd->hasDocumentation() || !hideClassFlag) && - //(bcd->protection()!=Private || extractPrivateFlag) - bcd->isVisible() - /*&& bmd->detailsAreVisible()*/ - ) ol.writePageRef(bcd->name(),bmd->anchor()); + parseText(ol,reimplFromLine.left(markerPos)); //text left from marker + if (bmd->hasDocumentation() && + (bmd->protection()!=Private || extractPrivateFlag) + ) // replace marker with link + { + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), + bmd->anchor(),bcd->name()); + if ( + !bcd->isReference() && + //(bcd->hasDocumentation() || !hideClassFlag) && + //(bcd->protection()!=Private || extractPrivateFlag) + bcd->isVisible() + /*&& bmd->detailsAreVisible()*/ + ) ol.writePageRef(bcd->name(),bmd->anchor()); + } + else + { + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), + 0,bcd->name()); + if ( + !bcd->isReference() && + //(bcd->hasDocumentation() || !hideClassFlag) && + //(bcd->protection()!=Private || extractPrivateFlag) + bcd->isVisible() + ) ol.writePageRef(bcd->name(),0); + } + parseText(ol,reimplFromLine.right( + reimplFromLine.length()-markerPos-2)); // text right from marker + } else { - ol.writeObjectLink(bcd->getReference(),bcd->classFile(), - 0,bcd->name()); - if ( - !bcd->isReference() && - //(bcd->hasDocumentation() || !hideClassFlag) && - //(bcd->protection()!=Private || extractPrivateFlag) - bcd->isVisible() - ) ol.writePageRef(bcd->name(),0); + err("Error: translation error: no marker in trReimplementsFromList()\n"); } - ol.writeString("."); + + //ol.writeString("."); } MemberList *bml=md->reimplementedBy(); int count; @@ -1193,16 +1257,53 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, { // write the list of classes that overwrite this member ol.newParagraph(); - parseDoc(ol,0,0,theTranslator->trReimplementedIn()); + //parseText(ol,theTranslator->trReimplementedIn()); //ol.writeString("Reimplemented in "); - ol.docify(" "); + //ol.docify(" "); + + QString reimplInLine = + theTranslator->trReimplementedInList(bml->count()); + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in reimplInLine with links to the classes + while ((newIndex=marker.match(reimplInLine,index,&matchLen))!=-1) + { + parseText(ol,reimplInLine.mid(index,newIndex-index)); + bool ok; + uint entryIndex = reimplInLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + bmd=bml->at(entryIndex); + if (ok && bmd) // write link for marker + { + ClassDef *bcd = bmd->memberClass(); + if (bmd->hasDocumentation() && + (bmd->protection()!=Private || extractPrivateFlag) + ) + { + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), + bmd->anchor(),bcd->name()); + if (!bcd->isReference() && bcd->isVisible()) + ol.writePageRef(bcd->name(),bmd->anchor()); + } + else + { + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), + 0,bcd->name()); + if (!bcd->isReference() && bcd->isVisible()) + ol.writePageRef(bcd->name(),0); + } + } + index=newIndex+matchLen; + } + parseText(ol,reimplInLine.right(reimplInLine.length()-index)); + +#if 0 bmd=bml->first(); while (bmd) { ClassDef *bcd = bmd->memberClass(); if (bmd->hasDocumentation()) { - ol.writeObjectLink(bcd->getReference(),bcd->classFile(), + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), bmd->anchor(),bcd->name()); if ( !bcd->isReference() && @@ -1214,7 +1315,7 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, } else { - ol.writeObjectLink(bcd->getReference(),bcd->classFile(), + ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), 0,bcd->name()); if ( !bcd->isReference() && @@ -1228,24 +1329,25 @@ void writeMemberDocs(OutputList &ol,MemberList *ml,const char *scopeName, { if (bml->at()==count-1) //ol.writeString(" and "); - parseDoc(ol,0,0," "+theTranslator->trAnd()+" "); + parseText(ol," "+theTranslator->trAnd()+" "); else ol.writeString(", "); } } ol.writeString("."); +#endif } // write the list of examples that use this member if (md->hasExamples()) { ol.startDescList(); ol.startBold(); - parseDoc(ol,0,0,theTranslator->trExamples()+": "); + parseText(ol,theTranslator->trExamples()+": "); //ol.writeBoldString("Examples: "); ol.endBold(); ol.endDescTitle(); ol.writeDescItem(); - md->writeExample(ol); + writeExample(ol,md->getExampleList()); //ol.endDescItem(); ol.endDescList(); } @@ -1388,8 +1490,7 @@ static QString trimTemplateSpecifiers(const QString &className,const QString &s) // removes the (one and only) occurrence of name:: from s. static QString trimScope(const QString &name,const QString &s) { - int spos; - spos=s.find(name+"::"); + int spos=s.find(name+"::"); if (spos!=-1) { return s.left(spos)+s.right(s.length()-spos-name.length()-2); @@ -1486,8 +1587,12 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, { srcAType=trimScope(className,srcAType); dstAType=trimScope(className,dstAType); - ClassDef *cd=getClass(className); - if (cd->baseClasses()->count()>0) + ClassDef *cd; + if (!namespaceName.isEmpty()) + cd=getClass(namespaceName+"::"+className); + else + cd=getClass(className); + if (cd && cd->baseClasses()->count()>0) { srcAType=trimBaseClassScope(cd->baseClasses(),srcAType); dstAType=trimBaseClassScope(cd->baseClasses(),dstAType); @@ -1703,17 +1808,19 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl) // returns TRUE if the class and member both could be found bool getDefs(const QString &memberName,const QString &className, - const char *args,MemberDef *&md, ClassDef *&cd, FileDef *&fd) + const char *args, + MemberDef *&md, ClassDef *&cd, FileDef *&fd,NamespaceDef *&nd) { //printf("Search for %s::%s %s\n",className.data(),memberName.data(),args); - fd=0; md=0; cd=0; + fd=0, md=0, cd=0, nd=0; if (memberName.length()==0) return FALSE; MemberName *mn; if ((mn=memberNameDict[memberName]) && className.length()>0) { //printf(" >member name found\n"); ClassDef *fcd=0; - if ((fcd=getClass(className))) + //printf("className=%s\n",className.data()); + if ((fcd=getClass(className)) && fcd->hasDocumentation()) { //printf(" >member class found\n"); MemberDef *mmd=mn->first(); @@ -1744,7 +1851,6 @@ bool getDefs(const QString &memberName,const QString &className, mdist=m; cd=mcd; md=mmd; - fd=0; } } if (argList) @@ -1778,7 +1884,6 @@ bool getDefs(const QString &memberName,const QString &className, mdist=m; cd=mcd; md=mmd; - fd=0; } } mmd=mn->next(); @@ -1788,11 +1893,28 @@ bool getDefs(const QString &memberName,const QString &className, return mdist<maxInheritanceDepth; } } - else // maybe an unrelated member ? + else // maybe an namespace or file member ? { MemberName *mn; - if ((mn=functionNameDict[memberName])) + if ((mn=functionNameDict[memberName])) // name is known { + NamespaceDef *fnd=0; + if (className.length()>0 && (fnd=namespaceDict[className]) && + fnd->hasDocumentation()) + { // inside a namespace + MemberDef *mmd=mn->first(); + while (mmd) + { + if (mmd->getNamespace()==fnd && mmd->hasDocumentation()) + { // namespace is found + nd=fnd; + md=mmd; + return TRUE; + } + mmd=mn->next(); + } + } + // maybe a file member (e.g. global function or variable) md=mn->first(); while (md) { @@ -1801,7 +1923,6 @@ bool getDefs(const QString &memberName,const QString &className, fd=md->getFileDef(); if (fd && fd->hasDocumentation()) { - cd=0; return TRUE; } } @@ -1828,12 +1949,18 @@ void generateClassRef(OutputList &ol,const char *clName,const char *linkTxt) ol.docify(linkText); return; } - ClassDef *cd; + ClassDef *cd=0; + NamespaceDef *nd=0; if ((cd=getClass(className)) && cd->isVisible()) { - ol.writeObjectLink(cd->getReference(),cd->classFile(),0,linkText); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,linkText); if (!cd->isReference()) ol.writePageRef(cd->name(),0); } + else if ((nd=namespaceDict[className]) && nd->hasDocumentation()) + { + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,linkText); + ol.writePageRef(nd->name(),0); + } else ol.docify(linkText); } @@ -1887,8 +2014,11 @@ void generateRef(OutputList &ol,const char *clName, } // extract scope - QString scopeStr; - if (scopePos>0) scopeStr=tmpName.left(scopePos); else scopeStr=clName; + QString scopeContext=clName; + QString scopeUser; + if (scopePos>0) scopeUser=tmpName.left(scopePos); + + //printf("scopeContext=%s scopeUser=%s\n",scopeContext.data(),scopeUser.data()); // extract name int startNamePos=scopePos!=-1 ? scopePos+2 : 0; @@ -1898,96 +2028,115 @@ void generateRef(OutputList &ol,const char *clName, // extract arguments QString argsStr; if (bracePos!=-1) argsStr=tmpName.right(tmpName.length()-bracePos); - - bool explicitLink=TRUE; + // create a default link text if none was explicitly given + bool explicitLink=TRUE; if (linkText.isNull()) { - if (!scopeStr.isNull() && scopePos>0) linkText=scopeStr+"::"; + if (!scopeUser.isEmpty()) linkText=scopeUser+"::"; linkText+=nameStr; explicitLink=FALSE; } - //printf("scope=`%s' name=`%s' arg=`%s' linkText=`%s'\n", // scopeStr.data(),nameStr.data(),argsStr.data(),linkText.data()); //Define *d=0; - MemberDef *md; - ClassDef *cd; - FileDef *fd; - // check if nameStr is a member or global. - if (getDefs(nameStr,scopeStr,argsStr,md,cd,fd)) - { - QString anchor = md->hasDocumentation() ? md->anchor() : 0; - QString cName,aName; - if (cd) // nameStr is a member of cd - { - //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(), - // cd->classFile(),anchor.data(),resultName.stripWhiteSpace().data()); - ol.writeObjectLink(cd->getReference(), - cd->classFile(),anchor, - linkText.stripWhiteSpace()); - cName=cd->name(); - aName=md->anchor(); - } - else if (fd) // nameStr is a global in file fd - { - //printf("addFileLink(%s,%s,%s)\n",fd->diskName(),anchor.data(), - // resultName.stripWhiteSpace().data()); - ol.writeObjectLink(fd->getReference(),fd->diskName(), - anchor, linkText.stripWhiteSpace()); - cName=fd->name(); - aName=md->anchor(); - } - else // should not be reached + MemberDef *md = 0; + ClassDef *cd = 0; + FileDef *fd = 0; + NamespaceDef *nd = 0; + int scopeOffset=scopeContext.length(); + do + { + QString totalScope=scopeUser.copy(); + if (scopeOffset>0) { - //printf("add no link fd=cd=0\n"); - ol.docify(linkText); + if (!totalScope.isEmpty()) totalScope.prepend("::"); + totalScope.prepend(scopeContext.left(scopeOffset)); } - - // for functions we add the arguments if explicitly specified or else "()" - if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot())) + //printf("Try with totalScope=`%s'\n",totalScope.data()); + // check if nameStr is a member or global. + if (getDefs(nameStr,totalScope,argsStr,md,cd,fd,nd)) { - if (argsStr.isNull()) - ol.writeString("()"); - else - ol.docify(argsStr); - } - - // generate the page reference (for LaTeX) - if (cName.length()>0 || aName.length()>0) - { - if (/*md->detailsAreVisible() &&*/ - ( - (cd && !cd->isReference() && - // (cd->hasDocumentation() || !hideClassFlag) && - // (cd->protection()!=Private || extractPrivateFlag) - cd->isVisible() - ) || - (fd && !fd->isReference()) - ) - ) ol.writePageRef(cName,aName); + QString anchor = md->hasDocumentation() ? md->anchor() : 0; + QString cName,aName; + if (cd) // nameStr is a member of cd + { + //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(), + // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data()); + ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), + anchor,linkText.stripWhiteSpace()); + cName=cd->name(); + aName=md->anchor(); + } + else if (nd) // nameStr is a member of nd + { + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), + anchor,linkText.stripWhiteSpace()); + cName=nd->name(); + aName=md->anchor(); + } + else if (fd) // nameStr is a global in file fd + { + //printf("addFileLink(%s,%s,%s)\n",fd->getOutputFileBase(),anchor.data(), + // resultName.stripWhiteSpace().data()); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(), + anchor,linkText.stripWhiteSpace()); + cName=fd->name(); + aName=md->anchor(); + } + else // should not be reached + { + //printf("add no link fd=cd=0\n"); + ol.docify(linkText); + } + + // for functions we add the arguments if explicitly specified or else "()" + if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot())) + { + if (argsStr.isNull()) + ol.writeString("()"); + else + ol.docify(argsStr); + } + + // generate the page reference (for LaTeX) + if (cName.length()>0 || aName.length()>0) + { + if ( + (cd && !cd->isReference() && cd->isVisible()) || + (fd && !fd->isReference()) || + (nd /* TODO: && !nd->isReference() */) + ) + { + ol.writePageRef(cName,aName); + } + } + return; } - } -// else if (!nameStr.isNull() && (d=defineDict[nameStr])) -// // check if nameStr is perhaps a define -// { -// if (d->hasDocumentation() && d->fileDef) -// { -// ol.writeObjectLink(0,d->fileDef->diskName(),d->anchor, -// linkText.stripWhiteSpace()); -// if (!explicitLink) ol.docify(argsStr); -// } -// } - else // nameStr is a false alarm or a typo. + // else if (!nameStr.isNull() && (d=defineDict[nameStr])) + // // check if nameStr is perhaps a define + // { + // if (d->hasDocumentation() && d->fileDef) + // { + // ol.writeObjectLink(0,d->fileDef->getOutputFileBase(),d->anchor, + // linkText.stripWhiteSpace()); + // if (!explicitLink) ol.docify(argsStr); + // } + // } + if (scopeOffset==0) + scopeOffset=-1; + else if ((scopeOffset=scopeContext.findRev("::",scopeOffset-1))==-1) + scopeOffset=0; + } while (scopeOffset>=0); + + // nothing found + if (rt) + ol.docify(rt); + else { - if (rt) - ol.docify(rt); - else - { - ol.docify(linkText); - if (!argsStr.isNull()) ol.docify(argsStr); - } + ol.docify(linkText); + if (!argsStr.isNull()) ol.docify(argsStr); } return; } @@ -2016,7 +2165,7 @@ void generateLink(OutputList &ol,const char *clName, else if ((fd=findFileDef(&inputNameDict,linkRef,ambig)) && fd->hasDocumentation()) // link to documented input file - ol.writeObjectLink(fd->getReference(),fd->diskName(),0,lt); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,lt); else // probably a class or member reference generateRef(ol,clName,lr,inSeeBlock,lt); } @@ -2030,7 +2179,7 @@ void generateFileRef(OutputList &ol,const char *name,const char *text) if ((fd=findFileDef(&inputNameDict,name,ambig)) && fd->hasDocumentation()) // link to documented input file - ol.writeObjectLink(fd->getReference(),fd->diskName(),0,linkText); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText); else ol.docify(linkText); } @@ -2172,3 +2321,17 @@ void showFileDefMatches(const FileNameDict *fnDict,const char *n) } } +//---------------------------------------------------------------------- + +void setFileNameForSections(QList<QString> *anchorList,const char *fileName) +{ + if (!anchorList) return; + QString *s=anchorList->first(); + while (s) + { + SectionInfo *si; + if (!s->isEmpty() && (si=sectionDict[*s])) si->fileName=fileName; + s=anchorList->next(); + } +} + @@ -46,7 +46,8 @@ extern QString dateToString(bool); //extern OutputList linkifyText(const char *clName,const char *name, // const char *text); extern bool getDefs(const QString &memberName,const QString &className, - const char *, MemberDef *&md, ClassDef *&cd,FileDef *&fd); + const char *, MemberDef *&md, ClassDef *&cd,FileDef *&fd, + NamespaceDef *&nd); extern void generateRef(OutputList &ol,const char *, const char *,bool inSeeBlock,const char * =0); extern void generateLink(OutputList &ol,const char *, @@ -78,5 +79,8 @@ void startFile(OutputList &ol,const char *name, void endFile(OutputList &ol,bool external=FALSE); void writeQuickLinks(OutputList &ol,bool compact,bool external=FALSE); QString argListToString(ArgumentList *al); +QString generateMarker(int id); +void writeExample(OutputList &ol,ExampleList *el); +void setFileNameForSections(QList<QString> *anchorList,const char *fileName); #endif |