diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/cmdmapper.cpp | 1 | ||||
-rw-r--r-- | src/config.l | 14 | ||||
-rw-r--r-- | src/docparser.cpp | 194 | ||||
-rw-r--r-- | src/docparser.h | 410 | ||||
-rw-r--r-- | src/doctokenizer.h | 25 | ||||
-rw-r--r-- | src/doctokenizer.l | 96 | ||||
-rw-r--r-- | src/docvisitor.h | 11 | ||||
-rw-r--r-- | src/doxygen.cpp | 5 | ||||
-rw-r--r-- | src/filedef.cpp | 1 | ||||
-rw-r--r-- | src/groupdef.cpp | 1 | ||||
-rw-r--r-- | src/htmlattrib.h | 53 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 110 | ||||
-rw-r--r-- | src/htmldocvisitor.h | 6 | ||||
-rw-r--r-- | src/htmlgen.cpp | 5 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 22 | ||||
-rw-r--r-- | src/latexdocvisitor.h | 8 | ||||
-rw-r--r-- | src/libdoxygen.pro.in | 3 | ||||
-rw-r--r-- | src/mandocvisitor.cpp | 854 | ||||
-rw-r--r-- | src/mandocvisitor.h | 144 | ||||
-rw-r--r-- | src/mangen.cpp | 6 | ||||
-rw-r--r-- | src/memberdef.cpp | 16 | ||||
-rw-r--r-- | src/namespacedef.cpp | 1 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 28 | ||||
-rw-r--r-- | src/rtfdocvisitor.h | 10 | ||||
-rw-r--r-- | src/scanner.l | 34 | ||||
-rw-r--r-- | src/translator_fr.h | 13 | ||||
-rw-r--r-- | src/util.cpp | 6 | ||||
-rw-r--r-- | src/xmldocvisitor.cpp | 10 | ||||
-rw-r--r-- | src/xmldocvisitor.h | 8 | ||||
-rw-r--r-- | src/xmlgen.cpp | 26 |
31 files changed, 1662 insertions, 461 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 2d4864f..0a9ae3e 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -790,9 +790,7 @@ void ClassDef::writeDocumentation(OutputList &ol) } ol.endTextLink(); ol.popGeneratorState(); - ol.disable(OutputGenerator::Man); ol.newParagraph(); - ol.enable(OutputGenerator::Man); } } ol.writeSynopsis(); diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index b2aedcf..449d467 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -175,6 +175,7 @@ CommandMap htmlTagMap[] = { "h1", HTML_H1 }, { "h2", HTML_H2 }, { "h3", HTML_H3 }, + { 0, 0 } }; //---------------------------------------------------------------------------- diff --git a/src/config.l b/src/config.l index daf461d..68515a6 100644 --- a/src/config.l +++ b/src/config.l @@ -1459,13 +1459,6 @@ void Config::create() FALSE ); cb = addBool( - "STRIP_CODE_COMMENTS", - "Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct \n" - "doxygen to hide any special comment blocks from generated source code \n" - "fragments. Normal C and C++ comments will always remain visible. \n", - TRUE - ); - cb = addBool( "CASE_SENSE_NAMES", "If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate \n" "file names in lower case letters. If set to YES upper case letters are also \n" @@ -1784,6 +1777,13 @@ void Config::create() "of functions and classes directly in the documentation. \n", FALSE ); + cb = addBool( + "STRIP_CODE_COMMENTS", + "Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct \n" + "doxygen to hide any special comment blocks from generated source code \n" + "fragments. Normal C and C++ comments will always remain visible. \n", + TRUE + ); cb = addBool( "REFERENCED_BY_RELATION", "If the REFERENCED_BY_RELATION tag is set to YES (the default) \n" "then for each documented function all documented \n" diff --git a/src/docparser.cpp b/src/docparser.cpp index 14968e7..f8c0e19 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -48,29 +48,29 @@ static MemberDef * g_memberDef; static QDict<void> g_paramsFound; // include file state -static QCString g_includeFileText; +static QString g_includeFileText; static uint g_includeFileOffset; static uint g_includeFileLength; // parser state -static QCString g_context; +static QString g_context; static bool g_inSeeBlock; static bool g_insideHtmlLink; static QStack<DocNode> g_nodeStack; static QStack<DocStyleChange> g_styleStack; static QList<Definition> g_copyStack; -static QCString g_fileName; +static QString g_fileName; struct DocParserContext { - QCString context; + QString context; bool inSeeBlock; bool insideHtmlLink; QStack<DocNode> nodeStack; QStack<DocStyleChange> styleStack; QList<Definition> copyStack; MemberDef *memberDef; - QCString fileName; + QString fileName; }; static QStack<DocParserContext> g_parserStack; @@ -107,7 +107,7 @@ static void docParserPopContext() //--------------------------------------------------------------------------- -static void checkArgumentName(const QCString &name,bool isParam) +static void checkArgumentName(const QString &name,bool isParam) { if (g_memberDef==0) return; // not a member ArgumentList *al=g_memberDef->isDocsForDefinition() ? @@ -120,14 +120,14 @@ static void checkArgumentName(const QCString &name,bool isParam) int p=0,i=0,l; while ((i=re.match(name,p,&l))!=-1) { - QCString aName=name.mid(i,l); + QString aName=name.mid(i,l); //printf("aName=%s\n",aName.data()); ArgumentListIterator ali(*al); Argument *a; bool found=FALSE; for (ali.toFirst();(a=ali.current());++ali) { - QCString argName = g_memberDef->isDefine() ? a->type : a->name; + QString argName = g_memberDef->isDefine() ? a->type : a->name; if (argName.right(3)=="...") argName=argName.left(argName.length()-3); if (aName==argName) { @@ -140,7 +140,7 @@ static void checkArgumentName(const QCString &name,bool isParam) if (!found && isParam) { //printf("member type=%d\n",memberDef->memberType()); - QCString scope=g_memberDef->getScopeString(); + QString scope=g_memberDef->getScopeString(); if (!scope.isEmpty()) scope+="::"; else scope=""; warn(g_memberDef->docFile(),g_memberDef->docLine(), "Warning: argument `%s' of command @param " @@ -167,7 +167,7 @@ static void checkUndocumentedParams() bool found=FALSE; for (ali.toFirst();(a=ali.current());++ali) { - QCString argName = g_memberDef->isDefine() ? a->type : a->name; + QString argName = g_memberDef->isDefine() ? a->type : a->name; if (argName.right(3)=="...") argName=argName.left(argName.length()-3); if (!argName.isEmpty() && g_paramsFound.find(argName)==0) { @@ -177,7 +177,7 @@ static void checkUndocumentedParams() } if (found) { - QCString scope=g_memberDef->getScopeString(); + QString scope=g_memberDef->getScopeString(); if (!scope.isEmpty()) scope+="::"; else scope=""; warn(g_memberDef->docFile(),g_memberDef->docLine(), "Warning: The following parameters of " @@ -186,7 +186,7 @@ static void checkUndocumentedParams() argListToString(al).data()); for (ali.toFirst();(a=ali.current());++ali) { - QCString argName = g_memberDef->isDefine() ? a->type : a->name; + QString argName = g_memberDef->isDefine() ? a->type : a->name; if (!argName.isEmpty() && g_paramsFound.find(argName)==0) { warn_cont( " parameter %s\n",argName.data()); @@ -199,15 +199,15 @@ static void checkUndocumentedParams() //--------------------------------------------------------------------------- -static QCString stripKnownExtensions(const char *text) +static QString stripKnownExtensions(const char *text) { - QCString result=text; + QString result=text; if (result.right(4)==".tex") { result=result.left(result.length()-4); } else if (result.right(Doxygen::htmlFileExtension.length())== - Doxygen::htmlFileExtension) + QString(Doxygen::htmlFileExtension)) { result=result.left(result.length()-Doxygen::htmlFileExtension.length()); } @@ -293,12 +293,12 @@ static bool insideLang(DocNode *n) * @retval FALSE if name was not found. */ static bool findDocsForMemberOrCompound(const char *commandName, - QCString *pDoc, + QString *pDoc, Definition **pDef) { - pDoc->resize(0); + *pDoc=""; *pDef=0; - QCString cmdArg=commandName; + QString cmdArg=commandName; int l=cmdArg.length(); if (l==0) return FALSE; @@ -306,10 +306,10 @@ static bool findDocsForMemberOrCompound(const char *commandName, if (funcStart==-1) funcStart=l; //int lastScopeStart=cmdArg.findRev("::",funcStart); //int lastScopeEnd = lastScopeStart==-1 ? 0 : lastScopeStart+2; - //QCString scope=cmdArg.left(QMAX(lastScopeStart,0)); - //QCString name=cmdArg.mid(lastScopeEnd,funcStart-lastScopeEnd); - QCString name=cmdArg.left(funcStart); - QCString args=cmdArg.right(l-funcStart); + //QString scope=cmdArg.left(QMAX(lastScopeStart,0)); + //QString name=cmdArg.mid(lastScopeEnd,funcStart-lastScopeEnd); + QString name=cmdArg.left(funcStart); + QString args=cmdArg.right(l-funcStart); // try if the link is to a member MemberDef *md=0; @@ -318,7 +318,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, NamespaceDef *nd=0; GroupDef *gd=0; PageInfo *pi=0; - bool found = getDefs(g_context,name,args,md,cd,fd,nd,gd,FALSE,0,TRUE); + bool found = getDefs(g_context.latin1(),name.latin1(),args,md,cd,fd,nd,gd,FALSE,0,TRUE); if (found && md) { *pDoc=md->documentation(); @@ -330,7 +330,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, int scopeOffset=g_context.length(); do // for each scope { - QCString fullName=cmdArg; + QString fullName=cmdArg; if (scopeOffset>0) { fullName.prepend(g_context.left(scopeOffset)+"::"); @@ -398,8 +398,9 @@ static bool defaultHandleToken(DocNode *parent,int tok, static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, - const QCString &cmdName) + const QString &cmdName) { + QString tokenName = g_token->name; int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { @@ -407,7 +408,9 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, cmdName.data()); return tok; } - while ((tok=doctokenizerYYlex()) && tok!=TK_WHITESPACE && tok!=TK_NEWPARA) + while ((tok=doctokenizerYYlex()) && + tok!=TK_WHITESPACE && tok!=TK_NEWPARA && tok!=TK_LISTITEM && tok!=TK_ENDLIST + ) { if (!defaultHandleToken(parent,tok,children)) { @@ -415,15 +418,15 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, { case TK_COMMAND: warn(g_fileName,doctokenizerYYlineno,"Error: Illegal command \\%s as the argument of a \\%s command", - g_token->name.data(),cmdName.data()); + tokenName.data(),cmdName.data()); break; case TK_SYMBOL: warn(g_fileName,doctokenizerYYlineno,"Error: Unsupported symbol %s found", - g_token->name.data()); + tokenName.data()); break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokenName.data()); break; } } @@ -540,7 +543,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children DBG((" name=%s",g_token->name.data())); } DBG(("\n")); - QCString tokenName = g_token->name; + QString tokenName = g_token->name; switch (tok) { case TK_COMMAND: @@ -803,7 +806,7 @@ handlepara: //--------------------------------------------------------------------------- -DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName,char *letter) +DocSymbol::SymType DocSymbol::decodeSymbol(const QString &symName,char *letter) { int l=symName.length(); DBG(("decodeSymbol(%s) l=%d\n",symName.data(),l)); @@ -856,7 +859,7 @@ DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName,char *letter) //--------------------------------------------------------------------------- static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, - const QCString &doc) + const QString &doc) { int retval = RetVal_OK; @@ -887,7 +890,7 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, //--------------------------------------------------------------------------- -static void readTextFileByName(const QCString &file,QCString &text) +static void readTextFileByName(const QString &file,QString &text) { bool ambig; FileDef *fd; @@ -911,7 +914,7 @@ static void readTextFileByName(const QCString &file,QCString &text) //--------------------------------------------------------------------------- -DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) +DocAnchor::DocAnchor(DocNode *parent,const QString &id,bool newAnchor) : m_parent(parent) { if (id.isEmpty()) @@ -1080,7 +1083,7 @@ void DocIncOperator::parse() void DocCopy::parse() { - QCString doc; + QString doc; Definition *def; if (findDocsForMemberOrCompound(m_link,&doc,&def)) { @@ -1114,7 +1117,7 @@ void DocCopy::parse() void DocXRefItem::parse() { - QCString listName; + QString listName; switch(m_type) { case Bug: listName="bug"; break; @@ -1143,7 +1146,7 @@ void DocXRefItem::parse() DocFormula::DocFormula(DocNode *parent,int id) : m_parent(parent) { - QCString formCmd; + QString formCmd; formCmd.sprintf("\\form#%d",id); Formula *formula=Doxygen::formulaNameDict[formCmd]; if (formula) @@ -1306,7 +1309,7 @@ endsecreflist: //--------------------------------------------------------------------------- -DocInternalRef::DocInternalRef(DocNode *parent,const QCString &ref) +DocInternalRef::DocInternalRef(DocNode *parent,const QString &ref) : m_parent(parent) { int i=ref.find('#'); @@ -1357,11 +1360,12 @@ void DocInternalRef::parse() //--------------------------------------------------------------------------- -DocRef::DocRef(DocNode *parent,const QCString &target) : +DocRef::DocRef(DocNode *parent,const QString &target) : m_parent(parent), m_refToSection(FALSE), m_refToAnchor(FALSE) { Definition *compound = 0; - MemberDef *member = 0; + PageInfo *pageInfo = 0; + QCString anchor; ASSERT(!target.isEmpty()); SectionInfo *sec = Doxygen::sectionDict[target]; if (sec) // ref to section or anchor @@ -1375,16 +1379,25 @@ DocRef::DocRef(DocNode *parent,const QCString &target) : m_refToAnchor = sec->type==SectionInfo::Anchor; m_refToSection = sec->type!=SectionInfo::Anchor; } - else if (resolveRef(g_context,target,TRUE,&compound,&member)) + else if (resolveLink(g_context,target,TRUE,&compound,&pageInfo,anchor)) { - if (member) // ref to member + m_text = target; + m_anchor = anchor; + if (pageInfo) // ref to page { - m_file = compound->getOutputFileBase(); - m_ref = compound->getReference(); - m_anchor = member->anchor(); + m_file = pageInfo->getOutputFileBase(); + m_ref = pageInfo->getReference(); } - else // ref to compound + else if (compound) // ref to compound { + if (anchor.isEmpty() && /* compound link */ + compound->definitionType()==Definition::TypeGroup && /* is group */ + ((GroupDef *)compound)->groupTitle() /* with title */ + ) + { + m_text=((GroupDef *)compound)->groupTitle(); // use group's title as l + } + m_file = compound->getOutputFileBase(); m_ref = compound->getReference(); } @@ -1432,14 +1445,16 @@ void DocRef::parse() //--------------------------------------------------------------------------- -DocLink::DocLink(DocNode *parent,const QCString &target) : +DocLink::DocLink(DocNode *parent,const QString &target) : m_parent(parent) { Definition *compound; PageInfo *page; + QCString anchor; if (resolveLink(g_context,stripKnownExtensions(target),g_inSeeBlock, - &compound,&page,m_anchor)) + &compound,&page,anchor)) { + m_anchor = anchor; if (compound) { m_file = compound->getOutputFileBase(); @@ -1459,9 +1474,9 @@ DocLink::DocLink(DocNode *parent,const QCString &target) : } -QCString DocLink::parse(bool isJavaLink) +QString DocLink::parse(bool isJavaLink) { - QCString result; + QString result; g_nodeStack.push(this); DBG(("DocLink::parse() start\n")); @@ -1495,7 +1510,7 @@ QCString DocLink::parse(bool isJavaLink) case TK_WORD: if (isJavaLink) // special case to detect closing } { - QCString w = g_token->name; + QString w = g_token->name; uint l=w.length(); int p; if (w=="}") @@ -1882,7 +1897,7 @@ int DocIndexEntry::parse() warn(g_fileName,doctokenizerYYlineno,"Error: expected whitespace after \\addindex command"); goto endindexentry; } - m_entry.resize(0); + m_entry=""; while ((tok=doctokenizerYYlex()) && tok!=TK_WHITESPACE && tok!=TK_NEWPARA) { switch (tok) @@ -2078,7 +2093,7 @@ int DocHtmlRow::parse() // parse one or more cells do { - cell=new DocHtmlCell(this,isHeading); + cell=new DocHtmlCell(this,g_token->attribs,isHeading); cell->markFirst(isFirst); isFirst=FALSE; m_children.append(cell); @@ -2125,7 +2140,7 @@ getrow: } else { - m_caption = new DocHtmlCaption(this); + m_caption = new DocHtmlCaption(this,g_token->attribs); retval=m_caption->parse(); if (retval==RetVal_OK) // caption was parsed ok @@ -2154,7 +2169,7 @@ getrow: // parse one or more rows while (retval==RetVal_TableRow) { - DocHtmlRow *tr=new DocHtmlRow(this); + DocHtmlRow *tr=new DocHtmlRow(this,g_token->attribs); m_children.append(tr); retval=tr->parse(); } @@ -2231,6 +2246,7 @@ endtitle: int DocHtmlDescData::parse() { + m_attribs = g_token->attribs; int retval=0; g_nodeStack.push(this); DBG(("DocHtmlDescData::parse() start\n")); @@ -2295,7 +2311,7 @@ int DocHtmlDescList::parse() do { - DocHtmlDescTitle *dt=new DocHtmlDescTitle(this); + DocHtmlDescTitle *dt=new DocHtmlDescTitle(this,g_token->attribs); m_children.append(dt); DocHtmlDescData *dd=new DocHtmlDescData(this); m_children.append(dd); @@ -2417,7 +2433,7 @@ int DocHtmlList::parse() do { - DocHtmlListItem *li=new DocHtmlListItem(this); + DocHtmlListItem *li=new DocHtmlListItem(this,g_token->attribs); m_children.append(li); retval=li->parse(); } while (retval==RetVal_ListItem); @@ -2598,7 +2614,7 @@ int DocSimpleSect::parse(bool userTitle) //-------------------------------------------------------------------------- -int DocParamList::parse(const QCString &cmdName) +int DocParamList::parse(const QString &cmdName) { int retval=RetVal_OK; DBG(("DocParamList::parse() start\n")); @@ -2648,7 +2664,7 @@ int DocParamList::parse(const QCString &cmdName) //-------------------------------------------------------------------------- -int DocParamSect::parse(const QCString &cmdName) +int DocParamSect::parse(const QString &cmdName) { int retval=RetVal_OK; DBG(("DocParamSect::parse() start\n")); @@ -2686,7 +2702,7 @@ int DocPara::handleSimpleSection(DocSimpleSect::Type t) return (rv!=TK_NEWPARA) ? rv : RetVal_OK; } -int DocPara::handleParamSection(const QCString &cmdName,DocParamSect::Type t) +int DocPara::handleParamSection(const QString &cmdName,DocParamSect::Type t) { DocParamSect *ps=0; @@ -2722,7 +2738,7 @@ int DocPara::handleXRefItem(DocXRefItem::Type t) return retval; } -void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t) +void DocPara::handleIncludeOperator(const QString &cmdName,DocIncOperator::Type t) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2772,7 +2788,7 @@ void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type op->parse(); } -void DocPara::handleImage(const QCString &cmdName) +void DocPara::handleImage(const QString &cmdName) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2796,7 +2812,7 @@ void DocPara::handleImage(const QCString &cmdName) return; } DocImage::Type t; - QCString imgType = g_token->name.lower(); + QString imgType = g_token->name.lower(); if (imgType=="html") t=DocImage::Html; else if (imgType=="latex") t=DocImage::Latex; else if (imgType=="rtf") t=DocImage::Rtf; @@ -2821,7 +2837,7 @@ void DocPara::handleImage(const QCString &cmdName) img->parse(); } -void DocPara::handleDotFile(const QCString &cmdName) +void DocPara::handleDotFile(const QString &cmdName) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2844,7 +2860,7 @@ void DocPara::handleDotFile(const QCString &cmdName) df->parse(); } -void DocPara::handleLink(const QCString &cmdName,bool isJavaLink) +void DocPara::handleLink(const QString &cmdName,bool isJavaLink) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2864,14 +2880,14 @@ void DocPara::handleLink(const QCString &cmdName,bool isJavaLink) doctokenizerYYsetStatePara(); DocLink *lnk = new DocLink(this,g_token->name); m_children.append(lnk); - QCString leftOver = lnk->parse(isJavaLink); + QString leftOver = lnk->parse(isJavaLink); if (!leftOver.isEmpty()) { m_children.append(new DocWord(this,leftOver)); } } -void DocPara::handleRef(const QCString &cmdName) +void DocPara::handleRef(const QString &cmdName) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2941,7 +2957,7 @@ endlang: return retval; } -void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) +void DocPara::handleInclude(const QString &cmdName,DocInclude::Type t) { int tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) @@ -2971,7 +2987,7 @@ void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) } -int DocPara::handleCommand(const QCString &cmdName) +int DocPara::handleCommand(const QString &cmdName) { int retval = RetVal_OK; switch (CmdMapper::map(cmdName)) @@ -3310,23 +3326,23 @@ int DocPara::handleCommand(const QCString &cmdName) } -int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tagOptions) +int DocPara::handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs) { - DBG(("handleHtmlStartTag(%s,%d)\n",tagName.data(),tagOptions.count())); + DBG(("handleHtmlStartTag(%s,%d)\n",tagName.data(),tagHtmlAttribs.count())); int retval=RetVal_OK; int tagId = HtmlTagMapper::map(tagName); switch (tagId) { case HTML_UL: { - DocHtmlList *list = new DocHtmlList(this,DocHtmlList::Unordered); + DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Unordered); m_children.append(list); retval=list->parse(); } break; case HTML_OL: { - DocHtmlList *list = new DocHtmlList(this,DocHtmlList::Ordered); + DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Ordered); m_children.append(list); retval=list->parse(); } @@ -3343,7 +3359,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag break; case HTML_PRE: { - DocHtmlPre *pre = new DocHtmlPre(this); + DocHtmlPre *pre = new DocHtmlPre(this,tagHtmlAttribs); m_children.append(pre); retval=pre->parse(); } @@ -3374,7 +3390,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag break; case HTML_DL: { - DocHtmlDescList *list = new DocHtmlDescList(this); + DocHtmlDescList *list = new DocHtmlDescList(this,tagHtmlAttribs); m_children.append(list); retval=list->parse(); } @@ -3387,7 +3403,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag break; case HTML_TABLE: { - DocHtmlTable *table = new DocHtmlTable(this); + DocHtmlTable *table = new DocHtmlTable(this,tagHtmlAttribs); m_children.append(table); retval=table->parse(); } @@ -3418,8 +3434,8 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag break; case HTML_A: { - QListIterator<Option> li(tagOptions); - Option *opt; + HtmlAttribListIterator li(tagHtmlAttribs); + HtmlAttrib *opt; for (li.toFirst();(opt=li.current());++li) { if (opt->name=="name") // <a name=label> tag @@ -3428,7 +3444,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag { DocAnchor *anc = new DocAnchor(this,opt->value,TRUE); m_children.append(anc); - break; // stop looking for other tag options + break; // stop looking for other tag attribs } else { @@ -3452,29 +3468,29 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag break; case HTML_H1: { - DocHtmlHeader *header = new DocHtmlHeader(this,1); + DocHtmlHeader *header = new DocHtmlHeader(this,tagHtmlAttribs,1); m_children.append(header); retval = header->parse(); } break; case HTML_H2: { - DocHtmlHeader *header = new DocHtmlHeader(this,2); + DocHtmlHeader *header = new DocHtmlHeader(this,tagHtmlAttribs,2); m_children.append(header); retval = header->parse(); } break; case HTML_H3: { - DocHtmlHeader *header = new DocHtmlHeader(this,3); + DocHtmlHeader *header = new DocHtmlHeader(this,tagHtmlAttribs,3); m_children.append(header); retval = header->parse(); } break; case HTML_IMG: { - QListIterator<Option> li(tagOptions); - Option *opt; + HtmlAttribListIterator li(tagHtmlAttribs); + HtmlAttrib *opt; for (li.toFirst();(opt=li.current());++li) { if (opt->name=="src" && !opt->value.isEmpty()) @@ -3496,7 +3512,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag return retval; } -int DocPara::handleHtmlEndTag(const QCString &tagName) +int DocPara::handleHtmlEndTag(const QString &tagName) { DBG(("handleHtmlEndTag(%s)\n",tagName.data())); int tagId = HtmlTagMapper::map(tagName); @@ -3817,7 +3833,7 @@ reparsetoken: { if (!g_token->endTag) // found a start tag { - retval = handleHtmlStartTag(g_token->name,g_token->options); + retval = handleHtmlStartTag(g_token->name,g_token->attribs); } else // found an end tag { @@ -4023,9 +4039,9 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, const char *context,MemberDef *md, const char *input) { - //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); - //printf("========== validating %s at line %d\n",fileName,startLine); + printf("========== validating %s at line %d\n",fileName,startLine); + printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); g_token = new TokenInfo; g_context = context; @@ -4035,7 +4051,7 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, g_styleStack.clear(); g_inSeeBlock = FALSE; g_insideHtmlLink = FALSE; - g_includeFileText.resize(0); + g_includeFileText = ""; g_includeFileOffset = 0; g_includeFileLength = 0; g_hasParamCommand = FALSE; diff --git a/src/docparser.h b/src/docparser.h index e5a76f3..493e9e3 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -19,12 +19,14 @@ #ifndef _DOCPARSER_H #define _DOCPARSER_H +#include <stdio.h> + #include <qlist.h> #include <qstrlist.h> -#include <stdio.h> +#include <qstring.h> #include "docvisitor.h" -#include "doctokenizer.h" +#include "htmlattrib.h" class DocNode; class MemberDef; @@ -138,16 +140,16 @@ template<class T> class CompAccept class DocWord : public DocNode { public: - DocWord(DocNode *parent,const QCString &word) : + DocWord(DocNode *parent,const QString &word) : m_parent(parent), m_word(word) {} - QCString word() const { return m_word; } + QString word() const { return m_word; } Kind kind() const { return Kind_Word; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_word; + QString m_word; }; /*! @brief Node representing a word that can be linked to something @@ -155,41 +157,41 @@ class DocWord : public DocNode class DocLinkedWord : public DocNode { public: - DocLinkedWord(DocNode *parent,const QCString &word, - const QCString &ref,const QCString &file, - const QCString &anchor) : + DocLinkedWord(DocNode *parent,const QString &word, + const QString &ref,const QString &file, + const QString &anchor) : m_parent(parent), m_word(word), m_ref(ref), m_file(file), m_anchor(anchor) {} - QCString word() const { return m_word; } + QString word() const { return m_word; } Kind kind() const { return Kind_Word; } DocNode *parent() const { return m_parent; } - QCString file() const { return m_file; } - QCString ref() const { return m_ref; } - QCString anchor() const { return m_anchor; } + QString file() const { return m_file; } + QString ref() const { return m_ref; } + QString anchor() const { return m_anchor; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_word; - QCString m_ref; - QCString m_file; - QCString m_anchor; + QString m_word; + QString m_ref; + QString m_file; + QString m_anchor; }; /*! @brief Node representing an URL (or email address) */ class DocURL : public DocNode { public: - DocURL(DocNode *parent,const QCString &url) : + DocURL(DocNode *parent,const QString &url) : m_parent(parent), m_url(url) {} - QCString url() const { return m_url; } + QString url() const { return m_url; } Kind kind() const { return Kind_URL; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_url; + QString m_url; }; /*! @brief Node representing a line break */ @@ -224,17 +226,17 @@ class DocHorRuler : public DocNode class DocAnchor : public DocNode { public: - DocAnchor(DocNode *parent,const QCString &id,bool newAnchor); + DocAnchor(DocNode *parent,const QString &id,bool newAnchor); Kind kind() const { return Kind_Anchor; } DocNode *parent() const { return m_parent; } - QCString anchor() const { return m_anchor; } - QCString file() const { return m_file; } + QString anchor() const { return m_anchor; } + QString file() const { return m_file; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_anchor; - QCString m_file; + QString m_anchor; + QString m_file; }; /*! @brief Node representing a style change */ @@ -255,9 +257,9 @@ class DocStyleChange : public DocNode private: DocNode *m_parent; - uint m_position; - Style m_style; - bool m_enable; + uint m_position; + Style m_style; + bool m_enable; }; /*! @brief Node representing a special symbol */ @@ -275,27 +277,27 @@ class DocSymbol : public DocNode Kind kind() const { return Kind_Symbol; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } - static SymType decodeSymbol(const QCString &symName,char *letter); + static SymType decodeSymbol(const QString &symName,char *letter); private: DocNode *m_parent; - SymType m_symbol; - char m_letter; + SymType m_symbol; + char m_letter; }; /*! @brief Node representing some amount of white space */ class DocWhiteSpace : public DocNode { public: - DocWhiteSpace(DocNode *parent,const QCString &chars) : + DocWhiteSpace(DocNode *parent,const QString &chars) : m_parent(parent), m_chars(chars) {} Kind kind() const { return Kind_WhiteSpace; } - QCString chars() const { return m_chars; } + QString chars() const { return m_chars; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_chars; + QString m_chars; }; /*! @brief Node representing a verbatim, unparsed text fragment */ @@ -303,21 +305,21 @@ class DocVerbatim : public DocNode { public: enum Type { Code, HtmlOnly, LatexOnly, Verbatim }; - DocVerbatim(DocNode *parent,const QCString &context, - const QCString &text, Type t) : + DocVerbatim(DocNode *parent,const QString &context, + const QString &text, Type t) : m_parent(parent), m_context(context), m_text(text), m_type(t) {} Kind kind() const { return Kind_Verbatim; } Type type() const { return m_type; } - QCString text() const { return m_text; } - QCString context() const { return m_context; } + QString text() const { return m_text; } + QString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_context; - QCString m_text; - Type m_type; + QString m_context; + QString m_text; + Type m_type; }; /*! @brief Node representing an included text block from file */ @@ -325,23 +327,23 @@ class DocInclude : public DocNode { public: enum Type { Include, DontInclude, VerbInclude, HtmlInclude }; - DocInclude(DocNode *parent,const QCString &file, - const QCString context, Type t) : + DocInclude(DocNode *parent,const QString &file, + const QString context, Type t) : m_parent(parent), m_file(file), m_context(context), m_type(t) {} Kind kind() const { return Kind_Include; } - QCString file() const { return m_file; } + QString file() const { return m_file; } Type type() const { return m_type; } - QCString text() const { return m_text; } - QCString context() const { return m_context; } + QString text() const { return m_text; } + QString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } void parse(); private: DocNode *m_parent; - QCString m_file; - QCString m_context; - QCString m_text; + QString m_file; + QString m_context; + QString m_text; Type m_type; }; @@ -350,15 +352,15 @@ class DocIncOperator : public DocNode { public: enum Type { Line, SkipLine, Skip, Until }; - DocIncOperator(DocNode *parent,Type t,const QCString &pat, - const QCString &context) : + DocIncOperator(DocNode *parent,Type t,const QString &pat, + const QString &context) : m_parent(parent), m_type(t), m_pattern(pat), m_context(context), m_isFirst(FALSE), m_isLast(FALSE) {} Kind kind() const { return Kind_IncOperator; } Type type() const { return m_type; } - QCString text() const { return m_text; } - QCString pattern() const { return m_pattern; } - QCString context() const { return m_context; } + QString text() const { return m_text; } + QString pattern() const { return m_pattern; } + QString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } void parse(); @@ -369,10 +371,10 @@ class DocIncOperator : public DocNode private: DocNode *m_parent; - Type m_type; - QCString m_text; - QCString m_pattern; - QCString m_context; + Type m_type; + QString m_text; + QString m_pattern; + QString m_context; bool m_isFirst; bool m_isLast; }; @@ -383,17 +385,17 @@ class DocFormula : public DocNode public: DocFormula(DocNode *parent,int id); Kind kind() const { return Kind_Formula; } - QCString name() const { return m_name; } - QCString text() const { return m_text; } + QString name() const { return m_name; } + QString text() const { return m_text; } int id() const { return m_id; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - QCString m_name; - QCString m_text; - int m_id; + QString m_name; + QString m_text; + int m_id; }; /*! @brief Node representing an entry in the index. */ @@ -405,11 +407,11 @@ class DocIndexEntry : public DocNode int parse(); DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } - QCString entry() { return m_entry; } + QString entry() { return m_entry; } private: DocNode *m_parent; - QCString m_entry; + QString m_entry; }; //----------------------------------------------------------------------- @@ -418,17 +420,17 @@ class DocIndexEntry : public DocNode class DocCopy : public CompAccept<DocCopy>, public DocNode { public: - DocCopy(DocNode *parent,const QCString &link) + DocCopy(DocNode *parent,const QString &link) : m_parent(parent), m_link(link) { } Kind kind() const { return Kind_IndexEntry; } - QCString link() const { return m_link; } + QString link() const { return m_link; } void parse(); DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocCopy>::accept(this,v); } private: DocNode *m_parent; - QCString m_link; + QString m_link; }; /*! @brief Node representing an auto List */ @@ -446,8 +448,8 @@ class DocAutoList : public CompAccept<DocAutoList>, public DocNode private: DocNode *m_parent; - int m_indent; - bool m_isEnumList; + int m_indent; + bool m_isEnumList; }; @@ -474,20 +476,20 @@ class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode m_parent(parent), m_id(id), m_type(t) {} Kind kind() const { return Kind_XRefItem; } Type type() const { return m_type; } - QCString file() const { return m_file; } - QCString anchor() const { return m_anchor; } - QCString title() const { return m_title; } + QString file() const { return m_file; } + QString anchor() const { return m_anchor; } + QString title() const { return m_title; } void parse(); DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocXRefItem>::accept(this,v); } private: DocNode *m_parent; - int m_id; - Type m_type; - QCString m_file; - QCString m_anchor; - QCString m_title; + int m_id; + Type m_type; + QString m_file; + QString m_anchor; + QString m_title; }; /*! @brief Node representing an image */ @@ -495,81 +497,81 @@ class DocImage : public CompAccept<DocImage>, public DocNode { public: enum Type { Html, Latex, Rtf }; - DocImage(DocNode *parent,const QCString &name,Type t) : + DocImage(DocNode *parent,const QString &name,Type t) : m_parent(parent), m_name(name), m_type(t) {} Kind kind() const { return Kind_Image; } Type type() const { return m_type; } - QCString name() const { return m_name; } + QString name() const { return m_name; } DocNode *parent() const { return m_parent; } bool hasCaption() const { return !m_children.isEmpty(); } - QCString width() const { return m_width; } - QCString height() const { return m_height; } + QString width() const { return m_width; } + QString height() const { return m_height; } void accept(DocVisitor *v) { CompAccept<DocImage>::accept(this,v); } void parse(); private: - DocNode *m_parent; - QCString m_name; - Type m_type; - QCString m_width; - QCString m_height; + DocNode *m_parent; + QString m_name; + Type m_type; + QString m_width; + QString m_height; }; /*! @brief Node representing a dot file */ class DocDotFile : public CompAccept<DocDotFile>, public DocNode { public: - DocDotFile(DocNode *parent,const QCString &name) : + DocDotFile(DocNode *parent,const QString &name) : m_parent(parent), m_name(name) { } void parse(); Kind kind() const { return Kind_DotFile; } - QCString name() const { return m_name; } - QCString file() const { return m_file; } + QString name() const { return m_name; } + QString file() const { return m_file; } bool hasCaption() const { return !m_children.isEmpty(); } - QCString width() const { return m_width; } - QCString height() const { return m_height; } + QString width() const { return m_width; } + QString height() const { return m_height; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocDotFile>::accept(this,v); } private: - DocNode *m_parent; - QCString m_name; - QCString m_file; - QCString m_width; - QCString m_height; + DocNode *m_parent; + QString m_name; + QString m_file; + QString m_width; + QString m_height; }; /*! @brief Node representing a link to some item */ class DocLink : public CompAccept<DocLink>, public DocNode { public: - DocLink(DocNode *parent,const QCString &target); - QCString parse(bool); + DocLink(DocNode *parent,const QString &target); + QString parse(bool); Kind kind() const { return Kind_Link; } - QCString file() const { return m_file; } - QCString ref() const { return m_ref; } - QCString anchor() const { return m_anchor; } + QString file() const { return m_file; } + QString ref() const { return m_ref; } + QString anchor() const { return m_anchor; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocLink>::accept(this,v); } private: - DocNode *m_parent; - QCString m_file; - QCString m_ref; - QCString m_anchor; + DocNode *m_parent; + QString m_file; + QString m_ref; + QString m_anchor; }; /*! @brief Node representing a reference to some item */ class DocRef : public CompAccept<DocRef>, public DocNode { public: - DocRef(DocNode *parent,const QCString &target); + DocRef(DocNode *parent,const QString &target); void parse(); Kind kind() const { return Kind_Ref; } - QCString file() const { return m_file; } - QCString ref() const { return m_ref; } - QCString anchor() const { return m_anchor; } - QCString targetTitle() const { return m_text; } + QString file() const { return m_file; } + QString ref() const { return m_ref; } + QString anchor() const { return m_anchor; } + QString targetTitle() const { return m_text; } DocNode *parent() const { return m_parent; } bool hasLinkText() const { return !m_children.isEmpty(); } bool refToAnchor() const { return m_refToAnchor; } @@ -577,40 +579,40 @@ class DocRef : public CompAccept<DocRef>, public DocNode void accept(DocVisitor *v) { CompAccept<DocRef>::accept(this,v); } private: - DocNode * m_parent; - bool m_refToSection; - bool m_refToAnchor; - QCString m_file; - QCString m_ref; - QCString m_anchor; - QCString m_text; + DocNode * m_parent; + bool m_refToSection; + bool m_refToAnchor; + QString m_file; + QString m_ref; + QString m_anchor; + QString m_text; }; /*! @brief Node representing an internal reference to some item */ class DocInternalRef : public CompAccept<DocInternalRef>, public DocNode { public: - DocInternalRef(DocNode *parent,const QCString &target); + DocInternalRef(DocNode *parent,const QString &target); void parse(); Kind kind() const { return Kind_Ref; } - QCString file() const { return m_file; } - QCString anchor() const { return m_anchor; } + QString file() const { return m_file; } + QString anchor() const { return m_anchor; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocInternalRef>::accept(this,v); } private: DocNode * m_parent; - QCString m_file; - QCString m_anchor; + QString m_file; + QString m_anchor; }; /*! @brief Node representing a Language specific section */ class DocLanguage : public CompAccept<DocLanguage>, public DocNode { public: - DocLanguage(DocNode *parent,const QCString &id) : + DocLanguage(DocNode *parent,const QString &id) : m_parent(parent), m_id(id) {} - QCString id() const { return m_id; } + QString id() const { return m_id; } int parse(); Kind kind() const { return Kind_Language; } DocNode *parent() const { return m_parent; } @@ -618,115 +620,123 @@ class DocLanguage : public CompAccept<DocLanguage>, public DocNode private: DocNode * m_parent; - QCString m_id; + QString m_id; }; /*! @brief Node representing a Hypertext reference */ class DocHRef : public CompAccept<DocHRef>, public DocNode { public: - DocHRef(DocNode *parent,const QCString &url) : + DocHRef(DocNode *parent,const QString &url) : m_parent(parent), m_url(url) {} int parse(); - QCString url() const { return m_url; } + QString url() const { return m_url; } Kind kind() const { return Kind_HRef; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHRef>::accept(this,v); } private: - DocNode * m_parent; - QCString m_url; + DocNode * m_parent; + QString m_url; }; /*! @brief Node Html heading */ class DocHtmlHeader : public CompAccept<DocHtmlHeader>, public DocNode { public: - DocHtmlHeader(DocNode *parent,int level) : - m_parent(parent), m_level(level) {} + DocHtmlHeader(DocNode *parent,const HtmlAttribList &attribs,int level) : + m_parent(parent), m_level(level), m_attribs(attribs) {} int parse(); int level() const { return m_level; } Kind kind() const { return Kind_HtmlHeader; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlHeader>::accept(this,v); } private: - DocNode * m_parent; - int m_level; + DocNode * m_parent; + int m_level; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html description item */ class DocHtmlDescTitle : public CompAccept<DocHtmlDescTitle>, public DocNode { public: - DocHtmlDescTitle(DocNode *parent) : m_parent(parent) {} + DocHtmlDescTitle(DocNode *parent,const HtmlAttribList &attribs) : + m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlDescTitle; } DocNode *parent() const { return m_parent; } + const HtmlAttribList &attribs() const { return m_attribs; } void accept(DocVisitor *v) { CompAccept<DocHtmlDescTitle>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html description list */ class DocHtmlDescList : public CompAccept<DocHtmlDescList>, public DocNode { public: - DocHtmlDescList(DocNode *parent) : m_parent(parent) {} + DocHtmlDescList(DocNode *parent,const HtmlAttribList &attribs) + : m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlDescList; } DocNode *parent() const { return m_parent; } + const HtmlAttribList &attribs() const { return m_attribs; } void accept(DocVisitor *v) { CompAccept<DocHtmlDescList>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a normal section */ class DocSection : public CompAccept<DocSection>, public DocNode { public: - DocSection(DocNode *parent,int level,const QCString &id) : + DocSection(DocNode *parent,int level,const QString &id) : m_parent(parent), m_level(level), m_id(id) {} Kind kind() const { return Kind_Section; } int level() const { return m_level; } - QCString title() const { return m_title; } - QCString anchor() const { return m_anchor; } - QCString id() const { return m_id; } - QCString file() const { return m_file; } + QString title() const { return m_title; } + QString anchor() const { return m_anchor; } + QString id() const { return m_id; } + QString file() const { return m_file; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocSection>::accept(this,v); } int parse(); private: - DocNode *m_parent; - int m_level; - QCString m_id; - QCString m_title; - QCString m_anchor; - QCString m_file; + DocNode *m_parent; + int m_level; + QString m_id; + QString m_title; + QString m_anchor; + QString m_file; }; /*! @brief Node representing a reference to a section */ class DocSecRefItem : public CompAccept<DocSecRefItem>, public DocNode { public: - DocSecRefItem(DocNode *parent,const QCString &target) : + DocSecRefItem(DocNode *parent,const QString &target) : m_parent(parent), m_target(target) {} Kind kind() const { return Kind_SecRefItem; } - QCString target() const { return m_target; } - QCString file() const { return m_file; } - QCString anchor() const { return m_anchor; } + QString target() const { return m_target; } + QString file() const { return m_file; } + QString anchor() const { return m_anchor; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocSecRefItem>::accept(this,v); } void parse(); private: - DocNode *m_parent; - QCString m_target; - QCString m_file; - QCString m_anchor; + DocNode *m_parent; + QString m_target; + QString m_file; + QString m_anchor; }; /*! @brief Node representing a list of section references */ @@ -776,16 +786,19 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode { public: enum Type { Unordered, Ordered }; - DocHtmlList(DocNode *parent,Type t) : m_parent(parent), m_type(t) {} + DocHtmlList(DocNode *parent,const HtmlAttribList &attribs,Type t) : + m_parent(parent), m_type(t), m_attribs(attribs) {} Kind kind() const { return Kind_HtmlList; } Type type() const { return m_type; } + const HtmlAttribList &attribs() const { return m_attribs; } int parse(); DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlList>::accept(this,v); } private: - DocNode *m_parent; - Type m_type; + DocNode * m_parent; + Type m_type; + HtmlAttribList m_attribs; }; /*! Node representing a simple section */ @@ -820,7 +833,7 @@ class DocParamSect : public CompAccept<DocParamSect>, public DocNode Unknown, Param, RetVal, Exception }; DocParamSect(DocNode *parent,Type t) : m_parent(parent), m_type(t) {} - int parse(const QCString &cmdName); + int parse(const QString &cmdName); Kind kind() const { return Kind_ParamSect; } Type type() const { return m_type; } DocNode *parent() const { return m_parent; } @@ -847,23 +860,23 @@ class DocPara : public CompAccept<DocPara>, public DocNode bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } - int handleCommand(const QCString &cmdName); - int handleHtmlStartTag(const QCString &tagName,const QList<Option> &tagOptions); - int handleHtmlEndTag(const QCString &tagName); + int handleCommand(const QString &cmdName); + int handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs); + int handleHtmlEndTag(const QString &tagName); int handleSimpleSection(DocSimpleSect::Type t); int handleXRefItem(DocXRefItem::Type t); - int handleParamSection(const QCString &cmdName,DocParamSect::Type t); - void handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t); - void handleImage(const QCString &cmdName); - void handleDotFile(const QCString &cmdName); - void handleInclude(const QCString &cmdName,DocInclude::Type t); - void handleLink(const QCString &cmdName,bool isJavaLink); - void handleRef(const QCString &cmdName); + int handleParamSection(const QString &cmdName,DocParamSect::Type t); + void handleIncludeOperator(const QString &cmdName,DocIncOperator::Type t); + void handleImage(const QString &cmdName); + void handleDotFile(const QString &cmdName); + void handleInclude(const QString &cmdName,DocInclude::Type t); + void handleLink(const QString &cmdName,bool isJavaLink); + void handleRef(const QString &cmdName); int handleLanguageSwitch(); private: DocNode *m_parent; - QCString m_sectionId; + QString m_sectionId; bool m_isFirst; bool m_isLast; }; @@ -877,7 +890,7 @@ class DocParamList : public DocNode { m_paragraph=new DocPara(this); } virtual ~DocParamList() { delete m_paragraph; } - int parse(const QCString &cmdName); + int parse(const QString &cmdName); Kind kind() const { return Kind_ParamList; } DocNode *parent() const { return m_parent; } const QStrList ¶meters() { return m_params; } @@ -890,9 +903,9 @@ class DocParamList : public DocNode } private: - DocNode *m_parent; - DocPara *m_paragraph; - QStrList m_params; + DocNode * m_parent; + DocPara * m_paragraph; + QStrList m_params; DocParamSect::Type m_type; }; @@ -943,28 +956,34 @@ class DocSimpleListItem : public DocNode class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode { public: - DocHtmlListItem(DocNode *parent) : m_parent(parent) {} + DocHtmlListItem(DocNode *parent,const HtmlAttribList &attribs) : + m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlListItem; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); } private: - DocNode *m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html description data */ class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode { public: - DocHtmlDescData(DocNode *parent) : m_parent(parent) {} + DocHtmlDescData(DocNode *parent) : + m_parent(parent) {} int parse(); Kind kind() const { return Kind_HtmlDescData; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlDescData>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; @@ -972,28 +991,32 @@ class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode class DocHtmlPre : public CompAccept<DocHtmlPre>, public DocNode { public: - DocHtmlPre(DocNode *parent) : m_parent(parent) {} + DocHtmlPre(DocNode *parent,const HtmlAttribList &attribs) + : m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlPre; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlPre>::accept(this,v); } private: - DocNode *m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html table cell */ class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode { public: - DocHtmlCell(DocNode *parent,bool isHeading) : + DocHtmlCell(DocNode *parent,const HtmlAttribList &attribs,bool isHeading) : m_parent(parent), m_isHeading(isHeading), - m_isFirst(FALSE), m_isLast(FALSE) {} + m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs) {} int parse(); bool isHeading() const { return m_isHeading; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } Kind kind() const { return Kind_HtmlCell; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlCell>::accept(this,v); } void markFirst(bool v=TRUE) { m_isFirst=v; } @@ -1004,47 +1027,57 @@ class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode bool m_isHeading; bool m_isFirst; bool m_isLast; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html table caption */ class DocHtmlCaption : public CompAccept<DocHtmlCaption>, public DocNode { public: - DocHtmlCaption(DocNode *parent) : m_parent(parent) {} + DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs) : + m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlCaption; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlCaption>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html table row */ class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode { public: - DocHtmlRow(DocNode *parent) : m_parent(parent) {} + DocHtmlRow(DocNode *parent,const HtmlAttribList &attribs) + : m_parent(parent), m_attribs(attribs) {} int parse(); Kind kind() const { return Kind_HtmlRow; } + const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } uint numCells() const { return m_children.count(); } void accept(DocVisitor *v) { CompAccept<DocHtmlRow>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; + HtmlAttribList m_attribs; }; /*! @brief Node representing a Html table */ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode { public: - DocHtmlTable(DocNode *parent) : m_parent(parent) { m_caption=0; } + DocHtmlTable(DocNode *parent,const HtmlAttribList &attribs) + : m_parent(parent), m_attribs(attribs) + { m_caption=0; } ~DocHtmlTable() { delete m_caption; } Kind kind() const { return Kind_HtmlTable; } DocNode *parent() const { return m_parent; } uint numRows() const { return m_children.count(); } bool hasCaption() { return m_caption!=0; } + const HtmlAttribList &attribs() const { return m_attribs; } int parse(); uint numCols() const { @@ -1071,6 +1104,7 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode private: DocNode * m_parent; DocHtmlCaption *m_caption; + HtmlAttribList m_attribs; }; diff --git a/src/doctokenizer.h b/src/doctokenizer.h index 07b6324..b4cea48 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -19,8 +19,9 @@ #ifndef _DOCTOKENIZER_H #define _DOCTOKENIZER_H -#include <qcstring.h> +#include <qstring.h> #include <qlist.h> +#include "htmlattrib.h" enum Tokens { @@ -53,24 +54,16 @@ enum Tokens RetVal_SwitchLang = 0x1000E }; -struct Option -{ - QCString name; - QCString value; -}; - struct TokenInfo { - TokenInfo() { options.setAutoDelete(TRUE); } - // unknown token char unknownChar; // command token - QCString name; + QString name; // command text (RCS tag) - QCString text; + QString text; // comment blocks @@ -79,23 +72,23 @@ struct TokenInfo int indent; // sections - QCString sectionId; + QString sectionId; // simple section - QCString simpleSectName; + QString simpleSectName; // verbatim fragment - QCString verb; + QString verb; // xrefitem int id; // html tag - QList<Option> options; + HtmlAttribList attribs; bool endTag; // whitespace - QCString chars; + QString chars; }; // globals diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 9962e52..f26f979 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -19,7 +19,7 @@ %{ #include <qfile.h> -#include <qcstring.h> +#include <qstring.h> #include <qstack.h> #include <qdict.h> @@ -36,7 +36,7 @@ static int g_commentState; TokenInfo *g_token = 0; static int g_inputPos = 0; static const char *g_inputString; -static QCString g_fileName; +static QString g_fileName; struct DocLexerContext { @@ -122,69 +122,68 @@ static int computeIndent(const char *str,int length) return indent; } -/*! converts input string \a opt into a list of Options. Each - * option is a name, value pair. The result is stored in g_token->options +/*! converts input string \a opt into a list of Html Attributes. Each + * attribute is a name, value pair. The result is stored in g_token->attribs */ -static void parseOptions(const QCString &opt) +static void parseHtmlAttribs(const char *att) { - //printf("parseOptions(%s)\n",opt.data()); - QCString options=opt; - g_token->options.clear(); - int len = options.length(); + //printf("parseHtmlAttribs(%s)\n",opt.data()); + QCString attribs=att; + int len = attribs.length(); char c; - int i=0,startName,endName,startOption,endOption; + int i=0,startName,endName,startAttrib,endAttrib; while (i<len) { - c=options.at(i); + c=attribs.at(i); // skip spaces - while (i<len && c==' ') { c=options.at(++i); } + while (i<len && c==' ') { c=attribs.at(++i); } startName=i; // search for end of name - while (i<len && c!=' ' && c!='=') { c=options.at(++i); } + while (i<len && c!=' ' && c!='=') { c=attribs.at(++i); } endName=i; - Option *opt = new Option; - opt->name = options.mid(startName,endName-startName).lower(); + HtmlAttrib opt; + opt.name = attribs.mid(startName,endName-startName).lower(); // skip spaces - while (i<len && c==' ') { c=options.at(++i); } - if (options.at(i)=='=') // option has value + while (i<len && c==' ') { c=attribs.at(++i); } + if (attribs.at(i)=='=') // option has value { i++; // skip spaces - while (i<len && c==' ') { c=options.at(++i); } - if (options.at(i)=='\'') // option '...' + while (i<len && c==' ') { c=attribs.at(++i); } + if (attribs.at(i)=='\'') // option '...' { i++; - startOption=i; + startAttrib=i; // search for matching quote - while (i<len && c!='\'') { c=options.at(++i); } - endOption=i; + while (i<len && c!='\'') { c=attribs.at(++i); } + endAttrib=i; i++; } - else if (options.at(i)=='"') // option "..." + else if (attribs.at(i)=='"') // option "..." { i++; - startOption=i; + startAttrib=i; // search for matching quote - while (i<len && c!='"') { c=options.at(++i); } - endOption=i; + while (i<len && c!='"') { c=attribs.at(++i); } + endAttrib=i; i++; } else // value without any quotes { - startOption=i; + startAttrib=i; // search for separator - while (i<len && c!=' ') { c=options.at(++i); } - endOption=i; + while (i<len && c!=' ') { c=attribs.at(++i); } + endAttrib=i; i++; } - opt->value = options.mid(startOption,endOption-startOption); + opt.value = attribs.mid(startAttrib,endAttrib-startAttrib); } else // start next option { } //printf("=====> Adding option name=<%s> value=<%s>\n", // opt->name.data(),opt->value.data()); - g_token->options.append(opt); + g_token->attribs.append(&opt); } } @@ -241,7 +240,7 @@ WORD1 [^ \t\n\r\\@<>&$#,.]+ WORD2 "."|"," WORD1NQ [^ \t\n\r\\@<>&$#,."]+ WORD2NQ "."|"," -HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" +HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*">" %option noyywrap %option yylineno @@ -269,14 +268,14 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" %% <St_Para>\r /* skip carriage return */ <St_Para>^{LISTITEM} { /* list item */ - QCString text=yytext; + QString text=yytext; int dashPos = text.findRev('-'); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->indent = computeIndent(yytext,dashPos); return TK_LISTITEM; } <St_Para>{BLANK}*\n{LISTITEM} { /* list item on next line */ - QCString text=yytext; + QString text=yytext; text=text.right(text.length()-text.find('\n')-1); int dashPos = text.findRev('-'); g_token->isEnumList = text.at(dashPos+1)=='#'; @@ -284,12 +283,12 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" return TK_LISTITEM; } <St_Para>^{ENDLIST} { /* end list */ - int dotPos = QCString(yytext).findRev('.'); + int dotPos = QString(yytext).findRev('.'); g_token->indent = computeIndent(yytext,dotPos); return TK_ENDLIST; } <St_Para>{BLANK}*\n{ENDLIST} { /* end list on next line */ - QCString text=yytext; + QString text=yytext; text=text.right(text.length()-text.find('\n')-1); int dotPos = text.findRev('.'); g_token->indent = computeIndent(text,dotPos); @@ -302,7 +301,7 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" <St_Para>{SPCMD3} { g_token->name = "form"; bool ok; - g_token->id = QCString(yytext).right(yyleng-6).toInt(&ok); + g_token->id = QString(yytext).right(yyleng-6).toInt(&ok); ASSERT(ok); return TK_COMMAND; } @@ -320,7 +319,7 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" return TK_URL; } <St_Para>"$"{ID}":"[^\n$]+"$" { /* RCS tag */ - QCString tagName(yytext+1); + QString tagName(yytext+1); int i=tagName.find(':'); g_token->name = tagName.left(i); g_token->text = tagName.mid(i+1,tagName.length()-i-2); @@ -334,13 +333,14 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" } <St_Para>{HTMLTAG} { /* html tag */ g_token->name = yytext; + g_token->attribs.clear(); int startNamePos=1; if (g_token->name.at(1)=='/') startNamePos++; - int optSep = g_token->name.find(' '); - if (optSep!=-1) // tag has one or more options + int attSep = g_token->name.find(' '); + if (attSep!=-1) // tag has one or more options { - parseOptions(g_token->name.mid(optSep+1,g_token->name.length()-optSep-2)); - g_token->name=g_token->name.mid(startNamePos,optSep-1).lower(); + parseHtmlAttribs(g_token->name.mid(attSep+1,g_token->name.length()-attSep-2)); + g_token->name=g_token->name.mid(startNamePos,attSep-1).lower(); } else // tag without options, strip brackets { @@ -539,7 +539,7 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" return 0; } <St_XRefItem>[0-9]+\n { - QCString numStr=yytext; + QString numStr=yytext; numStr=numStr.left(yyleng-1); g_token->id=numStr.toInt(); return RetVal_OK; @@ -567,7 +567,7 @@ HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" return TK_WORD; } <St_File>"\""[^\n\"]+"\"" { - QCString text=yytext; + QString text=yytext; g_token->name = text.mid(1,text.length()-2); return TK_WORD; } @@ -615,25 +615,25 @@ void doctokenizerYYsetStateTitle() void doctokenizerYYsetStateCode() { - g_token->verb.resize(0); + g_token->verb=""; BEGIN(St_Code); } void doctokenizerYYsetStateHtmlOnly() { - g_token->verb.resize(0); + g_token->verb=""; BEGIN(St_HtmlOnly); } void doctokenizerYYsetStateLatexOnly() { - g_token->verb.resize(0); + g_token->verb=""; BEGIN(St_LatexOnly); } void doctokenizerYYsetStateVerbatim() { - g_token->verb.resize(0); + g_token->verb=""; BEGIN(St_Verbatim); } diff --git a/src/docvisitor.h b/src/docvisitor.h index 4ccbd0e..3373f16 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -19,6 +19,7 @@ #ifndef _DOCVISITOR_H #define _DOCVISITOR_H +// forward declarations class DocWord; class DocWhiteSpace; class DocAutoList; @@ -73,7 +74,9 @@ class DocCopy; class DocVisitor { public: - /*! @name Visitor functions for leaf nodes */ + /*! @name Visitor functions for leaf nodes + * @{ + */ virtual void visit(DocWord *) = 0; virtual void visit(DocWhiteSpace *) = 0; virtual void visit(DocSymbol *) = 0; @@ -88,8 +91,11 @@ class DocVisitor virtual void visit(DocFormula *) = 0; virtual void visit(DocLinkedWord *) = 0; virtual void visit(DocIndexEntry *) = 0; + /*! @} */ - /*! @name Visitor functions for internal nodes */ + /*! @name Visitor functions for internal nodes + * @{ + */ virtual void visitPre(DocAutoList *) = 0; virtual void visitPost(DocAutoList *) = 0; virtual void visitPre(DocAutoListItem *) = 0; @@ -158,6 +164,7 @@ class DocVisitor virtual void visitPost(DocInternalRef *) = 0; virtual void visitPre(DocCopy *) = 0; virtual void visitPost(DocCopy *) = 0; + /*! @} */ }; #endif diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 3756c21..9164ed6 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1899,7 +1899,7 @@ static void buildFunctionList(Entry *root) { Debug::print(Debug::Functions,0, "FUNCTION_SEC:\n" - " `%s' `%s'::`%s' `%s' relates=`%s' file=`%s' line=`%d' bodyLine=`%d' #tArgLists=%d mGrpId=%d memSpec=%d proto=%d\n", + " `%s' `%s'::`%s' `%s' relates=`%s' file=`%s' line=`%d' bodyLine=`%d' #tArgLists=%d mGrpId=%d memSpec=%d proto=%d docFile=%s\n", root->type.data(), root->parent->name.data(), root->name.data(), @@ -1913,7 +1913,8 @@ static void buildFunctionList(Entry *root) //root->mtArgList ? (int)root->mtArgList->count() : -1, root->mGrpId, root->memSpec, - root->proto + root->proto, + root->docFile.data() ); bool isFriend=root->type.find("friend ")!=-1; diff --git a/src/filedef.cpp b/src/filedef.cpp index 040e458..a2e5e7c 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -186,6 +186,7 @@ void FileDef::writeDocumentation(OutputList &ol) if (Config_getBool("DETAILS_AT_TOP")) { writeDetailedDocumentation(ol); + ol.newParagraph(); } else if (briefDescription()) { diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 2a83ae6..ff2e09c 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -392,6 +392,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (Config_getBool("DETAILS_AT_TOP")) { writeDetailedDocumentation(ol); + ol.newParagraph(); } else if (!briefDescription().isEmpty()) { diff --git a/src/htmlattrib.h b/src/htmlattrib.h new file mode 100644 index 0000000..4715002 --- /dev/null +++ b/src/htmlattrib.h @@ -0,0 +1,53 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2002 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. + * + */ + +#ifndef _HTMLATTRIB_H +#define _HTMLATTRIB_H + +/*! A Html option. A name, value pair */ +struct HtmlAttrib +{ + QString name; + QString value; +}; + +/*! @brief A list of Html attributes. + * + * The Html attributes are deeply copied into the list. + */ +class HtmlAttribList : public QList<HtmlAttrib> +{ + public: + HtmlAttribList() : QList<HtmlAttrib>() { setAutoDelete(TRUE); } + ~HtmlAttribList() { clear(); } + HtmlAttribList(const HtmlAttribList &l) : QList<HtmlAttrib>() + { operator=(l); } + HtmlAttribList &operator=(const HtmlAttribList &l) + { clear(); QList<HtmlAttrib>::operator=(l); return *this; } + private: + QCollection::Item newItem( QCollection::Item d ) + { return (QCollection::Item)new HtmlAttrib(*(HtmlAttrib *)d); } + void deleteItem(QCollection::Item d) + { delete (HtmlAttrib *)d; } +}; + +/*! @brief Html attribute list iterator */ +class HtmlAttribListIterator : public QListIterator<HtmlAttrib> +{ + public: + HtmlAttribListIterator(const HtmlAttribList &l) : QListIterator<HtmlAttrib>(l) {} +}; + +#endif + diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 7e6f385..0d31529 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -25,6 +25,24 @@ #include "dot.h" #include "message.h" +static QString htmlAttribsToString(const HtmlAttribList &attribs) +{ + QString result; + HtmlAttribListIterator li(attribs); + HtmlAttrib *att; + for (li.toFirst();(att=li.current());++li) + { + printf("Found attion name=`%s' value=`%s'\n", + att->name.data(),att->value.data()); + result+=" "; + result+=att->name; + if (!att->value.isEmpty()) result+="=\""+att->value+"\""; + } + return result; +} + +//------------------------------------------------------------------------- + HtmlDocVisitor::HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) { @@ -147,7 +165,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "<div class=\"fragment\"><pre>"; - parseCode(m_ci,s->context(),s->text(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); m_t << "</pre></div>"; break; case DocVerbatim::Verbatim: @@ -177,7 +195,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "<div class=\"fragment\"><pre>"; - parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); m_t << "</pre></div>"; break; case DocInclude::DontInclude: @@ -204,7 +222,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); } if (op->isLast()) { @@ -395,9 +413,9 @@ void HtmlDocVisitor::visitPost(DocSection *) void HtmlDocVisitor::visitPre(DocHtmlList *s) { if (s->type()==DocHtmlList::Ordered) - m_t << "<ol>\n"; + m_t << "<ol" << htmlAttribsToString(s->attribs()) << ">\n"; else - m_t << "<ul>\n"; + m_t << "<ul" << htmlAttribsToString(s->attribs()) << ">\n"; } void HtmlDocVisitor::visitPost(DocHtmlList *s) @@ -408,9 +426,9 @@ void HtmlDocVisitor::visitPost(DocHtmlList *s) m_t << "</ul>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlListItem *) +void HtmlDocVisitor::visitPre(DocHtmlListItem *i) { - m_t << "<li>\n"; + m_t << "<li" << htmlAttribsToString(i->attribs()) << ">\n"; } void HtmlDocVisitor::visitPost(DocHtmlListItem *) @@ -418,9 +436,9 @@ void HtmlDocVisitor::visitPost(DocHtmlListItem *) m_t << "</li>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlPre *) +void HtmlDocVisitor::visitPre(DocHtmlPre *p) { - m_t << "<pre>\n"; + m_t << "<pre" << htmlAttribsToString(p->attribs()) << ">\n"; m_insidePre=TRUE; } @@ -430,9 +448,9 @@ void HtmlDocVisitor::visitPost(DocHtmlPre *) m_t << "</pre>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlDescList *) +void HtmlDocVisitor::visitPre(DocHtmlDescList *dl) { - m_t << "<dl>\n"; + m_t << "<dl" << htmlAttribsToString(dl->attribs()) << ">\n"; } void HtmlDocVisitor::visitPost(DocHtmlDescList *) @@ -440,9 +458,9 @@ void HtmlDocVisitor::visitPost(DocHtmlDescList *) m_t << "</dl>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlDescTitle *) +void HtmlDocVisitor::visitPre(DocHtmlDescTitle *dt) { - m_t << "<dt>"; + m_t << "<dt" << htmlAttribsToString(dt->attribs()) << ">"; } void HtmlDocVisitor::visitPost(DocHtmlDescTitle *) @@ -450,9 +468,9 @@ void HtmlDocVisitor::visitPost(DocHtmlDescTitle *) m_t << "</dt>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlDescData *) +void HtmlDocVisitor::visitPre(DocHtmlDescData *dd) { - m_t << "<dd>"; + m_t << "<dd" << htmlAttribsToString(dd->attribs()) << ">"; } void HtmlDocVisitor::visitPost(DocHtmlDescData *) @@ -460,9 +478,25 @@ void HtmlDocVisitor::visitPost(DocHtmlDescData *) m_t << "</dd>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlTable *) +void HtmlDocVisitor::visitPre(DocHtmlTable *t) { - m_t << "<table border=\"1\" cellspacing=\"3\" cellpadding=\"3\">\n"; + bool hasBorder = FALSE; + bool hasCellSpacing = FALSE; + bool hasCellPadding = FALSE; + + HtmlAttribListIterator li(t->attribs()); + HtmlAttrib *att; + for (li.toFirst();(att=li.current());++li) + { + if (att->name=="border") hasBorder=TRUE; + else if (att->name=="cellspacing") hasCellSpacing=TRUE; + else if (att->name=="cellpadding") hasCellPadding=TRUE; + } + m_t << "<table" << htmlAttribsToString(t->attribs()); + if (!hasBorder) m_t << " border=\"1\""; + if (!hasCellSpacing) m_t << " cellspacing=\"3\""; + if (!hasCellPadding) m_t << " cellpadding=\"3\""; + m_t << ">\n"; } void HtmlDocVisitor::visitPost(DocHtmlTable *) @@ -470,9 +504,9 @@ void HtmlDocVisitor::visitPost(DocHtmlTable *) m_t << "</table>\n"; } -void HtmlDocVisitor::visitPre(DocHtmlRow *) +void HtmlDocVisitor::visitPre(DocHtmlRow *tr) { - m_t << "<tr>\n"; + m_t << "<tr" << htmlAttribsToString(tr->attribs()) << ">\n"; } void HtmlDocVisitor::visitPost(DocHtmlRow *) @@ -482,7 +516,14 @@ void HtmlDocVisitor::visitPost(DocHtmlRow *) void HtmlDocVisitor::visitPre(DocHtmlCell *c) { - if (c->isHeading()) m_t << "<th>"; else m_t << "<td>"; + if (c->isHeading()) + { + m_t << "<th" << htmlAttribsToString(c->attribs()) << ">"; + } + else + { + m_t << "<td" << htmlAttribsToString(c->attribs()) << ">"; + } } void HtmlDocVisitor::visitPost(DocHtmlCell *c) @@ -490,9 +531,18 @@ void HtmlDocVisitor::visitPost(DocHtmlCell *c) if (c->isHeading()) m_t << "</th>"; else m_t << "</td>"; } -void HtmlDocVisitor::visitPre(DocHtmlCaption *) +void HtmlDocVisitor::visitPre(DocHtmlCaption *c) { - m_t << "<caption align=\"bottom\">"; + bool hasAlign = FALSE; + HtmlAttribListIterator li(c->attribs()); + HtmlAttrib *att; + for (li.toFirst();(att=li.current());++li) + { + if (att->name=="align") hasAlign=TRUE; + } + m_t << "<caption" << htmlAttribsToString(c->attribs()); + if (!hasAlign) m_t << " align=\"bottom\""; + m_t << ">"; } void HtmlDocVisitor::visitPost(DocHtmlCaption *) @@ -523,7 +573,8 @@ void HtmlDocVisitor::visitPost(DocHRef *) void HtmlDocVisitor::visitPre(DocHtmlHeader *header) { - m_t << "<h" << header->level() << ">"; + m_t << "<h" << header->level() + << htmlAttribsToString(header->attribs()) << ">"; } void HtmlDocVisitor::visitPost(DocHtmlHeader *header) @@ -535,7 +586,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) { if (img->type()==DocImage::Html) { - QCString baseName=img->name(); + QString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { @@ -573,13 +624,13 @@ void HtmlDocVisitor::visitPost(DocImage *img) void HtmlDocVisitor::visitPre(DocDotFile *df) { - QCString baseName=df->file(); + QString baseName=df->file(); int i; if ((i=baseName.findRev('/'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } - QCString outDir = Config_getString("HTML_OUTPUT"); + QString outDir = Config_getString("HTML_OUTPUT"); writeDotGraphFromFile(df->file(),outDir,baseName,BITMAP); m_t << "<div align=\"center\">" << endl; m_t << "<img src=\"" << baseName << "." @@ -624,8 +675,9 @@ void HtmlDocVisitor::visitPost(DocRef *) void HtmlDocVisitor::visitPre(DocSecRefItem *ref) { - QCString refName=ref->file(); - if (refName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) + QString refName=ref->file(); + if (refName.right(Doxygen::htmlFileExtension.length())!= + QString(Doxygen::htmlFileExtension)) { refName+=Doxygen::htmlFileExtension; } @@ -752,7 +804,7 @@ void HtmlDocVisitor::filter(const char *str) } } -void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +void HtmlDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { QCString *dest; if (!ref.isEmpty()) // link to entity imported via tag file diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 7d3470e..9c944b9 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -23,7 +23,7 @@ class QTextStream; class BaseCodeDocInterface; -class QCString; +class QString; /*! @brief Concrete visitor implementation for HTML output. */ class HtmlDocVisitor : public DocVisitor @@ -130,8 +130,8 @@ class HtmlDocVisitor : public DocVisitor //-------------------------------------- void filter(const char *str); - void startLink(const QCString &ref,const QCString &file, - const QCString &anchor); + void startLink(const QString &ref,const QString &file, + const QString &anchor); void endLink(); //-------------------------------------- diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 7962c0b..eba8971 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -336,8 +336,11 @@ void HtmlGenerator::writeStyleInfo(int part) } else { + // convert style sheet to string + QCString fileStr = fileToString(cssname); + // write the string into the output dir startPlainFile(cssfi.fileName()); - t << fileToString(cssname); + t << fileStr; endPlainFile(); } } diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index bc1b17c..fd66059 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -26,9 +26,9 @@ #include "util.h" #include "message.h" -static QCString escapeLabelName(const char *s) +static QString escapeLabelName(const char *s) { - QCString result; + QString result; const char *p=s; char c; while ((c=*p++)) @@ -44,9 +44,9 @@ static QCString escapeLabelName(const char *s) return result; } -QCString LatexDocVisitor::escapeMakeIndexChars(const char *s) +QString LatexDocVisitor::escapeMakeIndexChars(const char *s) { - QCString result; + QString result; const char *p=s; char str[2]; str[1]=0; char c; @@ -211,7 +211,7 @@ void LatexDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,s->context(),s->text(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); m_t << "\\end{verbatim}\\normalsize" << endl; break; case DocVerbatim::Verbatim: @@ -246,7 +246,7 @@ void LatexDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); m_t << "\\end{verbatim}\\normalsize" << endl; break; case DocInclude::DontInclude: @@ -272,7 +272,7 @@ void LatexDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); } if (op->isLast()) { @@ -648,7 +648,7 @@ void LatexDocVisitor::visitPre(DocImage *img) { m_t << "\\mbox{"; } - QCString gfxName = img->name(); + QString gfxName = img->name(); if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") { gfxName=gfxName.left(gfxName.length()-4); @@ -693,7 +693,7 @@ void LatexDocVisitor::visitPost(DocImage *img) void LatexDocVisitor::visitPre(DocDotFile *df) { - QCString baseName=df->file(); + QString baseName=df->file(); int i; if ((i=baseName.findRev('/'))!=-1) { @@ -703,7 +703,7 @@ void LatexDocVisitor::visitPre(DocDotFile *df) { baseName=baseName.left(baseName.length()-4); } - QCString outDir = Config_getString("LATEX_OUTPUT"); + QString outDir = Config_getString("LATEX_OUTPUT"); writeDotGraphFromFile(df->file(),outDir,baseName,EPS); if (df->hasCaption()) { @@ -883,7 +883,7 @@ void LatexDocVisitor::filter(const char *str) filterLatexString(m_t,str,FALSE,m_insidePre); } -void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +void LatexDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) { diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 504da97..70a6b27 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -23,7 +23,7 @@ class QTextStream; class BaseCodeDocInterface; -class QCString; +class QString; /*! @brief Concrete visitor implementation for LaTeX output. */ class LatexDocVisitor : public DocVisitor @@ -130,10 +130,10 @@ class LatexDocVisitor : public DocVisitor //-------------------------------------- void filter(const char *str); - void startLink(const QCString &ref,const QCString &file, - const QCString &anchor); + void startLink(const QString &ref,const QString &file, + const QString &anchor); void endLink(); - QCString escapeMakeIndexChars(const char *s); + QString escapeMakeIndexChars(const char *s); //-------------------------------------- // state variables diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index 4d038d7..aac6366 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -45,6 +45,7 @@ HEADERS = bufstr.h \ formula.h \ ftvhelp.h \ groupdef.h \ + htmlattrib.h \ htmldocvisitor.h \ htmlgen.h \ htmlhelp.h \ @@ -55,6 +56,7 @@ HEADERS = bufstr.h \ latexdocvisitor.h \ latexgen.h \ logos.h \ + mandocvisitor.h \ mangen.h \ memberdef.h \ membergroup.h \ @@ -152,6 +154,7 @@ SOURCES = ce_lex.cpp \ latexdocvisitor.cpp \ latexgen.cpp \ logos.cpp \ + mandocvisitor.cpp \ mangen.cpp \ memberdef.cpp \ membergroup.cpp \ diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp new file mode 100644 index 0000000..e29765e --- /dev/null +++ b/src/mandocvisitor.cpp @@ -0,0 +1,854 @@ +/****************************************************************************** + * + * + * + * + * Copyright (C) 1997-2002 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#include "mandocvisitor.h" +#include "docparser.h" +#include "language.h" +#include "doxygen.h" +#include "outputgen.h" +#include "code.h" +#include "dot.h" +#include "util.h" +#include "message.h" + +ManDocVisitor::ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) + : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) +{ +} + + //-------------------------------------- + // visitor functions for leaf nodes + //-------------------------------------- + +void ManDocVisitor::visit(DocWord *w) +{ + if (m_hide) return; + filter(w->word()); +} + +void ManDocVisitor::visit(DocLinkedWord *w) +{ + if (m_hide) return; + m_t << "\\fB"; + filter(w->word()); + m_t << "\\fP"; +} + +void ManDocVisitor::visit(DocWhiteSpace *w) +{ + if (m_hide) return; + if (m_insidePre) + { + m_t << w->chars(); + } + else + { + m_t << " "; + } +} + +void ManDocVisitor::visit(DocSymbol *s) +{ + if (m_hide) return; + switch(s->symbol()) + { + case DocSymbol::BSlash: m_t << "$\\backslash$"; break; + case DocSymbol::At: m_t << "@"; break; + case DocSymbol::Less: m_t << "$<$"; break; + case DocSymbol::Greater: m_t << "$>$"; break; + case DocSymbol::Amp: m_t << "\\&"; break; + case DocSymbol::Dollar: m_t << "\\$"; break; + case DocSymbol::Hash: m_t << "\\#"; break; + case DocSymbol::Percent: m_t << "\\%"; break; + case DocSymbol::Copy: m_t << "\\copyright"; break; + case DocSymbol::Apos: m_t << "'"; break; + case DocSymbol::Quot: m_t << "''"; break; + case DocSymbol::Uml: + if (s->letter()=='i') + m_t << "\\\"{\\i}"; + else + m_t << "\\\"{" << s->letter() << "}"; + break; + case DocSymbol::Acute: + if (s->letter()=='i') + m_t << "\\'{\\i}"; + else + m_t << "\\'{" << s->letter() << "}"; + break; + case DocSymbol::Grave: + if (s->letter()=='i') + m_t << "\\`{\\i}"; + else + m_t << "\\`{" << s->letter() << "}"; + break; + case DocSymbol::Circ: + if (s->letter()=='i') + m_t << "\\^{\\i}"; + else + m_t << "\\^{" << s->letter() << "}"; + break; + case DocSymbol::Tilde: m_t << "\\~{" << s->letter() << "}"; break; + case DocSymbol::Szlig: m_t << "\"s"; break; + case DocSymbol::Cedil: m_t << "\\c{" << s->letter() << "}"; break; + case DocSymbol::Ring: m_t << "\\" << s->letter() << s->letter(); break; + case DocSymbol::Nbsp: m_t << "\\ "; break; + default: + err("Error: unknown symbol found\n"); + } +} + +void ManDocVisitor::visit(DocURL *u) +{ + if (m_hide) return; + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\href{" << u->url() << "}"; + } + m_t << "{\\tt " << u->url() << "}"; +} + +void ManDocVisitor::visit(DocLineBreak *) +{ + if (m_hide) return; + m_t << "\\par\n"; +} + +void ManDocVisitor::visit(DocHorRuler *) +{ + if (m_hide) return; + m_t << "\n\n"; +} + +void ManDocVisitor::visit(DocStyleChange *s) +{ + if (m_hide) return; + switch (s->style()) + { + case DocStyleChange::Bold: + if (s->enable()) m_t << "{\\bf "; else m_t << "} "; + break; + case DocStyleChange::Italic: + if (s->enable()) m_t << "{\\em "; else m_t << "} "; + break; + case DocStyleChange::Code: + if (s->enable()) m_t << "{\\tt "; else m_t << "} "; + break; + case DocStyleChange::Subscript: + if (s->enable()) m_t << "$_{\\mbox{"; else m_t << "}}$ "; + break; + case DocStyleChange::Superscript: + if (s->enable()) m_t << "$^{\\mbox{"; else m_t << "}}$ "; + break; + case DocStyleChange::Center: + if (s->enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} "; + break; + case DocStyleChange::Small: + if (s->enable()) m_t << "\\footnotesize "; else m_t << "\\normalsize "; + break; + } +} + +void ManDocVisitor::visit(DocVerbatim *s) +{ + if (m_hide) return; + switch(s->type()) + { + case DocVerbatim::Code: // fall though + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocVerbatim::Verbatim: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_t << s->text(); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocVerbatim::HtmlOnly: + /* nothing */ + break; + case DocVerbatim::LatexOnly: + /* nothing */ + break; + } +} + +void ManDocVisitor::visit(DocAnchor *anc) +{ + if (m_hide) return; + m_t << "\\label{" << anc->anchor() << "}" << endl; + if (!anc->file().isEmpty() && Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hypertarget{" << anc->file() << "_" << anc->anchor() + << "}{}" << endl; + } +} + +void ManDocVisitor::visit(DocInclude *inc) +{ + if (m_hide) return; + switch(inc->type()) + { + case DocInclude::Include: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocInclude::DontInclude: + break; + case DocInclude::HtmlInclude: + break; + case DocInclude::VerbInclude: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_t << inc->text(); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + } +} + +void ManDocVisitor::visit(DocIncOperator *op) +{ + //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", + // op->type(),op->isFirst(),op->isLast(),op->text().data()); + if (op->isFirst()) + { + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_hide = TRUE; + } + if (op->type()!=DocIncOperator::Skip) + { + parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + } + if (op->isLast()) + { + m_hide = FALSE; + m_t << "\\end{verbatim}\\normalsize" << endl; + } + else + { + m_t << endl; + } +} + +void ManDocVisitor::visit(DocFormula *f) +{ + if (m_hide) return; + m_t << f->text(); +} + +void ManDocVisitor::visit(DocIndexEntry *i) +{ + m_t << "\\index{" << i->entry() << "@{"; + m_t << "}}"; +} + +//-------------------------------------- +// visitor functions for compound nodes +//-------------------------------------- + +void ManDocVisitor::visitPre(DocAutoList *l) +{ + if (l->isEnumList()) + { + m_t << "\\begin{enumerate}" << endl; + } + else + { + m_t << "\\begin{itemize}" << endl; + } +} + +void ManDocVisitor::visitPost(DocAutoList *l) +{ + if (l->isEnumList()) + { + m_t << "\\end{enumerate}" << endl; + } + else + { + m_t << "\\end{itemize}" << endl; + } +} + +void ManDocVisitor::visitPre(DocAutoListItem *) +{ + m_t << "\\item "; +} + +void ManDocVisitor::visitPost(DocAutoListItem *) +{ +} + +void ManDocVisitor::visitPre(DocPara *) +{ +} + +void ManDocVisitor::visitPost(DocPara *p) +{ + if (!p->isLast() && // omit <p> for last paragraph + !(p->parent() && // and for parameter sections + p->parent()->kind()==DocNode::Kind_ParamSect + ) + ) m_t << endl << endl; +} + +void ManDocVisitor::visitPre(DocRoot *) +{ +} + +void ManDocVisitor::visitPost(DocRoot *) +{ +} + +void ManDocVisitor::visitPre(DocSimpleSect *s) +{ + m_t << "\\begin{Desc}\n\\item["; + switch(s->type()) + { + case DocSimpleSect::See: + m_t << theTranslator->trSeeAlso(); break; + case DocSimpleSect::Return: + m_t << theTranslator->trReturns(); break; + case DocSimpleSect::Author: + m_t << theTranslator->trAuthor(TRUE,TRUE); break; + case DocSimpleSect::Authors: + m_t << theTranslator->trAuthor(TRUE,FALSE); break; + case DocSimpleSect::Version: + m_t << theTranslator->trVersion(); break; + case DocSimpleSect::Since: + m_t << theTranslator->trSince(); break; + case DocSimpleSect::Date: + m_t << theTranslator->trDate(); break; + case DocSimpleSect::Note: + m_t << theTranslator->trNote(); break; + case DocSimpleSect::Warning: + m_t << theTranslator->trWarning(); break; + case DocSimpleSect::Pre: + m_t << theTranslator->trPrecondition(); break; + case DocSimpleSect::Post: + m_t << theTranslator->trPostcondition(); break; + case DocSimpleSect::Invar: + m_t << theTranslator->trInvariant(); break; + case DocSimpleSect::Remark: + m_t << theTranslator->trRemarks(); break; + case DocSimpleSect::Attention: + m_t << theTranslator->trAttention(); break; + case DocSimpleSect::User: break; + case DocSimpleSect::Unknown: break; + } + + // special case 1: user defined title + if (s->type()!=DocSimpleSect::User) + { + m_t << ":]"; + } +} + +void ManDocVisitor::visitPost(DocSimpleSect *) +{ + m_t << "\\end{Desc}" << endl; +} + +void ManDocVisitor::visitPre(DocTitle *) +{ +} + +void ManDocVisitor::visitPost(DocTitle *) +{ + m_t << "]"; +} + +void ManDocVisitor::visitPre(DocSimpleList *) +{ + m_t << "\\begin{itemize}" << endl; +} + +void ManDocVisitor::visitPost(DocSimpleList *) +{ + m_t << "\\end{itemize}" << endl; +} + +void ManDocVisitor::visitPre(DocSimpleListItem *) +{ + m_t << "\\item "; +} + +void ManDocVisitor::visitPost(DocSimpleListItem *) +{ +} + +void ManDocVisitor::visitPre(DocSection *s) +{ + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hypertarget{" << s->file() << "_" << s->anchor() << "}{}"; + } + if (Config_getBool("COMPACT_LATEX")) + { + switch(s->level()) + { + case 1: m_t << "\\subsubsection{"; break; + case 2: m_t << "\\paragraph{"; break; + case 3: m_t << "\\subparagraph{"; break; + case 4: m_t << "\\subparagraph{"; break; + } + } + else + { + switch(s->level()) + { + case 1: m_t << "\\subsection{"; break; + case 2: m_t << "\\subsubsection{"; break; + case 3: m_t << "\\paragraph{"; break; + case 4: m_t << "\\subparagraph{"; break; + } + } + filter(s->title()); + m_t << "}\\label{" << s->anchor() << "}" << endl; +} + +void ManDocVisitor::visitPost(DocSection *) +{ +} + +void ManDocVisitor::visitPre(DocHtmlList *s) +{ + if (s->type()==DocHtmlList::Ordered) + m_t << "\\begin{enumerate}" << endl; + else + m_t << "\\begin{itemize}" << endl; +} + +void ManDocVisitor::visitPost(DocHtmlList *s) +{ + if (s->type()==DocHtmlList::Ordered) + m_t << "\\end{enumerate}" << endl; + else + m_t << "\\end{itemize}" << endl; +} + +void ManDocVisitor::visitPre(DocHtmlListItem *) +{ + m_t << "\\item "; +} + +void ManDocVisitor::visitPost(DocHtmlListItem *) +{ +} + +void ManDocVisitor::visitPre(DocHtmlPre *) +{ + m_t << "\\small\\begin{alltt}"; + m_insidePre=TRUE; +} + +void ManDocVisitor::visitPost(DocHtmlPre *) +{ + m_insidePre=FALSE; + m_t << "\\end{alltt}\\normalsize " << endl; +} + +void ManDocVisitor::visitPre(DocHtmlDescList *) +{ + m_t << "\\begin{description}" << endl; +} + +void ManDocVisitor::visitPost(DocHtmlDescList *) +{ + m_t << "\\end{description}" << endl; +} + +void ManDocVisitor::visitPre(DocHtmlDescTitle *) +{ + m_t << "\\item["; +} + +void ManDocVisitor::visitPost(DocHtmlDescTitle *) +{ + m_t << "]"; +} + +void ManDocVisitor::visitPre(DocHtmlDescData *) +{ +} + +void ManDocVisitor::visitPost(DocHtmlDescData *) +{ +} + +void ManDocVisitor::visitPre(DocHtmlTable *t) +{ + if (t->hasCaption()) + { + m_t << "\\begin{table}[h]"; + } + m_t << "\\begin{TabularC}{" << t->numCols() << "}\n\\hline\n"; +} + +void ManDocVisitor::visitPost(DocHtmlTable *t) +{ + if (t->hasCaption()) + { + m_t << "\\end{table}\n"; + } + else + { + m_t << "\\\\\\hline\n\\end{TabularC}\n"; + } +} + +void ManDocVisitor::visitPre(DocHtmlCaption *) +{ + m_t << "\\\\\\hline\n\\end{TabularC}\n\\centering\n\\caption{"; +} + +void ManDocVisitor::visitPost(DocHtmlCaption *) +{ + m_t << "}\n"; +} + +void ManDocVisitor::visitPre(DocHtmlRow *) +{ +} + +void ManDocVisitor::visitPost(DocHtmlRow *) +{ + m_t << "\\\\\\hline\n"; +} + +void ManDocVisitor::visitPre(DocHtmlCell *) +{ +} + +void ManDocVisitor::visitPost(DocHtmlCell *c) +{ + if (!c->isLast()) m_t << "&"; +} + +void ManDocVisitor::visitPre(DocInternal *) +{ + m_t << "\\begin{Desc}" << endl + << "\\item[" << theTranslator->trForInternalUseOnly() << "]" << endl; +} + +void ManDocVisitor::visitPost(DocInternal *) +{ + m_t << "\\end{Desc}" << endl; +} + +void ManDocVisitor::visitPre(DocHRef *href) +{ + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\href{"; + m_t << href->url(); + m_t << "}"; + } + m_t << "{\\tt "; +} + +void ManDocVisitor::visitPost(DocHRef *) +{ + m_t << "}"; +} + +void ManDocVisitor::visitPre(DocHtmlHeader *header) +{ + if (Config_getBool("COMPACT_LATEX")) + { + switch(header->level()) + { + case 1: m_t << "\\subsection*{"; break; + case 2: m_t << "\\subsubsection*{"; break; + case 3: m_t << "\\paragraph*{"; break; + } + } + else + { + switch(header->level()) + { + case 1: m_t << "\\section*{"; break; + case 2: m_t << "\\subsection*{"; break; + case 3: m_t << "\\subsubsection*{"; break; + } + } +} + +void ManDocVisitor::visitPost(DocHtmlHeader *) +{ + m_t << "}"; +} + +void ManDocVisitor::visitPre(DocImage *img) +{ + if (img->type()==DocImage::Latex) + { + if (img->hasCaption()) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + QString gfxName = img->name(); + if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") + { + gfxName=gfxName.left(gfxName.length()-4); + } + m_t << "\\includegraphics"; + if (!img->width().isEmpty()) + { + m_t << "[width=" << img->width() << "]"; + } + else if (!img->height().isEmpty()) + { + m_t << "[height=" << img->height() << "]"; + } + m_t << "{" << gfxName << "}"; + if (img->hasCaption()) + { + m_t << "\\caption{"; + } + } + else // other format -> skip + { + m_hide=TRUE; + } +} + +void ManDocVisitor::visitPost(DocImage *img) +{ + if (img->type()==DocImage::Latex) + { + m_t << "}" << endl; // end mbox or caption + if (img->hasCaption()) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } + } + else // other format + { + m_hide=FALSE; + } +} + +void ManDocVisitor::visitPre(DocDotFile *df) +{ + QString baseName=df->file(); + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") + { + baseName=baseName.left(baseName.length()-4); + } + QString outDir = Config_getString("LATEX_OUTPUT"); + writeDotGraphFromFile(df->file(),outDir,baseName,EPS); + if (df->hasCaption()) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + m_t << "\\includegraphics"; + if (!df->width().isEmpty()) + { + m_t << "[width=" << df->width() << "]"; + } + else if (!df->height().isEmpty()) + { + m_t << "[height=" << df->height() << "]"; + } + m_t << "{" << baseName << "}"; + + if (df->hasCaption()) + { + m_t << "\\caption{"; + } +} + +void ManDocVisitor::visitPost(DocDotFile *df) +{ + m_t << "}" << endl; // end mbox or caption + if (df->hasCaption()) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } +} + +void ManDocVisitor::visitPre(DocLink *) +{ + m_t << "\\fB "; +} + +void ManDocVisitor::visitPost(DocLink *) +{ + m_t << "\\fP "; +} + +void ManDocVisitor::visitPre(DocRef *ref) +{ + m_t << "\\fB "; + if (!ref->hasLinkText()) filter(ref->targetTitle()); +} + +void ManDocVisitor::visitPost(DocRef *) +{ + m_t << "\\fP "; +} + +void ManDocVisitor::visitPre(DocSecRefItem *) +{ + m_t << "\\item \\contentsline{section}{"; +} + +void ManDocVisitor::visitPost(DocSecRefItem *ref) +{ + m_t << "}{\\ref{" << ref->anchor() << "}}{}" << endl; +} + +void ManDocVisitor::visitPre(DocSecRefList *) +{ + m_t << "\\footnotesize" << endl; + m_t << "\\begin{multicols}{2}" << endl; + m_t << "\\begin{CompactList}" << endl; +} + +void ManDocVisitor::visitPost(DocSecRefList *) +{ + m_t << "\\end{CompactList}" << endl; + m_t << "\\end{multicols}" << endl; + m_t << "\\normalsize" << endl; +} + +void ManDocVisitor::visitPre(DocLanguage *) +{ +} + +void ManDocVisitor::visitPost(DocLanguage *) +{ +} + +void ManDocVisitor::visitPre(DocParamSect *s) +{ + m_t << "\\begin{Desc}" << endl; + m_t << "\\item["; + switch(s->type()) + { + case DocParamSect::Param: + m_t << theTranslator->trParameters(); break; + case DocParamSect::RetVal: + m_t << theTranslator->trReturnValues(); break; + case DocParamSect::Exception: + m_t << theTranslator->trExceptions(); break; + default: + ASSERT(0); + } + m_t << ":]" << endl; + m_t << "\\begin{description}" << endl; +} + +void ManDocVisitor::visitPost(DocParamSect *) +{ + m_t << "\\end{description}" << endl; + m_t << "\\end{Desc}" << endl; +} + +void ManDocVisitor::visitPre(DocParamList *pl) +{ + m_t << "\\item[{\\em "; + QStrListIterator li(pl->parameters()); + const char *s; + bool first=TRUE; + for (li.toFirst();(s=li.current());++li) + { + if (!first) m_t << ","; else first=FALSE; + m_t << s; + } + m_t << "}]"; +} + +void ManDocVisitor::visitPost(DocParamList *) +{ +} + +void ManDocVisitor::visitPre(DocXRefItem *x) +{ + m_t << "\\begin{Desc}" << endl; + m_t << "\\item["; + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hyperlink{" << x->file() << "_" << x->anchor() << "}{"; + } + else + { + m_t << "{\\bf "; + } + filter(x->title()); + m_t << "}]"; +} + +void ManDocVisitor::visitPost(DocXRefItem *) +{ + m_t << "\\end{Desc}" << endl; +} + +void ManDocVisitor::visitPre(DocInternalRef *) +{ + m_t << "\\fB "; +} + +void ManDocVisitor::visitPost(DocInternalRef *) +{ + m_t << "\\fP "; +} + +void ManDocVisitor::visitPre(DocCopy *) +{ +} + +void ManDocVisitor::visitPost(DocCopy *) +{ +} + +void ManDocVisitor::filter(const char *str) +{ + if (str) + { + const char *p=str; + char c=0; + while ((c=*p++)) + { + switch(c) + { + case '\\': m_t << "\\\\"; break; + case '"': c = '\''; // fall through + default: m_t << c; break; + } + } + } +} + diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h new file mode 100644 index 0000000..8dd75f6 --- /dev/null +++ b/src/mandocvisitor.h @@ -0,0 +1,144 @@ +/****************************************************************************** + * + * + * + * + * Copyright (C) 1997-2002 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef _MANDOCVISITOR_H +#define _MANDOCVISITOR_H + +#include "docvisitor.h" + +class QTextStream; +class BaseCodeDocInterface; +class QString; + +/*! @brief Concrete visitor implementation for LaTeX output. */ +class ManDocVisitor : public DocVisitor +{ + public: + ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci); + + //-------------------------------------- + // visitor functions for leaf nodes + //-------------------------------------- + + void visit(DocWord *); + void visit(DocLinkedWord *); + void visit(DocWhiteSpace *); + void visit(DocSymbol *); + void visit(DocURL *); + void visit(DocLineBreak *); + void visit(DocHorRuler *); + void visit(DocStyleChange *); + void visit(DocVerbatim *); + void visit(DocAnchor *); + void visit(DocInclude *); + void visit(DocIncOperator *); + void visit(DocFormula *); + void visit(DocIndexEntry *); + + //-------------------------------------- + // visitor functions for compound nodes + //-------------------------------------- + + void visitPre(DocAutoList *); + void visitPost(DocAutoList *); + void visitPre(DocAutoListItem *); + void visitPost(DocAutoListItem *); + void visitPre(DocPara *); + void visitPost(DocPara *); + void visitPre(DocRoot *); + void visitPost(DocRoot *); + void visitPre(DocSimpleSect *); + void visitPost(DocSimpleSect *); + void visitPre(DocTitle *); + void visitPost(DocTitle *); + void visitPre(DocSimpleList *); + void visitPost(DocSimpleList *); + void visitPre(DocSimpleListItem *); + void visitPost(DocSimpleListItem *); + void visitPre(DocSection *s); + void visitPost(DocSection *); + void visitPre(DocHtmlList *s); + void visitPost(DocHtmlList *s); + void visitPre(DocHtmlListItem *); + void visitPost(DocHtmlListItem *); + void visitPre(DocHtmlPre *); + void visitPost(DocHtmlPre *); + void visitPre(DocHtmlDescList *); + void visitPost(DocHtmlDescList *); + void visitPre(DocHtmlDescTitle *); + void visitPost(DocHtmlDescTitle *); + void visitPre(DocHtmlDescData *); + void visitPost(DocHtmlDescData *); + void visitPre(DocHtmlTable *t); + void visitPost(DocHtmlTable *t); + void visitPre(DocHtmlCaption *); + void visitPost(DocHtmlCaption *); + void visitPre(DocHtmlRow *); + void visitPost(DocHtmlRow *) ; + void visitPre(DocHtmlCell *); + void visitPost(DocHtmlCell *); + void visitPre(DocInternal *); + void visitPost(DocInternal *); + void visitPre(DocHRef *); + void visitPost(DocHRef *); + void visitPre(DocHtmlHeader *); + void visitPost(DocHtmlHeader *) ; + void visitPre(DocImage *); + void visitPost(DocImage *); + void visitPre(DocDotFile *); + void visitPost(DocDotFile *); + void visitPre(DocLink *lnk); + void visitPost(DocLink *); + void visitPre(DocRef *ref); + void visitPost(DocRef *); + void visitPre(DocSecRefItem *); + void visitPost(DocSecRefItem *); + void visitPre(DocSecRefList *); + void visitPost(DocSecRefList *); + void visitPre(DocLanguage *); + void visitPost(DocLanguage *); + void visitPre(DocParamSect *); + void visitPost(DocParamSect *); + void visitPre(DocParamList *); + void visitPost(DocParamList *); + void visitPre(DocXRefItem *); + void visitPost(DocXRefItem *); + void visitPre(DocInternalRef *); + void visitPost(DocInternalRef *); + void visitPre(DocCopy *); + void visitPost(DocCopy *); + + private: + + //-------------------------------------- + // helper functions + //-------------------------------------- + + void filter(const char *str); + + //-------------------------------------- + // state variables + //-------------------------------------- + + QTextStream &m_t; + BaseCodeDocInterface &m_ci; + bool m_insidePre; + bool m_hide; +}; + +#endif diff --git a/src/mangen.cpp b/src/mangen.cpp index 6464790..bf99072 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -29,6 +29,7 @@ #include "doxygen.h" #include <string.h> #include "docparser.h" +#include "mandocvisitor.h" static QCString getExtension() { @@ -613,7 +614,10 @@ void ManGenerator::endParamList() { } -void ManGenerator::printDoc(DocNode *) +void ManGenerator::printDoc(DocNode *n) { + ManDocVisitor *visitor = new ManDocVisitor(t,*this); + n->accept(visitor); + delete visitor; } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 6932f7d..659cde8 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -554,8 +554,8 @@ bool MemberDef::isBriefSectionVisible() const { //printf("Member %s grpId=%d docs=%s file=%s args=%s\n", // name().data(), - // grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), - // getFileDef()->name().data(), + // 0,"", //grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), + // "", //getFileDef()->name().data(), // argsString()); bool hasDocs = hasDocumentation() || // part of a documented member group @@ -600,8 +600,10 @@ bool MemberDef::isBriefSectionVisible() const ); // hide member if it overrides a member in a superclass and has no - // documentation - bool visibleIfDocVirtual = (reimplements() || hasDocs); + // documentation of its own + //bool visibleIfDocVirtual = !reimplements() || + // !Config_getBool("INHERIT_DOCS") || + // hasDocs; // true if this member is a constructor or destructor bool cOrDTor = isConstructor() || isDestructor(); @@ -624,7 +626,7 @@ bool MemberDef::isBriefSectionVisible() const bool visible = visibleIfStatic && visibleIfDocumented && visibleIfEnabled && visibleIfPrivate && - visibleIfDocVirtual && visibleIfNotDefaultCDTor && + /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && visibleIfFriendCompound && !annScope; //printf("MemberDef::isBriefSectionVisible() %d\n",visible); @@ -1539,6 +1541,10 @@ void MemberDef::warnIfUndocumented() else t="file", d=fd; + //printf("warnIfUndoc: d->isLinkable()=%d isLinkable()=%d " + // "isDocumentedFriendClass()=%d name()=%s prot=%d\n", + // d->isLinkable(),isLinkable(),isDocumentedFriendClass(), + // name().data(),prot); if (d && d->isLinkable() && !isLinkable() && !isDocumentedFriendClass() && name().find('@')==-1 && diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 6403053..893ff96 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -248,6 +248,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) if (Config_getBool("DETAILS_AT_TOP")) { writeDetailedDocumentation(ol); + ol.newParagraph(); } else if (!briefDescription().isEmpty()) { diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 40f3398..d9b16a4 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -32,9 +32,9 @@ RTFDocVisitor::RTFDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) { } -QCString RTFDocVisitor::getStyle(const char *name) +QString RTFDocVisitor::getStyle(const char *name) { - QCString n; + QString n; n.sprintf("%s%d",name,m_indentLevel); StyleData *sd = rtf_Style[n]; ASSERT(sd!=0); @@ -271,7 +271,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); - parseCode(m_ci,s->context(),s->text(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); m_t << "\\par" << endl; m_t << "}" << endl; break; @@ -295,7 +295,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) void RTFDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; - QCString anchor; + QString anchor; if (!anc->file().isEmpty()) { anchor+=anc->file(); @@ -321,7 +321,7 @@ void RTFDocVisitor::visit(DocInclude *inc) m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); - parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); m_t << "\\par" << endl; m_t << "}" << endl; break; @@ -353,7 +353,7 @@ void RTFDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); } if (op->isLast()) { @@ -534,7 +534,7 @@ void RTFDocVisitor::visitPre(DocSection *s) { m_t << "{" // start section << rtf_Style_Reset; - QCString heading; + QString heading; int level = QMIN(s->level()+2,4); heading.sprintf("Heading%d",level); // set style @@ -750,7 +750,7 @@ void RTFDocVisitor::visitPre(DocHtmlHeader *header) { m_t << "{" // start section << rtf_Style_Reset; - QCString heading; + QString heading; int level = QMIN(header->level()+2,4); heading.sprintf("Heading%d",level); // set style @@ -793,13 +793,13 @@ void RTFDocVisitor::visitPost(DocImage *) void RTFDocVisitor::visitPre(DocDotFile *df) { - QCString baseName=df->file(); + QString baseName=df->file(); int i; if ((i=baseName.findRev('/'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } - QCString outDir = Config_getString("RTF_OUTPUT"); + QString outDir = Config_getString("RTF_OUTPUT"); writeDotGraphFromFile(df->file(),outDir,baseName,BITMAP); m_t << "\\par" << endl; m_t << "{" << endl; @@ -927,7 +927,7 @@ void RTFDocVisitor::visitPre(DocXRefItem *x) m_t << "\\par" << endl; if (Config_getBool("RTF_HYPERLINKS")) { - QCString refName; + QString refName; if (!x->file().isEmpty()) { refName+=x->file(); @@ -1033,11 +1033,11 @@ void RTFDocVisitor::filter(const char *str) } } -void RTFDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +void RTFDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS")) { - QCString refName; + QString refName; if (!file.isEmpty()) { refName+=file; @@ -1059,7 +1059,7 @@ void RTFDocVisitor::startLink(const QCString &ref,const QCString &file,const QCS } } -void RTFDocVisitor::endLink(const QCString &ref) +void RTFDocVisitor::endLink(const QString &ref) { if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS")) { diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 0f7649a..f0b2b20 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -23,7 +23,7 @@ class QTextStream; class BaseCodeDocInterface; -class QCString; +class QString; /*! @brief Concrete visitor implementation for RTF output. */ class RTFDocVisitor : public DocVisitor @@ -130,10 +130,10 @@ class RTFDocVisitor : public DocVisitor //-------------------------------------- void filter(const char *str); - void startLink(const QCString &ref,const QCString &file, - const QCString &anchor); - void endLink(const QCString &ref); - QCString getStyle(const char *name); + void startLink(const QString &ref,const QString &file, + const QString &anchor); + void endLink(const QString &ref); + QString getStyle(const char *name); void incIndentLevel(); void decIndentLevel(); diff --git a/src/scanner.l b/src/scanner.l index 1d7eec8..5a5d9c0 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3925,33 +3925,33 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) yyLineNr++; } <SkipSection>"//"|"*/" -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { // previous section enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { // section was enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { // section enabled => absorb endif } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"ingroup"{B}+ { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"ingroup"{B}+ { lastGroupContext = YY_START; lineCount(); BEGIN( GroupName ); } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"nosubgrouping"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"nosubgrouping"/[^a-z_A-Z0-9] { current->subGrouping = FALSE; } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"showinitializer"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"showinitializer"/[^a-z_A-Z0-9] { current->initLines = 100000; // ON } -<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"hideinitializer"/[^a-z_A-Z0-9] { +<ClassDoc,ClassDocBrief,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"hideinitializer"/[^a-z_A-Z0-9] { current->initLines = 0; // OFF } <GroupName>{ID} { @@ -3992,7 +3992,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } else { - yyLineNr++; + if (yytext[yyleng-1]=='\n') yyLineNr++; } BEGIN( lastBriefContext ); } @@ -4295,7 +4295,18 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc>"\\"[a-z_A-Z][a-z_A-Z0-9]*[\\] { // directory type of text current->doc+=yytext; } -<Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc,CopyArgComment,SkipSection>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { +<SkipSection>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { + QCString *pValue=Doxygen::aliasDict[yytext+1]; + if (pValue) + { + int i,l=pValue->length(); + for (i=l-1;i>=0;i--) + { + unput(pValue->at(i)); + } + } + } +<Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc,CopyArgComment>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { bool handled=FALSE; if ( useOverrideCommands) { @@ -4338,9 +4349,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) if (pValue) { int i,l=pValue->length(); + char c; for (i=l-1;i>=0;i--) { - unput(pValue->at(i)); + c=pValue->at(i); + unput(c); + if (c=='\n') yyLineNr--; } } else diff --git a/src/translator_fr.h b/src/translator_fr.h index 945c198..a30fcd8 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -37,6 +37,8 @@ * -------------+------------------------------------------------------------ * 2002-07-11 | Update for new since 1.2.16 * -------------+------------------------------------------------------------ + * 2002-09-24 | Update for new since 1.2.17 + * -------------+------------------------------------------------------------ */ #ifndef TRANSLATOR_FR_H #define TRANSLATOR_FR_H @@ -1268,6 +1270,17 @@ class TranslatorFrench : public TranslatorAdapter_1_2_17 return "Table des matières"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.2.17 +////////////////////////////////////////////////////////////////////////// + + /*! Used as the header of the list of item that have been + * flagged deprecated + */ + virtual QCString trDeprecatedList() + { + return "Liste obsolète"; + } }; diff --git a/src/util.cpp b/src/util.cpp index 65d2069..979911a 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2569,9 +2569,11 @@ bool generateLink(OutputDocInterface &od,const char *clName, } else if (compound) // link to compound { - if (lt==0 && compound->definitionType()==Definition::TypeGroup) + if (lt==0 && anchor.isEmpty() && /* compound link */ + compound->definitionType()==Definition::TypeGroup /* is group */ + ) { - linkText=((GroupDef *)compound)->groupTitle(); + linkText=((GroupDef *)compound)->groupTitle(); // use group's title as link } od.writeObjectLink(compound->getReference(), compound->getOutputFileBase(),anchor,linkText); diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index d65d2fa..43fda0b 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -148,7 +148,7 @@ void XmlDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "<programlisting>"; - parseCode(m_ci,s->context(),s->text(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); m_t << "</programlisting>"; break; case DocVerbatim::Verbatim: @@ -182,7 +182,7 @@ void XmlDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "<programlisting>"; - parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); m_t << "</programlisting>"; break; case DocInclude::DontInclude: @@ -211,7 +211,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); } if (op->isLast()) { @@ -536,7 +536,7 @@ void XmlDocVisitor::visitPre(DocImage *img) } m_t << "\""; - QCString baseName=img->name(); + QString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { @@ -719,7 +719,7 @@ void XmlDocVisitor::filter(const char *str) } } -void XmlDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +void XmlDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { m_t << "<ref refid=\"" << file; if (!anchor.isEmpty()) m_t << "_1" << anchor; diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 381c2b6..83db6c3 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -23,9 +23,9 @@ class QTextStream; class BaseCodeDocInterface; -class QCString; +class QString; -/*! @brief Concrete visitor implementation for HTML output. */ +/*! @brief Concrete visitor implementation for XML output. */ class XmlDocVisitor : public DocVisitor { public: @@ -130,8 +130,8 @@ class XmlDocVisitor : public DocVisitor //-------------------------------------- void filter(const char *str); - void startLink(const QCString &ref,const QCString &file, - const QCString &anchor); + void startLink(const QString &ref,const QString &file, + const QString &anchor); void endLink(); //-------------------------------------- diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index f29af33..cabc130 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1199,7 +1199,7 @@ static void writeXMLDocBlock(QTextStream &t, const QCString &text) { QCString stext = text.stripWhiteSpace(); - if (text.isEmpty()) return; + if (stext.isEmpty()) return; // convert the documentation string into an abstract syntax tree DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext); // create a code generator @@ -1489,20 +1489,20 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De t << "</initializer>" << endl; } t << " <briefdescription>" << endl; - writeXMLDocBlock(t,emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->briefDescription()); + writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),scopeName,emd,emd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->documentation()); + writeXMLDocBlock(t,emd->docFile(),emd->docLine(),scopeName,emd,emd->documentation()); t << " </detaileddescription>" << endl; t << " </enumvalue>" << endl; } } } t << " <briefdescription>" << endl; - writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(),scopeName,md,md->briefDescription()); + writeXMLDocBlock(t,md->briefFile(),md->briefLine(),scopeName,md,md->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(),scopeName,md,md->documentation()); + writeXMLDocBlock(t,md->docFile(),md->docLine(),scopeName,md,md->documentation()); t << " </detaileddescription>" << endl; if (md->getDefLine()!=-1) { @@ -1763,10 +1763,10 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) generateXMLSection(cd,ti,t,&cd->related,"related"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->briefDescription()); + writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd->name(),0,cd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->documentation()); + writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd->name(),0,cd->documentation()); t << " </detaileddescription>" << endl; DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance); if (!inheritanceGraph.isTrivial()) @@ -1868,10 +1868,10 @@ static void generateXMLForNamespace(NamespaceDef *nd,QTextStream &ti) generateXMLSection(nd,ti,t,&nd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,nd->getDefFileName(),nd->getDefLine(),0,0,nd->briefDescription()); + writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),0,0,nd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,nd->getDefFileName(),nd->getDefLine(),0,0,nd->documentation()); + writeXMLDocBlock(t,nd->docFile(),nd->docLine(),0,0,nd->documentation()); t << " </detaileddescription>" << endl; t << " <location file=\"" << nd->getDefFileName() << "\" line=\"" @@ -2002,10 +2002,10 @@ static void generateXMLForFile(FileDef *fd,QTextStream &ti) generateXMLSection(fd,ti,t,&fd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription()); + writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),0,0,fd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation()); + writeXMLDocBlock(t,fd->docFile(),fd->docLine(),0,0,fd->documentation()); t << " </detaileddescription>" << endl; t << " <programlisting>" << endl; writeXMLCodeBlock(t,fd); @@ -2125,10 +2125,10 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) generateXMLSection(gd,ti,t,&gd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,gd->getDefFileName(),gd->getDefLine(),0,0,gd->briefDescription()); + writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),0,0,gd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,gd->getDefFileName(),gd->getDefLine(),0,0,gd->documentation()); + writeXMLDocBlock(t,gd->docFile(),gd->docLine(),0,0,gd->documentation()); t << " </detaileddescription>" << endl; t << " </compounddef>" << endl; t << "</doxygen>" << endl; |