diff options
Diffstat (limited to 'src')
105 files changed, 6795 insertions, 3482 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 155bf77..6763cf5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,28 +85,28 @@ add_custom_command( set_source_files_properties(${GENERATED_SRC}/layout_default.xml.h PROPERTIES GENERATED 1) # Targets for flex/bison generated files -FLEX_TARGET(scanner scanner.l ${GENERATED_SRC}/scanner.cpp COMPILE_FLAGS "-PscannerYY") -FLEX_TARGET(code code.l ${GENERATED_SRC}/code.cpp COMPILE_FLAGS "-PcodeYY") -FLEX_TARGET(pyscanner pyscanner.l ${GENERATED_SRC}/pyscanner.cpp COMPILE_FLAGS "-PpyscannerYY") -FLEX_TARGET(pycode pycode.l ${GENERATED_SRC}/pycode.cpp COMPILE_FLAGS "-PpycodeYY") -FLEX_TARGET(fortranscanner fortranscanner.l ${GENERATED_SRC}/fortranscanner.cpp COMPILE_FLAGS "-PfortranscannerYY -i") -FLEX_TARGET(fortrancode fortrancode.l ${GENERATED_SRC}/fortrancode.cpp COMPILE_FLAGS "-PfortrancodeYY -i") -FLEX_TARGET(vhdlcode vhdlcode.l ${GENERATED_SRC}/vhdlcode.cpp COMPILE_FLAGS "-PvhdlcodeYY -i") -FLEX_TARGET(tclscanner tclscanner.l ${GENERATED_SRC}/tclscanner.cpp COMPILE_FLAGS "-PtclscannerYY -i") -FLEX_TARGET(pre pre.l ${GENERATED_SRC}/pre.cpp COMPILE_FLAGS "-PpreYY") -FLEX_TARGET(declinfo declinfo.l ${GENERATED_SRC}/declinfo.cpp COMPILE_FLAGS "-PdeclinfoYY") -FLEX_TARGET(defargs defargs.l ${GENERATED_SRC}/defargs.cpp COMPILE_FLAGS "-PdefargsYY") -FLEX_TARGET(doctokenizer doctokenizer.l ${GENERATED_SRC}/doctokenizer.cpp COMPILE_FLAGS "-PdoctokenizerYY") -FLEX_TARGET(commentcnv commentcnv.l ${GENERATED_SRC}/commentcnv.cpp COMPILE_FLAGS "-PcommentcnvYY") -FLEX_TARGET(commentscan commentscan.l ${GENERATED_SRC}/commentscan.cpp COMPILE_FLAGS "-PcommentscanYY") -FLEX_TARGET(constexp constexp.l ${GENERATED_SRC}/constexp.cpp COMPILE_FLAGS "-PconstexpYY") -FLEX_TARGET(xmlcode xmlcode.l ${GENERATED_SRC}/xmlcode.cpp COMPILE_FLAGS "-PxmlcodeYY") -FLEX_TARGET(config config.l ${GENERATED_SRC}/config.cpp COMPILE_FLAGS "-PconfigYY") - -BISON_TARGET(vhdlparser vhdlparser.y ${GENERATED_SRC}/vhdlparser.cpp COMPILE_FLAGS "-l -p vhdlscannerYY") -BISON_TARGET(constexp constexp.y ${GENERATED_SRC}/ce_parse.cpp COMPILE_FLAGS "-l -p constexpYY") - -add_library(doxycfg +FLEX_TARGET(scanner scanner.l ${GENERATED_SRC}/scanner.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PscannerYY") +FLEX_TARGET(code code.l ${GENERATED_SRC}/code.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PcodeYY") +FLEX_TARGET(pyscanner pyscanner.l ${GENERATED_SRC}/pyscanner.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PpyscannerYY") +FLEX_TARGET(pycode pycode.l ${GENERATED_SRC}/pycode.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PpycodeYY") +FLEX_TARGET(fortranscanner fortranscanner.l ${GENERATED_SRC}/fortranscanner.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PfortranscannerYY -i") +FLEX_TARGET(fortrancode fortrancode.l ${GENERATED_SRC}/fortrancode.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PfortrancodeYY -i") +FLEX_TARGET(vhdlcode vhdlcode.l ${GENERATED_SRC}/vhdlcode.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PvhdlcodeYY -i") +FLEX_TARGET(tclscanner tclscanner.l ${GENERATED_SRC}/tclscanner.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PtclscannerYY -i") +FLEX_TARGET(pre pre.l ${GENERATED_SRC}/pre.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PpreYY") +FLEX_TARGET(declinfo declinfo.l ${GENERATED_SRC}/declinfo.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PdeclinfoYY") +FLEX_TARGET(defargs defargs.l ${GENERATED_SRC}/defargs.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PdefargsYY") +FLEX_TARGET(doctokenizer doctokenizer.l ${GENERATED_SRC}/doctokenizer.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PdoctokenizerYY") +FLEX_TARGET(commentcnv commentcnv.l ${GENERATED_SRC}/commentcnv.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PcommentcnvYY") +FLEX_TARGET(commentscan commentscan.l ${GENERATED_SRC}/commentscan.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PcommentscanYY") +FLEX_TARGET(constexp constexp.l ${GENERATED_SRC}/constexp.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PconstexpYY") +FLEX_TARGET(xmlcode xmlcode.l ${GENERATED_SRC}/xmlcode.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PxmlcodeYY") +FLEX_TARGET(config config.l ${GENERATED_SRC}/config.cpp COMPILE_FLAGS "$(LEX_FLAGS) -PconfigYY") + +BISON_TARGET(vhdlparser vhdlparser.y ${GENERATED_SRC}/vhdlparser.cpp COMPILE_FLAGS "$(YACC_FLAGS) -l -p vhdlscannerYY") +BISON_TARGET(constexp constexp.y ${GENERATED_SRC}/ce_parse.cpp COMPILE_FLAGS "$(YACC_FLAGS) -l -p constexpYY") + +add_library(doxycfg STATIC ${GENERATED_SRC}/lang_cfg.h ${GENERATED_SRC}/config.cpp ${GENERATED_SRC}/configoptions.cpp @@ -114,7 +114,7 @@ add_library(doxycfg portable_c.c ) -add_library(_doxygen +add_library(_doxygen STATIC # custom generated files ${GENERATED_SRC}/lang_cfg.h ${GENERATED_SRC}/settings.h diff --git a/src/cite.cpp b/src/cite.cpp index 2ea6300..3125f35 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -226,13 +226,13 @@ void CiteDict::generatePage() const else if (insideBib) doc+=line+"\n"; int i; // determine text to use at the location of the @cite command - if (insideBib && (i=line.find("<a name=\"CITEREF_"))!=-1) + if (insideBib && (i=line.find("name=\"CITEREF_"))!=-1) { int j=line.find("\">["); int k=line.find("]</a>"); if (j!=-1 && k!=-1) { - QCString label = line.mid(i+17,j-i-17); + QCString label = line.mid(i+14,j-i-14); QCString number = line.mid(j+2,k-j-1); CiteInfo *ci = m_entries.find(label); //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),ci); diff --git a/src/classdef.cpp b/src/classdef.cpp index 95428d6..88f9a70 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -925,10 +925,7 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, if (a) ol.docify(", "); } ol.docify(">"); - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); ol.lineBreak(); - ol.popGeneratorState(); } ol.docify(type.lower()+" "+name); ol.endSubsubsection(); @@ -1960,7 +1957,6 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page QCString pageType = " "; pageType += compoundTypeString(); - toupper(pageType.at(1)); Doxygen::indexList->addIndexItem(this,0); @@ -2607,7 +2603,7 @@ void ClassDef::setTypeConstraints(ArgumentList *al) void ClassDef::setTemplateArguments(ArgumentList *al) { if (al==0) return; - if (!m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed + if (m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed //printf("setting template args '%s' for '%s'\n",tempArgListToString(al,getLanguage()).data(),name().data()); m_impl->tempArgs=new ArgumentList; ArgumentListIterator ali(*al); diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index 5c38b5a..6784b3e 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -115,6 +115,9 @@ CommandMap cmdMap[] = { "#", CMD_HASH }, { "%", CMD_PERCENT }, { "|", CMD_PIPE }, + { ".", CMD_PUNT }, + { "+", CMD_PLUS }, + { "-", CMD_MINUS }, { "::", CMD_DCOLON }, { "\"", CMD_QUOTE }, { "_internalref", CMD_INTERNALREF }, diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 5a59f39..92c906a 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -130,7 +130,10 @@ enum CommandType CMD_MDASH = 100, CMD_STARTUML = 101, CMD_ENDUML = 102, - CMD_SETSCOPE = 103 + CMD_SETSCOPE = 103, + CMD_PUNT = 104, + CMD_PLUS = 105, + CMD_MINUS = 106 }; enum HtmlTagType @@ -1781,7 +1781,7 @@ TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") -KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) +KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) FLOWKW ("break"|"case"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"for"|"foreach"|"for each"|"goto"|"if"|"return"|"switch"|"throw"|"throws"|"try"|"while"|"@try"|"@catch"|"@finally") TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") @@ -2026,6 +2026,11 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" <SkipCPP>"//" { g_code->codify(yytext); } +<Body,FuncCall>"}" { + g_theVarContext.popScope(); + g_yyColNr++; + g_code->codify(yytext); + } <Body,FuncCall>"{" { g_theVarContext.pushScope(); @@ -3695,7 +3700,7 @@ void codeFreeScanner() extern "C" { // some bogus code to keep the compiler happy void codeYYdummy() { yy_flex_realloc(0,0); } } -#elif YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" +#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 +#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." #endif diff --git a/src/commentcnv.l b/src/commentcnv.l index 8823b68..f65c073 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -704,6 +704,14 @@ void replaceComment(int offset); g_readLineCtx=YY_START; BEGIN(ReadLine); } +<SComment>\n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n { + /* See Bug 752712: end the multiline comment when finding a @} or \} command */ + copyToOutput(" */",3); + copyToOutput(yytext,(int)yyleng); + g_inSpecialComment=FALSE; + g_inRoseComment=FALSE; + BEGIN(Scan); + } <SComment>\n[ \t]*"///"[^\/\n]/.*\n { replaceComment(1); g_readLineCtx=YY_START; @@ -773,6 +781,7 @@ void replaceComment(int offset); //printf("** Adding start of comment!\n"); if (g_lang!=SrcLangExt_Python && g_lang!=SrcLangExt_VHDL && + g_lang!=SrcLangExt_Markdown && g_lang!=SrcLangExt_Fortran) { ADDCHAR('/'); @@ -792,6 +801,7 @@ void replaceComment(int offset); { if (g_lang!=SrcLangExt_Python && g_lang!=SrcLangExt_VHDL && + g_lang!=SrcLangExt_Markdown && g_lang!=SrcLangExt_Fortran) { ADDCHAR('*'); diff --git a/src/commentscan.l b/src/commentscan.l index 3546277..ffed075 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -374,7 +374,7 @@ class GuardedSection void openGroup(Entry *e,const char *file,int line); void closeGroup(Entry *e,const char *file,int line,bool foundInline=FALSE); void initGroupInfo(Entry *e); -static void groupAddDocs(Entry *e,const char *fileName); +static void groupAddDocs(Entry *e); /* ----------------------------------------------------------------- * @@ -834,6 +834,29 @@ static inline void setOutput(OutputContext ctx) } } + +static void addAnchor(const char *anchor) +{ + SectionInfo *si = Doxygen::sectionDict->find(anchor); + if (si) + { + if (si->lineNr != -1) + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)",anchor,si->fileName.data(),si->lineNr); + } + else + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)",anchor,si->fileName.data()); + } + } + else + { + si = new SectionInfo(yyFileName,yyLineNr,anchor,0,SectionInfo::Anchor,0); + Doxygen::sectionDict->append(anchor,si); + current->anchors->append(si); + } +} + // add a string to the output static inline void addOutput(const char *s) { @@ -905,6 +928,7 @@ IMG [iI][mM][gG] HR [hH][rR] PARA [pP][aA][rR][aA] CODE [cC][oO][dD][eE] +CAPTION [cC][aA][pP][tT][iI][oO][nN] DETAILEDHTML {PRE}|{UL}|{TABLE}|{OL}|{DL}|{P}|[Hh][1-6]|{IMG}|{HR}|{PARA} DETAILEDHTMLOPT {CODE} BN [ \t\n\r] @@ -920,7 +944,7 @@ FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+@&#] FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]*"\"") ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]* -CITESCHAR [a-z_A-Z\x80-\xFF] +CITESCHAR [a-z_A-Z0-9\x80-\xFF] CITEECHAR [a-z_A-Z0-9\x80-\xFF\-\+:\/]* CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)* SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) @@ -1008,23 +1032,6 @@ RCSTAG "$"{ID}":"[^\n$]+"$" <Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!) addOutput(yytext); } -<Comment>{XREFCMD}/[^a-z_A-Z]* { // xref command - if (inContext!=OutputXRef) - { - briefEndsAtDot=FALSE; - setOutput(OutputDoc); - } - // continue with the same input - REJECT; - } - /* -<Comment>{DETAILEDCMD}/[^a-z_A-Z]* { // command that can end a brief description - briefEndsAtDot=FALSE; - setOutput(OutputDoc); - // continue with the same input - REJECT; - } - */ <Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description setOutput(OutputDoc); // continue with the same input @@ -1053,6 +1060,24 @@ RCSTAG "$"{ID}":"[^\n$]+"$" <Comment>"</remarks>" { // end of a brief or detailed description addOutput(yytext); } +<Comment>"<"{CAPTION}{ATTR}">" { + QCString tag=yytext; + int s=tag.find("id="); + if (s!=-1) // command has id attribute + { + char c=tag[s+3]; + if (c=='\'' || c=='"') // valid start + { + int e=tag.find(c,s+4); + if (e!=-1) // found matching end + { + QCString id=tag.mid(s+4,e-s-4); // extract id + addAnchor(id); + } + } + } + addOutput(yytext); + } <Comment>"<"{PRE}{ATTR}">" { insidePre=TRUE; addOutput(yytext); @@ -1085,8 +1110,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" int i=0; while (yytext[i]==' ' || yytext[i]=='\t') i++; g_spaceBeforeCmd = QCString(yytext).left(i); - if (cmdPtr->endsBrief && inContext!=OutputXRef) - { + if (cmdPtr->endsBrief && !(inContext==OutputXRef && cmdName=="parblock")) + { briefEndsAtDot=FALSE; // this command forces the end of brief description setOutput(OutputDoc); @@ -1103,7 +1128,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" // but we need to know the position in the input buffer where this // rule matched. // for flex 2.5.33+ we should use YY_CURRENT_BUFFER_LVALUE -#if YY_FLEX_MINOR_VERSION>=5 && YY_FLEX_SUBMINOR_VERSION>=33 +#if YY_FLEX_MAJOR_VERSION>=2 && (YY_FLEX_MINOR_VERSION>5 || (YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33)) inputPosition=prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); #else inputPosition=prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf); @@ -1165,7 +1190,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" g_memberGroupHeader.resize(0); parseMore=TRUE; needNewEntry = TRUE; -#if YY_FLEX_MINOR_VERSION>=5 && YY_FLEX_SUBMINOR_VERSION>=33 +#if YY_FLEX_MAJOR_VERSION>=2 && (YY_FLEX_MINOR_VERSION>5 || (YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33)) inputPosition=prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + strlen(yytext); #else inputPosition=prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf) + strlen(yytext); @@ -1745,24 +1770,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle arguments of the anchor command ------- */ <AnchorLabel>{LABELID} { // found argument - SectionInfo *si = Doxygen::sectionDict->find(yytext); - if (si) - { - if (si->lineNr != -1) - { - warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)",yytext,si->fileName.data(),si->lineNr); - } - else - { - warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)",yytext,si->fileName.data()); - } - } - else - { - si = new SectionInfo(yyFileName,yyLineNr,yytext,0,SectionInfo::Anchor,0); - Doxygen::sectionDict->append(yytext,si); - current->anchors->append(si); - } + addAnchor(yytext); addOutput(yytext); BEGIN( Comment ); } @@ -2971,7 +2979,7 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, checkFormula(); prot = protection; - groupAddDocs(curEntry,fileName); + groupAddDocs(curEntry); newEntryNeeded = needNewEntry; @@ -3100,10 +3108,10 @@ void openGroup(Entry *e,const char *,int) } } -void closeGroup(Entry *e,const char *fileName,int,bool foundInline) +void closeGroup(Entry *e,const char *fileName,int line,bool foundInline) { - //printf("==> closeGroup(name=%s,sec=%x) g_autoGroupStack=%d\n", - // e->name.data(),e->section,g_autoGroupStack.count()); + //printf("==> closeGroup(name=%s,sec=%x,file=%s,line=%d) g_autoGroupStack=%d\n", + // e->name.data(),e->section,fileName,line,g_autoGroupStack.count()); if (g_memberGroupId!=DOX_NOGROUP) // end of member group { MemberGroupInfo *info=Doxygen::memGrpInfoDict.find(g_memberGroupId); @@ -3111,6 +3119,7 @@ void closeGroup(Entry *e,const char *fileName,int,bool foundInline) { info->doc = g_memberGroupDocs; info->docFile = fileName; + info->docLine = line; } g_memberGroupId=DOX_NOGROUP; g_memberGroupRelates.resize(0); @@ -3144,7 +3153,7 @@ void initGroupInfo(Entry *e) } } -static void groupAddDocs(Entry *e,const char *fileName) +static void groupAddDocs(Entry *e) { if (e->section==Entry::MEMBERGRP_SEC) { @@ -3159,7 +3168,8 @@ static void groupAddDocs(Entry *e,const char *fileName) if (info) { info->doc = g_memberGroupDocs; - info->docFile = fileName; + info->docFile = e->docFile; + info->docLine = e->docLine; info->setRefItems(e->sli); } e->doc.resize(0); diff --git a/src/config.l b/src/config.l index 1bbe320..26e0283 100644 --- a/src/config.l +++ b/src/config.l @@ -242,7 +242,7 @@ QStrList &Config::getList(const char *fileName,int num,const char *name) const } else if (opt->kind()!=ConfigOption::O_List) { - config_err("%d<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); + config_err("%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); exit(1); } return *((ConfigList *)opt)->valueRef(); @@ -1077,7 +1077,7 @@ void Config::checkFileName(const char *optionName) (val=="no" || val=="false" || val=="0" || val=="none")) { config_err("file name expected for option %s, got %s instead. Ignoring...\n",optionName,s.data()); - s=""; // note tihe use of &s above: this will change the option value! + s=""; // note the use of &s above: this will change the option value! } } @@ -1119,14 +1119,15 @@ void Config::check() QCString &paperType = Config_getEnum("PAPER_TYPE"); paperType=paperType.lower().stripWhiteSpace(); - if (paperType.isEmpty()) + if (paperType.isEmpty() || paperType=="a4wide") { paperType = "a4"; } - if (paperType!="a4" && paperType!="a4wide" && paperType!="letter" && + if (paperType!="a4" && paperType!="letter" && paperType!="legal" && paperType!="executive") { config_err("Unknown page type specified\n"); + paperType="a4"; } QCString &outputLanguage=Config_getEnum("OUTPUT_LANGUAGE"); @@ -1198,6 +1199,12 @@ void Config::check() exit(1); } } + QCString &path = Config_getString("MATHJAX_RELPATH"); + if (!path.isEmpty() && path.at(path.length()-1)!='/') + { + path+="/"; + } + } // Test to see if LaTeX header is valid @@ -1426,71 +1433,7 @@ void Config::check() } } - // add default pattern if needed - QStrList &filePatternList = Config_getList("FILE_PATTERNS"); - if (filePatternList.isEmpty()) - { - filePatternList.append("*.c"); - filePatternList.append("*.cc"); - filePatternList.append("*.cxx"); - filePatternList.append("*.cpp"); - filePatternList.append("*.c++"); - //filePatternList.append("*.d"); - filePatternList.append("*.java"); - filePatternList.append("*.ii"); - filePatternList.append("*.ixx"); - filePatternList.append("*.ipp"); - filePatternList.append("*.i++"); - filePatternList.append("*.inl"); - filePatternList.append("*.h"); - filePatternList.append("*.hh"); - filePatternList.append("*.hxx"); - filePatternList.append("*.hpp"); - filePatternList.append("*.h++"); - filePatternList.append("*.idl"); - filePatternList.append("*.odl"); - filePatternList.append("*.cs"); - filePatternList.append("*.php"); - filePatternList.append("*.php3"); - filePatternList.append("*.inc"); - filePatternList.append("*.m"); - filePatternList.append("*.mm"); - filePatternList.append("*.dox"); - filePatternList.append("*.py"); - filePatternList.append("*.f90"); - filePatternList.append("*.f"); - filePatternList.append("*.for"); - filePatternList.append("*.vhd"); - filePatternList.append("*.vhdl"); - filePatternList.append("*.tcl"); - filePatternList.append("*.md"); - filePatternList.append("*.markdown"); - if (portable_fileSystemIsCaseSensitive()) - { - // unix => case sensitive match => also include useful uppercase versions - filePatternList.append("*.C"); - filePatternList.append("*.CC"); - filePatternList.append("*.C++"); - filePatternList.append("*.II"); - filePatternList.append("*.I++"); - filePatternList.append("*.H"); - filePatternList.append("*.HH"); - filePatternList.append("*.H++"); - filePatternList.append("*.CS"); - filePatternList.append("*.PHP"); - filePatternList.append("*.PHP3"); - filePatternList.append("*.M"); - filePatternList.append("*.MM"); - filePatternList.append("*.PY"); - filePatternList.append("*.F90"); - filePatternList.append("*.F"); - filePatternList.append("*.VHD"); - filePatternList.append("*.VHDL"); - filePatternList.append("*.TCL"); - filePatternList.append("*.MD"); - filePatternList.append("*.MARKDOWN"); - } - } + initFilePattern(); // add default pattern if needed QStrList &examplePatternList = Config_getList("EXAMPLE_PATTERNS"); @@ -1756,6 +1699,7 @@ static QCString configFileToString(const char *name) if (!fileOpened) { config_err("cannot open file `%s' for reading\n",name); + exit(1); } return ""; } diff --git a/src/config.xml b/src/config.xml index acbee8e..0aa8fda 100644 --- a/src/config.xml +++ b/src/config.xml @@ -1221,6 +1221,14 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn" ]]> </docs> </option> + <option type='bool' id='WARN_AS_ERROR' defval='0'> + <docs> +<![CDATA[ + If the \c WARN_AS_ERROR tag is set to \c YES then doxygen will immediately stop + when a warning is encountered. +]]> + </docs> + </option> <option type='string' id='WARN_FORMAT' format='string' defval='$file:$line: $text'> <docs> <![CDATA[ @@ -1317,6 +1325,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn" <value name='*.mm'/> <value name='*.dox'/> <value name='*.py'/> + <value name='*.pyw'/> <value name='*.f90'/> <value name='*.f'/> <value name='*.for'/> @@ -1436,6 +1445,10 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn" <br>Note that the filter must not add or remove lines; it is applied before the code is scanned, but not when the output code is generated. If lines are added or removed, the anchors will not be placed correctly. + <br>Note that for custom extensions or not directly supported extensions you also + need to set \ref cfg_extension_mapping "EXTENSION_MAPPING" for the extension + otherwise the files are not properly processed by doxygen.<br> + ]]> </docs> </option> @@ -1449,6 +1462,9 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn" information on how filters are used. If the \c FILTER_PATTERNS tag is empty or if none of the patterns match the file name, \ref cfg_input_filter "INPUT_FILTER" is applied. + <br>Note that for custom extensions or not directly supported extensions you also + need to set \ref cfg_extension_mapping "EXTENSION_MAPPING" for the extension + otherwise the files are not properly processed by doxygen.<br> ]]> </docs> </option> @@ -1596,7 +1612,7 @@ to disable this feature. necessary type information. @note The availability of this option depends on whether or not doxygen - was compiled with the `--with-libclang` option. + was generated with the `-Duse-libclang=ON` option for CMake. ]]> </docs> </option> @@ -2647,6 +2663,16 @@ or ]]> </docs> </option> + <option type='bool' id='LATEX_TIMESTAMP' defval='0' depends='GENERATE_LATEX'> + <docs> +<![CDATA[ + If the \c LATEX_TIMESTAMP tag is set to \c YES then the footer of + each generated page will contain the date and time when the page + was generated. Setting this to \c NO can help when comparing the output of + multiple runs. +]]> + </docs> + </option> </group> <group name='RTF' docs='Configuration options related to the RTF output'> <option type='bool' id='GENERATE_RTF' defval='0'> diff --git a/src/context.cpp b/src/context.cpp index f76c49b..2412010 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -35,6 +35,8 @@ #include "docparser.h" #include "htmlgen.h" #include "htmldocvisitor.h" +#include "latexgen.h" +#include "latexdocvisitor.h" #include "dot.h" #include "diagram.h" #include "example.h" @@ -43,27 +45,30 @@ #include "portable.h" #include "arguments.h" #include "groupdef.h" +#include "searchindex.h" // TODO: pass the current file to Dot*::writeGraph, so the user can put dot graphs in other // files as well #define ADD_PROPERTY(name) addProperty(#name,this,&Private::name); +enum ContextOutputFormat +{ + ContextOutputFormat_Unspecified=0, + ContextOutputFormat_Html, + ContextOutputFormat_Latex, + ContextOutputFormat_Rtf, + ContextOutputFormat_ManPage, + ContextOutputFormat_DocBook, + ContextOutputFormat_Xml, + ContextOutputFormat_TagFile +}; + struct ContextGlobals { - enum OutputFormat - { - Html, - LateX, - Rtf, - ManPage, - DocBook, - Xml, - TagFile - }; - int dynSectionId; - QCString outputDir; - OutputFormat outputFormat; + int dynSectionId; + QCString outputDir; + ContextOutputFormat outputFormat; } g_globals; /** @brief Scoped smart pointer */ @@ -216,38 +221,35 @@ class GenericNodeListContext : public TemplateListIntf //------------------------------------------------------------------------ /** @brief Helper class to map a property name to a handler member function */ -class PropertyMapper +template<typename T> +class PropertyMapper { private: struct PropertyFuncIntf { virtual ~PropertyFuncIntf() {} - virtual TemplateVariant operator()() const = 0; + virtual TemplateVariant operator()(const T *obj) const = 0; }; - template<typename T> struct PropertyFunc : public PropertyFuncIntf { typedef TemplateVariant (T::*Handler)() const; - PropertyFunc(const T *o,Handler h) : obj(o), handler(h) {} - TemplateVariant operator()() const + PropertyFunc(Handler h) : handler(h) {} + TemplateVariant operator()(const T *obj) const { return (obj->*handler)(); } - const T *obj; Handler handler; }; public: - PropertyMapper() { m_map.setAutoDelete(TRUE); } + PropertyMapper() : m_map(63) { m_map.setAutoDelete(TRUE); } /** Add a property to the map * @param[in] name The name of the property to add. * @param[in] obj The object handling access to the property. * @param[in] handle The method to call when the property is accessed. */ - template<typename T> - void addProperty(const char *name,const T* obj, - typename PropertyFunc<T>::Handler handle) + void addProperty(const char *name,typename PropertyFunc::Handler handle) { if (m_map.find(name)) { @@ -255,7 +257,7 @@ class PropertyMapper } else { - m_map.insert(name,new PropertyFunc<T>(obj,handle)); + m_map.insert(name,new PropertyFunc(handle)); } } @@ -264,14 +266,14 @@ class PropertyMapper * @returns A variant representing the properties value or an * invalid variant if it was not found. */ - TemplateVariant get(const char *name) const + TemplateVariant get(const T *obj,const char *name) const { //printf("PropertyMapper::get(%s)\n",name); TemplateVariant result; PropertyFuncIntf *func = m_map.find(name); if (func) { - result = (*func)(); + result = (*func)(obj); } return result; } @@ -358,7 +360,7 @@ TemplateVariant ConfigContext::get(const char *name) const //%% struct Doxygen: global information //%% { -class DoxygenContext::Private : public PropertyMapper +class DoxygenContext::Private { public: TemplateVariant version() const @@ -367,18 +369,44 @@ class DoxygenContext::Private : public PropertyMapper } TemplateVariant date() const { - return TemplateVariant(dateToString(TRUE)); + return dateToString(TRUE); + } + TemplateVariant maxJaxCodeFile() const + { + return m_cache.maxJaxCodeFile; } Private() { - //%% string version - addProperty("version",this,&Private::version); //makeProperty(this,&Private::version)); - //%% string date - addProperty("date", this,&Private::date); + static bool init=FALSE; + if (!init) + { + //%% string version + s_inst.addProperty("version", &Private::version); + //%% string date + s_inst.addProperty("date", &Private::date); + //%% string maxJaxCodeFile + s_inst.addProperty("mathJaxCodeFile", &Private::maxJaxCodeFile); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } + private: + struct Cachable + { + Cachable() { maxJaxCodeFile=fileToString(Config_getString("MATHJAX_CODEFILE")); } + QCString maxJaxCodeFile; + }; + mutable Cachable m_cache; + static PropertyMapper<DoxygenContext::Private> s_inst; }; //%% } +PropertyMapper<DoxygenContext::Private> DoxygenContext::Private::s_inst; +// (PropertyMapper<DoxygenContext::Private>::instance()); + DoxygenContext::DoxygenContext() : RefCountedContext("DoxygenContext") { p = new Private; @@ -398,7 +426,7 @@ TemplateVariant DoxygenContext::get(const char *n) const //%% struct Translator: translation methods //%% { -class TranslateContext::Private : public PropertyMapper +class TranslateContext::Private { public: @@ -438,6 +466,18 @@ class TranslateContext::Private : public PropertyMapper } return TemplateVariant(); } + TemplateVariant handleDirDependencyGraphFor(const QValueList<TemplateVariant> &args) const + { + if (args.count()==1) + { + return theTranslator->trDirDepGraph(args[0].toString()); + } + else + { + err("tr.dirDependencyGraphFor should take one argument, got %d!\n",args.count()); + } + return TemplateVariant(); + } TemplateVariant handleInheritsList(const QValueList<TemplateVariant> &args) const { if (args.count()==1) @@ -553,6 +593,10 @@ class TranslateContext::Private : public PropertyMapper { return TemplateVariant::Delegate::fromMethod<Private,&Private::handleCollaborationDiagramFor>(this); } + TemplateVariant dirDependencyGraphFor() const + { + return TemplateVariant::Delegate::fromMethod<Private,&Private::handleDirDependencyGraphFor>(this); + } TemplateVariant search() const { return theTranslator->trSearch(); @@ -579,6 +623,10 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trCompoundIndex(); } + TemplateVariant namespaceIndex() const + { + return theTranslator->trNamespaceIndex(); + } TemplateVariant classHierarchy() const { return theTranslator->trClassHierarchy(); @@ -591,6 +639,10 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trModules(); } + TemplateVariant moduleIndex() const + { + return theTranslator->trModuleIndex(); + } TemplateVariant namespaces() const { if (m_javaOpt || m_vhdlOpt) @@ -610,6 +662,10 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trFile(TRUE,FALSE); } + TemplateVariant fileIndex() const + { + return theTranslator->trFileIndex(); + } TemplateVariant pages() const { return theTranslator->trRelatedPages(); @@ -648,6 +704,14 @@ class TranslateContext::Private : public PropertyMapper return theTranslator->trNamespaceMembers(); } } + TemplateVariant moduleDocumentation() const + { + return theTranslator->trModuleDocumentation(); + } + TemplateVariant fileDocumentation() const + { + return theTranslator->trFileDocumentation(); + } TemplateVariant fileList() const { return theTranslator->trFileList(); @@ -815,6 +879,10 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trClassDocumentation(); } + TemplateVariant namespaceDocumentation() const + { + return theTranslator->trNamespaceDocumentation(); + } TemplateVariant compoundMembers() const { return theTranslator->trCompoundMembers(); @@ -882,166 +950,265 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trDefines(); } + TemplateVariant loading() const + { + return theTranslator->trLoading(); + } + TemplateVariant searching() const + { + return theTranslator->trSearching(); + } + TemplateVariant noMatches() const + { + return theTranslator->trNoMatches(); + } + TemplateVariant enumName() const + { + return theTranslator->trEnumName(); + } + TemplateVariant enumValue() const + { + return theTranslator->trEnumValue(); + } + TemplateVariant referenceManual() const + { + return theTranslator->trReferenceManual(); + } + TemplateVariant index() const + { + return theTranslator->trRTFGeneralIndex(); + } + TemplateVariant panelSyncOn() const + { + return theTranslator->trPanelSynchronisationTooltip(FALSE); + } + TemplateVariant panelSyncOff() const + { + return theTranslator->trPanelSynchronisationTooltip(TRUE); + } + TemplateVariant providedByCategory() const + { + return theTranslator->trProvidedByCategory(); + } + TemplateVariant extendsClass() const + { + return theTranslator->trExtendsClass(); + } + TemplateVariant examplesDescription() const + { + return theTranslator->trExamplesDescription(); + } Private() { - //%% string generatedBy - addProperty("generatedby", this,&Private::generatedBy); - //%% string generatedAt - addProperty("generatedAt", this,&Private::generatedAt); - //%% string search - addProperty("search", this,&Private::search); - //%% string mainPage - addProperty("mainPage", this,&Private::mainPage); - //%% string classes - addProperty("classes", this,&Private::classes); - //%% string classList - addProperty("classList", this,&Private::classList); - //%% string classListDescription - addProperty("classListDescription", this,&Private::classListDescription); - //%% string classIndex - addProperty("classIndex", this,&Private::classIndex); - //%% string classHierarchy - addProperty("classHierarchy", this,&Private::classHierarchy); - //%% string classMembers - addProperty("classMembers", this,&Private::classMembers); - //%% string classMembersDescription - addProperty("classMembersDescription",this,&Private::classMembersDescription); - //%% string modules - addProperty("modules", this,&Private::modules); - //%% string namespaces - addProperty("namespaces", this,&Private::namespaces); - //%% string files - addProperty("files", this,&Private::files); - //%% string pages - addProperty("pages", this,&Private::pages); - //%% string examples - addProperty("examples", this,&Private::examples); - //%% string namespaceList - addProperty("namespaceList", this,&Private::namespaceList); - //%% string namespaceMembers - addProperty("namespaceMembers", this,&Private::namespaceMembers); - //%% srting fileList - addProperty("fileList", this,&Private::fileList); - //%% string fileMembers - addProperty("fileMembers", this,&Private::fileMembers); - //%% string fileMembersDescription - addProperty("fileMembersDescription", this,&Private::fileMembersDescription); - //%% string relatedPagesDescripiton - addProperty("relatedPagesDesc", this,&Private::relatedPagesDesc); - //%% string more - addProperty("more", this,&Private::more); - //%% string detailedDescription - addProperty("detailedDesc", this,&Private::detailedDesc); - //%% string inheritanceDiagramFor - addProperty("inheritanceDiagramFor", this,&Private::inheritanceDiagramFor); - //%% string collaborationDiagramFor - addProperty("collaborationDiagramFor", this,&Private::collaborationDiagramFor); - //%% markerstring inheritsList - addProperty("inheritsList", this,&Private::inheritsList); - //%% markerstring inheritedByList - addProperty("inheritedByList", this,&Private::inheritedByList); - //%% markerstring definedAtLineInSourceFile - addProperty("definedAtLineInSourceFile", this,&Private::definedAtLineInSourceFile); - //%% string typeConstraints - addProperty("typeConstraints", this,&Private::typeConstraints); - //%% string exampleList - addProperty("exampleList", this,&Private::exampleList); - //%% string listOfAllMembers - addProperty("listOfAllMembers", this,&Private::listOfAllMembers); - //%% string memberList - addProperty("memberList", this,&Private::memberList); - //%% string theListOfAllMembers - addProperty("theListOfAllMembers",this,&Private::theListOfAllMembers); - //%% string incInheritedMembers - addProperty("incInheritedMembers",this,&Private::incInheritedMembers); - //%% string defineValue - addProperty("defineValue", this,&Private::defineValue); - //%% string initialValue - addProperty("initialValue", this,&Private::initialValue); - //%% markerstring implements - addProperty("implements", this,&Private::implements); - //%% markerstring reimplements - addProperty("reimplements", this,&Private::reimplements); - //%% markerstring implementedBy - addProperty("implementedBy", this,&Private::implementedBy); - //%% markerstring reimplementedBy - addProperty("reimplementedBy", this,&Private::reimplementedBy); - //%% markerstring sourceRefs - addProperty("sourceRefs", this,&Private::sourceRefs); - //%% markerstring sourceRefBys - addProperty("sourceRefBys", this,&Private::sourceRefBys); - //%% string callGraph - addProperty("callGraph", this,&Private::callGraph); - //%% string callerGraph - addProperty("callerGraph", this,&Private::callerGraph); - //%% markerstring inheritedFrom - addProperty("inheritedFrom", this,&Private::inheritedFrom); - //%% string addtionalInheritedMembers - addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers); - //%% string includeDependencyGraph:container_name - addProperty("includeDependencyGraph",this,&Private::includeDependencyGraph); - //%% string includedByDependencyGraph - addProperty("includedByDependencyGraph",this,&Private::includedByDependencyGraph); - //%% string gotoSourceCode - addProperty("gotoSourceCode", this,&Private::gotoSourceCode); - //%% string gotoDocumentation - addProperty("gotoDocumentation", this,&Private::gotoDocumentation); - //%% string constantgroups - addProperty("constantgroups", this,&Private::constantgroups); - //%% string classDocumentation - addProperty("classDocumentation", this,&Private::classDocumentation); - //%% string compoundMembers - addProperty("compoundMembers", this,&Private::compoundMembers); - //%% string detailLevel - addProperty("detailLevel", this,&Private::detailLevel); - //%% string fileListDescription - addProperty("fileListDescription",this,&Private::fileListDescription); - //%% string namespaceListDescription - addProperty("namespaceListDescription",this,&Private::namespaceListDescription); - //%% string directories - addProperty("directories", this,&Private::directories); - //%% string moduleDescript - addProperty("modulesDescription", this,&Private::modulesDescription); - //%% string all - addProperty("all", this,&Private::all); - //%% string functions - addProperty("functions", this,&Private::functions); - //%% string variables - addProperty("variables", this,&Private::variables); - //%% string typedefs - addProperty("typedefs", this,&Private::typedefs); - //%% string enums - addProperty("enums", this,&Private::enums); - //%% string enumValues - addProperty("enumValues", this,&Private::enumerationValues); - //%% string properties - addProperty("properties", this,&Private::properties); - //%% string events - addProperty("events", this,&Private::events); - //%% string related - addProperty("related", this,&Private::related); - //%% string macros - addProperty("macros", this,&Private::macros); - //%% string namespaceMembersDescription - addProperty("namespaceMembersDescription",this,&Private::namespaceMembersDescription); - //%% string classHierarchyDescription - addProperty("classHierarchyDescription",this,&Private::classHierarchyDescription); - //%% string gotoGraphicalHierarchy - addProperty("gotoGraphicalHierarchy",this,&Private::gotoGraphicalHierarchy); - //%% string gotoTextualHierarchy - addProperty("gotoTextualHierarchy",this,&Private::gotoTextualHierarchy); + static bool init=FALSE; + if (!init) + { + //%% string generatedBy + s_inst.addProperty("generatedBy", &Private::generatedBy); + //%% string generatedAt + s_inst.addProperty("generatedAt", &Private::generatedAt); + //%% string search + s_inst.addProperty("search", &Private::search); + //%% string mainPage + s_inst.addProperty("mainPage", &Private::mainPage); + //%% string classes + s_inst.addProperty("classes", &Private::classes); + //%% string classList + s_inst.addProperty("classList", &Private::classList); + //%% string classListDescription + s_inst.addProperty("classListDescription", &Private::classListDescription); + //%% string classIndex + s_inst.addProperty("classIndex", &Private::classIndex); + //%% string namespaceIndex + s_inst.addProperty("namespaceIndex", &Private::namespaceIndex); + //%% string classHierarchy + s_inst.addProperty("classHierarchy", &Private::classHierarchy); + //%% string classMembers + s_inst.addProperty("classMembers", &Private::classMembers); + //%% string classMembersDescription + s_inst.addProperty("classMembersDescription",&Private::classMembersDescription); + //%% string modules + s_inst.addProperty("modules", &Private::modules); + //%% string moduleIndex + s_inst.addProperty("moduleIndex", &Private::moduleIndex); + //%% string namespaces + s_inst.addProperty("namespaces", &Private::namespaces); + //%% string fileIndex + s_inst.addProperty("fileIndex", &Private::fileIndex); + //%% string files + s_inst.addProperty("files", &Private::files); + //%% string pages + s_inst.addProperty("pages", &Private::pages); + //%% string examples + s_inst.addProperty("examples", &Private::examples); + //%% string namespaceList + s_inst.addProperty("namespaceList", &Private::namespaceList); + //%% string namespaceMembers + s_inst.addProperty("namespaceMembers", &Private::namespaceMembers); + //%% srting fileList + s_inst.addProperty("fileList", &Private::fileList); + //%% string fileMembers + s_inst.addProperty("fileMembers", &Private::fileMembers); + //%% string fileMembersDescription + s_inst.addProperty("fileMembersDescription", &Private::fileMembersDescription); + //%% string relatedPagesDescripiton + s_inst.addProperty("relatedPagesDesc", &Private::relatedPagesDesc); + //%% string more + s_inst.addProperty("more", &Private::more); + //%% string detailedDescription + s_inst.addProperty("detailedDesc", &Private::detailedDesc); + //%% string inheritanceDiagramFor + s_inst.addProperty("inheritanceDiagramFor", &Private::inheritanceDiagramFor); + //%% string collaborationDiagramFor + s_inst.addProperty("collaborationDiagramFor", &Private::collaborationDiagramFor); + //%% markerstring inheritsList + s_inst.addProperty("inheritsList", &Private::inheritsList); + //%% markerstring inheritedByList + s_inst.addProperty("inheritedByList", &Private::inheritedByList); + //%% markerstring definedAtLineInSourceFile + s_inst.addProperty("definedAtLineInSourceFile", &Private::definedAtLineInSourceFile); + //%% string typeConstraints + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + //%% string exampleList + s_inst.addProperty("exampleList", &Private::exampleList); + //%% string listOfAllMembers + s_inst.addProperty("listOfAllMembers", &Private::listOfAllMembers); + //%% string memberList + s_inst.addProperty("memberList", &Private::memberList); + //%% string theListOfAllMembers + s_inst.addProperty("theListOfAllMembers",&Private::theListOfAllMembers); + //%% string incInheritedMembers + s_inst.addProperty("incInheritedMembers",&Private::incInheritedMembers); + //%% string defineValue + s_inst.addProperty("defineValue", &Private::defineValue); + //%% string initialValue + s_inst.addProperty("initialValue", &Private::initialValue); + //%% markerstring implements + s_inst.addProperty("implements", &Private::implements); + //%% markerstring reimplements + s_inst.addProperty("reimplements", &Private::reimplements); + //%% markerstring implementedBy + s_inst.addProperty("implementedBy", &Private::implementedBy); + //%% markerstring reimplementedBy + s_inst.addProperty("reimplementedBy", &Private::reimplementedBy); + //%% markerstring sourceRefs + s_inst.addProperty("sourceRefs", &Private::sourceRefs); + //%% markerstring sourceRefBys + s_inst.addProperty("sourceRefBys", &Private::sourceRefBys); + //%% string callGraph + s_inst.addProperty("callGraph", &Private::callGraph); + //%% string callerGraph + s_inst.addProperty("callerGraph", &Private::callerGraph); + //%% markerstring inheritedFrom + s_inst.addProperty("inheritedFrom", &Private::inheritedFrom); + //%% string addtionalInheritedMembers + s_inst.addProperty("additionalInheritedMembers",&Private::additionalInheritedMembers); + //%% string includeDependencyGraph:container_name + s_inst.addProperty("includeDependencyGraph",&Private::includeDependencyGraph); + //%% string includedByDependencyGraph + s_inst.addProperty("includedByDependencyGraph",&Private::includedByDependencyGraph); + //%% string gotoSourceCode + s_inst.addProperty("gotoSourceCode", &Private::gotoSourceCode); + //%% string gotoDocumentation + s_inst.addProperty("gotoDocumentation", &Private::gotoDocumentation); + //%% string constantgroups + s_inst.addProperty("constantgroups", &Private::constantgroups); + //%% string classDocumentation + s_inst.addProperty("classDocumentation", &Private::classDocumentation); + //%% string namespaceDocumentation + s_inst.addProperty("namespaceDocumentation", &Private::namespaceDocumentation); + //%% string moduleDocumentation + s_inst.addProperty("moduleDocumentation",&Private::moduleDocumentation); + //%% string fileDocumentation + s_inst.addProperty("fileDocumentation", &Private::fileDocumentation); + //%% string compoundMembers + s_inst.addProperty("compoundMembers", &Private::compoundMembers); + //%% string detailLevel + s_inst.addProperty("detailLevel", &Private::detailLevel); + //%% string fileListDescription + s_inst.addProperty("fileListDescription",&Private::fileListDescription); + //%% string namespaceListDescription + s_inst.addProperty("namespaceListDescription",&Private::namespaceListDescription); + //%% string directories + s_inst.addProperty("directories", &Private::directories); + //%% string moduleDescription + s_inst.addProperty("modulesDescription", &Private::modulesDescription); + //%% string all + s_inst.addProperty("all", &Private::all); + //%% string functions + s_inst.addProperty("functions", &Private::functions); + //%% string variables + s_inst.addProperty("variables", &Private::variables); + //%% string typedefs + s_inst.addProperty("typedefs", &Private::typedefs); + //%% string enums + s_inst.addProperty("enums", &Private::enums); + //%% string enumValues + s_inst.addProperty("enumValues", &Private::enumerationValues); + //%% string properties + s_inst.addProperty("properties", &Private::properties); + //%% string events + s_inst.addProperty("events", &Private::events); + //%% string related + s_inst.addProperty("related", &Private::related); + //%% string macros + s_inst.addProperty("macros", &Private::macros); + //%% string namespaceMembersDescription + s_inst.addProperty("namespaceMembersDescription",&Private::namespaceMembersDescription); + //%% string classHierarchyDescription + s_inst.addProperty("classHierarchyDescription",&Private::classHierarchyDescription); + //%% string gotoGraphicalHierarchy + s_inst.addProperty("gotoGraphicalHierarchy",&Private::gotoGraphicalHierarchy); + //%% string gotoTextualHierarchy + s_inst.addProperty("gotoTextualHierarchy",&Private::gotoTextualHierarchy); + //%% string loading + s_inst.addProperty("loading", &Private::loading); + //%% string searching + s_inst.addProperty("searching", &Private::searching); + //%% string noMatches + s_inst.addProperty("noMatches", &Private::noMatches); + //%% string enumValue + s_inst.addProperty("enumValue", &Private::enumValue); + //%% string enumName + s_inst.addProperty("enumName", &Private::enumName); + //%% string referenceManual + s_inst.addProperty("referenceManual", &Private::referenceManual); + //%% string index + s_inst.addProperty("index", &Private::index); + //%% string panelSyncOn + s_inst.addProperty("panelSyncOn", &Private::panelSyncOn); + //%% string panelSyncOff + s_inst.addProperty("panelSyncOff", &Private::panelSyncOff); + //%% string dirDependencyGraph + s_inst.addProperty("dirDependencyGraphFor", &Private::dirDependencyGraphFor); + //%% string providedByCategory + s_inst.addProperty("providedByCategory", &Private::providedByCategory); + //%% string extendsClass + s_inst.addProperty("extendsClass", &Private::extendsClass); + //%% string examplesDescription + s_inst.addProperty("examplesDescription",&Private::examplesDescription); + + init=TRUE; + } m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); m_vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } private: bool m_javaOpt; bool m_fortranOpt; bool m_vhdlOpt; + static PropertyMapper<TranslateContext::Private> s_inst; }; //%% } +PropertyMapper<TranslateContext::Private> TranslateContext::Private::s_inst; + TranslateContext::TranslateContext() : RefCountedContext("TranslateContext") { p = new Private; @@ -1065,10 +1232,27 @@ static TemplateVariant parseDoc(Definition *def,const QCString &file,int line, QGString docs; { FTextStream ts(&docs); - // TODO: support other generators - HtmlCodeGenerator codeGen(ts,relPath); - HtmlDocVisitor visitor(ts,codeGen,def); - root->accept(&visitor); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + HtmlCodeGenerator codeGen(ts,relPath); + HtmlDocVisitor visitor(ts,codeGen,def); + root->accept(&visitor); + } + break; + case ContextOutputFormat_Latex: + { + LatexCodeGenerator codeGen(ts,relPath,file); + LatexDocVisitor visitor(ts,codeGen,def->getDefFileExtension(),FALSE); + root->accept(&visitor); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } } bool isEmpty = root->isEmpty(); if (isEmpty) @@ -1086,9 +1270,27 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q pIntf->resetCodeParserState(); QGString s; FTextStream t(&s); - HtmlCodeGenerator codeGen(t,relPath); - pIntf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), - startLine,endLine,TRUE,md,showLineNumbers,md); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + HtmlCodeGenerator codeGen(t,relPath); + pIntf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), + startLine,endLine,TRUE,md,showLineNumbers,md); + } + break; + case ContextOutputFormat_Latex: + { + LatexCodeGenerator codeGen(t,relPath,md->docFile()); + pIntf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), + startLine,endLine,TRUE,md,showLineNumbers,md); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } return TemplateVariant(s.data(),TRUE); } @@ -1099,21 +1301,51 @@ static TemplateVariant parseCode(FileDef *fd,const QCString &relPath) pIntf->resetCodeParserState(); QGString s; FTextStream t(&s); - HtmlCodeGenerator codeGen(t,relPath); - pIntf->parseCode(codeGen,0, - fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources - fd->getLanguage(), // lang - FALSE, // isExampleBlock - 0, // exampleName - fd, // fileDef - -1, // startLine - -1, // endLine - FALSE, // inlineFragment - 0, // memberDef - TRUE, // showLineNumbers - 0, // searchCtx - TRUE // collectXRefs, TODO: should become FALSE - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + HtmlCodeGenerator codeGen(t,relPath); + pIntf->parseCode(codeGen,0, + fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources + fd->getLanguage(), // lang + FALSE, // isExampleBlock + 0, // exampleName + fd, // fileDef + -1, // startLine + -1, // endLine + FALSE, // inlineFragment + 0, // memberDef + TRUE, // showLineNumbers + 0, // searchCtx + TRUE // collectXRefs, TODO: should become FALSE + ); + } + break; + case ContextOutputFormat_Latex: + { + LatexCodeGenerator codeGen(t,relPath,fd->docFile()); + pIntf->parseCode(codeGen,0, + fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources + fd->getLanguage(), // lang + FALSE, // isExampleBlock + 0, // exampleName + fd, // fileDef + -1, // startLine + -1, // endLine + FALSE, // inlineFragment + 0, // memberDef + TRUE, // showLineNumbers + 0, // searchCtx + TRUE // collectXRefs, TODO: should become FALSE + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } return TemplateVariant(s.data(),TRUE); } @@ -1122,71 +1354,51 @@ static TemplateVariant parseCode(FileDef *fd,const QCString &relPath) //%% struct Symbol: shared info for all symbols //%% { template<typename T> -class DefinitionContext : public PropertyMapper +class DefinitionContext { public: DefinitionContext(Definition *d) : m_def(d) { assert(d!=0); + } + void addBaseProperties(PropertyMapper<T> &inst) + { //%% string name: the name of the symbol - addProperty("name",this,&DefinitionContext::name); + inst.addProperty("name",&DefinitionContext::name); //%% string bareName: the bare name of the symbol with scope info - addProperty("bareName",this,&DefinitionContext::bareName); + inst.addProperty("bareName",&DefinitionContext::bareName); //%% string relPath: the relative path to the root of the output (CREATE_SUBDIRS) - addProperty("relPath",this,&DefinitionContext::relPath); + inst.addProperty("relPath",&DefinitionContext::relPath); //%% string fileName: the file name of the output file associated with the symbol (without extension) - addProperty("fileName",this,&DefinitionContext::fileName); + inst.addProperty("fileName",&DefinitionContext::fileName); //%% string anchor: anchor within the page - addProperty("anchor",this,&DefinitionContext::anchor); + inst.addProperty("anchor",&DefinitionContext::anchor); //%% string details: the detailed documentation for this symbol - addProperty("details",this,&DefinitionContext::details); + inst.addProperty("details",&DefinitionContext::details); //%% string brief: the brief description for this symbol - addProperty("brief",this,&DefinitionContext::brief); + inst.addProperty("brief",&DefinitionContext::brief); //%% string inbodyDocs: the documentation found in the body - addProperty("inbodyDocs",this,&DefinitionContext::inbodyDocs); + inst.addProperty("inbodyDocs",&DefinitionContext::inbodyDocs); //%% string sourceFileName: the file name of the source file (without extension) - addProperty("sourceFileName",this,&DefinitionContext::sourceFileName); + inst.addProperty("sourceFileName",&DefinitionContext::sourceFileName); //%% bool isLinkable: can the symbol be linked to? - addProperty("isLinkable",this,&DefinitionContext::isLinkable); + inst.addProperty("isLinkable",&DefinitionContext::isLinkable); //%% bool isLinkableInProject: can the symbol be linked within this project? - addProperty("isLinkableInProject",this,&DefinitionContext::isLinkableInProject); + inst.addProperty("isLinkableInProject",&DefinitionContext::isLinkableInProject); //%% int dynSectionId: identifier that can be used for collapsable sections - addProperty("dynSectionId",this,&DefinitionContext::dynSectionId); + inst.addProperty("dynSectionId",&DefinitionContext::dynSectionId); //%% string language: the programming language in which the symbol is written - addProperty("language",this,&DefinitionContext::language); + inst.addProperty("language",&DefinitionContext::language); //%% string sourceDef: A link to the source definition - addProperty("sourceDef",this,&DefinitionContext::sourceDef); + inst.addProperty("sourceDef",&DefinitionContext::sourceDef); //%% list[Definition] navigationPath: Breadcrumb navigation path to this item - addProperty("navigationPath",this,&DefinitionContext::navigationPath); - - m_cache.sourceDef.reset(TemplateList::alloc()); - m_cache.lineLink.reset(TemplateStruct::alloc()); - m_cache.fileLink.reset(TemplateStruct::alloc()); - - if (m_def && !m_def->getSourceFileBase().isEmpty()) - { - m_cache.lineLink->set("text",m_def->getStartBodyLine()); - m_cache.lineLink->set("isLinkable",TRUE); - m_cache.lineLink->set("fileName",m_def->getSourceFileBase()); - m_cache.lineLink->set("anchor",m_def->getSourceAnchor()); - if (m_def->definitionType()==Definition::TypeFile) - { - m_cache.fileLink->set("text",m_def->name()); - } - else if (m_def->getBodyDef()) - { - m_cache.fileLink->set("text",m_def->getBodyDef()->name()); - } - else - { - m_cache.fileLink->set("text",name()); - } - m_cache.fileLink->set("isLinkable",TRUE); - m_cache.fileLink->set("fileName",m_def->getSourceFileBase()); - m_cache.fileLink->set("anchor",QCString()); - m_cache.sourceDef->append(m_cache.lineLink.get()); - m_cache.sourceDef->append(m_cache.fileLink.get()); - } + inst.addProperty("navigationPath",&DefinitionContext::navigationPath); + //%% string kind: Kind of compound object: class, namespace, module, package, page, dir + inst.addProperty("compoundKind",&DefinitionContext::compoundKind); + //%% bool isReference: is this definition imported via a tag file + inst.addProperty("isReference",&DefinitionContext::isReference); + //%% string externalReference: the link to the element in the remote documentation + inst.addProperty("externalReference",&DefinitionContext::externalReference); } TemplateVariant fileName() const { @@ -1227,44 +1439,50 @@ class DefinitionContext : public PropertyMapper } TemplateVariant details() const { - if (!m_cache.details) + Cachable &cache = getCache(); + if (!cache.details || g_globals.outputFormat!=cache.detailsOutputFormat) { - m_cache.details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(), + cache.details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(), relPathAsString(),m_def->documentation(),FALSE))); + cache.detailsOutputFormat = g_globals.outputFormat; } - return *m_cache.details; + return *cache.details; } TemplateVariant brief() const { - if (!m_cache.brief) + Cachable &cache = getCache(); + if (!cache.brief || g_globals.outputFormat!=cache.briefOutputFormat) { if (m_def->hasBriefDescription()) { - m_cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), + cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), relPathAsString(),m_def->briefDescription(),TRUE))); + cache.briefOutputFormat = g_globals.outputFormat; } else { - m_cache.brief.reset(new TemplateVariant("")); + cache.brief.reset(new TemplateVariant("")); } } - return *m_cache.brief; + return *cache.brief; } TemplateVariant inbodyDocs() const { - if (!m_cache.inbodyDocs) + Cachable &cache = getCache(); + if (!cache.inbodyDocs || g_globals.outputFormat!=cache.inbodyDocsOutputFormat) { if (!m_def->inbodyDocumentation().isEmpty()) { - m_cache.inbodyDocs.reset(new TemplateVariant(parseDoc(m_def,m_def->inbodyFile(),m_def->inbodyLine(), + cache.inbodyDocs.reset(new TemplateVariant(parseDoc(m_def,m_def->inbodyFile(),m_def->inbodyLine(), relPathAsString(),m_def->inbodyDocumentation(),FALSE))); + cache.inbodyDocsOutputFormat = g_globals.outputFormat; } else { - m_cache.inbodyDocs.reset(new TemplateVariant("")); + cache.inbodyDocs.reset(new TemplateVariant("")); } } - return *m_cache.inbodyDocs; + return *cache.inbodyDocs; } TemplateVariant dynSectionId() const { @@ -1294,11 +1512,30 @@ class DefinitionContext : public PropertyMapper } return result; } + TemplateVariant compoundKind() const + { + QCString result = "unspecified"; + switch (m_def->definitionType()) + { + case DefinitionIntf::TypeClass: result="class"; break; + case DefinitionIntf::TypeFile: result="file"; break; + case DefinitionIntf::TypeNamespace: result="namespace"; break; + case DefinitionIntf::TypeGroup: result="module"; break; + case DefinitionIntf::TypePackage: result="package"; break; + case DefinitionIntf::TypePage: result="page"; break; + case DefinitionIntf::TypeDir: result="dir"; break; + case DefinitionIntf::TypeMember: // fall through + case DefinitionIntf::TypeSymbolList: + break; + } + return result; + } TemplateVariant sourceDef() const { - if (m_cache.sourceDef->count()==2) + Cachable &cache = getCache(); + if (cache.sourceDef->count()==2) { - return m_cache.sourceDef.get(); + return cache.sourceDef.get(); } else { @@ -1321,7 +1558,8 @@ class DefinitionContext : public PropertyMapper } TemplateVariant navigationPath() const { - if (!m_cache.navPath) + Cachable &cache = getCache(); + if (!cache.navPath) { TemplateList *list = TemplateList::alloc(); if (m_def->getOuterScope() && m_def->getOuterScope()!=Doxygen::globalScope) @@ -1332,25 +1570,80 @@ class DefinitionContext : public PropertyMapper { fillPath(((const FileDef *)m_def)->getDirDef(),list); } - m_cache.navPath.reset(list); + cache.navPath.reset(list); } - return m_cache.navPath.get(); + return cache.navPath.get(); + } + TemplateVariant isReference() const + { + return m_def->isReference(); + } + TemplateVariant externalReference() const + { + return m_def->externalReference(relPathAsString()); } - private: - Definition *m_def; - struct Cachable + protected: + struct Cachable : public Definition::Cookie { - Cachable() { } + Cachable(Definition *def) : detailsOutputFormat(ContextOutputFormat_Unspecified), + briefOutputFormat(ContextOutputFormat_Unspecified), + inbodyDocsOutputFormat(ContextOutputFormat_Unspecified) + { + sourceDef.reset(TemplateList::alloc()); + lineLink.reset(TemplateStruct::alloc()); + fileLink.reset(TemplateStruct::alloc()); + + if (def && !def->getSourceFileBase().isEmpty()) + { + lineLink->set("text",def->getStartBodyLine()); + lineLink->set("isLinkable",TRUE); + lineLink->set("fileName",def->getSourceFileBase()); + lineLink->set("anchor",def->getSourceAnchor()); + lineLink->set("isReference",FALSE); + lineLink->set("externalReference",""); + if (def->definitionType()==Definition::TypeFile) + { + fileLink->set("text",def->name()); + } + else if (def->getBodyDef()) + { + fileLink->set("text",def->getBodyDef()->name()); + } + else + { + fileLink->set("text",def->displayName(TRUE)); + } + fileLink->set("isLinkable",TRUE); + fileLink->set("fileName",def->getSourceFileBase()); + fileLink->set("anchor",QCString()); + fileLink->set("isReference",FALSE); + fileLink->set("externalReference",""); + sourceDef->append(lineLink.get()); + sourceDef->append(fileLink.get()); + } + } ScopedPtr<TemplateVariant> details; + ContextOutputFormat detailsOutputFormat; ScopedPtr<TemplateVariant> brief; + ContextOutputFormat briefOutputFormat; ScopedPtr<TemplateVariant> inbodyDocs; + ContextOutputFormat inbodyDocsOutputFormat; SharedPtr<TemplateList> navPath; SharedPtr<TemplateList> sourceDef; SharedPtr<TemplateStruct> fileLink; SharedPtr<TemplateStruct> lineLink; }; - mutable Cachable m_cache; + + + private: + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_def->cookie()); + assert(c!=0); + return *c; + } + Definition *m_def; }; //%% } @@ -1358,21 +1651,27 @@ class DefinitionContext : public PropertyMapper //%% struct IncludeInfo: include file information //%% { -class IncludeInfoContext::Private : public PropertyMapper +class IncludeInfoContext::Private { public: Private(const IncludeInfo *info,SrcLangExt lang) : m_info(info), m_lang(lang) { - if (m_info) + static bool init=FALSE; + if (!init) { - addProperty("file",this,&Private::file); - addProperty("name",this,&Private::name); - addProperty("isImport",this,&Private::isImport); - addProperty("isLocal",this,&Private::isLocal); + s_inst.addProperty("file",&Private::file); + s_inst.addProperty("name",&Private::name); + s_inst.addProperty("isImport",&Private::isImport); + s_inst.addProperty("isLocal",&Private::isLocal); + init=TRUE; } } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant isLocal() const { bool isIDLorJava = m_lang==SrcLangExt_IDL || m_lang==SrcLangExt_Java; @@ -1380,7 +1679,7 @@ class IncludeInfoContext::Private : public PropertyMapper } TemplateVariant isImport() const { - return m_info->imported; + return m_info->imported || m_lang==SrcLangExt_ObjC; } TemplateVariant file() const { @@ -1405,8 +1704,11 @@ class IncludeInfoContext::Private : public PropertyMapper const IncludeInfo *m_info; mutable SharedPtr<FileContext> m_fileContext; SrcLangExt m_lang; + static PropertyMapper<IncludeInfoContext::Private> s_inst; }; +PropertyMapper<IncludeInfoContext::Private> IncludeInfoContext::Private::s_inst; + IncludeInfoContext::IncludeInfoContext(const IncludeInfo *info,SrcLangExt lang) : RefCountedContext("IncludeContext") { p = new Private(info,lang); @@ -1479,71 +1781,85 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd), m_classDef(cd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("generatedFromFiles", this,&Private::generatedFromFiles); - addProperty("usedFiles", this,&Private::usedFiles); - addProperty("hasInheritanceDiagram", this,&Private::hasInheritanceDiagram); - addProperty("inheritanceDiagram", this,&Private::inheritanceDiagram); - addProperty("hasCollaborationDiagram", this,&Private::hasCollaborationDiagram); - addProperty("collaborationDiagram", this,&Private::collaborationDiagram); - addProperty("includeInfo", this,&Private::includeInfo); - addProperty("inherits", this,&Private::inherits); - addProperty("inheritedBy", this,&Private::inheritedBy); - addProperty("unoIDLServices", this,&Private::unoIDLServices); - addProperty("unoIDLInterfaces", this,&Private::unoIDLInterfaces); - addProperty("signals", this,&Private::signals); - addProperty("publicTypes", this,&Private::publicTypes); - addProperty("publicMethods", this,&Private::publicMethods); - addProperty("publicStaticMethods", this,&Private::publicStaticMethods); - addProperty("publicAttributes", this,&Private::publicAttributes); - addProperty("publicStaticAttributes", this,&Private::publicStaticAttributes); - addProperty("publicSlots", this,&Private::publicSlots); - addProperty("protectedTypes", this,&Private::protectedTypes); - addProperty("protectedMethods", this,&Private::protectedMethods); - addProperty("protectedStaticMethods", this,&Private::protectedStaticMethods); - addProperty("protectedAttributes", this,&Private::protectedAttributes); - addProperty("protectedStaticAttributes", this,&Private::protectedStaticAttributes); - addProperty("protectedSlots", this,&Private::protectedSlots); - addProperty("privateTypes", this,&Private::privateTypes); - addProperty("privateMethods", this,&Private::privateMethods); - addProperty("privateStaticMethods", this,&Private::privateStaticMethods); - addProperty("privateAttributes", this,&Private::privateAttributes); - addProperty("privateStaticAttributes", this,&Private::privateStaticAttributes); - addProperty("privateSlots", this,&Private::privateSlots); - addProperty("packageTypes", this,&Private::packageTypes); - addProperty("packageMethods", this,&Private::packageMethods); - addProperty("packageStaticMethods", this,&Private::packageStaticMethods); - addProperty("packageAttributes", this,&Private::packageAttributes); - addProperty("packageStaticAttributes", this,&Private::packageStaticAttributes); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("friends", this,&Private::friends); - addProperty("related", this,&Private::related); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedServices", this,&Private::detailedServices); - addProperty("detailedInterfaces", this,&Private::detailedInterfaces); - addProperty("detailedConstructors", this,&Private::detailedConstructors); - addProperty("detailedMethods", this,&Private::detailedMethods); - addProperty("detailedRelated", this,&Private::detailedRelated); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("detailedProperties", this,&Private::detailedProperties); - addProperty("detailedEvents", this,&Private::detailedEvents); - addProperty("classes", this,&Private::classes); - addProperty("compoundType", this,&Private::compoundType); - addProperty("templateDecls", this,&Private::templateDecls); - addProperty("typeConstraints", this,&Private::typeConstraints); - addProperty("examples", this,&Private::examples); - addProperty("members", this,&Private::members); - addProperty("allMembersList", this,&Private::allMembersList); - addProperty("allMembersFileName", this,&Private::allMembersFileName); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("generatedFromFiles", &Private::generatedFromFiles); + s_inst.addProperty("usedFiles", &Private::usedFiles); + s_inst.addProperty("hasInheritanceDiagram", &Private::hasInheritanceDiagram); + s_inst.addProperty("inheritanceDiagram", &Private::inheritanceDiagram); + s_inst.addProperty("hasCollaborationDiagram", &Private::hasCollaborationDiagram); + s_inst.addProperty("collaborationDiagram", &Private::collaborationDiagram); + s_inst.addProperty("includeInfo", &Private::includeInfo); + s_inst.addProperty("inherits", &Private::inherits); + s_inst.addProperty("inheritedBy", &Private::inheritedBy); + s_inst.addProperty("unoIDLServices", &Private::unoIDLServices); + s_inst.addProperty("unoIDLInterfaces", &Private::unoIDLInterfaces); + s_inst.addProperty("signals", &Private::signals); + s_inst.addProperty("publicTypes", &Private::publicTypes); + s_inst.addProperty("publicMethods", &Private::publicMethods); + s_inst.addProperty("publicStaticMethods", &Private::publicStaticMethods); + s_inst.addProperty("publicAttributes", &Private::publicAttributes); + s_inst.addProperty("publicStaticAttributes", &Private::publicStaticAttributes); + s_inst.addProperty("publicSlots", &Private::publicSlots); + s_inst.addProperty("protectedTypes", &Private::protectedTypes); + s_inst.addProperty("protectedMethods", &Private::protectedMethods); + s_inst.addProperty("protectedStaticMethods", &Private::protectedStaticMethods); + s_inst.addProperty("protectedAttributes", &Private::protectedAttributes); + s_inst.addProperty("protectedStaticAttributes", &Private::protectedStaticAttributes); + s_inst.addProperty("protectedSlots", &Private::protectedSlots); + s_inst.addProperty("privateTypes", &Private::privateTypes); + s_inst.addProperty("privateMethods", &Private::privateMethods); + s_inst.addProperty("privateStaticMethods", &Private::privateStaticMethods); + s_inst.addProperty("privateAttributes", &Private::privateAttributes); + s_inst.addProperty("privateStaticAttributes", &Private::privateStaticAttributes); + s_inst.addProperty("privateSlots", &Private::privateSlots); + s_inst.addProperty("packageTypes", &Private::packageTypes); + s_inst.addProperty("packageMethods", &Private::packageMethods); + s_inst.addProperty("packageStaticMethods", &Private::packageStaticMethods); + s_inst.addProperty("packageAttributes", &Private::packageAttributes); + s_inst.addProperty("packageStaticAttributes", &Private::packageStaticAttributes); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("friends", &Private::friends); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedServices", &Private::detailedServices); + s_inst.addProperty("detailedInterfaces", &Private::detailedInterfaces); + s_inst.addProperty("detailedConstructors", &Private::detailedConstructors); + s_inst.addProperty("detailedMethods", &Private::detailedMethods); + s_inst.addProperty("detailedRelated", &Private::detailedRelated); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("detailedProperties", &Private::detailedProperties); + s_inst.addProperty("detailedEvents", &Private::detailedEvents); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("innerClasses", &Private::innerClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + s_inst.addProperty("templateDecls", &Private::templateDecls); + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("allMembersList", &Private::allMembersList); + s_inst.addProperty("allMembersFileName", &Private::allMembersFileName); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("additionalInheritedMembers",&Private::additionalInheritedMembers); + s_inst.addProperty("isSimple", &Private::isSimple); + s_inst.addProperty("categoryOf", &Private::categoryOf); + init=TRUE; + } + if (!cd->cookie()) { cd->setCookie(new ClassContext::Private::Cachable(cd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_classDef->title()); @@ -1566,27 +1882,30 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant usedFiles() const { - if (!m_cache.usedFiles) + Cachable &cache = getCache(); + if (!cache.usedFiles) { - m_cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef)); + cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef)); } - return m_cache.usedFiles.get(); + return cache.usedFiles.get(); } DotClassGraph *getClassGraph() const { - if (!m_cache.classGraph) + Cachable &cache = getCache(); + if (!cache.classGraph) { - m_cache.classGraph.reset(new DotClassGraph(m_classDef,DotNode::Inheritance)); + cache.classGraph.reset(new DotClassGraph(m_classDef,DotNode::Inheritance)); } - return m_cache.classGraph.get(); + return cache.classGraph.get(); } int numInheritanceNodes() const { - if (m_cache.inheritanceNodes==-1) + Cachable &cache = getCache(); + if (cache.inheritanceNodes==-1) { - m_cache.inheritanceNodes=m_classDef->countInheritanceNodes(); + cache.inheritanceNodes=m_classDef->countInheritanceNodes(); } - return m_cache.inheritanceNodes>0; + return cache.inheritanceNodes>0; } TemplateVariant hasInheritanceDiagram() const { @@ -1615,37 +1934,75 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { DotClassGraph *cg = getClassGraph(); FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; } else if (classDiagrams) { ClassDiagram d(m_classDef); FTextStream t(&result); - QCString name = convertToHtml(m_classDef->displayName()); - t << "<div class=\"center\">" << endl; - t << "<img src=\""; - t << relPathAsString() << m_classDef->getOutputFileBase(); - t << ".png\" usemap=\"#" << name << "_map\" alt=\"\"/>" << endl; - t << "<map id=\"" << name << "_map\" name=\"" << name << "_map\">" << endl; - d.writeImage(t,g_globals.outputDir, - relPathAsString(), - m_classDef->getOutputFileBase()); - t << "</div>"; - } - g_globals.dynSectionId++; + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + QCString name = convertToHtml(m_classDef->displayName()); + t << "<div class=\"center\">" << endl; + t << "<img src=\""; + t << relPathAsString() << m_classDef->getOutputFileBase(); + t << ".png\" usemap=\"#" << convertToId(name) << "_map\" alt=\"\"/>" << endl; + t << "<map id=\"" << convertToId(name) << "_map\" name=\"" << name << "_map\">" << endl; + d.writeImage(t,g_globals.outputDir, + relPathAsString(), + m_classDef->getOutputFileBase()); + t << "</div>"; + } + break; + case ContextOutputFormat_Latex: + { + d.writeFigure(t,g_globals.outputDir,m_classDef->getOutputFileBase()); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; + } return TemplateVariant(result.data(),TRUE); } DotClassGraph *getCollaborationGraph() const { - if (!m_cache.collaborationGraph) + Cachable &cache = getCache(); + if (!cache.collaborationGraph) { - m_cache.collaborationGraph.reset(new DotClassGraph(m_classDef,DotNode::Collaboration)); + cache.collaborationGraph.reset(new DotClassGraph(m_classDef,DotNode::Collaboration)); } - return m_cache.collaborationGraph.get(); + return cache.collaborationGraph.get(); } TemplateVariant hasCollaborationDiagram() const { @@ -1660,25 +2017,46 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { DotClassGraph *cg = getCollaborationGraph(); FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; } - g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } TemplateVariant includeInfo() const { - if (!m_cache.includeInfo && m_classDef->includeInfo()) + Cachable &cache = getCache(); + if (!cache.includeInfo && m_classDef->includeInfo()) { - m_cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage())); + cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage())); } - if (m_cache.includeInfo) + if (cache.includeInfo) { - return m_cache.includeInfo.get(); + return cache.includeInfo.get(); } else { @@ -1687,19 +2065,21 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant inherits() const { - if (!m_cache.inheritsList) + Cachable &cache = getCache(); + if (!cache.inheritsList) { - m_cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE)); + cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE)); } - return m_cache.inheritsList.get(); + return cache.inheritsList.get(); } TemplateVariant inheritedBy() const { - if (!m_cache.inheritedByList) + Cachable &cache = getCache(); + if (!cache.inheritedByList) { - m_cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE)); + cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE)); } - return m_cache.inheritedByList.get(); + return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -1709,7 +2089,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> MemberList *ml = m_classDef->getMemberList(type); if (ml) { - list.reset(MemberListInfoContext::alloc(m_classDef,relPathAsString(),ml,title,detailed)); + list.reset(MemberListInfoContext::alloc(m_classDef,relPathAsString(),ml,title,"")); } } if (list) @@ -1723,171 +2103,172 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant unoIDLServices() const { - return getMemberList(m_cache.unoIDLServices,MemberListType_services,theTranslator->trServices()); + return getMemberList(getCache().unoIDLServices,MemberListType_services,theTranslator->trServices()); } TemplateVariant unoIDLInterfaces() const { - return getMemberList(m_cache.unoIDLInterfaces,MemberListType_interfaces,theTranslator->trInterfaces()); + return getMemberList(getCache().unoIDLInterfaces,MemberListType_interfaces,theTranslator->trInterfaces()); } TemplateVariant signals() const { - return getMemberList(m_cache.signals,MemberListType_signals,theTranslator->trSignals()); + return getMemberList(getCache().signals,MemberListType_signals,theTranslator->trSignals()); } TemplateVariant publicTypes() const { - return getMemberList(m_cache.publicTypes,MemberListType_pubTypes,theTranslator->trPublicTypes()); + return getMemberList(getCache().publicTypes,MemberListType_pubTypes,theTranslator->trPublicTypes()); } TemplateVariant publicMethods() const { - return getMemberList(m_cache.publicMethods,MemberListType_pubMethods, + return getMemberList(getCache().publicMethods,MemberListType_pubMethods, m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trInstanceMethods() : theTranslator->trPublicMembers()); } TemplateVariant publicStaticMethods() const { - return getMemberList(m_cache.publicStaticMethods,MemberListType_pubStaticMethods, + return getMemberList(getCache().publicStaticMethods,MemberListType_pubStaticMethods, m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trClassMethods() : theTranslator->trStaticPublicMembers()); } TemplateVariant publicAttributes() const { - return getMemberList(m_cache.publicAttributes,MemberListType_pubAttribs,theTranslator->trPublicAttribs()); + return getMemberList(getCache().publicAttributes,MemberListType_pubAttribs,theTranslator->trPublicAttribs()); } TemplateVariant publicStaticAttributes() const { - return getMemberList(m_cache.publicStaticAttributes,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs()); + return getMemberList(getCache().publicStaticAttributes,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs()); } TemplateVariant publicSlots() const { - return getMemberList(m_cache.publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); + return getMemberList(getCache().publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); } TemplateVariant protectedTypes() const { - return getMemberList(m_cache.protectedTypes,MemberListType_proTypes,theTranslator->trProtectedTypes()); + return getMemberList(getCache().protectedTypes,MemberListType_proTypes,theTranslator->trProtectedTypes()); } TemplateVariant protectedMethods() const { - return getMemberList(m_cache.protectedMethods,MemberListType_proMethods,theTranslator->trProtectedMembers()); + return getMemberList(getCache().protectedMethods,MemberListType_proMethods,theTranslator->trProtectedMembers()); } TemplateVariant protectedStaticMethods() const { - return getMemberList(m_cache.protectedStaticMethods,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers()); + return getMemberList(getCache().protectedStaticMethods,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers()); } TemplateVariant protectedAttributes() const { - return getMemberList(m_cache.protectedAttributes,MemberListType_proAttribs,theTranslator->trProtectedAttribs()); + return getMemberList(getCache().protectedAttributes,MemberListType_proAttribs,theTranslator->trProtectedAttribs()); } TemplateVariant protectedStaticAttributes() const { - return getMemberList(m_cache.protectedStaticAttributes,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs()); + return getMemberList(getCache().protectedStaticAttributes,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs()); } TemplateVariant protectedSlots() const { - return getMemberList(m_cache.protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); + return getMemberList(getCache().protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); } TemplateVariant privateTypes() const { - return getMemberList(m_cache.privateTypes,MemberListType_priTypes,theTranslator->trPrivateTypes()); + return getMemberList(getCache().privateTypes,MemberListType_priTypes,theTranslator->trPrivateTypes()); } TemplateVariant privateSlots() const { - return getMemberList(m_cache.privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); + return getMemberList(getCache().privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); } TemplateVariant privateMethods() const { - return getMemberList(m_cache.privateMethods,MemberListType_priMethods,theTranslator->trPrivateMembers()); + return getMemberList(getCache().privateMethods,MemberListType_priMethods,theTranslator->trPrivateMembers()); } TemplateVariant privateStaticMethods() const { - return getMemberList(m_cache.privateStaticMethods,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers()); + return getMemberList(getCache().privateStaticMethods,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers()); } TemplateVariant privateAttributes() const { - return getMemberList(m_cache.privateAttributes,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); + return getMemberList(getCache().privateAttributes,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); } TemplateVariant privateStaticAttributes() const { - return getMemberList(m_cache.privateStaticAttributes,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); + return getMemberList(getCache().privateStaticAttributes,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); } TemplateVariant packageTypes() const { - return getMemberList(m_cache.packageTypes,MemberListType_pacTypes,theTranslator->trPackageTypes()); + return getMemberList(getCache().packageTypes,MemberListType_pacTypes,theTranslator->trPackageTypes()); } TemplateVariant packageMethods() const { - return getMemberList(m_cache.packageMethods,MemberListType_pacMethods,theTranslator->trPackageMembers()); + return getMemberList(getCache().packageMethods,MemberListType_pacMethods,theTranslator->trPackageMembers()); } TemplateVariant packageStaticMethods() const { - return getMemberList(m_cache.packageStaticMethods,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers()); + return getMemberList(getCache().packageStaticMethods,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers()); } TemplateVariant packageAttributes() const { - return getMemberList(m_cache.packageAttributes,MemberListType_pacAttribs,theTranslator->trPackageAttribs()); + return getMemberList(getCache().packageAttributes,MemberListType_pacAttribs,theTranslator->trPackageAttribs()); } TemplateVariant packageStaticAttributes() const { - return getMemberList(m_cache.packageStaticAttributes,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs()); + return getMemberList(getCache().packageStaticAttributes,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs()); } TemplateVariant properties() const { - return getMemberList(m_cache.properties,MemberListType_properties,theTranslator->trProperties()); + return getMemberList(getCache().properties,MemberListType_properties,theTranslator->trProperties()); } TemplateVariant events() const { - return getMemberList(m_cache.events,MemberListType_events,theTranslator->trEvents()); + return getMemberList(getCache().events,MemberListType_events,theTranslator->trEvents()); } TemplateVariant friends() const { - return getMemberList(m_cache.friends,MemberListType_friends,theTranslator->trFriends()); + return getMemberList(getCache().friends,MemberListType_friends,theTranslator->trFriends()); } TemplateVariant related() const { - return getMemberList(m_cache.related,MemberListType_related,theTranslator->trRelatedFunctions()); + return getMemberList(getCache().related,MemberListType_related,theTranslator->trRelatedFunctions()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation(),TRUE); + return getMemberList(getCache().detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation(),TRUE); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation(),TRUE); + return getMemberList(getCache().detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation(),TRUE); } TemplateVariant detailedServices() const { - return getMemberList(m_cache.detailedServices,MemberListType_serviceMembers,theTranslator->trServices(),TRUE); + return getMemberList(getCache().detailedServices,MemberListType_serviceMembers,theTranslator->trServices(),TRUE); } TemplateVariant detailedInterfaces() const { - return getMemberList(m_cache.detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces(),TRUE); + return getMemberList(getCache().detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces(),TRUE); } TemplateVariant detailedConstructors() const { - return getMemberList(m_cache.detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation(),TRUE); + return getMemberList(getCache().detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation(),TRUE); } TemplateVariant detailedMethods() const { - return getMemberList(m_cache.detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation(),TRUE); + return getMemberList(getCache().detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation(),TRUE); } TemplateVariant detailedRelated() const { - return getMemberList(m_cache.detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation(),TRUE); + return getMemberList(getCache().detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation(),TRUE); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation(),TRUE); + return getMemberList(getCache().detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation(),TRUE); } TemplateVariant detailedProperties() const { - return getMemberList(m_cache.detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation(),TRUE); + return getMemberList(getCache().detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation(),TRUE); } TemplateVariant detailedEvents() const { - return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE); + return getMemberList(getCache().detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE); } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_classDef->getClassSDict()) @@ -1902,9 +2283,35 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); + } + TemplateVariant innerClasses() const + { + Cachable &cache = getCache(); + if (!cache.innerClasses) + { + TemplateList *classList = TemplateList::alloc(); + if (m_classDef->getClassSDict()) + { + ClassSDict::Iterator sdi(*m_classDef->getClassSDict()); + ClassDef *cd; + for (sdi.toFirst();(cd=sdi.current());++sdi) + { + if (cd->name().find('@')==-1 && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups()==0 + ) + { + classList->append(ClassContext::alloc(cd)); + } + } + } + cache.innerClasses.reset(classList); + } + return cache.innerClasses.get(); } TemplateVariant compoundType() const { @@ -1942,61 +2349,68 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> s->set("isLinkable",TRUE); s->set("anchor",ex->anchor); s->set("fileName",ex->file); + s->set("isReference",FALSE); + s->set("externalReference",""); list->append(s); } } } TemplateVariant templateDecls() const { - if (!m_cache.templateDecls) + Cachable &cache = getCache(); + if (!cache.templateDecls) { TemplateList *tl = TemplateList::alloc(); addTemplateDecls(m_classDef,tl); - m_cache.templateDecls.reset(tl); + cache.templateDecls.reset(tl); } - return m_cache.templateDecls.get(); + return cache.templateDecls.get(); } TemplateVariant typeConstraints() const { - if (!m_cache.typeConstraints && m_classDef->typeConstraints()) - { - m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString())); - } - else + if (m_classDef->typeConstraints()) { - m_cache.typeConstraints.reset(ArgumentListContext::alloc()); + Cachable &cache = getCache(); + if (!cache.typeConstraints && m_classDef->typeConstraints()) + { + cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString())); + } + return cache.typeConstraints.get(); } - return m_cache.typeConstraints.get(); + return FALSE; } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } void addMembers(ClassDef *cd,MemberListType lt) const { MemberList *ml = cd->getMemberList(lt); if (ml) { + Cachable &cache = getCache(); MemberListIterator li(*ml); const MemberDef *md; for (li.toFirst();(md=li.current());++li) { if (md->isBriefSectionVisible()) { - m_cache.allMembers.append(md); + cache.allMembers.append(md); } } } } TemplateVariant members() const { - if (!m_cache.members) + Cachable &cache = getCache(); + if (!cache.members) { addMembers(m_classDef,MemberListType_pubTypes); addMembers(m_classDef,MemberListType_services); @@ -2027,25 +2441,26 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> addMembers(m_classDef,MemberListType_priAttribs); addMembers(m_classDef,MemberListType_priStaticAttribs); addMembers(m_classDef,MemberListType_related); - m_cache.members.reset(MemberListContext::alloc(&m_cache.allMembers)); + cache.members.reset(MemberListContext::alloc(&cache.allMembers)); } - return m_cache.members.get(); + return cache.members.get(); } TemplateVariant allMembersList() const { - if (!m_cache.allMembersList) + Cachable &cache = getCache(); + if (!cache.allMembersList) { if (m_classDef->memberNameInfoSDict()) { AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoSDict()); - m_cache.allMembersList.reset(ml); + cache.allMembersList.reset(ml); } else { - m_cache.allMembersList.reset(AllMembersListContext::alloc()); + cache.allMembersList.reset(AllMembersListContext::alloc()); } } - return m_cache.allMembersList.get(); + return cache.allMembersList.get(); } TemplateVariant allMembersFileName() const { @@ -2053,22 +2468,24 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_classDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant additionalInheritedMembers() const { - if (!m_cache.additionalInheritedMembers) + Cachable &cache = getCache(); + if (!cache.additionalInheritedMembers) { InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); ctx->addMemberList(m_classDef,MemberListType_pubTypes,theTranslator->trPublicTypes()); @@ -2104,22 +2521,44 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ctx->addMemberList(m_classDef,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); ctx->addMemberList(m_classDef,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); ctx->addMemberList(m_classDef,MemberListType_related,theTranslator->trRelatedFunctions()); - m_cache.additionalInheritedMembers.reset(ctx); + cache.additionalInheritedMembers.reset(ctx); + } + return cache.additionalInheritedMembers.get(); + } + TemplateVariant isSimple() const + { + return m_classDef->isSimple(); + } + TemplateVariant categoryOf() const + { + Cachable &cache = getCache(); + if (!cache.categoryOf && m_classDef->categoryOf()) + { + cache.categoryOf.reset(ClassContext::alloc(m_classDef->categoryOf())); + } + if (cache.categoryOf) + { + return cache.categoryOf.get(); + } + else + { + return TemplateVariant(FALSE); } - return m_cache.additionalInheritedMembers.get(); } private: ClassDef *m_classDef; - struct Cachable + struct Cachable : public DefinitionContext<ClassContext::Private>::Cachable { - Cachable() : inheritanceNodes(-1) { } + Cachable(ClassDef *cd) : DefinitionContext<ClassContext::Private>::Cachable(cd), + inheritanceNodes(-1) { } SharedPtr<IncludeInfoContext> includeInfo; SharedPtr<InheritanceListContext> inheritsList; SharedPtr<InheritanceListContext> inheritedByList; ScopedPtr<DotClassGraph> classGraph; ScopedPtr<DotClassGraph> collaborationGraph; SharedPtr<TemplateList> classes; + SharedPtr<TemplateList> innerClasses; SharedPtr<MemberListInfoContext> publicTypes; SharedPtr<MemberListInfoContext> publicMethods; SharedPtr<MemberListInfoContext> publicStaticMethods; @@ -2169,13 +2608,22 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> SharedPtr<MemberListContext> members; SharedPtr<UsedFilesContext> usedFiles; SharedPtr<TemplateList> exampleList; + SharedPtr<ClassContext> categoryOf; int inheritanceNodes; MemberList allMembers; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_classDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<ClassContext::Private> s_inst; }; //%% } +PropertyMapper<ClassContext::Private> ClassContext::Private::s_inst; + ClassContext::ClassContext(ClassDef *cd) : RefCountedContext("ClassContext") { //printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():"<none>"); @@ -2199,28 +2647,40 @@ TemplateVariant ClassContext::get(const char *n) const class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Private> { public: - Private(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>(nd) , m_namespaceDef(nd) - { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("compoundType", this,&Private::compoundType); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("classes", this,&Private::classes); - addProperty("namespaces", this,&Private::namespaces); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("inlineClasses", this,&Private::inlineClasses); + Private(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>(nd), + m_namespaceDef(nd) + { + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("compoundType", &Private::compoundType); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + init=TRUE; + } + if (!nd->cookie()) { nd->setCookie(new NamespaceContext::Private::Cachable(nd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_namespaceDef->title()); @@ -2243,7 +2703,8 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_namespaceDef->getClassSDict()) @@ -2258,13 +2719,14 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_namespaceDef->getNamespaceSDict()) @@ -2279,13 +2741,14 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_namespaceDef->getNamespaceSDict()) @@ -2300,9 +2763,9 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -2312,7 +2775,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri MemberList *ml = m_namespaceDef->getMemberList(type); if (ml) { - list.reset(MemberListInfoContext::alloc(m_namespaceDef,relPathAsString(),ml,title,detailed)); + list.reset(MemberListInfoContext::alloc(m_namespaceDef,relPathAsString(),ml,title,"")); } } if (list) @@ -2326,11 +2789,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant functions() const { @@ -2338,49 +2801,51 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri SrcLangExt lang = m_namespaceDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_namespaceDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroupSDict(),m_namespaceDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroupSDict(),m_namespaceDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_namespaceDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_namespaceDef->getClassSDict()) @@ -2398,14 +2863,15 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } private: NamespaceDef *m_namespaceDef; - struct Cachable + struct Cachable : public DefinitionContext<NamespaceContext::Private>::Cachable { + Cachable(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>::Cachable(nd) {} SharedPtr<TemplateList> classes; SharedPtr<TemplateList> namespaces; SharedPtr<TemplateList> constantgroups; @@ -2420,10 +2886,18 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri SharedPtr<MemberListInfoContext> detailedVariables; SharedPtr<TemplateList> inlineClasses; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_namespaceDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<NamespaceContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceContext::Private> NamespaceContext::Private::s_inst; + NamespaceContext::NamespaceContext(NamespaceDef *nd) : RefCountedContext("NamespaceContext") { p = new Private(nd); @@ -2449,37 +2923,48 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> Private(FileDef *fd) : DefinitionContext<FileContext::Private>(fd) , m_fileDef(fd) { if (fd==0) abort(); - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("versionInfo", this,&Private::versionInfo); - addProperty("includeList", this,&Private::includeList); - addProperty("hasIncludeGraph", this,&Private::hasIncludeGraph); - addProperty("hasIncludedByGraph", this,&Private::hasIncludedByGraph); - addProperty("includeGraph", this,&Private::includeGraph); - addProperty("includedByGraph", this,&Private::includedByGraph); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("hasSourceFile", this,&Private::hasSourceFile); - addProperty("sources", this,&Private::sources); - addProperty("version", this,&Private::version); - addProperty("classes", this,&Private::classes); - addProperty("namespaces", this,&Private::namespaces); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("macros", this,&Private::macros); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedMacros", this,&Private::detailedMacros); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("inlineClasses", this,&Private::inlineClasses); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("versionInfo", &Private::versionInfo); + s_inst.addProperty("includeList", &Private::includeList); + s_inst.addProperty("hasIncludeGraph", &Private::hasIncludeGraph); + s_inst.addProperty("hasIncludedByGraph", &Private::hasIncludedByGraph); + s_inst.addProperty("includeGraph", &Private::includeGraph); + s_inst.addProperty("includedByGraph", &Private::includedByGraph); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("hasSourceFile", &Private::hasSourceFile); + s_inst.addProperty("sources", &Private::sources); + s_inst.addProperty("version", &Private::version); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedMacros", &Private::detailedMacros); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!fd->cookie()) { fd->setCookie(new FileContext::Private::Cachable(fd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return m_fileDef->title(); @@ -2498,14 +2983,15 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant includeList() const { - if (!m_cache.includeInfoList && m_fileDef->includeFileList()) + Cachable &cache = getCache(); + if (!cache.includeInfoList && m_fileDef->includeFileList()) { - m_cache.includeInfoList.reset(IncludeInfoListContext::alloc( + cache.includeInfoList.reset(IncludeInfoListContext::alloc( *m_fileDef->includeFileList(),m_fileDef->getLanguage())); } - if (m_cache.includeInfoList) + if (cache.includeInfoList) { - return m_cache.includeInfoList.get(); + return cache.includeInfoList.get(); } else { @@ -2514,11 +3000,12 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } DotInclDepGraph *getIncludeGraph() const { - if (!m_cache.includeGraph) + Cachable &cache = getCache(); + if (!cache.includeGraph) { - m_cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE)); + cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE)); } - return m_cache.includeGraph.get(); + return cache.includeGraph.get(); } TemplateVariant hasIncludeGraph() const { @@ -2534,22 +3021,43 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> { DotInclDepGraph *cg = getIncludeGraph(); FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; } - g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } DotInclDepGraph *getIncludedByGraph() const { - if (!m_cache.includedByGraph) + Cachable &cache = getCache(); + if (!cache.includedByGraph) { - m_cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE)); + cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE)); } - return m_cache.includedByGraph.get(); + return cache.includedByGraph.get(); } TemplateVariant hasIncludedByGraph() const { @@ -2565,13 +3073,33 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> { DotInclDepGraph *cg = getIncludedByGraph(); FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; } - g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } TemplateVariant hasDetails() const @@ -2584,18 +3112,19 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant sources() const { - if (!m_cache.sources) + Cachable &cache = getCache(); + if (!cache.sources) { if (m_fileDef->generateSourceFile()) { - m_cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString()))); + cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString()))); } else { - m_cache.sources.reset(new TemplateVariant("")); + cache.sources.reset(new TemplateVariant("")); } } - return *m_cache.sources; + return *cache.sources; } TemplateVariant version() const { @@ -2603,7 +3132,8 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_fileDef->getClassSDict()) @@ -2618,13 +3148,14 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_fileDef->getNamespaceSDict()) @@ -2639,13 +3170,14 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_fileDef->getNamespaceSDict()) @@ -2660,9 +3192,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -2672,7 +3204,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> MemberList *ml = m_fileDef->getMemberList(type); if (ml) { - list.reset(MemberListInfoContext::alloc(m_fileDef,relPathAsString(),ml,title,detailed)); + list.reset(MemberListInfoContext::alloc(m_fileDef,relPathAsString(),ml,title,"")); } } if (list) @@ -2686,15 +3218,15 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant macros() const { - return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines()); + return getMemberList(getCache().macros,MemberListType_decDefineMembers,theTranslator->trDefines()); } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant functions() const { @@ -2702,53 +3234,55 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> SrcLangExt lang = m_fileDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_fileDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedMacros() const { - return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); + return getMemberList(getCache().detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_fileDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_fileDef->getClassSDict()) @@ -2766,9 +3300,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } TemplateVariant compoundType() const { @@ -2777,8 +3311,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> private: FileDef *m_fileDef; - struct Cachable + struct Cachable : public DefinitionContext<FileContext::Private>::Cachable { + Cachable(FileDef *fd) : DefinitionContext<FileContext::Private>::Cachable(fd) {} SharedPtr<IncludeInfoListContext> includeInfoList; ScopedPtr<DotInclDepGraph> includeGraph; ScopedPtr<DotInclDepGraph> includedByGraph; @@ -2799,10 +3334,18 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> SharedPtr<MemberListInfoContext> detailedVariables; SharedPtr<TemplateList> inlineClasses; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_fileDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<FileContext::Private> s_inst; }; //%% } +PropertyMapper<FileContext::Private> FileContext::Private::s_inst; + FileContext::FileContext(FileDef *fd) : RefCountedContext("FileContext") { p = new Private(fd); @@ -2827,16 +3370,29 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> public: Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("dirName", this,&Private::dirName); - addProperty("dirs", this,&Private::dirs); - addProperty("files", this,&Private::files); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("dirName", &Private::dirName); + s_inst.addProperty("dirs", &Private::dirs); + s_inst.addProperty("files", &Private::files); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("hasDirGraph", &Private::hasDirGraph); + s_inst.addProperty("dirGraph", &Private::dirGraph); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!dd->cookie()) { dd->setCookie(new DirContext::Private::Cachable(dd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_dirDef->shortTitle()); @@ -2855,26 +3411,27 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } TemplateVariant dirs() const { - if (!m_cache.dirs) + Cachable &cache = getCache(); + if (!cache.dirs) { - m_cache.dirs.reset(TemplateList::alloc()); + cache.dirs.reset(TemplateList::alloc()); const DirList &subDirs = m_dirDef->subDirs(); QListIterator<DirDef> it(subDirs); DirDef *dd; for (it.toFirst();(dd=it.current());++it) { DirContext *dc = new DirContext(dd); - m_cache.dirs->append(dc); + cache.dirs->append(dc); } } - return m_cache.dirs.get(); + return cache.dirs.get(); } TemplateVariant files() const { - // FileList *list = m_dirDef->getFiles(); - if (!m_cache.files) + Cachable &cache = getCache(); + if (!cache.files) { - m_cache.files.reset(TemplateList::alloc()); + cache.files.reset(TemplateList::alloc()); FileList *files = m_dirDef->getFiles(); if (files) { @@ -2883,11 +3440,11 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> for (it.toFirst();(fd=it.current());++it) { FileContext *fc = FileContext::alloc(fd); - m_cache.files->append(fc); + cache.files->append(fc); } } } - return m_cache.files.get(); + return cache.files.get(); } TemplateVariant hasDetails() const { @@ -2901,19 +3458,93 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> { return ""; } + DotDirDeps *getDirDepsGraph() const + { + Cachable &cache = getCache(); + if (!cache.dirDepsGraph) + { + cache.dirDepsGraph.reset(new DotDirDeps(m_dirDef)); + } + return cache.dirDepsGraph.get(); + } + TemplateVariant hasDirGraph() const + { + bool result=FALSE; + static bool haveDot = Config_getBool("HAVE_DOT"); + static bool dirGraph = Config_getBool("DIRECTORY_GRAPH"); + if (haveDot && dirGraph) + { + DotDirDeps *graph = getDirDepsGraph(); + result = !graph->isTrivial(); + } + return result; + } + TemplateVariant dirGraph() const + { + QGString result; + static bool haveDot = Config_getBool("HAVE_DOT"); + static bool dirGraph = Config_getBool("DIRECTORY_GRAPH"); + if (haveDot && dirGraph) + { + DotDirDeps *graph = getDirDepsGraph(); + FTextStream t(&result); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + graph->writeGraph(t,GOF_BITMAP, + EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_dirDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(), + TRUE, + g_globals.dynSectionId, + FALSE); + } + break; + case ContextOutputFormat_Latex: + { + graph->writeGraph(t,GOF_EPS, + EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_dirDef->getOutputFileBase()+".tex", + relPathAsString(), + TRUE, + g_globals.dynSectionId, + FALSE); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; + } + return TemplateVariant(result.data(),TRUE); + } private: DirDef *m_dirDef; - struct Cachable + struct Cachable : public DefinitionContext<DirContext::Private>::Cachable { - Cachable() {} + Cachable(DirDef *dd) : DefinitionContext<DirContext::Private>::Cachable(dd) {} SharedPtr<TemplateList> dirs; SharedPtr<TemplateList> files; + ScopedPtr<DotDirDeps> dirDepsGraph; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_dirDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<DirContext::Private> s_inst; }; //%% } +PropertyMapper<DirContext::Private> DirContext::Private::s_inst; + DirContext::DirContext(DirDef *fd) : RefCountedContext("DirContext") { p = new Private(fd); @@ -2936,14 +3567,27 @@ TemplateVariant DirContext::get(const char *n) const class PageContext::Private : public DefinitionContext<PageContext::Private> { public: - Private(PageDef *pd,bool isMainPage) - : DefinitionContext<PageContext::Private>(pd) , m_pageDef(pd), m_isMainPage(isMainPage) + Private(PageDef *pd,bool isMainPage,bool isExample) + : DefinitionContext<PageContext::Private>(pd) , m_pageDef(pd), m_isMainPage(isMainPage), + m_isExample(isExample) { - addProperty("title",this,&Private::title); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subHighlight); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subHighlight); + s_inst.addProperty("example", &Private::example); + init=TRUE; + } + if (!pd->cookie()) { pd->setCookie(new PageContext::Private::Cachable(pd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { if (m_isMainPage) @@ -2957,6 +3601,10 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> return theTranslator->trMainPage(); } } + else if (m_isExample) + { + return m_pageDef->name(); + } else { return m_pageDef->title(); @@ -2988,15 +3636,51 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> { return ""; } + TemplateVariant example() const + { + if (m_isExample) + { + Cachable &cache = getCache(); + if (!cache.example || g_globals.outputFormat!=cache.exampleOutputFormat) + { + cache.example.reset(new TemplateVariant( + parseDoc(m_pageDef,m_pageDef->docFile(),m_pageDef->docLine(), + relPathAsString(),"\\include "+m_pageDef->name(),FALSE))); + cache.exampleOutputFormat = g_globals.outputFormat; + } + return *cache.example; + } + else + { + return TemplateVariant(""); + } + } private: PageDef *m_pageDef; + struct Cachable : public DefinitionContext<PageContext::Private>::Cachable + { + Cachable(PageDef *pd) : DefinitionContext<PageContext::Private>::Cachable(pd), + exampleOutputFormat(ContextOutputFormat_Unspecified) { } + ScopedPtr<TemplateVariant> example; + ContextOutputFormat exampleOutputFormat; + }; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_pageDef->cookie()); + assert(c!=0); + return *c; + } bool m_isMainPage; + bool m_isExample; + static PropertyMapper<PageContext::Private> s_inst; }; //%% } -PageContext::PageContext(PageDef *pd,bool isMainPage) : RefCountedContext("PageContext") +PropertyMapper<PageContext::Private> PageContext::Private::s_inst; + +PageContext::PageContext(PageDef *pd,bool isMainPage,bool isExample) : RefCountedContext("PageContext") { - p = new Private(pd,isMainPage); + p = new Private(pd,isMainPage,isExample); } PageContext::~PageContext() @@ -3019,7 +3703,6 @@ class TextGeneratorHtml : public TextGeneratorIntf void writeString(const char *s,bool keepSpaces) const { if (s==0) return; - //printf("TextGeneratorOlImpl::writeString('%s',%d)\n",s,keepSpaces); if (keepSpaces) { const char *p=s; @@ -3079,6 +3762,54 @@ class TextGeneratorHtml : public TextGeneratorIntf QCString m_relPath; }; +//------------------------------------------------------------------------ + +class TextGeneratorLatex : public TextGeneratorIntf +{ + public: + TextGeneratorLatex(FTextStream &ts) : m_ts(ts) {} + void writeString(const char *s,bool keepSpaces) const + { + if (s==0) return; + m_ts << convertToLaTeX(s,FALSE,keepSpaces); + } + void writeBreak(int indent) const + { + m_ts << "\\\\*\n"; + for (int i=0;i<indent;i++) + { + m_ts << "~"; + } + } + void writeLink(const char *ref,const char *f, + const char *anchor,const char *text + ) const + { + static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); + if (!ref && pdfHyperlinks) + { + m_ts << "\\hyperlink{"; + if (f) m_ts << stripPath(f); + if (f && anchor) m_ts << "_"; + if (anchor) m_ts << anchor; + m_ts << "}{"; + filterLatexString(m_ts,text); + m_ts << "}"; + } + else + { + m_ts << "{\\bf "; + filterLatexString(m_ts,text); + m_ts << "}"; + } + } + + private: + FTextStream &m_ts; +}; + +//------------------------------------------------------------------------ + class TextGeneratorFactory { public: @@ -3092,9 +3823,10 @@ class TextGeneratorFactory { switch (g_globals.outputFormat) { - case ContextGlobals::Html: + case ContextOutputFormat_Html: return new TextGeneratorHtml(ts,relPath); - break; + case ContextOutputFormat_Latex: + return new TextGeneratorLatex(ts); default: break; } @@ -3113,6 +3845,7 @@ TemplateVariant createLinkedText(Definition *def,const QCString &relPath,const Q if (tg) { linkifyText(*tg,def->getOuterScope(),def->getBodyDef(),def,text); + delete tg; return TemplateVariant(s.data(),TRUE); } else @@ -3128,147 +3861,184 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> public: Private(MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md) { - addProperty("isSignal", this,&Private::isSignal); - addProperty("isSlot", this,&Private::isSlot); - addProperty("isVariable", this,&Private::isVariable); - addProperty("isEnumeration", this,&Private::isEnumeration); - addProperty("isEnumValue", this,&Private::isEnumValue); - addProperty("isTypedef", this,&Private::isTypedef); - addProperty("isFunction", this,&Private::isFunction); - addProperty("isFunctionPtr", this,&Private::isFunctionPtr); - addProperty("isDefine", this,&Private::isDefine); - addProperty("isFriend", this,&Private::isFriend); - addProperty("isProperty", this,&Private::isProperty); - addProperty("isEvent", this,&Private::isEvent); - addProperty("isRelated", this,&Private::isRelated); - addProperty("isForeign", this,&Private::isForeign); - addProperty("isStatic", this,&Private::isStatic); - addProperty("isInline", this,&Private::isInline); - addProperty("isExplicit", this,&Private::isExplicit); - addProperty("isMutable", this,&Private::isMutable); - addProperty("isGettable", this,&Private::isGettable); - addProperty("isPrivateGettable", this,&Private::isPrivateGettable); - addProperty("isProtectedGettable", this,&Private::isProtectedGettable); - addProperty("isSettable", this,&Private::isSettable); - addProperty("isPrivateSettable", this,&Private::isPrivateSettable); - addProperty("isProtectedSettable", this,&Private::isProtectedSettable); - addProperty("isReadable", this,&Private::isReadable); - addProperty("isWritable", this,&Private::isWritable); - addProperty("isAddable", this,&Private::isAddable); - addProperty("isRemovable", this,&Private::isRemovable); - addProperty("isRaisable", this,&Private::isRaisable); - addProperty("isFinal", this,&Private::isFinal); - addProperty("isAbstract", this,&Private::isAbstract); - addProperty("isOverride", this,&Private::isOverride); - addProperty("isInitonly", this,&Private::isInitonly); - addProperty("isOptional", this,&Private::isOptional); - addProperty("isRequired", this,&Private::isRequired); - addProperty("isNonAtomic", this,&Private::isNonAtomic); - addProperty("isCopy", this,&Private::isCopy); - addProperty("isAssign", this,&Private::isAssign); - addProperty("isRetain", this,&Private::isRetain); - addProperty("isWeak", this,&Private::isWeak); - addProperty("isStrong", this,&Private::isStrong); - addProperty("isUnretained", this,&Private::isUnretained); - addProperty("isNew", this,&Private::isNew); - addProperty("isSealed", this,&Private::isSealed); - addProperty("isImplementation", this,&Private::isImplementation); - addProperty("isExternal", this,&Private::isExternal); - addProperty("isAlias", this,&Private::isAlias); - addProperty("isDefault", this,&Private::isDefault); - addProperty("isDelete", this,&Private::isDelete); - addProperty("isNoExcept", this,&Private::isNoExcept); - addProperty("isAttribute", this,&Private::isAttribute); - addProperty("isUNOProperty", this,&Private::isUNOProperty); - addProperty("isReadonly", this,&Private::isReadonly); - addProperty("isBound", this,&Private::isBound); - addProperty("isConstrained", this,&Private::isConstrained); - addProperty("isTransient", this,&Private::isTransient); - addProperty("isMaybeVoid", this,&Private::isMaybeVoid); - addProperty("isMaybeDefault", this,&Private::isMaybeDefault); - addProperty("isMaybeAmbiguous", this,&Private::isMaybeAmbiguous); - addProperty("isPublished", this,&Private::isPublished); - addProperty("isTemplateSpecialization",this,&Private::isTemplateSpecialization); - addProperty("isObjCMethod", this,&Private::isObjCMethod); - addProperty("isObjCProperty", this,&Private::isObjCProperty); - addProperty("isAnonymous", this,&Private::isAnonymous); - addProperty("declType", this,&Private::declType); - addProperty("declArgs", this,&Private::declArgs); - addProperty("anonymousType", this,&Private::anonymousType); - addProperty("anonymousMember", this,&Private::anonymousMember); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("exception", this,&Private::exception); - addProperty("bitfields", this,&Private::bitfields); - addProperty("initializer", this,&Private::initializer); - addProperty("initializerAsCode", this,&Private::initializerAsCode); - addProperty("hasOneLineInitializer", this,&Private::hasOneLineInitializer); - addProperty("hasMultiLineInitializer", this,&Private::hasMultiLineInitializer); - addProperty("templateArgs", this,&Private::templateArgs); - addProperty("templateAlias", this,&Private::templateAlias); - addProperty("propertyAttrs", this,&Private::propertyAttrs); - addProperty("eventAttrs", this,&Private::eventAttrs); - addProperty("class", this,&Private::getClass); - addProperty("file", this,&Private::getFile); - addProperty("namespace", this,&Private::getNamespace); - addProperty("definition", this,&Private::definition); - addProperty("parameters", this,&Private::parameters); - addProperty("hasParameterList", this,&Private::hasParameterList); - addProperty("hasConstQualifier", this,&Private::hasConstQualifier); - addProperty("hasVolatileQualifier",this,&Private::hasVolatileQualifier); - addProperty("trailingReturnType", this,&Private::trailingReturnType); - addProperty("extraTypeChars", this,&Private::extraTypeChars); - addProperty("templateDecls", this,&Private::templateDecls); - addProperty("labels", this,&Private::labels); - addProperty("enumBaseType", this,&Private::enumBaseType); - addProperty("enumValues", this,&Private::enumValues); - addProperty("paramDocs", this,&Private::paramDocs); - addProperty("reimplements", this,&Private::reimplements); - addProperty("implements", this,&Private::implements); - addProperty("reimplementedBy", this,&Private::reimplementedBy); - addProperty("implementedBy", this,&Private::implementedBy); - addProperty("examples", this,&Private::examples); - addProperty("typeConstraints", this,&Private::typeConstraints); - addProperty("functionQualifier", this,&Private::functionQualifier); - addProperty("sourceRefs", this,&Private::sourceRefs); - addProperty("sourceRefBys", this,&Private::sourceRefBys); - addProperty("hasSources", this,&Private::hasSources); - addProperty("sourceCode", this,&Private::sourceCode); - addProperty("hasCallGraph", this,&Private::hasCallGraph); - addProperty("callGraph", this,&Private::callGraph); - addProperty("hasCallerGraph", this,&Private::hasCallerGraph); - addProperty("callerGraph", this,&Private::callerGraph); - addProperty("fieldType", this,&Private::fieldType); - - m_cache.propertyAttrs.reset(TemplateList::alloc()); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("isSignal", &Private::isSignal); + s_inst.addProperty("isSlot", &Private::isSlot); + s_inst.addProperty("isVariable", &Private::isVariable); + s_inst.addProperty("isEnumeration", &Private::isEnumeration); + s_inst.addProperty("isEnumValue", &Private::isEnumValue); + s_inst.addProperty("isTypedef", &Private::isTypedef); + s_inst.addProperty("isFunction", &Private::isFunction); + s_inst.addProperty("isFunctionPtr", &Private::isFunctionPtr); + s_inst.addProperty("isDefine", &Private::isDefine); + s_inst.addProperty("isFriend", &Private::isFriend); + s_inst.addProperty("isProperty", &Private::isProperty); + s_inst.addProperty("isEvent", &Private::isEvent); + s_inst.addProperty("isRelated", &Private::isRelated); + s_inst.addProperty("isForeign", &Private::isForeign); + s_inst.addProperty("isStatic", &Private::isStatic); + s_inst.addProperty("isInline", &Private::isInline); + s_inst.addProperty("isExplicit", &Private::isExplicit); + s_inst.addProperty("isMutable", &Private::isMutable); + s_inst.addProperty("isGettable", &Private::isGettable); + s_inst.addProperty("isPrivateGettable", &Private::isPrivateGettable); + s_inst.addProperty("isProtectedGettable", &Private::isProtectedGettable); + s_inst.addProperty("isSettable", &Private::isSettable); + s_inst.addProperty("isPrivateSettable", &Private::isPrivateSettable); + s_inst.addProperty("isProtectedSettable", &Private::isProtectedSettable); + s_inst.addProperty("isReadable", &Private::isReadable); + s_inst.addProperty("isWritable", &Private::isWritable); + s_inst.addProperty("isAddable", &Private::isAddable); + s_inst.addProperty("isRemovable", &Private::isRemovable); + s_inst.addProperty("isRaisable", &Private::isRaisable); + s_inst.addProperty("isFinal", &Private::isFinal); + s_inst.addProperty("isAbstract", &Private::isAbstract); + s_inst.addProperty("isOverride", &Private::isOverride); + s_inst.addProperty("isInitonly", &Private::isInitonly); + s_inst.addProperty("isOptional", &Private::isOptional); + s_inst.addProperty("isRequired", &Private::isRequired); + s_inst.addProperty("isNonAtomic", &Private::isNonAtomic); + s_inst.addProperty("isCopy", &Private::isCopy); + s_inst.addProperty("isAssign", &Private::isAssign); + s_inst.addProperty("isRetain", &Private::isRetain); + s_inst.addProperty("isWeak", &Private::isWeak); + s_inst.addProperty("isStrong", &Private::isStrong); + s_inst.addProperty("isUnretained", &Private::isUnretained); + s_inst.addProperty("isNew", &Private::isNew); + s_inst.addProperty("isSealed", &Private::isSealed); + s_inst.addProperty("isImplementation", &Private::isImplementation); + s_inst.addProperty("isExternal", &Private::isExternal); + s_inst.addProperty("isAlias", &Private::isAlias); + s_inst.addProperty("isDefault", &Private::isDefault); + s_inst.addProperty("isDelete", &Private::isDelete); + s_inst.addProperty("isNoExcept", &Private::isNoExcept); + s_inst.addProperty("isAttribute", &Private::isAttribute); + s_inst.addProperty("isUNOProperty", &Private::isUNOProperty); + s_inst.addProperty("isReadonly", &Private::isReadonly); + s_inst.addProperty("isBound", &Private::isBound); + s_inst.addProperty("isConstrained", &Private::isConstrained); + s_inst.addProperty("isTransient", &Private::isTransient); + s_inst.addProperty("isMaybeVoid", &Private::isMaybeVoid); + s_inst.addProperty("isMaybeDefault", &Private::isMaybeDefault); + s_inst.addProperty("isMaybeAmbiguous", &Private::isMaybeAmbiguous); + s_inst.addProperty("isPublished", &Private::isPublished); + s_inst.addProperty("isTemplateSpecialization",&Private::isTemplateSpecialization); + s_inst.addProperty("isObjCMethod", &Private::isObjCMethod); + s_inst.addProperty("isObjCProperty", &Private::isObjCProperty); + s_inst.addProperty("isAnonymous", &Private::isAnonymous); + s_inst.addProperty("hasParameters", &Private::hasParameters); + s_inst.addProperty("declType", &Private::declType); + s_inst.addProperty("declArgs", &Private::declArgs); + s_inst.addProperty("anonymousType", &Private::anonymousType); + s_inst.addProperty("anonymousMember", &Private::anonymousMember); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("exception", &Private::exception); + s_inst.addProperty("bitfields", &Private::bitfields); + s_inst.addProperty("initializer", &Private::initializer); + s_inst.addProperty("initializerAsCode", &Private::initializerAsCode); + s_inst.addProperty("hasOneLineInitializer", &Private::hasOneLineInitializer); + s_inst.addProperty("hasMultiLineInitializer", &Private::hasMultiLineInitializer); + s_inst.addProperty("templateArgs", &Private::templateArgs); + s_inst.addProperty("templateAlias", &Private::templateAlias); + s_inst.addProperty("propertyAttrs", &Private::propertyAttrs); + s_inst.addProperty("eventAttrs", &Private::eventAttrs); + s_inst.addProperty("category", &Private::category); + s_inst.addProperty("categoryRelation", &Private::categoryRelation); + s_inst.addProperty("class", &Private::getClass); + s_inst.addProperty("file", &Private::getFile); + s_inst.addProperty("namespace", &Private::getNamespace); + s_inst.addProperty("definition", &Private::definition); + s_inst.addProperty("parameters", &Private::parameters); + s_inst.addProperty("hasConstQualifier", &Private::hasConstQualifier); + s_inst.addProperty("hasVolatileQualifier",&Private::hasVolatileQualifier); + s_inst.addProperty("trailingReturnType", &Private::trailingReturnType); + s_inst.addProperty("extraTypeChars", &Private::extraTypeChars); + s_inst.addProperty("templateDecls", &Private::templateDecls); + s_inst.addProperty("labels", &Private::labels); + s_inst.addProperty("enumBaseType", &Private::enumBaseType); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("paramDocs", &Private::paramDocs); + s_inst.addProperty("reimplements", &Private::reimplements); + s_inst.addProperty("implements", &Private::implements); + s_inst.addProperty("reimplementedBy", &Private::reimplementedBy); + s_inst.addProperty("implementedBy", &Private::implementedBy); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + s_inst.addProperty("functionQualifier", &Private::functionQualifier); + s_inst.addProperty("sourceRefs", &Private::sourceRefs); + s_inst.addProperty("sourceRefBys", &Private::sourceRefBys); + s_inst.addProperty("hasSources", &Private::hasSources); + s_inst.addProperty("sourceCode", &Private::sourceCode); + s_inst.addProperty("hasCallGraph", &Private::hasCallGraph); + s_inst.addProperty("callGraph", &Private::callGraph); + s_inst.addProperty("hasCallerGraph", &Private::hasCallerGraph); + s_inst.addProperty("callerGraph", &Private::callerGraph); + s_inst.addProperty("fieldType", &Private::fieldType); + s_inst.addProperty("type", &Private::type); + s_inst.addProperty("detailsVisibleFor", &Private::detailsVisibleFor); + s_inst.addProperty("nameWithContextFor", &Private::nameWithContextFor); + init=TRUE; + } + if (!md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); } + + Cachable &cache = getCache(); + cache.propertyAttrs.reset(TemplateList::alloc()); if (md && md->isProperty()) { - if (md->isGettable()) m_cache.propertyAttrs->append("get"); - if (md->isPrivateGettable()) m_cache.propertyAttrs->append("private get"); - if (md->isProtectedGettable()) m_cache.propertyAttrs->append("protected get"); - if (md->isSettable()) m_cache.propertyAttrs->append("set"); - if (md->isPrivateSettable()) m_cache.propertyAttrs->append("private set"); - if (md->isProtectedSettable()) m_cache.propertyAttrs->append("protected set"); + if (md->isGettable()) cache.propertyAttrs->append("get"); + if (md->isPrivateGettable()) cache.propertyAttrs->append("private get"); + if (md->isProtectedGettable()) cache.propertyAttrs->append("protected get"); + if (md->isSettable()) cache.propertyAttrs->append("set"); + if (md->isPrivateSettable()) cache.propertyAttrs->append("private set"); + if (md->isProtectedSettable()) cache.propertyAttrs->append("protected set"); } - m_cache.eventAttrs.reset(TemplateList::alloc()); + cache.eventAttrs.reset(TemplateList::alloc()); if (md && md->isEvent()) { - if (md->isAddable()) m_cache.eventAttrs->append("add"); - if (md->isRemovable()) m_cache.eventAttrs->append("remove"); - if (md->isRaisable()) m_cache.eventAttrs->append("raise"); + if (md->isAddable()) cache.eventAttrs->append("add"); + if (md->isRemovable()) cache.eventAttrs->append("remove"); + if (md->isRaisable()) cache.eventAttrs->append("raise"); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant fieldType() const { return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->fieldType()); } TemplateVariant declType() const { - return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); + Cachable &cache = getCache(); + if (!cache.declTypeParsed) + { + cache.declType=createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); + cache.declTypeParsed = TRUE; + return cache.declType; + } + else + { + return cache.declType; + } } TemplateVariant declArgs() const { - return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->argsString()); + Cachable &cache = getCache(); + if (!cache.declArgsParsed) + { + cache.declArgs=createLinkedText(m_memberDef,relPathAsString(),m_memberDef->argsString()); + cache.declArgsParsed = TRUE; + return cache.declArgs; + } + else + { + return cache.declArgs; + } } TemplateVariant exception() const { @@ -3532,7 +4302,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant initializerAsCode() const { - if (!m_cache.initializerParsed) + Cachable &cache = getCache(); + if (!cache.initializerParsed) { QCString scopeName; if (m_memberDef->getClassDef()) @@ -3543,11 +4314,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - m_cache.initializer = parseCode(m_memberDef,scopeName,relPathAsString(), + cache.initializer = parseCode(m_memberDef,scopeName,relPathAsString(), m_memberDef->initializer()); - m_cache.initializerParsed = TRUE; + cache.initializerParsed = TRUE; } - return m_cache.initializer; + return cache.initializer; } TemplateVariant isDefine() const { @@ -3560,17 +4331,18 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant anonymousType() const { - if (!m_cache.anonymousType) + Cachable &cache = getCache(); + if (!cache.anonymousType) { ClassDef *cd = m_memberDef->getClassDefOfAnonymousType(); if (cd) { - m_cache.anonymousType.reset(ClassContext::alloc(cd)); + cache.anonymousType.reset(ClassContext::alloc(cd)); } } - if (m_cache.anonymousType) + if (cache.anonymousType) { - return m_cache.anonymousType.get(); + return cache.anonymousType.get(); } else { @@ -3579,17 +4351,18 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant anonymousMember() const { - if (!m_cache.anonymousMember) + Cachable &cache = getCache(); + if (!cache.anonymousMember) { MemberDef *md = m_memberDef->fromAnonymousMember(); if (md) { - m_cache.anonymousMember.reset(MemberContext::alloc(md)); + cache.anonymousMember.reset(MemberContext::alloc(md)); } } - if (m_cache.anonymousMember) + if (cache.anonymousMember) { - return m_cache.anonymousMember.get(); + return cache.anonymousMember.get(); } else { @@ -3614,29 +4387,31 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant enumValues() const { - if (!m_cache.enumValues) + Cachable &cache = getCache(); + if (!cache.enumValues) { MemberList *ml = m_memberDef->enumFieldList(); if (ml) { - m_cache.enumValues.reset(MemberListContext::alloc(ml)); + cache.enumValues.reset(MemberListContext::alloc(ml)); } else { - m_cache.enumValues.reset(MemberListContext::alloc()); + cache.enumValues.reset(MemberListContext::alloc()); } } - return m_cache.enumValues.get(); + return cache.enumValues.get(); } TemplateVariant templateArgs() const { - if (!m_cache.templateArgs && m_memberDef->templateArguments()) + Cachable &cache = getCache(); + if (!cache.templateArgs && m_memberDef->templateArguments()) { - m_cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); + cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); } - if (m_cache.templateArgs) + if (cache.templateArgs) { - return m_cache.templateArgs.get(); + return cache.templateArgs.get(); } else { @@ -3654,21 +4429,54 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant propertyAttrs() const { - return m_cache.propertyAttrs.get(); + return getCache().propertyAttrs.get(); } TemplateVariant eventAttrs() const { - return m_cache.eventAttrs.get(); + return getCache().eventAttrs.get(); } TemplateVariant getClass() const { - if (!m_cache.classDef && m_memberDef->getClassDef()) + Cachable &cache = getCache(); + if (!cache.classDef && m_memberDef->getClassDef()) + { + cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef())); + } + if (cache.classDef) + { + return cache.classDef.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant category() const + { + Cachable &cache = getCache(); + if (!cache.category && m_memberDef->category()) + { + cache.category.reset(ClassContext::alloc(m_memberDef->category())); + } + if (cache.category) + { + return cache.category.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant categoryRelation() const + { + Cachable &cache = getCache(); + if (!cache.categoryRelation && m_memberDef->categoryRelation()) { - m_cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef())); + cache.categoryRelation.reset(MemberContext::alloc(m_memberDef->categoryRelation())); } - if (m_cache.classDef) + if (cache.categoryRelation) { - return m_cache.classDef.get(); + return cache.categoryRelation.get(); } else { @@ -3677,13 +4485,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant getFile() const { - if (!m_cache.fileDef && m_memberDef->getFileDef()) + Cachable &cache = getCache(); + if (!cache.fileDef && m_memberDef->getFileDef()) { - m_cache.fileDef.reset(FileContext::alloc(m_memberDef->getFileDef())); + cache.fileDef.reset(FileContext::alloc(m_memberDef->getFileDef())); } - if (m_cache.fileDef) + if (cache.fileDef) { - return m_cache.fileDef.get(); + return cache.fileDef.get(); } else { @@ -3692,13 +4501,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant getNamespace() const { - if (!m_cache.namespaceDef && m_memberDef->getNamespaceDef()) + Cachable &cache = getCache(); + if (!cache.namespaceDef && m_memberDef->getNamespaceDef()) { - m_cache.namespaceDef.reset(NamespaceContext::alloc(m_memberDef->getNamespaceDef())); + cache.namespaceDef.reset(NamespaceContext::alloc(m_memberDef->getNamespaceDef())); } - if (m_cache.namespaceDef) + if (cache.namespaceDef) { - return m_cache.namespaceDef.get(); + return cache.namespaceDef.get(); } else { @@ -3717,21 +4527,22 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant parameters() const { - if (!m_cache.arguments) + Cachable &cache = getCache(); + if (!cache.arguments) { ArgumentList *defArgList = getDefArgList(); if (defArgList && !m_memberDef->isProperty()) { - m_cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString())); + cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString())); } else { - m_cache.arguments.reset(ArgumentListContext::alloc()); + cache.arguments.reset(ArgumentListContext::alloc()); } } - return m_cache.arguments.get(); + return cache.arguments.get(); } - TemplateVariant hasParameterList() const + TemplateVariant hasParameters() const { return getDefArgList()!=0; } @@ -3806,17 +4617,19 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant templateDecls() const { - if (!m_cache.templateDecls) + Cachable &cache = getCache(); + if (!cache.templateDecls) { TemplateList *tl = TemplateList::alloc(); addTemplateDecls(tl); - m_cache.templateDecls.reset(tl); + cache.templateDecls.reset(tl); } - return m_cache.templateDecls.get(); + return cache.templateDecls.get(); } TemplateVariant labels() const { - if (!m_cache.labels) + Cachable &cache = getCache(); + if (!cache.labels) { QStrList sl; m_memberDef->getLabels(sl,m_memberDef->getOuterScope()); @@ -3829,13 +4642,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> tl->append(*it); } } - m_cache.labels.reset(tl); + cache.labels.reset(tl); } - return m_cache.labels.get(); + return cache.labels.get(); } TemplateVariant paramDocs() const { - if (!m_cache.paramDocs) + Cachable &cache = getCache(); + if (!cache.paramDocs) { if (m_memberDef->argumentList() && m_memberDef->argumentList()->hasDocumentation()) { @@ -3851,59 +4665,62 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> paramDocs+="@param"+direction+" "+a->name+" "+a->docs; } } - m_cache.paramDocs.reset(new TemplateVariant(parseDoc(m_memberDef, + cache.paramDocs.reset(new TemplateVariant(parseDoc(m_memberDef, m_memberDef->docFile(),m_memberDef->docLine(), relPathAsString(),paramDocs,FALSE))); } else { - m_cache.paramDocs.reset(new TemplateVariant("")); + cache.paramDocs.reset(new TemplateVariant("")); } } - return *m_cache.paramDocs; + return *cache.paramDocs; } TemplateVariant implements() const { - if (!m_cache.implements) + Cachable &cache = getCache(); + if (!cache.implements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.implements.reset(TemplateList::alloc()); + cache.implements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { MemberContext *mc = MemberContext::alloc(md); - m_cache.implements->append(mc); + cache.implements->append(mc); } } } - return m_cache.implements.get(); + return cache.implements.get(); } TemplateVariant reimplements() const { - if (!m_cache.reimplements) + Cachable &cache = getCache(); + if (!cache.reimplements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.reimplements.reset(TemplateList::alloc()); + cache.reimplements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { MemberContext *mc = MemberContext::alloc(md); - m_cache.reimplements->append(mc); + cache.reimplements->append(mc); } } } - return m_cache.reimplements.get(); + return cache.reimplements.get(); } TemplateVariant implementedBy() const { - if (!m_cache.implementedBy) + Cachable &cache = getCache(); + if (!cache.implementedBy) { MemberList *ml = m_memberDef->reimplementedBy(); - m_cache.implementedBy.reset(TemplateList::alloc()); + cache.implementedBy.reset(TemplateList::alloc()); if (ml) { MemberListIterator mli(*ml); @@ -3914,18 +4731,19 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { MemberContext *mc = new MemberContext(md); - m_cache.implementedBy->append(mc); + cache.implementedBy->append(mc); } } } } - return m_cache.implementedBy.get(); + return cache.implementedBy.get(); } TemplateVariant reimplementedBy() const { - if (!m_cache.reimplementedBy) + Cachable &cache = getCache(); + if (!cache.reimplementedBy) { - m_cache.reimplementedBy.reset(TemplateList::alloc()); + cache.reimplementedBy.reset(TemplateList::alloc()); MemberList *ml = m_memberDef->reimplementedBy(); if (ml) { @@ -3937,12 +4755,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { MemberContext *mc = new MemberContext(md); - m_cache.reimplementedBy->append(mc); + cache.reimplementedBy->append(mc); } } } } - return m_cache.reimplementedBy.get(); + return cache.reimplementedBy.get(); } void addExamples(TemplateList *list) const { @@ -3957,31 +4775,35 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> s->set("isLinkable",TRUE); s->set("anchor",ex->anchor); s->set("fileName",ex->file); + s->set("isReference",FALSE); + s->set("externalReference",""); list->append(s); } } } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } TemplateVariant typeConstraints() const { - if (!m_cache.typeConstraints && m_memberDef->typeConstraints()) + Cachable &cache = getCache(); + if (!cache.typeConstraints && m_memberDef->typeConstraints()) { - m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); + cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); } else { - m_cache.typeConstraints.reset(ArgumentListContext::alloc()); + cache.typeConstraints.reset(ArgumentListContext::alloc()); } - return m_cache.typeConstraints.get(); + return cache.typeConstraints.get(); } TemplateVariant functionQualifier() const { @@ -4000,19 +4822,21 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant sourceRefs() const { - if (!m_cache.sourceRefs) + Cachable &cache = getCache(); + if (!cache.sourceRefs) { - m_cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); + cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); } - return m_cache.sourceRefs.get(); + return cache.sourceRefs.get(); } TemplateVariant sourceRefBys() const { - if (!m_cache.sourceRefBys) + Cachable &cache = getCache(); + if (!cache.sourceRefBys) { - m_cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); + cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); } - return m_cache.sourceRefBys.get(); + return cache.sourceRefBys.get(); } TemplateVariant hasSources() const { @@ -4020,7 +4844,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant sourceCode() const { - if (!m_cache.sourceCodeParsed) + Cachable &cache = getCache(); + if (!cache.sourceCodeParsed) { QCString codeFragment; FileDef *fd = m_memberDef->getBodyDef(); @@ -4039,19 +4864,20 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - m_cache.sourceCode = parseCode(m_memberDef,scopeName,relPathAsString(),codeFragment,startLine,endLine,TRUE); - m_cache.sourceCodeParsed = TRUE; + cache.sourceCode = parseCode(m_memberDef,scopeName,relPathAsString(),codeFragment,startLine,endLine,TRUE); + cache.sourceCodeParsed = TRUE; } } - return m_cache.sourceCode; + return cache.sourceCode; } DotCallGraph *getCallGraph() const { - if (!m_cache.callGraph) + Cachable &cache = getCache(); + if (!cache.callGraph) { - m_cache.callGraph.reset(new DotCallGraph(m_memberDef,FALSE)); + cache.callGraph.reset(new DotCallGraph(m_memberDef,FALSE)); } - return m_cache.callGraph.get(); + return cache.callGraph.get(); } TemplateVariant hasCallGraph() const { @@ -4071,11 +4897,31 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> DotCallGraph *cg = getCallGraph(); QGString result; FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } @@ -4086,11 +4932,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } DotCallGraph *getCallerGraph() const { - if (!m_cache.callerGraph) + Cachable &cache = getCache(); + if (!cache.callerGraph) { - m_cache.callerGraph.reset(new DotCallGraph(m_memberDef,TRUE)); + cache.callerGraph.reset(new DotCallGraph(m_memberDef,TRUE)); } - return m_cache.callerGraph.get(); + return cache.callerGraph.get(); } TemplateVariant hasCallerGraph() const { @@ -4110,11 +4957,31 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> DotCallGraph *cg = getCallerGraph(); QGString result; FTextStream t(&result); - cg->writeGraph(t,GOF_BITMAP,EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(),TRUE,g_globals.dynSectionId - ); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + cg->writeGraph(t,GOF_BITMAP,EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + case ContextOutputFormat_Latex: + { + cg->writeGraph(t,GOF_EPS,EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+".tex", + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } @@ -4123,18 +4990,72 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> return TemplateVariant(""); } } - private: - MemberDef *m_memberDef; - struct Cachable + TemplateVariant type() const + { + return m_memberDef->typeString(); + } + TemplateVariant handleDetailsVisibleFor(const QValueList<TemplateVariant> &args) const + { + if (args.count()==1) + { + return m_memberDef->isDetailedSectionVisible(args[0].toString()=="module",args[0].toString()=="file"); + } + else + { + err(".detailsVisibleFor should take one string argument, got %d\n",args.count()); + } + return TemplateVariant(); + } + TemplateVariant detailsVisibleFor() const + { + return TemplateVariant::Delegate::fromMethod<Private,&Private::handleDetailsVisibleFor>(this); + } + TemplateVariant handleNameWithContextFor(const QValueList<TemplateVariant> &args) const { - Cachable() : initializerParsed(FALSE), sourceCodeParsed(FALSE) + if (args.count()==1) + { + SrcLangExt lang = m_memberDef->getLanguage(); + QCString n = m_memberDef->name(); + QCString ctx = args[0].toString(); + QCString sep = getLanguageSpecificSeparator(lang,TRUE); + if (m_memberDef->getEnumScope() && m_memberDef->livesInsideEnum()) + { + n.prepend(m_memberDef->getEnumScope()->displayName()+sep); + } + if (ctx=="module" && m_memberDef->getClassDef() && !m_memberDef->isRelated()) + { + n.prepend(m_memberDef->getClassDef()->displayName()+sep); + } + else if ((ctx=="module" || ctx=="file") && m_memberDef->getNamespaceDef()) + { + n.prepend(m_memberDef->getNamespaceDef()->displayName()+sep); + } + return n; + } + else { + err(".nameWithContextFor should take one string argument, got %d\n",args.count()); } + return TemplateVariant(); + } + TemplateVariant nameWithContextFor() const + { + return TemplateVariant::Delegate::fromMethod<Private,&Private::handleNameWithContextFor>(this); + } + private: + MemberDef *m_memberDef; + struct Cachable : public DefinitionContext<MemberContext::Private>::Cachable + { + Cachable(MemberDef *md) : DefinitionContext<MemberContext::Private>::Cachable(md), + initializerParsed(FALSE), sourceCodeParsed(FALSE), + declArgsParsed(FALSE), declTypeParsed(FALSE) { } SharedPtr<ArgumentListContext> templateArgs; SharedPtr<ArgumentListContext> arguments; SharedPtr<MemberListContext> enumValues; SharedPtr<FileContext> fileDef; SharedPtr<NamespaceContext> namespaceDef; + SharedPtr<ClassContext> category; + SharedPtr<MemberContext> categoryRelation; SharedPtr<ClassContext> classDef; SharedPtr<ClassContext> anonymousType; SharedPtr<TemplateList> templateDecls; @@ -4153,16 +5074,28 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> bool initializerParsed; TemplateVariant sourceCode; bool sourceCodeParsed; + TemplateVariant declArgs; + bool declArgsParsed; + TemplateVariant declType; + bool declTypeParsed; SharedPtr<TemplateList> examples; SharedPtr<TemplateList> exampleList; SharedPtr<ArgumentListContext> typeConstraints; SharedPtr<TemplateList> propertyAttrs; SharedPtr<TemplateList> eventAttrs; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_memberDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<MemberContext::Private> s_inst; }; //%% } +PropertyMapper<MemberContext::Private> MemberContext::Private::s_inst; + MemberContext::MemberContext(MemberDef *md) : RefCountedContext("MemberContext") { p = new Private(md); @@ -4188,50 +5121,61 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> public: Private(GroupDef *gd) : DefinitionContext<ModuleContext::Private>(gd) , m_groupDef(gd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("hasGroupGraph", this,&Private::hasGroupGraph); - addProperty("groupGraph", this,&Private::groupGraph); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("modules", this,&Private::modules); - addProperty("dirs", this,&Private::dirs); - addProperty("files", this,&Private::files); - addProperty("namespaces", this,&Private::namespaces); - addProperty("classes", this,&Private::classes); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("examples", this,&Private::examples); - addProperty("macros", this,&Private::macros); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumvalues", this,&Private::enumValues); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("signals", this,&Private::signals); - addProperty("publicSlots", this,&Private::publicSlots); - addProperty("protectedSlots", this,&Private::protectedSlots); - addProperty("privateSlots", this,&Private::privateSlots); - addProperty("events", this,&Private::events); - addProperty("properties", this,&Private::properties); - addProperty("friends", this,&Private::friends); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedMacros", this,&Private::detailedMacros); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedEnumValues", this,&Private::detailedEnumValues); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("detailedSignals", this,&Private::detailedSignals); - addProperty("detailedPublicSlots", this,&Private::detailedPublicSlots); - addProperty("detailedProtectedSlots", this,&Private::detailedProtectedSlots); - addProperty("detailedPrivateSlots", this,&Private::detailedPrivateSlots); - addProperty("detailedEvents", this,&Private::detailedEvents); - addProperty("detailedProperties", this,&Private::detailedProperties); - addProperty("detailedFriends", this,&Private::detailedFriends); - addProperty("inlineClasses", this,&Private::inlineClasses); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("hasGroupGraph", &Private::hasGroupGraph); + s_inst.addProperty("groupGraph", &Private::groupGraph); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("modules", &Private::modules); + s_inst.addProperty("dirs", &Private::dirs); + s_inst.addProperty("files", &Private::files); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumvalues", &Private::enumValues); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("signals", &Private::signals); + s_inst.addProperty("publicSlots", &Private::publicSlots); + s_inst.addProperty("protectedSlots", &Private::protectedSlots); + s_inst.addProperty("privateSlots", &Private::privateSlots); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("friends", &Private::friends); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedMacros", &Private::detailedMacros); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedEnumValues", &Private::detailedEnumValues); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("detailedSignals", &Private::detailedSignals); + s_inst.addProperty("detailedPublicSlots", &Private::detailedPublicSlots); + s_inst.addProperty("detailedProtectedSlots", &Private::detailedProtectedSlots); + s_inst.addProperty("detailedPrivateSlots", &Private::detailedPrivateSlots); + s_inst.addProperty("detailedEvents", &Private::detailedEvents); + s_inst.addProperty("detailedProperties", &Private::detailedProperties); + s_inst.addProperty("detailedFriends", &Private::detailedFriends); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!gd->cookie()) { gd->setCookie(new ModuleContext::Private::Cachable(gd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_groupDef->groupTitle()); @@ -4246,11 +5190,12 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } DotGroupCollaboration *getGroupGraph() const { - if (!m_cache.groupGraph) + Cachable &cache = getCache(); + if (!cache.groupGraph) { - m_cache.groupGraph.reset(new DotGroupCollaboration(m_groupDef)); + cache.groupGraph.reset(new DotGroupCollaboration(m_groupDef)); } - return m_cache.groupGraph.get(); + return cache.groupGraph.get(); } TemplateVariant hasGroupGraph() const { @@ -4273,15 +5218,37 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> { DotGroupCollaboration *graph = getGroupGraph(); FTextStream t(&result); - graph->writeGraph(t,GOF_BITMAP, - EOF_Html, - g_globals.outputDir, - g_globals.outputDir+portable_pathSeparator()+m_groupDef->getOutputFileBase()+Doxygen::htmlFileExtension, - relPathAsString(), - TRUE, - g_globals.dynSectionId); + switch (g_globals.outputFormat) + { + case ContextOutputFormat_Html: + { + graph->writeGraph(t,GOF_BITMAP, + EOF_Html, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_groupDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(), + TRUE, + g_globals.dynSectionId); + } + break; + case ContextOutputFormat_Latex: + { + graph->writeGraph(t,GOF_EPS, + EOF_LaTeX, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_groupDef->getOutputFileBase()+".tex", + relPathAsString(), + TRUE, + g_globals.dynSectionId); + } + break; + // TODO: support other generators + default: + err("context.cpp: output format not yet supported"); + break; + } + g_globals.dynSectionId++; } - g_globals.dynSectionId++; return TemplateVariant(result.data(),TRUE); } TemplateVariant hasDetails() const @@ -4290,7 +5257,8 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant modules() const { - if (!m_cache.modules) + Cachable &cache = getCache(); + if (!cache.modules) { TemplateList *moduleList = TemplateList::alloc(); if (m_groupDef->getSubGroups()) @@ -4305,13 +5273,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.modules.reset(moduleList); + cache.modules.reset(moduleList); } - return m_cache.modules.get(); + return cache.modules.get(); } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); if (m_groupDef->getExamples()) @@ -4320,16 +5289,17 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> PageDef *ex; for (eli.toFirst();(ex=eli.current());++eli) { - exampleList->append(PageContext::alloc(ex)); + exampleList->append(PageContext::alloc(ex,FALSE,TRUE)); } } - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } TemplateVariant pages() const { - if (!m_cache.pages) + Cachable &cache = getCache(); + if (!cache.pages) { TemplateList *pageList = TemplateList::alloc(); if (m_groupDef->getExamples()) @@ -4338,16 +5308,17 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> PageDef *ex; for (eli.toFirst();(ex=eli.current());++eli) { - pageList->append(PageContext::alloc(ex)); + pageList->append(PageContext::alloc(ex,FALSE,TRUE)); } } - m_cache.pages.reset(pageList); + cache.pages.reset(pageList); } - return m_cache.pages.get(); + return cache.pages.get(); } TemplateVariant dirs() const { - if (!m_cache.dirs) + Cachable &cache = getCache(); + if (!cache.dirs) { TemplateList *dirList = TemplateList::alloc(); if (m_groupDef->getDirs()) @@ -4359,13 +5330,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> dirList->append(DirContext::alloc(dd)); } } - m_cache.dirs.reset(dirList); + cache.dirs.reset(dirList); } - return m_cache.dirs.get(); + return cache.dirs.get(); } TemplateVariant files() const { - if (!m_cache.files) + Cachable &cache = getCache(); + if (!cache.files) { TemplateList *fileList = TemplateList::alloc(); if (m_groupDef->getFiles()) @@ -4377,13 +5349,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> fileList->append(FileContext::alloc(fd)); } } - m_cache.files.reset(fileList); + cache.files.reset(fileList); } - return m_cache.files.get(); + return cache.files.get(); } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_groupDef->getClasses()) @@ -4398,13 +5371,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_groupDef->getNamespaces()) @@ -4419,13 +5393,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_groupDef->getNamespaces()) @@ -4440,9 +5415,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, @@ -4453,7 +5428,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> MemberList *ml = m_groupDef->getMemberList(type); if (ml) { - list.reset(MemberListInfoContext::alloc(m_groupDef,relPathAsString(),ml,title,detailed)); + list.reset(MemberListInfoContext::alloc(m_groupDef,relPathAsString(),ml,title,"")); } } if (list) @@ -4467,19 +5442,19 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant macros() const { - return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines()); + return getMemberList(getCache().macros,MemberListType_decDefineMembers,theTranslator->trDefines()); } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant enumValues() const { - return getMemberList(m_cache.enums,MemberListType_decEnumValMembers,theTranslator->trEnumerationValues()); + return getMemberList(getCache().enums,MemberListType_decEnumValMembers,theTranslator->trEnumerationValues()); } TemplateVariant functions() const { @@ -4487,113 +5462,115 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> SrcLangExt lang = m_groupDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant signals() const { - return getMemberList(m_cache.signals,MemberListType_signals,theTranslator->trSignals()); + return getMemberList(getCache().signals,MemberListType_signals,theTranslator->trSignals()); } TemplateVariant publicSlots() const { - return getMemberList(m_cache.publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); + return getMemberList(getCache().publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); } TemplateVariant protectedSlots() const { - return getMemberList(m_cache.protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); + return getMemberList(getCache().protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); } TemplateVariant privateSlots() const { - return getMemberList(m_cache.privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); + return getMemberList(getCache().privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); } TemplateVariant events() const { - return getMemberList(m_cache.events,MemberListType_events,theTranslator->trEvents()); + return getMemberList(getCache().events,MemberListType_events,theTranslator->trEvents()); } TemplateVariant properties() const { - return getMemberList(m_cache.properties,MemberListType_properties,theTranslator->trProperties()); + return getMemberList(getCache().properties,MemberListType_properties,theTranslator->trProperties()); } TemplateVariant friends() const { - return getMemberList(m_cache.friends,MemberListType_friends,theTranslator->trFriends()); + return getMemberList(getCache().friends,MemberListType_friends,theTranslator->trFriends()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_groupDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroupSDict(),m_groupDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroupSDict(),m_groupDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedMacros() const { - return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); + return getMemberList(getCache().detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedEnumValues() const { - return getMemberList(m_cache.detailedEnumValues,MemberListType_docEnumValMembers,theTranslator->trEnumerationValueDocumentation()); + return getMemberList(getCache().detailedEnumValues,MemberListType_docEnumValMembers,theTranslator->trEnumerationValueDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_groupDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant detailedSignals() const { - return getMemberList(m_cache.detailedSignals,MemberListType_docSignalMembers,theTranslator->trSignals()); + return getMemberList(getCache().detailedSignals,MemberListType_docSignalMembers,theTranslator->trSignals()); } TemplateVariant detailedPublicSlots() const { - return getMemberList(m_cache.detailedPublicSlots,MemberListType_docPubSlotMembers,theTranslator->trPublicSlots()); + return getMemberList(getCache().detailedPublicSlots,MemberListType_docPubSlotMembers,theTranslator->trPublicSlots()); } TemplateVariant detailedProtectedSlots() const { - return getMemberList(m_cache.detailedProtectedSlots,MemberListType_docProSlotMembers,theTranslator->trProtectedSlots()); + return getMemberList(getCache().detailedProtectedSlots,MemberListType_docProSlotMembers,theTranslator->trProtectedSlots()); } TemplateVariant detailedPrivateSlots() const { - return getMemberList(m_cache.detailedPrivateSlots,MemberListType_docPriSlotMembers,theTranslator->trPrivateSlots()); + return getMemberList(getCache().detailedPrivateSlots,MemberListType_docPriSlotMembers,theTranslator->trPrivateSlots()); } TemplateVariant detailedEvents() const { - return getMemberList(m_cache.detailedEvents,MemberListType_docEventMembers,theTranslator->trEventDocumentation(),TRUE); + return getMemberList(getCache().detailedEvents,MemberListType_docEventMembers,theTranslator->trEventDocumentation(),TRUE); } TemplateVariant detailedProperties() const { - return getMemberList(m_cache.detailedProperties,MemberListType_docPropMembers,theTranslator->trPropertyDocumentation(),TRUE); + return getMemberList(getCache().detailedProperties,MemberListType_docPropMembers,theTranslator->trPropertyDocumentation(),TRUE); } TemplateVariant detailedFriends() const { - return getMemberList(m_cache.detailedFriends,MemberListType_docFriendMembers,theTranslator->trFriends(),TRUE); + return getMemberList(getCache().detailedFriends,MemberListType_docFriendMembers,theTranslator->trFriends(),TRUE); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_groupDef->getClasses()) @@ -4611,9 +5588,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } TemplateVariant compoundType() const { @@ -4621,8 +5598,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } private: GroupDef *m_groupDef; - struct Cachable + struct Cachable : public DefinitionContext<ModuleContext::Private>::Cachable { + Cachable(GroupDef *gd) : DefinitionContext<ModuleContext::Private>::Cachable(gd) {} SharedPtr<TemplateList> modules; SharedPtr<TemplateList> dirs; SharedPtr<TemplateList> files; @@ -4661,10 +5639,18 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> SharedPtr<TemplateList> inlineClasses; ScopedPtr<DotGroupCollaboration> groupGraph; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_groupDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<ModuleContext::Private> s_inst; }; //%% } +PropertyMapper<ModuleContext::Private> ModuleContext::Private::s_inst; + ModuleContext::ModuleContext(GroupDef *gd) : RefCountedContext("ModuleContext") { p = new Private(gd); @@ -4699,7 +5685,8 @@ class ClassListContext::Private : public GenericNodeListContext { continue; } - if (cd->isLinkableInProject() && cd->templateMaster()==0) + if (cd->isLinkableInProject() && cd->templateMaster()==0 && + !cd->isHidden() && !cd->isEmbeddedInOuterScope()) { append(ClassContext::alloc(cd)); } @@ -4738,17 +5725,26 @@ TemplateListIntf::ConstIterator *ClassListContext::createIterator() const //------------------------------------------------------------------------ //%% list ClassIndex[Class] : list of classes -class ClassIndexContext::Private : public PropertyMapper +class ClassIndexContext::Private { public: Private() { - addProperty("list", this,&Private::list); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("list", &Private::list); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant list() const { @@ -4817,8 +5813,11 @@ class ClassIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> classes; }; mutable Cachable m_cache; + static PropertyMapper<ClassIndexContext::Private> s_inst; }; +PropertyMapper<ClassIndexContext::Private> ClassIndexContext::Private::s_inst; + ClassIndexContext::ClassIndexContext() : RefCountedContext("ClassIndexContext") { p = new Private; @@ -4912,7 +5911,7 @@ static int computePreferredDepth(const TemplateListIntf *list,int maxDepth) //%% struct ClassHierarchy: inheritance tree //%% { -class ClassHierarchyContext::Private : public PropertyMapper +class ClassHierarchyContext::Private { public: Private() @@ -4923,15 +5922,24 @@ class ClassHierarchyContext::Private : public PropertyMapper m_classTree->addClassHierarchy(*Doxygen::classSDict,TRUE); m_classTree->addClassHierarchy(*Doxygen::hiddenClasses,TRUE); //%% ClassInheritance tree - addProperty("tree", this,&Private::tree); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subhighlight); - addProperty("title", this,&Private::title); - addProperty("preferredDepth", this,&Private::preferredDepth); - addProperty("maxDepth", this,&Private::maxDepth); - addProperty("diagrams", this,&Private::diagrams); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth", &Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + s_inst.addProperty("diagrams", &Private::diagrams); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -5025,9 +6033,12 @@ class ClassHierarchyContext::Private : public PropertyMapper ScopedPtr<DotGfxHierarchyTable> hierarchy; }; mutable Cachable m_cache; + static PropertyMapper<ClassHierarchyContext::Private> s_inst; }; //%% } +PropertyMapper<ClassHierarchyContext::Private> ClassHierarchyContext::Private::s_inst; + ClassHierarchyContext::ClassHierarchyContext() : RefCountedContext("ClassHierarchyContext") { p = new Private; @@ -5047,7 +6058,7 @@ TemplateVariant ClassHierarchyContext::get(const char *name) const //%% struct NestingNode: node is a nesting relation tree //%% { -class NestingNodeContext::Private : public PropertyMapper +class NestingNodeContext::Private { public: Private(const NestingNodeContext *parent,const NestingNodeContext *thisNode, @@ -5055,34 +6066,41 @@ class NestingNodeContext::Private : public PropertyMapper : m_parent(parent), m_def(d), m_level(level), m_index(index) { m_children.reset(NestingContext::alloc(thisNode,level+1)); - //%% bool is_leaf_node: true if this node does not have any children - addProperty("is_leaf_node",this,&Private::isLeafNode); - //%% Nesting children: list of nested classes/namespaces - addProperty("children",this,&Private::children); - //%% [optional] Class class: class info (if this node represents a class) - addProperty("class",this,&Private::getClass); - //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) - addProperty("namespace",this,&Private::getNamespace); - //%% [optional] File file: file info (if this node represents a file) - addProperty("file",this,&Private::getFile); - //%% [optional] Dir dir: directory info (if this node represents a directory) - addProperty("dir",this,&Private::getDir); - //%% [optional] Page page: page info (if this node represents a page) - addProperty("page",this,&Private::getPage); - //%% [optional] Module module: module info (if this node represents a module) - addProperty("module",this,&Private::getModule); - //%% int id - addProperty("id",this,&Private::id); - //%% string level - addProperty("level",this,&Private::level); - //%% string name - addProperty("name",this,&Private::name); - //%% string brief - addProperty("brief",this,&Private::brief); - //%% bool isLinkable - addProperty("isLinkable",this,&Private::isLinkable); - addProperty("anchor",this,&Private::anchor); - addProperty("fileName",this,&Private::fileName); + static bool init=FALSE; + if (!init) + { + //%% bool is_leaf_node: true if this node does not have any children + s_inst.addProperty("is_leaf_node",&Private::isLeafNode); + //%% Nesting children: list of nested classes/namespaces + s_inst.addProperty("children",&Private::children); + //%% [optional] Class class: class info (if this node represents a class) + s_inst.addProperty("class",&Private::getClass); + //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) + s_inst.addProperty("namespace",&Private::getNamespace); + //%% [optional] File file: file info (if this node represents a file) + s_inst.addProperty("file",&Private::getFile); + //%% [optional] Dir dir: directory info (if this node represents a directory) + s_inst.addProperty("dir",&Private::getDir); + //%% [optional] Page page: page info (if this node represents a page) + s_inst.addProperty("page",&Private::getPage); + //%% [optional] Module module: module info (if this node represents a module) + s_inst.addProperty("module",&Private::getModule); + //%% int id + s_inst.addProperty("id",&Private::id); + //%% string level + s_inst.addProperty("level",&Private::level); + //%% string name + s_inst.addProperty("name",&Private::name); + //%% string brief + s_inst.addProperty("brief",&Private::brief); + //%% bool isLinkable + s_inst.addProperty("isLinkable",&Private::isLinkable); + s_inst.addProperty("anchor",&Private::anchor); + s_inst.addProperty("fileName",&Private::fileName); + s_inst.addProperty("isReference",&Private::isReference); + s_inst.addProperty("externalReference",&Private::externalReference); + init=TRUE; + } addNamespaces(addCls); addClasses(inherit,hideSuper); @@ -5090,6 +6108,10 @@ class NestingNodeContext::Private : public PropertyMapper addPages(); addModules(); } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant isLeafNode() const { return m_children->count()==0; @@ -5162,7 +6184,7 @@ class NestingNodeContext::Private : public PropertyMapper { if (!m_cache.pageContext && m_def->definitionType()==Definition::TypePage) { - m_cache.pageContext.reset(PageContext::alloc((PageDef*)m_def)); + m_cache.pageContext.reset(PageContext::alloc((PageDef*)m_def,FALSE,FALSE)); } if (m_cache.pageContext) { @@ -5236,6 +6258,14 @@ class NestingNodeContext::Private : public PropertyMapper { return m_def->getOutputFileBase(); } + TemplateVariant isReference() const + { + return m_def->isReference(); + } + TemplateVariant externalReference() const + { + return m_def->externalReference(relPathAsString()); + } //------------------------------------------------------------------ @@ -5324,9 +6354,12 @@ class NestingNodeContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> brief; }; mutable Cachable m_cache; + static PropertyMapper<NestingNodeContext::Private> s_inst; }; //%% } +PropertyMapper<NestingNodeContext::Private> NestingNodeContext::Private::s_inst; + NestingNodeContext::NestingNodeContext(const NestingNodeContext *parent, Definition *d,int index,int level,bool addClass,bool inherit,bool hideSuper) : RefCountedContext("NestingNodeContext") @@ -5656,7 +6689,7 @@ void NestingContext::addDerivedClasses(const BaseClassList *bcl,bool hideSuper) //%% struct ClassTree: Class nesting relations //%% { -class ClassTreeContext::Private : public PropertyMapper +class ClassTreeContext::Private { public: Private() @@ -5671,14 +6704,23 @@ class ClassTreeContext::Private : public PropertyMapper m_classTree->addClasses(*Doxygen::classSDict,TRUE); } //%% Nesting tree - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -5747,9 +6789,12 @@ class ClassTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<ClassTreeContext::Private> s_inst; }; //%% } +PropertyMapper<ClassTreeContext::Private> ClassTreeContext::Private::s_inst; + ClassTreeContext::ClassTreeContext() : RefCountedContext("ClassTreeContext") { p = new Private; @@ -5816,7 +6861,7 @@ TemplateListIntf::ConstIterator *NamespaceListContext::createIterator() const //%% struct NamespaceTree: tree of nested namespace //%% { -class NamespaceTreeContext::Private : public PropertyMapper +class NamespaceTreeContext::Private { public: Private() @@ -5827,14 +6872,23 @@ class NamespaceTreeContext::Private : public PropertyMapper m_namespaceTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE); } //%% Nesting tree - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -5903,9 +6957,12 @@ class NamespaceTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<NamespaceTreeContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceTreeContext::Private> NamespaceTreeContext::Private::s_inst; + NamespaceTreeContext::NamespaceTreeContext() : RefCountedContext("NamespaceTreeContext") { p = new Private; @@ -6077,7 +7134,7 @@ void UsedFilesContext::addFile(FileDef *fd) //%% struct FileTree: tree of directories and files //%% { -class FileTreeContext::Private : public PropertyMapper +class FileTreeContext::Private { public: Private() @@ -6093,14 +7150,23 @@ class FileTreeContext::Private : public PropertyMapper m_dirFileTree->addFiles(*Doxygen::inputNameList); } //%% DirFile tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6156,9 +7222,12 @@ class FileTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<FileTreeContext::Private> s_inst; }; //%% } +PropertyMapper<FileTreeContext::Private> FileTreeContext::Private::s_inst; + FileTreeContext::FileTreeContext() : RefCountedContext("FileTreeContext") { p = new Private; @@ -6178,27 +7247,36 @@ TemplateVariant FileTreeContext::get(const char *name) const //%% struct PageTree: tree of related pages //%% { -class PageTreeContext::Private : public PropertyMapper +class PageTreeContext::Private { public: - Private() + Private(const PageSDict *pages) { m_pageTree.reset(NestingContext::alloc(0,0)); // Add pages - if (Doxygen::pageSDict) + if (pages) { - m_pageTree->addPages(*Doxygen::pageSDict,TRUE); + m_pageTree->addPages(*pages,TRUE); } //%% PageNodeList tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6253,12 +7331,15 @@ class PageTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<PageTreeContext::Private> s_inst; }; //%% } -PageTreeContext::PageTreeContext() : RefCountedContext("PageTreeContext") +PropertyMapper<PageTreeContext::Private> PageTreeContext::Private::s_inst; + +PageTreeContext::PageTreeContext(const PageSDict *pages) : RefCountedContext("PageTreeContext") { - p = new Private; + p = new Private(pages); } PageTreeContext::~PageTreeContext() @@ -6285,7 +7366,7 @@ class PageListContext::Private : public GenericNodeListContext { if (!pd->getGroupDef() && !pd->isReference()) { - append(PageContext::alloc(pd)); + append(PageContext::alloc(pd,FALSE,FALSE)); } } } @@ -6320,6 +7401,55 @@ TemplateListIntf::ConstIterator *PageListContext::createIterator() const //------------------------------------------------------------------------ +//%% list ExampleList[Page]: list of pages +class ExampleListContext::Private : public GenericNodeListContext +{ + public: + Private() + { + if (Doxygen::exampleSDict) + { + PageSDict::Iterator pdi(*Doxygen::exampleSDict); + PageDef *pd=0; + for (pdi.toFirst();(pd=pdi.current());++pdi) + { + if (!pd->getGroupDef() && !pd->isReference()) + { + append(PageContext::alloc(pd,FALSE,TRUE)); + } + } + } + } +}; + +ExampleListContext::ExampleListContext() : RefCountedContext("ExampleListContext") +{ + p = new Private; +} + +ExampleListContext::~ExampleListContext() +{ + delete p; +} + +// TemplateListIntf +int ExampleListContext::count() const +{ + return p->count(); +} + +TemplateVariant ExampleListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *ExampleListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + //%% list ModuleList[ModuleNode]: list of directories and/or files class ModuleListContext::Private : public GenericNodeListContext { @@ -6369,7 +7499,7 @@ TemplateListIntf::ConstIterator *ModuleListContext::createIterator() const //%% struct ModuleTree: tree of modules //%% { -class ModuleTreeContext::Private : public PropertyMapper +class ModuleTreeContext::Private { public: Private() @@ -6382,14 +7512,23 @@ class ModuleTreeContext::Private : public PropertyMapper } //%% ModuleList tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6444,9 +7583,12 @@ class ModuleTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<ModuleTreeContext::Private> s_inst; }; //%% } +PropertyMapper<ModuleTreeContext::Private> ModuleTreeContext::Private::s_inst; + ModuleTreeContext::ModuleTreeContext() : RefCountedContext("ModuleTreeContext") { p = new Private; @@ -6466,15 +7608,26 @@ TemplateVariant ModuleTreeContext::get(const char *name) const //%% struct NavPathElem: list of examples page //%% { -class NavPathElemContext::Private : public PropertyMapper +class NavPathElemContext::Private { public: Private(Definition *def) : m_def(def) { - addProperty("isLinkable",this,&Private::isLinkable); - addProperty("fileName",this,&Private::fileName); - addProperty("anchor",this,&Private::anchor); - addProperty("text",this,&Private::text); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("isLinkable", &Private::isLinkable); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("text", &Private::text); + s_inst.addProperty("isReference", &Private::isReference); + s_inst.addProperty("externalReference",&Private::externalReference); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant isLinkable() const { @@ -6509,11 +7662,27 @@ class NavPathElemContext::Private : public PropertyMapper } return text; } + TemplateVariant isReference() const + { + return m_def->isReference(); + } + QCString relPathAsString() const + { + static bool createSubdirs = Config_getBool("CREATE_SUBDIRS"); + return createSubdirs ? QCString("../../") : QCString(""); + } + TemplateVariant externalReference() const + { + return m_def->externalReference(relPathAsString()); + } private: Definition *m_def; + static PropertyMapper<NavPathElemContext::Private> s_inst; }; //%% } +PropertyMapper<NavPathElemContext::Private> NavPathElemContext::Private::s_inst; + NavPathElemContext::NavPathElemContext(Definition *def) : RefCountedContext("NavPathElemContext") { p = new Private(def); @@ -6534,12 +7703,39 @@ TemplateVariant NavPathElemContext::get(const char *name) const //%% struct ExampleList: list of examples page //%% { -class ExampleListContext::Private : public PropertyMapper +class ExampleTreeContext::Private { public: - TemplateVariant items() const + Private() + { + m_exampleTree.reset(NestingContext::alloc(0,0)); + // Add pages + if (Doxygen::exampleSDict) + { + m_exampleTree->addPages(*Doxygen::exampleSDict,TRUE); + } + + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } + TemplateVariant tree() const { - return m_pageList.get(); + return m_exampleTree.get(); } TemplateVariant fileName() const { @@ -6561,33 +7757,52 @@ class ExampleListContext::Private : public PropertyMapper { return theTranslator->trExamples(); } - Private() + TemplateVariant maxDepth() const { - m_pageList.reset(PageListContext::alloc(Doxygen::exampleSDict)); - - addProperty("items",this,&Private::items); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); + if (!m_cache.maxDepthComputed) + { + m_cache.maxDepth = computeMaxDepth(m_exampleTree.get()); + m_cache.maxDepthComputed=TRUE; + } + return m_cache.maxDepth; + } + TemplateVariant preferredDepth() const + { + if (!m_cache.preferredDepthComputed) + { + m_cache.preferredDepth = computePreferredDepth(m_exampleTree.get(),maxDepth().toInt()); + m_cache.preferredDepthComputed=TRUE; + } + return m_cache.preferredDepth; } private: - SharedPtr<PageListContext> m_pageList; + SharedPtr<NestingContext> m_exampleTree; + struct Cachable + { + Cachable() : maxDepthComputed(FALSE), preferredDepthComputed(FALSE) {} + int maxDepth; + bool maxDepthComputed; + int preferredDepth; + bool preferredDepthComputed; + }; + mutable Cachable m_cache; + static PropertyMapper<ExampleTreeContext::Private> s_inst; }; //%% } -ExampleListContext::ExampleListContext() : RefCountedContext("ExampleListContext") +PropertyMapper<ExampleTreeContext::Private> ExampleTreeContext::Private::s_inst; + +ExampleTreeContext::ExampleTreeContext() : RefCountedContext("ExampleTreeContext") { p = new Private; } -ExampleListContext::~ExampleListContext() +ExampleTreeContext::~ExampleTreeContext() { delete p; } -TemplateVariant ExampleListContext::get(const char *name) const +TemplateVariant ExampleTreeContext::get(const char *name) const { return p->get(name); } @@ -6596,26 +7811,35 @@ TemplateVariant ExampleListContext::get(const char *name) const //%% struct GlobalsIndex: list of examples page //%% { -class GlobalsIndexContext::Private : public PropertyMapper +class GlobalsIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -6719,9 +7943,12 @@ class GlobalsIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> macros; }; mutable Cachable m_cache; + static PropertyMapper<GlobalsIndexContext::Private> s_inst; }; //%% } +PropertyMapper<GlobalsIndexContext::Private> GlobalsIndexContext::Private::s_inst; + GlobalsIndexContext::GlobalsIndexContext() : RefCountedContext("GlobalsIndexContext") { p = new Private; @@ -6741,26 +7968,35 @@ TemplateVariant GlobalsIndexContext::get(const char *name) const //%% struct ClassMembersIndex: list of examples page //%% { -class ClassMembersIndexContext::Private : public PropertyMapper +class ClassMembersIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -6866,9 +8102,12 @@ class ClassMembersIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> related; }; mutable Cachable m_cache; + static PropertyMapper<ClassMembersIndexContext::Private> s_inst; }; //%% } +PropertyMapper<ClassMembersIndexContext::Private> ClassMembersIndexContext::Private::s_inst; + ClassMembersIndexContext::ClassMembersIndexContext() : RefCountedContext("ClassMembersIndexContext") { p = new Private; @@ -6888,26 +8127,35 @@ TemplateVariant ClassMembersIndexContext::get(const char *name) const //%% struct NamespaceMembersIndex: list of examples page //%% { -class NamespaceMembersIndexContext::Private : public PropertyMapper +class NamespaceMembersIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -7010,9 +8258,12 @@ class NamespaceMembersIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> enumValues; }; mutable Cachable m_cache; + static PropertyMapper<NamespaceMembersIndexContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceMembersIndexContext::Private> NamespaceMembersIndexContext::Private::s_inst; + NamespaceMembersIndexContext::NamespaceMembersIndexContext() : RefCountedContext("NamespaceMembersIndexContext") { p = new Private; @@ -7032,12 +8283,21 @@ TemplateVariant NamespaceMembersIndexContext::get(const char *name) const //%% struct InheritanceGraph: a connected graph reprenting part of the overall interitance tree //%% { -class InheritanceGraphContext::Private : public PropertyMapper +class InheritanceGraphContext::Private { public: Private(DotGfxHierarchyTable *hierarchy,DotNode *n,int id) : m_hierarchy(hierarchy), m_node(n), m_id(id) { - addProperty("graph",this,&Private::graph); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("graph",&Private::graph); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant graph() const { @@ -7060,8 +8320,11 @@ class InheritanceGraphContext::Private : public PropertyMapper DotGfxHierarchyTable *m_hierarchy; DotNode *m_node; int m_id; + static PropertyMapper<InheritanceGraphContext::Private> s_inst; }; +PropertyMapper<InheritanceGraphContext::Private> InheritanceGraphContext::Private::s_inst; + InheritanceGraphContext::InheritanceGraphContext(DotGfxHierarchyTable *hierarchy,DotNode *n,int id) : RefCountedContext("InheritanceGraphContext") { @@ -7083,13 +8346,22 @@ TemplateVariant InheritanceGraphContext::get(const char *name) const //%% struct InheritanceNode: a class in the inheritance list //%% { -class InheritanceNodeContext::Private : public PropertyMapper +class InheritanceNodeContext::Private { public: Private(ClassDef *cd,const QCString &name) : m_classDef(cd), m_name(name) { - addProperty("class",this,&Private::getClass); - addProperty("name",this,&Private::name); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("class",&Private::getClass); + s_inst.addProperty("name", &Private::name); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant getClass() const { @@ -7107,9 +8379,12 @@ class InheritanceNodeContext::Private : public PropertyMapper ClassDef *m_classDef; mutable SharedPtr<ClassContext> m_classContext; QCString m_name; + static PropertyMapper<InheritanceNodeContext::Private> s_inst; }; //%% } +PropertyMapper<InheritanceNodeContext::Private> InheritanceNodeContext::Private::s_inst; + InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) : RefCountedContext("InheritanceNodeContext") { p = new Private(cd,name); @@ -7264,19 +8539,28 @@ TemplateListIntf::ConstIterator *MemberListContext::createIterator() const //%% struct MemberInfo: member information //%% { -class MemberInfoContext::Private : public PropertyMapper +class MemberInfoContext::Private { public: Private(const MemberInfo *mi) : m_memberInfo(mi) { - //%% string protection - addProperty("protection",this,&Private::protection); - //%% string virtualness - addProperty("virtualness",this,&Private::virtualness); - //%% string ambiguityScope - addProperty("ambiguityScope",this,&Private::ambiguityScope); - //%% Member member - addProperty("member",this,&Private::member); + static bool init=FALSE; + if (!init) + { + //%% string protection + s_inst.addProperty("protection", &Private::protection); + //%% string virtualness + s_inst.addProperty("virtualness", &Private::virtualness); + //%% string ambiguityScope + s_inst.addProperty("ambiguityScope",&Private::ambiguityScope); + //%% Member member + s_inst.addProperty("member", &Private::member); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant protection() const { @@ -7321,9 +8605,12 @@ class MemberInfoContext::Private : public PropertyMapper private: const MemberInfo *m_memberInfo; mutable SharedPtr<MemberContext> m_member; + static PropertyMapper<MemberInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberInfoContext::Private> MemberInfoContext::Private::s_inst; + MemberInfoContext::MemberInfoContext(const MemberInfo *mi) : RefCountedContext("MemberInfoContext") { p = new Private(mi); @@ -7413,7 +8700,7 @@ TemplateListIntf::ConstIterator *AllMembersListContext::createIterator() const //%% struct MemberGroupInfo: member group information //%% { -class MemberGroupInfoContext::Private : public PropertyMapper +class MemberGroupInfoContext::Private { public: Private(Definition *def,const QCString &relPath,const MemberGroup *mg) : @@ -7421,13 +8708,22 @@ class MemberGroupInfoContext::Private : public PropertyMapper m_relPath(relPath), m_memberGroup(mg) { - addProperty("members", this,&Private::members); - addProperty("title", this,&Private::groupTitle); - addProperty("subtitle", this,&Private::groupSubtitle); - addProperty("anchor", this,&Private::groupAnchor); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("docs", this,&Private::docs); - addProperty("inherited", this,&Private::inherited); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("title", &Private::groupTitle); + s_inst.addProperty("subtitle", &Private::groupSubtitle); + s_inst.addProperty("anchor", &Private::groupAnchor); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("docs", &Private::docs); + s_inst.addProperty("inherited", &Private::inherited); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant members() const { @@ -7491,9 +8787,12 @@ class MemberGroupInfoContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> docs; }; mutable Cachable m_cache; + static PropertyMapper<MemberGroupInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberGroupInfoContext::Private> MemberGroupInfoContext::Private::s_inst; + MemberGroupInfoContext::MemberGroupInfoContext(Definition *def, const QCString &relPath,const MemberGroup *mg) : RefCountedContext("MemberGroupInfoContext") { @@ -7584,7 +8883,7 @@ TemplateListIntf::ConstIterator *MemberGroupListContext::createIterator() const //%% struct MemberListInfo: member list information //%% { -class MemberListInfoContext::Private : public PropertyMapper +class MemberListInfoContext::Private { public: Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) : @@ -7594,12 +8893,21 @@ class MemberListInfoContext::Private : public PropertyMapper m_title(title), m_subtitle(subtitle) { - addProperty("members", this,&Private::members); - addProperty("title", this,&Private::title); - addProperty("subtitle", this,&Private::subtitle); - addProperty("anchor", this,&Private::anchor); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("inherited", this,&Private::inherited); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("subtitle", &Private::subtitle); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("inherited", &Private::inherited); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant members() const { @@ -7660,9 +8968,12 @@ class MemberListInfoContext::Private : public PropertyMapper SharedPtr<InheritedMemberInfoListContext> inherited; }; mutable Cachable m_cache; + static PropertyMapper<MemberListInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberListInfoContext::Private> MemberListInfoContext::Private::s_inst; + MemberListInfoContext::MemberListInfoContext( Definition *def,const QCString &relPath,const MemberList *ml, const QCString &title,const QCString &subtitle) : RefCountedContext("MemberListInfoContext") @@ -7684,17 +8995,26 @@ TemplateVariant MemberListInfoContext::get(const char *name) const //%% struct InheritedMemberInfo: inherited member information //%% { -class InheritedMemberInfoContext::Private : public PropertyMapper +class InheritedMemberInfoContext::Private { public: Private(ClassDef *cd,MemberList *ml,const QCString &title) : m_class(cd), m_memberList(ml), m_title(title) { - addProperty("class", this,&Private::getClass); - addProperty("title", this,&Private::title); - addProperty("members", this,&Private::members); - addProperty("id", this,&Private::id); - addProperty("inheritedFrom", this,&Private::inheritedFrom); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("class", &Private::getClass); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("id", &Private::id); + s_inst.addProperty("inheritedFrom", &Private::inheritedFrom); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } virtual ~Private() { @@ -7743,9 +9063,12 @@ class InheritedMemberInfoContext::Private : public PropertyMapper mutable SharedPtr<ClassContext> m_classCtx; mutable SharedPtr<MemberListContext> m_memberListCtx; mutable SharedPtr<TemplateList> m_inheritedFrom; + static PropertyMapper<InheritedMemberInfoContext::Private> s_inst; }; //%% } +PropertyMapper<InheritedMemberInfoContext::Private> InheritedMemberInfoContext::Private::s_inst; + InheritedMemberInfoContext::InheritedMemberInfoContext(ClassDef *cd,MemberList *ml, const QCString &title) : RefCountedContext("InheritedMemberInfoContext") { @@ -7922,19 +9245,28 @@ TemplateListIntf::ConstIterator *InheritedMemberInfoListContext::createIterator( //%% struct Argument: parameter information //%% { -class ArgumentContext::Private : public PropertyMapper +class ArgumentContext::Private { public: Private(const Argument *arg,Definition *def,const QCString &relPath) : m_argument(arg), m_def(def), m_relPath(relPath) { - addProperty("type", this,&Private::type); - addProperty("name", this,&Private::name); - addProperty("defVal", this,&Private::defVal); - addProperty("docs", this,&Private::docs); - addProperty("attrib", this,&Private::attrib); - addProperty("array", this,&Private::array); - addProperty("namePart", this,&Private::namePart); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("type", &Private::type); + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("defVal", &Private::defVal); + s_inst.addProperty("docs", &Private::docs); + s_inst.addProperty("attrib", &Private::attrib); + s_inst.addProperty("array", &Private::array); + s_inst.addProperty("namePart", &Private::namePart); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant type() const { @@ -7993,9 +9325,12 @@ class ArgumentContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> docs; }; mutable Cachable m_cache; + static PropertyMapper<ArgumentContext::Private> s_inst; }; //%% } +PropertyMapper<ArgumentContext::Private> ArgumentContext::Private::s_inst; + ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath) : RefCountedContext("ArgumentContext") { p = new Private(al,def,relPath); @@ -8066,6 +9401,534 @@ TemplateListIntf::ConstIterator *ArgumentListContext::createIterator() const //------------------------------------------------------------------------ +// SymbolIndex +// - name: string +// - letter: string +// - symbolGroups: SymbolGroupList +// SymbolGroupList: list of SymbolGroups +// SymbolGroup +// - id +// - name +// - symbols: SymbolList +// SymbolList: list of Symbols +// Symbol +// - obj +// - scope +// - relPath + +//------------------------------------------------------------------------ + +//%% struct SymbolGroup: search group of similar symbols +//%% { +class SymbolContext::Private +{ + public: + Private(const Definition *d,const Definition *prev, + const Definition *next) : m_def(d), m_prevDef(prev), m_nextDef(next) + { + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("fileName",&Private::fileName); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("scope", &Private::scope); + s_inst.addProperty("relPath", &Private::relPath); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } + TemplateVariant fileName() const + { + return m_def->getOutputFileBase(); + } + TemplateVariant anchor() const + { + return m_def->anchor(); + } + TemplateVariant scope() const + { + const Definition *scope = m_def->getOuterScope(); + const Definition *next = m_nextDef; + const Definition *prev = m_prevDef; + const Definition *nextScope = next ? next->getOuterScope() : 0; + const Definition *prevScope = prev ? prev->getOuterScope() : 0; + bool isMemberDef = m_def->definitionType()==Definition::TypeMember; + const MemberDef *md = isMemberDef ? (const MemberDef*)m_def : 0; + bool isFunctionLike = md && (md->isFunction() || md->isSlot() || md->isSignal()); + bool overloadedFunction = isFunctionLike && + ((prevScope!=0 && scope==prevScope) || (scope && scope==nextScope)); + QCString prefix; + if (md) prefix=md->localName(); + if (overloadedFunction) // overloaded member function + { + prefix+=md->argsString(); + // show argument list to disambiguate overloaded functions + } + else if (md && isFunctionLike) // unique member function + { + prefix+="()"; // only to show it is a function + } + bool found=FALSE; + QCString name; + if (m_def->definitionType()==Definition::TypeClass) + { + name = m_def->displayName(); + found = TRUE; + } + else if (m_def->definitionType()==Definition::TypeNamespace) + { + name = m_def->displayName(); + found = TRUE; + } + else if (scope==0 || scope==Doxygen::globalScope) // in global scope + { + if (md) + { + FileDef *fd = md->getBodyDef(); + if (fd==0) fd = md->getFileDef(); + if (fd) + { + if (!prefix.isEmpty()) prefix+=": "; + name = prefix + convertToXML(fd->localName()); + found = TRUE; + } + } + } + else if (md && (md->getClassDef() || md->getNamespaceDef())) + // member in class or namespace scope + { + SrcLangExt lang = md->getLanguage(); + name = m_def->getOuterScope()->qualifiedName() + + getLanguageSpecificSeparator(lang) + prefix; + found = TRUE; + } + else if (scope) // some thing else? -> show scope + { + name = prefix + convertToXML(scope->name()); + found = TRUE; + } + if (!found) // fallback + { + name = prefix + "("+theTranslator->trGlobalNamespace()+")"; + } + return name; + } + TemplateVariant relPath() const + { + return externalRef("../",m_def->getReference(),TRUE); + } + private: + const Definition *m_def; + const Definition *m_prevDef; + const Definition *m_nextDef; + static PropertyMapper<SymbolContext::Private> s_inst; +}; +//%% } + +PropertyMapper<SymbolContext::Private> SymbolContext::Private::s_inst; + +SymbolContext::SymbolContext(const Definition *def,const Definition *prevDef,const Definition *nextDef) + : RefCountedContext("SymbolContext") +{ + p = new Private(def,prevDef,nextDef); +} + +SymbolContext::~SymbolContext() +{ + delete p; +} + +TemplateVariant SymbolContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list SymbolList[Symbol] : list of search symbols with the same name +class SymbolListContext::Private : public GenericNodeListContext +{ + public: + Private(const SearchDefinitionList *sdl) + { + QListIterator<Definition> li(*sdl); + Definition *def; + Definition *prev = 0; + for (li.toFirst();(def=li.current());) + { + ++li; + const Definition *next = li.current(); + append(SymbolContext::alloc(def,prev,next)); + prev = def; + } + } +}; + +SymbolListContext::SymbolListContext(const SearchDefinitionList *sdl) + : RefCountedContext("SymbolListContext") +{ + p = new Private(sdl); +} + +SymbolListContext::~SymbolListContext() +{ + delete p; +} + +// TemplateListIntf +int SymbolListContext::count() const +{ + return p->count(); +} + +TemplateVariant SymbolListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *SymbolListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + +//%% struct SymbolGroup: search group of similar symbols +//%% { +class SymbolGroupContext::Private +{ + public: + Private(const SearchDefinitionList *sdl) : m_sdl(sdl) + { + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("id", &Private::id); + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("symbols",&Private::symbolList); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } + TemplateVariant id() const + { + return m_sdl->id(); + } + TemplateVariant name() const + { + return m_sdl->name(); + } + TemplateVariant symbolList() const + { + if (!m_cache.symbolList) + { + m_cache.symbolList.reset(SymbolListContext::alloc(m_sdl)); + } + return m_cache.symbolList.get(); + } + private: + const SearchDefinitionList *m_sdl; + struct Cachable + { + SharedPtr<SymbolListContext> symbolList; + }; + mutable Cachable m_cache; + static PropertyMapper<SymbolGroupContext::Private> s_inst; +}; +//%% } + +PropertyMapper<SymbolGroupContext::Private> SymbolGroupContext::Private::s_inst; + +SymbolGroupContext::SymbolGroupContext(const SearchDefinitionList *sdl) + : RefCountedContext("SymbolGroupContext") +{ + p = new Private(sdl); +} + +SymbolGroupContext::~SymbolGroupContext() +{ + delete p; +} + +TemplateVariant SymbolGroupContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list SymbolGroupList[SymbolGroup] : list of search groups one per by name +class SymbolGroupListContext::Private : public GenericNodeListContext +{ + public: + Private(const SearchIndexList *sil) + { + SDict<SearchDefinitionList>::Iterator li(*sil); + SearchDefinitionList *dl; + for (li.toFirst();(dl=li.current());++li) + { + append(SymbolGroupContext::alloc(dl)); + } + } +}; + +SymbolGroupListContext::SymbolGroupListContext(const SearchIndexList *sil) + : RefCountedContext("SymbolGroupListContext") +{ + p = new Private(sil); +} + +SymbolGroupListContext::~SymbolGroupListContext() +{ + delete p; +} + +// TemplateListIntf +int SymbolGroupListContext::count() const +{ + return p->count(); +} + +TemplateVariant SymbolGroupListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *SymbolGroupListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + +//%% struct SymbolIndex: search index +//%% { +class SymbolIndexContext::Private +{ + public: + Private(const SearchIndexList *sl,const QCString &name) : m_searchList(sl), m_name(name) + { + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("letter", &Private::letter); + s_inst.addProperty("symbolGroups",&Private::symbolGroups); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } + TemplateVariant name() const + { + return m_name; + } + TemplateVariant letter() const + { + return QString(QChar(m_searchList->letter())).utf8(); + } + TemplateVariant symbolGroups() const + { + if (!m_cache.symbolGroups) + { + m_cache.symbolGroups.reset(SymbolGroupListContext::alloc(m_searchList)); + } + return m_cache.symbolGroups.get(); + } + private: + const SearchIndexList *m_searchList; + QCString m_name; + struct Cachable + { + SharedPtr<SymbolGroupListContext> symbolGroups; + }; + mutable Cachable m_cache; + static PropertyMapper<SymbolIndexContext::Private> s_inst; +}; +//%% } + +PropertyMapper<SymbolIndexContext::Private> SymbolIndexContext::Private::s_inst; + +SymbolIndexContext::SymbolIndexContext(const SearchIndexList *sl,const QCString &name) + : RefCountedContext("SymbolIndexContext") +{ + p = new Private(sl,name); +} + +SymbolIndexContext::~SymbolIndexContext() +{ + delete p; +} + +TemplateVariant SymbolIndexContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list SymbolIndices[SymbolIndex] : list of search indices one per by type +class SymbolIndicesContext::Private : public GenericNodeListContext +{ + public: + Private(const SearchIndexInfo *info) + { + // use info->symbolList to populate the list + SIntDict<SearchIndexList>::Iterator it(info->symbolList); + const SearchIndexList *sl; + for (it.toFirst();(sl=it.current());++it) // for each letter + { + append(SymbolIndexContext::alloc(sl,info->name)); + } + } +}; + +SymbolIndicesContext::SymbolIndicesContext(const SearchIndexInfo *info) : RefCountedContext("SymbolIndicesContext") +{ + p = new Private(info); +} + +SymbolIndicesContext::~SymbolIndicesContext() +{ + delete p; +} + +// TemplateListIntf +int SymbolIndicesContext::count() const +{ + return p->count(); +} + +TemplateVariant SymbolIndicesContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *SymbolIndicesContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + +//%% struct SearchIndex: search index +//%% { +class SearchIndexContext::Private +{ + public: + Private(const SearchIndexInfo *info) : m_info(info) + { + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("text", &Private::text); + s_inst.addProperty("symbolIndices",&Private::symbolIndices); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } + TemplateVariant name() const + { + return m_info->name; + } + TemplateVariant text() const + { + return m_info->text; + } + TemplateVariant symbolIndices() const + { + if (!m_cache.symbolIndices) + { + m_cache.symbolIndices.reset(SymbolIndicesContext::alloc(m_info)); + } + return m_cache.symbolIndices.get(); + } + private: + const SearchIndexInfo *m_info; + struct Cachable + { + SharedPtr<SymbolIndicesContext> symbolIndices; + }; + mutable Cachable m_cache; + static PropertyMapper<SearchIndexContext::Private> s_inst; +}; +//%% } + +PropertyMapper<SearchIndexContext::Private> SearchIndexContext::Private::s_inst; + +SearchIndexContext::SearchIndexContext(const SearchIndexInfo *info) + : RefCountedContext("SearchIndexContext") +{ + p = new Private(info); +} + +SearchIndexContext::~SearchIndexContext() +{ + delete p; +} + +TemplateVariant SearchIndexContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list SearchIndices[SearchIndex] : list of search indices one per by type +class SearchIndicesContext::Private : public GenericNodeListContext +{ + public: + Private() + { + const SearchIndexInfo *indices = getSearchIndices(); + for (int i=0;i<NUM_SEARCH_INDICES;i++) + { + append(SearchIndexContext::alloc(&indices[i])); + } + } +}; + +SearchIndicesContext::SearchIndicesContext() : RefCountedContext("SearchIndicesContext") +{ + p = new Private; +} + +SearchIndicesContext::~SearchIndicesContext() +{ + delete p; +} + +// TemplateListIntf +int SearchIndicesContext::count() const +{ + return p->count(); +} + +TemplateVariant SearchIndicesContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *SearchIndicesContext::createIterator() const +{ + return p->createIterator(); +} + + +//------------------------------------------------------------------------ + class HtmlEscaper : public TemplateEscapeIntf { public: @@ -8073,6 +9936,36 @@ class HtmlEscaper : public TemplateEscapeIntf { return convertToHtml(s,TRUE); } + void enableTabbing(bool) {} +}; + +//------------------------------------------------------------------------ + +class LatexSpaceless : public TemplateSpacelessIntf +{ + public: + LatexSpaceless() { reset(); } + void reset() { } + QCString remove(const QCString &s) + { + QGString result; + const char *p = s.data(); + char c; + while ((c=*p++)) + { + switch(c) + { + case '\t': case ' ': case '\n': + break; + default: + result+=c; + break; + } + } + result+='\0'; + return result.data(); + } + private: }; //------------------------------------------------------------------------ @@ -8152,12 +10045,29 @@ class HtmlSpaceless : public TemplateSpacelessIntf //------------------------------------------------------------------------ +class LatexEscaper : public TemplateEscapeIntf +{ + public: + LatexEscaper() : m_tabbing(FALSE) {} + QCString escape(const QCString &s) + { + return convertToLaTeX(s,m_tabbing); + } + void enableTabbing(bool b) { m_tabbing=b; } + private: + bool m_tabbing; +}; + + +//------------------------------------------------------------------------ + #if DEBUG_REF int RefCountedContext::s_totalCount; #endif void generateOutputViaTemplate() { + msg("Generating output via template engine...\n"); { TemplateEngine e; TemplateContext *ctx = e.createContext(); @@ -8175,14 +10085,16 @@ void generateOutputViaTemplate() SharedPtr<DirListContext> dirList (DirListContext::alloc()); SharedPtr<FileListContext> fileList (FileListContext::alloc()); SharedPtr<FileTreeContext> fileTree (FileTreeContext::alloc()); - SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc()); + SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc(Doxygen::pageSDict)); SharedPtr<PageListContext> pageList (PageListContext::alloc(Doxygen::pageSDict)); + SharedPtr<ExampleTreeContext> exampleTree (ExampleTreeContext::alloc()); SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc()); SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc()); SharedPtr<ModuleListContext> moduleList (ModuleListContext::alloc()); SharedPtr<GlobalsIndexContext> globalsIndex (GlobalsIndexContext::alloc()); SharedPtr<ClassMembersIndexContext> classMembersIndex (ClassMembersIndexContext::alloc()); SharedPtr<NamespaceMembersIndexContext> namespaceMembersIndex(NamespaceMembersIndexContext::alloc()); + SharedPtr<SearchIndicesContext> searchIndices (SearchIndicesContext::alloc()); //%% Doxygen doxygen: ctx->set("doxygen",doxygen.get()); @@ -8210,6 +10122,8 @@ void generateOutputViaTemplate() ctx->set("pageList",pageList.get()); //%% PageTree pageTree ctx->set("pageTree",pageTree.get()); + //%% ExampleTree exampleTree + ctx->set("exampleTree",exampleTree.get()); //%% ExampleList exampleList ctx->set("exampleList",exampleList.get()); //%% ModuleTree moduleTree @@ -8221,15 +10135,15 @@ void generateOutputViaTemplate() //%% Page mainPage if (Doxygen::mainPage) { - SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE)); + SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); } else { // TODO: for LaTeX output index should be main... => solve in template Doxygen::mainPage = new PageDef("[generated]",1,"index","",theTranslator->trMainPage()); - Doxygen::mainPage->setFileName("index",TRUE); - SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE)); + Doxygen::mainPage->setFileName("index"); + SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); } //%% GlobalsIndex globalsIndex: @@ -8238,27 +10152,77 @@ void generateOutputViaTemplate() ctx->set("classMembersIndex",classMembersIndex.get()); //%% NamespaceMembersIndex namespaceMembersIndex: ctx->set("namespaceMembersIndex",namespaceMembersIndex.get()); + //%% SearchIndicaes searchindicaes + ctx->set("searchIndices",searchIndices.get()); + //%% string space + ctx->set("space"," "); + + //if (Config_getBool("GENERATE_HTML")) + { // render HTML output + Template *tpl = e.loadByName("htmllayout.tpl",1); + if (tpl) + { + g_globals.outputFormat = ContextOutputFormat_Html; + g_globals.dynSectionId = 0; + g_globals.outputDir = Config_getString("HTML_OUTPUT"); + QDir dir(g_globals.outputDir); + createSubDirs(dir); + HtmlEscaper htmlEsc; + ctx->setEscapeIntf(Config_getString("HTML_FILE_EXTENSION"),&htmlEsc); + HtmlSpaceless spl; + ctx->setSpacelessIntf(&spl); + ctx->setOutputDirectory(g_globals.outputDir); + FTextStream ts; + tpl->render(ts,ctx); + e.unload(tpl); + } + } + + // TODO: clean index before each run... + + //if (Config_getBool("GENERATE_LATEX")) + if (0) + { // render LaTeX output + Template *tpl = e.loadByName("latexlayout.tpl",1); + if (tpl) + { + g_globals.outputFormat = ContextOutputFormat_Latex; + g_globals.dynSectionId = 0; + g_globals.outputDir = Config_getString("LATEX_OUTPUT"); + QDir dir(g_globals.outputDir); + createSubDirs(dir); + LatexEscaper latexEsc; + ctx->setEscapeIntf(".tex",&latexEsc); + LatexSpaceless spl; + ctx->setSpacelessIntf(&spl); + ctx->setOutputDirectory(g_globals.outputDir); + FTextStream ts; + tpl->render(ts,ctx); + e.unload(tpl); + } + } - // render HTML output - Template *tpl = e.loadByName("htmllayout.tpl",1); - if (tpl) - { - g_globals.outputFormat = ContextGlobals::Html; - g_globals.dynSectionId = 0; - g_globals.outputDir = Config_getString("HTML_OUTPUT"); - QDir dir(g_globals.outputDir); - createSubDirs(dir); - HtmlEscaper htmlEsc; - ctx->setEscapeIntf(Config_getString("HTML_FILE_EXTENSION"),&htmlEsc); - HtmlSpaceless spl; - ctx->setSpacelessIntf(&spl); - ctx->setOutputDirectory(g_globals.outputDir); - FTextStream ts; - tpl->render(ts,ctx); - e.unload(tpl); - } - - // TODO: render other outputs + // clear all cached data in Definition objects. + QDictIterator<DefinitionIntf> di(*Doxygen::symbolMap); + DefinitionIntf *intf; + for (;(intf=di.current());++di) + { + if (intf->definitionType()==DefinitionIntf::TypeSymbolList) // list of symbols + { + DefinitionListIterator dli(*(DefinitionList*)intf); + Definition *d; + // for each symbol + for (dli.toFirst();(d=dli.current());++dli) + { + d->setCookie(0); + } + } + else // single symbol + { + Definition *d = (Definition *)intf; + d->setCookie(0); + } + } e.destroyContext(ctx); } diff --git a/src/context.h b/src/context.h index cb20313..7c98222 100644 --- a/src/context.h +++ b/src/context.h @@ -52,7 +52,10 @@ class MemberGroup; class MemberGroupSDict; class MemberGroupList; class DotNode; -class DotGfxHierarchyTable; +class DotGfxHierarchyTable; +struct SearchIndexInfo; +class SearchIndexList; +class SearchDefinitionList; //---------------------------------------------------- @@ -68,7 +71,7 @@ class RefCountedContext m_className=className; m_insideRelease = FALSE; } - ~RefCountedContext() + virtual ~RefCountedContext() { if (!m_insideRelease) abort(); } @@ -326,7 +329,7 @@ class DirContext : public RefCountedContext, public TemplateStructIntf class PageContext : public RefCountedContext, public TemplateStructIntf { public: - static PageContext *alloc(PageDef *pd,bool isMainPage=FALSE) { return new PageContext(pd,isMainPage); } + static PageContext *alloc(PageDef *pd,bool isMainPage,bool isExample) { return new PageContext(pd,isMainPage,isExample); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; @@ -334,7 +337,7 @@ class PageContext : public RefCountedContext, public TemplateStructIntf virtual int release() { return RefCountedContext::release(); } private: - PageContext(PageDef *,bool isMainPage); + PageContext(PageDef *,bool isMainPage,bool isExample); ~PageContext(); class Private; Private *p; @@ -707,7 +710,7 @@ class PageListContext : public RefCountedContext, public TemplateListIntf class PageTreeContext : public RefCountedContext, public TemplateStructIntf { public: - static PageTreeContext *alloc() { return new PageTreeContext; } + static PageTreeContext *alloc(const PageSDict *pages) { return new PageTreeContext(pages); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; @@ -715,7 +718,7 @@ class PageTreeContext : public RefCountedContext, public TemplateStructIntf virtual int release() { return RefCountedContext::release(); } private: - PageTreeContext(); + PageTreeContext(const PageSDict *pages); ~PageTreeContext(); class Private; Private *p; @@ -785,13 +788,15 @@ class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf //---------------------------------------------------- -class ExampleListContext : public RefCountedContext, public TemplateStructIntf +class ExampleListContext : public RefCountedContext, public TemplateListIntf { public: - static ExampleListContext *alloc() { return new ExampleListContext(); } + static ExampleListContext *alloc() { return new ExampleListContext; } - // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + // TemplateListIntf methods + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -804,6 +809,26 @@ class ExampleListContext : public RefCountedContext, public TemplateStructIntf //---------------------------------------------------- + +class ExampleTreeContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static ExampleTreeContext *alloc() { return new ExampleTreeContext; } + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + ExampleTreeContext(); + ~ExampleTreeContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + class GlobalsIndexContext : public RefCountedContext, public TemplateStructIntf { public: @@ -1154,6 +1179,173 @@ class ArgumentListContext : public RefCountedContext, public TemplateListIntf //---------------------------------------------------- +class SymbolContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static SymbolContext *alloc(const Definition *def,const Definition *prev,const Definition *next) + { return new SymbolContext(def,prev,next); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolContext(const Definition *def,const Definition *prev,const Definition *next); + ~SymbolContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SymbolListContext : public RefCountedContext, public TemplateListIntf +{ + public: + static SymbolListContext *alloc(const SearchDefinitionList *sdl) + { return new SymbolListContext(sdl); } + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolListContext(const SearchDefinitionList *sdl); + ~SymbolListContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SymbolGroupContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static SymbolGroupContext *alloc(const SearchDefinitionList *sdl) + { return new SymbolGroupContext(sdl); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolGroupContext(const SearchDefinitionList *sdl); + ~SymbolGroupContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SymbolGroupListContext : public RefCountedContext, public TemplateListIntf +{ + public: + static SymbolGroupListContext *alloc(const SearchIndexList *sil) + { return new SymbolGroupListContext(sil); } + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolGroupListContext(const SearchIndexList *sil); + ~SymbolGroupListContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SymbolIndexContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static SymbolIndexContext *alloc(const SearchIndexList *sl,const QCString &name) + { return new SymbolIndexContext(sl,name); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolIndexContext(const SearchIndexList *sl,const QCString &name); + ~SymbolIndexContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SymbolIndicesContext : public RefCountedContext, public TemplateListIntf +{ + public: + static SymbolIndicesContext *alloc(const SearchIndexInfo *info) + { return new SymbolIndicesContext(info); } + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SymbolIndicesContext(const SearchIndexInfo *info); + ~SymbolIndicesContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SearchIndexContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static SearchIndexContext *alloc(const SearchIndexInfo *info) + { return new SearchIndexContext(info); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SearchIndexContext(const SearchIndexInfo *info); + ~SearchIndexContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class SearchIndicesContext : public RefCountedContext, public TemplateListIntf +{ + public: + static SearchIndicesContext *alloc() { return new SearchIndicesContext; } + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + SearchIndicesContext(); + ~SearchIndicesContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + void generateOutputViaTemplate(); #endif diff --git a/src/defargs.l b/src/defargs.l index 9032d8e..603f238 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -346,7 +346,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" int bi=g_curArgTypeName.find('('); int fi=bi-1; //printf("func arg fi=%d\n",fi); - while (fi>=0 && isId(g_curArgTypeName.at(fi))) fi--; + while (fi>=0 && (isId(g_curArgTypeName.at(fi)) || g_curArgTypeName.at(fi)==':')) fi--; if (fi>=0) { a->type = g_curArgTypeName.left(fi+1); diff --git a/src/definition.cpp b/src/definition.cpp index 457c6ea..d04dd59 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -282,7 +282,7 @@ void Definition::removeFromMap(Definition *d) Definition::Definition(const char *df,int dl,int dc, const char *name,const char *b, - const char *d,bool isSymbol) + const char *d,bool isSymbol) : m_cookie(0) { m_name = name; m_defLine = dl; @@ -299,7 +299,7 @@ Definition::Definition(const char *df,int dl,int dc, } } -Definition::Definition(const Definition &d) : DefinitionIntf() +Definition::Definition(const Definition &d) : DefinitionIntf(), m_cookie(0) { m_name = d.m_name; m_defLine = d.m_defLine; @@ -380,7 +380,7 @@ Definition::Definition(const Definition &d) : DefinitionIntf() Definition::~Definition() { - if (m_isSymbol) + if (m_isSymbol) { removeFromMap(this); } @@ -389,6 +389,8 @@ Definition::~Definition() delete m_impl; m_impl=0; } + delete m_cookie; + m_cookie=0; } void Definition::setName(const char *name) @@ -1217,7 +1219,7 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { ol.disable(OutputGenerator::Latex); } - if (!rtfSourceCode) + if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); } @@ -1943,4 +1945,27 @@ bool Definition::hasBriefDescription() const return !briefDescription().isEmpty() && briefMemberDesc; } +QCString Definition::externalReference(const QCString &relPath) const +{ + QCString ref = getReference(); + if (!ref.isEmpty()) + { + QCString *dest = Doxygen::tagDestinationDict[ref]; + if (dest) + { + QCString result = *dest; + int l = result.length(); + if (!relPath.isEmpty() && l>0 && result.at(0)=='.') + { // relative path -> prepend relPath. + result.prepend(relPath); + l+=relPath.length(); + } + if (l>0 && result.at(l-1)!='/') result+='/'; + return result; + } + } + return relPath; +} + + diff --git a/src/definition.h b/src/definition.h index 5905a55..6277c6c 100644 --- a/src/definition.h +++ b/src/definition.h @@ -92,7 +92,11 @@ class DefinitionIntf class Definition : public DefinitionIntf { public: - + struct Cookie + { + virtual ~Cookie() {} + }; + /*! Create a new definition */ Definition( const char *defFileName,int defLine,int defColumn, @@ -231,6 +235,9 @@ class Definition : public DefinitionIntf /*! Returns TRUE if this definition is imported via a tag file. */ virtual bool isReference() const; + /*! Convenience method to return a resolved external link */ + QCString externalReference(const QCString &relPath) const; + /*! Returns the first line of the body of this item (applicable to classes and * functions). */ @@ -341,6 +348,9 @@ class Definition : public DefinitionIntf void addSectionsToIndex(); void writeToc(OutputList &ol); + void setCookie(Cookie *cookie) { delete m_cookie; m_cookie = cookie; } + Cookie *cookie() const { return m_cookie; } + protected: Definition(const Definition &d); @@ -364,6 +374,7 @@ class Definition : public DefinitionIntf QCString m_symbolName; int m_defLine; int m_defColumn; + Cookie *m_cookie; }; /** A list of Definition objects. */ diff --git a/src/diagram.cpp b/src/diagram.cpp index 994c1a4..8a6ccf6 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -274,7 +274,7 @@ static void writeMapArea(FTextStream &t,ClassDef *cd,QCString relPath, QCString tooltip = cd->briefDescriptionAsTooltip(); if (!tooltip.isEmpty()) { - t << "title=\"" << tooltip << "\" "; + t << "title=\"" << convertToHtml(tooltip) << "\" "; } t << "alt=\"" << convertToXML(cd->displayName()); t << "\" shape=\"rect\" coords=\"" << x << "," << y << ","; diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 067daa0..ddd0c37 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -228,6 +228,7 @@ void DirDef::writeSubDirList(OutputList &ol) DirDef *dd; for (;(dd=it.current());++it) { + if (!dd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); ol.parseText(theTranslator->trDir(FALSE,TRUE)+" "); @@ -266,6 +267,7 @@ void DirDef::writeFileList(OutputList &ol) FileDef *fd; for (;(fd=it.current());++it) { + if (!fd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); @@ -385,7 +387,7 @@ void DirDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); QCString title=theTranslator->trDirReference(m_dispName); - startFile(ol,getOutputFileBase(),name(),title,HLI_None,!generateTreeView); + startFile(ol,getOutputFileBase(),name(),title,HLI_Files,!generateTreeView); if (!generateTreeView) { @@ -610,7 +612,7 @@ bool DirDef::isParentOf(DirDef *dir) const bool DirDef::depGraphIsTrivial() const { - return FALSE; + return m_usedDirs->count()==0; } //---------------------------------------------------------------------- @@ -696,11 +698,6 @@ DirDef *DirDef::mergeDirectoryInTree(const QCString &path) return dir; } -void DirDef::writeDepGraph(FTextStream &t) -{ - writeDotDirDepGraph(t,this); -} - //---------------------------------------------------------------------- static void writePartialDirPath(OutputList &ol,const DirDef *root,const DirDef *target) @@ -841,6 +838,7 @@ static void computeCommonDirPrefix() else // dir is shorter than path -> take path of dir as new start { path=dir->name(); + l=path.length(); int i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { diff --git a/src/dirdef.h b/src/dirdef.h index 1a87f5b..611ba3e 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -71,7 +71,6 @@ class DirDef : public Definition // generate output void writeDocumentation(OutputList &ol); - void writeDepGraph(FTextStream &t); void writeTagFile(FTextStream &t); static DirDef *mergeDirectoryInTree(const QCString &path); diff --git a/src/docparser.cpp b/src/docparser.cpp index f4261ac..099213d 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -471,9 +471,9 @@ static void checkUndocumentedParams() if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); if (argName.right(3)=="...") argName=argName.left(argName.length()-3); - if (g_memberDef->getLanguage()==SrcLangExt_Python && argName=="self") + if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) { - // allow undocumented self parameter for Python + // allow undocumented self / cls parameter for Python } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty()) { @@ -494,9 +494,9 @@ static void checkUndocumentedParams() QCString argName = g_memberDef->isDefine() ? a->type : a->name; if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); - if (g_memberDef->getLanguage()==SrcLangExt_Python && argName=="self") + if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) { - // allow undocumented self parameter for Python + // allow undocumented self / cls parameter for Python } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0) { @@ -511,18 +511,9 @@ static void checkUndocumentedParams() errMsg+=" parameter '"+argName+"'"; } } - if (g_memberDef->inheritsDocsFrom()) - { - warn_doc_error(g_memberDef->getDefFileName(), - g_memberDef->getDefLine(), - substitute(errMsg,"%","%%")); - } - else - { - warn_doc_error(g_memberDef->getDefFileName(), - g_memberDef->getDefLine(), - substitute(errMsg,"%","%%")); - } + warn_doc_error(g_memberDef->getDefFileName(), + g_memberDef->getDefLine(), + substitute(errMsg,"%","%%")); } } } @@ -563,7 +554,7 @@ static void detectNoDocumentedParams() for (ali.toFirst();(a=ali.current()) && allDoc;++ali) { if (!a->name.isEmpty() && a->type!="void" && - !(isPython && a->name=="self") + !(isPython && (a->name=="self" || a->name=="cls")) ) { allDoc = !a->docs.isEmpty(); @@ -579,7 +570,7 @@ static void detectNoDocumentedParams() for (ali.toFirst();(a=ali.current()) && allDoc;++ali) { if (!a->name.isEmpty() && a->type!="void" && - !(isPython && a->name=="self") + !(isPython && (a->name=="self" || a->name=="cls")) ) { allDoc = !a->docs.isEmpty(); @@ -594,7 +585,8 @@ static void detectNoDocumentedParams() g_memberDef->setHasDocumentedParams(TRUE); } } - //printf("Member %s hasReturnCommand=%d\n",g_memberDef->name().data(),g_hasReturnCommand); + //printf("Member %s hadDocumentedReturnType()=%d hasReturnCommand=%d\n", + // g_memberDef->name().data(),g_memberDef->hasDocumentedReturnType(),g_hasReturnCommand); if (!g_memberDef->hasDocumentedReturnType() && // docs not yet found g_hasReturnCommand) { @@ -611,7 +603,18 @@ static void detectNoDocumentedParams() { g_memberDef->setHasDocumentedReturnType(TRUE); } - + else if ( // see if return type is documented in a function w/o return type + g_memberDef->hasDocumentedReturnType() && + (returnType.isEmpty() || // empty return type + returnType.find("void")!=-1 || // void return type + returnType.find("subroutine")!=-1 || // fortran subroutine + g_memberDef->isConstructor() || // a constructor + g_memberDef->isDestructor() // or destructor + ) + ) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type"); + } } } @@ -1382,6 +1385,15 @@ reparsetoken: case CMD_QUOTE: children.append(new DocSymbol(parent,DocSymbol::Sym_Quot)); break; + case CMD_PUNT: + children.append(new DocSymbol(parent,DocSymbol::Sym_Dot)); + break; + case CMD_PLUS: + children.append(new DocSymbol(parent,DocSymbol::Sym_Plus)); + break; + case CMD_MINUS: + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); + break; case CMD_EMPHASIS: { children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,TRUE)); @@ -2168,7 +2180,7 @@ bool DocXRefItem::parse() } else { - m_file = convertNameToFile(refList->listName(),FALSE,TRUE); + m_file = refList->fileName(); m_anchor = item->listAnchor; } m_title = refList->sectionTitle(); @@ -2418,7 +2430,7 @@ void DocInternalRef::parse() //--------------------------------------------------------------------------- DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : - m_refToSection(FALSE), m_refToAnchor(FALSE), m_isSubPage(FALSE) + m_refType(Unknown), m_isSubPage(FALSE) { m_parent = parent; Definition *compound = 0; @@ -2444,8 +2456,18 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : m_ref = sec->ref; m_file = stripKnownExtensions(sec->fileName); - m_refToAnchor = sec->type==SectionInfo::Anchor; - m_refToSection = sec->type!=SectionInfo::Anchor; + if (sec->type==SectionInfo::Anchor) + { + m_refType = Anchor; + } + else if (sec->type==SectionInfo::Table) + { + m_refType = Table; + } + else + { + m_refType = Section; + } m_isSubPage = pd && pd->hasParentPage(); if (sec->type!=SectionInfo::Page || m_isSubPage) m_anchor = sec->label; //printf("m_text=%s,m_ref=%s,m_file=%s,m_refToAnchor=%d type=%d\n", @@ -3216,6 +3238,9 @@ int DocIndexEntry::parse() case CMD_NDASH: m_entry+="--"; break; case CMD_MDASH: m_entry+="---"; break; case CMD_QUOTE: m_entry+='"'; break; + case CMD_PUNT: m_entry+='.'; break; + case CMD_PLUS: m_entry+='+'; break; + case CMD_MINUS: m_entry+='-'; break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command %s found as argument of \\addindex", qPrint(g_token->name)); @@ -3239,6 +3264,41 @@ endindexentry: //--------------------------------------------------------------------------- +DocHtmlCaption::DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs) +{ + m_hasCaptionId = FALSE; + HtmlAttribListIterator li(attribs); + HtmlAttrib *opt; + for (li.toFirst();(opt=li.current());++li) + { + if (opt->name=="id") // interpret id attribute as an anchor + { + SectionInfo *sec = Doxygen::sectionDict->find(opt->value); + if (sec) + { + //printf("Found anchor %s\n",id.data()); + m_file = sec->fileName; + m_anchor = sec->label; + m_hasCaptionId = TRUE; + if (g_sectionDict && g_sectionDict->find(opt->value)==0) + { + //printf("Inserting in dictionary!\n"); + g_sectionDict->append(opt->value,sec); + } + } + else + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid caption id `%s'",qPrint(opt->value)); + } + } + else // copy attribute + { + m_attribs.append(new HtmlAttrib(*opt)); + } + } + m_parent = parent; +} + int DocHtmlCaption::parse() { int retval=0; @@ -3744,12 +3804,14 @@ void DocHtmlTable::accept(DocVisitor *v) { v->visitPre(this); // for HTML output we put the caption first - if (m_caption && v->id()==DocVisitor_Html) m_caption->accept(v); + //if (m_caption && v->id()==DocVisitor_Html) m_caption->accept(v); + // doxygen 1.8.11: always put the caption first + if (m_caption) m_caption->accept(v); QListIterator<DocNode> cli(m_children); DocNode *n; for (cli.toFirst();(n=cli.current());++cli) n->accept(v); // for other output formats we put the caption last - if (m_caption && v->id()!=DocVisitor_Html) m_caption->accept(v); + //if (m_caption && v->id()!=DocVisitor_Html) m_caption->accept(v); v->visitPost(this); } @@ -5287,6 +5349,15 @@ int DocPara::handleCommand(const QCString &cmdName) case CMD_QUOTE: m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; + case CMD_PUNT: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dot)); + break; + case CMD_PLUS: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Plus)); + break; + case CMD_MINUS: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + break; case CMD_SA: g_inSeeBlock=TRUE; retval = handleSimpleSection(DocSimpleSect::See); @@ -5895,7 +5966,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta { if (Config_getBool("WARN_NO_PARAMDOC")) { - warn_doc_error(g_fileName,doctokenizerYYlineno,"empty 'name' attribute for <param> tag."); + warn_doc_error(g_fileName,doctokenizerYYlineno,"empty 'name' attribute for <param%s> tag.",tagId==XML_PARAM?"":"type"); } } else @@ -5907,7 +5978,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } else { - warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param> tag."); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param%s> tag.",tagId==XML_PARAM?"":"type"); } } break; @@ -5940,7 +6011,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } else { - warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <exception> tag."); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <exception> tag."); } } break; @@ -6798,6 +6869,15 @@ void DocText::parse() case CMD_QUOTE: m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; + case CMD_PUNT: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dot)); + break; + case CMD_PLUS: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Plus)); + break; + case CMD_MINUS: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command `%s' found", qPrint(g_token->name)); diff --git a/src/docparser.h b/src/docparser.h index 1abb687..e2751d8 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -309,10 +309,18 @@ class DocCite : public DocNode class DocStyleChange : public DocNode { public: - enum Style { Bold, Italic, Code, Center, Small, - Subscript, Superscript, Preformatted, - Span, Div + enum Style { Bold = (1<<0), + Italic = (1<<1), + Code = (1<<2), + Center = (1<<3), + Small = (1<<4), + Subscript = (1<<5), + Superscript = (1<<6), + Preformatted = (1<<7), + Span = (1<<8), + Div = (1<<9) }; + DocStyleChange(DocNode *parent,uint position,Style s,bool enable, const HtmlAttribList *attribs=0) : m_position(position), m_style(s), m_enable(enable) @@ -395,7 +403,7 @@ class DocSymbol : public DocNode /* doxygen commands mapped */ Sym_BSlash, Sym_At, Sym_Less, Sym_Greater, Sym_Amp, Sym_Dollar, Sym_Hash, Sym_DoubleColon, Sym_Percent, Sym_Pipe, - Sym_Quot, Sym_Minus + Sym_Quot, Sym_Minus, Sym_Plus, Sym_Dot }; enum PerlType { Perl_unknown = 0, Perl_string, Perl_char, Perl_symbol, Perl_umlaut, Perl_acute, Perl_grave, Perl_circ, Perl_slash, Perl_tilde, @@ -822,15 +830,16 @@ class DocRef : public CompAccept<DocRef>, public DocNode QCString anchor() const { return m_anchor; } QCString targetTitle() const { return m_text; } bool hasLinkText() const { return !m_children.isEmpty(); } - bool refToAnchor() const { return m_refToAnchor; } - bool refToSection() const { return m_refToSection; } + bool refToAnchor() const { return m_refType==Anchor; } + bool refToSection() const { return m_refType==Section; } + bool refToTable() const { return m_refType==Table; } bool isSubPage() const { return m_isSubPage; } void accept(DocVisitor *v) { CompAccept<DocRef>::accept(this,v); } private: - bool m_refToSection; - bool m_refToAnchor; - bool m_isSubPage; + enum RefType { Unknown, Anchor, Section, Table }; + RefType m_refType; + bool m_isSubPage; QCString m_file; QCString m_relPath; QCString m_ref; @@ -1279,15 +1288,20 @@ class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode class DocHtmlCaption : public CompAccept<DocHtmlCaption>, public DocNode { public: - DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs) : - m_attribs(attribs) { m_parent = parent; } + DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs); Kind kind() const { return Kind_HtmlCaption; } void accept(DocVisitor *v) { CompAccept<DocHtmlCaption>::accept(this,v); } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); + bool hasCaptionId() const { return m_hasCaptionId; } + QCString file() const { return m_file; } + QCString anchor() const { return m_anchor; } private: HtmlAttribList m_attribs; + bool m_hasCaptionId; + QCString m_file; + QCString m_anchor; }; /** Node representing a HTML table row */ @@ -1303,8 +1317,18 @@ class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode const HtmlAttribList &attribs() const { return m_attribs; } int parse(); int parseXml(bool header); - bool isHeading() const { return m_children.count()>0 && - ((DocHtmlCell*)m_children.getFirst())->isHeading(); + bool isHeading() const { // a row is a table heading if all cells are marked as such + bool heading=TRUE; + QListIterator<DocNode> it(m_children); + DocNode *n; + for (;(n=it.current());++it) + { + if (n->kind()==Kind_HtmlCell) + { + heading = heading && ((DocHtmlCell*)n)->isHeading(); + } + } + return m_children.count()>0 && heading; } void setVisibleCells(int n) { m_visibleCells = n; } int visibleCells() const { return m_visibleCells; } @@ -1332,6 +1356,12 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode int parseXml(); uint numColumns() const { return m_numCols; } void accept(DocVisitor *v); + DocHtmlCaption *caption() const { return m_caption; } + DocHtmlRow *firstRow() const { + DocNode *n = m_children.getFirst(); + if (n && n->kind()==Kind_HtmlRow) return (DocHtmlRow*)n; + return 0; + } private: void computeTableGrid(); diff --git a/src/docsets.cpp b/src/docsets.cpp index cde317d..9772d4e 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -468,10 +468,6 @@ void DocSets::addIndexItem(Definition *context,MemberDef *md, if (ii) { decl=ii->includeName; - if (decl.isEmpty()) - { - decl=ii->local; - } } } else if (nd) diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 31d583c..3169fc0 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -169,8 +169,7 @@ static void processSection() if ((si=Doxygen::sectionDict->find(g_secLabel))) { si->fileName = file; - //si = new SectionInfo(file,g_secLabel,g_secTitle,g_secType); - //Doxygen::sectionDict.insert(g_secLabel,si); + si->type = g_secType; } } @@ -334,7 +333,7 @@ BLANK [ \t\r] ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]* PHPTYPE [\\:a-z_A-Z0-9\x80-\xFF\-]+ -CITESCHAR [a-z_A-Z\x80-\xFF] +CITESCHAR [a-z_A-Z0-9\x80-\xFF] CITEECHAR [a-z_A-Z0-9\x80-\xFF\-\+:\/]* CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)* MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ @@ -354,7 +353,7 @@ FILEMASK ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|{HFILEMASK} LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)? VERBATIM "verbatim"{BLANK}* SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---") -SPCMD2 {CMD}[\\@<>&$#%~".|] +SPCMD2 {CMD}[\\@<>&$#%~".+|-] SPCMD3 {CMD}form#[0-9]+ SPCMD4 {CMD}"::" INOUT "inout"|"in"|"out"|("in"{BLANK}*","{BLANK}*"out")|("out"{BLANK}*","{BLANK}*"in") @@ -389,6 +388,7 @@ WORD1 {ESCWORD}|{CHARWORDQ}+|"{"|"}"|"'\"'"|("\""[^"\n]*\n?[^"\n]*"\"") WORD2 "."|","|"("|")"|"["|"]"|":"|";"|"\?"|"="|"'" WORD1NQ {ESCWORD}|{CHARWORDQ}+|"{"|"}" WORD2NQ "."|","|"("|")"|"["|"]"|":"|";"|"\?"|"="|"'" +CAPTION [cC][aA][pP][tT][iI][oO][nN] HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">" HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p" HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P" @@ -1160,8 +1160,26 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4} /* State for the pass used to find the anchors and sections */ -<St_Sections>[^\n@\\]+ -<St_Sections>"@@"|"\\\\" +<St_Sections>[^\n@\\<]+ +<St_Sections>"@@"|"\\\\"|"@<"|"\\<" +<St_Sections>"<"{CAPTION}({WS}+{ATTRIB})*">" { + QCString tag=yytext; + int s=tag.find("id="); + if (s!=-1) // command has id attribute + { + char c=tag[s+3]; + if (c=='\'' || c=='"') // valid start + { + int e=tag.find(c,s+4); + if (e!=-1) // found matching end + { + g_secType = SectionInfo::Table; + g_secLabel=tag.mid(s+4,e-s-4); // extract id + processSection(); + } + } + } + } <St_Sections>{CMD}"anchor"{BLANK}+ { g_secType = SectionInfo::Anchor; BEGIN(St_SecLabel1); diff --git a/src/dot.cpp b/src/dot.cpp index 705aa27..0a4f136 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -659,10 +659,9 @@ static bool writeSVGFigureLink(FTextStream &out,const QCString &relPath, // since dot silently reproduces the input file when it does not // support the PNG format, we need to check the result. -static void checkDotResult(const QCString &imgName) +static void checkDotResult(const char *imgExt, const char *imgName) { - QCString imgExt = getDotImageExtension(); - if (imgExt=="png") + if (qstrcmp(imgExt,"png")==0) { FILE *f = portable_fopen(imgName,"rb"); if (f) @@ -675,19 +674,19 @@ static void checkDotResult(const QCString &imgName) err("Image `%s' produced by dot is not a valid PNG!\n" "You should either select a different format " "(DOT_IMAGE_FORMAT in the config file) or install a more " - "recent version of graphviz (1.7+)\n",imgName.data() + "recent version of graphviz (1.7+)\n",imgName ); } } else { - err("Could not read image `%s' generated by dot!\n",imgName.data()); + err("Could not read image `%s' generated by dot!\n",imgName); } fclose(f); } else { - err("Could not open image `%s' generated by dot!\n",imgName.data()); + err("Could not open image `%s' generated by dot!\n",imgName); } } } @@ -793,54 +792,46 @@ int DotNodeList::compareValues(const DotNode *n1,const DotNode *n2) const DotRunner::DotRunner(const QCString &file,const QCString &path, bool checkResult,const QCString &imageName) - : m_file(file), m_path(path), - m_checkResult(checkResult), m_imageName(imageName) -{ - static bool dotCleanUp = Config_getBool("DOT_CLEANUP"); - m_cleanUp = dotCleanUp; + : m_dotExe(Config_getString("DOT_PATH")+"dot"), + m_file(file), m_path(path), + m_checkResult(checkResult), m_imageName(imageName), + m_imgExt(getDotImageExtension()) +{ + static bool dotCleanUp = Config_getBool("DOT_CLEANUP"); + static bool dotMultiTargets = Config_getBool("DOT_MULTI_TARGETS"); + m_cleanUp = dotCleanUp; + m_multiTargets = dotMultiTargets; m_jobs.setAutoDelete(TRUE); } void DotRunner::addJob(const char *format,const char *output) { QCString args = QCString("-T")+format+" -o \""+output+"\""; - m_jobs.append(new QCString(args)); + m_jobs.append(new DotConstString(args)); } void DotRunner::addPostProcessing(const char *cmd,const char *args) { - m_postCmd = cmd; - m_postArgs = args; + m_postCmd.set(cmd); + m_postArgs.set(args); } bool DotRunner::run() { int exitCode=0; - // we need to use data here to make a copy of the string, as Config_getString can be called by - // multiple threads simulaneously and the reference counting is not thread safe. - QCString dotExe = Config_getString("DOT_PATH").data(); - dotExe+="dot"; - bool multiTargets = Config_getBool("DOT_MULTI_TARGETS"); QCString dotArgs; - QListIterator<QCString> li(m_jobs); - QCString *s; - QCString file = m_file; - QCString path = m_path; - QCString imageName = m_imageName; - QCString postCmd = m_postCmd; - QCString postArgs = m_postArgs; - bool checkResult = m_checkResult; - bool cleanUp = m_cleanUp; - if (multiTargets) - { - dotArgs="\""+file+"\""; + QListIterator<DotConstString> li(m_jobs); + DotConstString *s; + if (m_multiTargets) + { + dotArgs=QCString("\"")+m_file.data()+"\""; for (li.toFirst();(s=li.current());++li) { dotArgs+=' '; - dotArgs+=*s; + dotArgs+=s->data(); } - if ((exitCode=portable_system(dotExe,dotArgs,FALSE))!=0) + if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) { goto error; } @@ -849,30 +840,33 @@ bool DotRunner::run() { for (li.toFirst();(s=li.current());++li) { - dotArgs="\""+file+"\" "+*s; - if ((exitCode=portable_system(dotExe,dotArgs,FALSE))!=0) + dotArgs=QCString("\"")+m_file.data()+"\" "+s->data(); + if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) { goto error; } } } - if (!postCmd.isEmpty() && portable_system(postCmd,postArgs)!=0) + if (!m_postCmd.isEmpty() && portable_system(m_postCmd.data(),m_postArgs.data())!=0) { err("Problems running '%s' as a post-processing step for dot output\n",m_postCmd.data()); return FALSE; } - if (checkResult) checkDotResult(imageName); - if (cleanUp) + if (m_checkResult) + { + checkDotResult(m_imgExt.data(),m_imageName.data()); + } + if (m_cleanUp) { //printf("removing dot file %s\n",m_file.data()); //QDir(path).remove(file); - m_cleanupItem.file = file; - m_cleanupItem.path = path; + m_cleanupItem.file.set(m_file.data()); + m_cleanupItem.path.set(m_path.data()); } return TRUE; error: err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n", - exitCode,dotExe.data(),dotArgs.data()); + exitCode,m_dotExe.data(),dotArgs.data()); return FALSE; } @@ -1202,7 +1196,7 @@ void DotWorkerThread::run() while ((runner=m_queue->dequeue())) { runner->run(); - DotRunner::CleanupItem cleanup = runner->cleanup(); + const DotRunner::CleanupItem &cleanup = runner->cleanup(); if (!cleanup.file.isEmpty()) { m_cleanupItems.append(new DotRunner::CleanupItem(cleanup)); @@ -1216,7 +1210,7 @@ void DotWorkerThread::cleanup() DotRunner::CleanupItem *ci; for (;(ci=it.current());++it) { - QDir(ci->path).remove(ci->file); + QDir(ci->path.data()).remove(ci->file.data()); } } @@ -2600,7 +2594,12 @@ void DotClassGraph::addClass(ClassDef *cd,DotNode *n,int prot, int edgeStyle = (label || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid; QCString className; - if (usedName) // name is a typedef + if (cd->isAnonymous()) + { + className="anonymous:"; + className+=label; + } + else if (usedName) // name is a typedef { className=usedName; } @@ -2828,9 +2827,9 @@ void DotClassGraph::buildGraph(ClassDef *cd,DotNode *n,bool base,int distance) if (m_graphType == DotNode::Collaboration) { // ---- Add usage relations - - UsesClassDict *dict = - base ? cd->usedImplementationClasses() : + + UsesClassDict *dict = + base ? cd->usedImplementationClasses() : cd->usedByImplementationClasses() ; if (dict) @@ -3965,6 +3964,7 @@ bool DotCallGraph::isTooBig() const } //------------------------------------------------------------- +static void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations); DotDirDeps::DotDirDeps(DirDef *dir) : m_dir(dir) { @@ -3981,7 +3981,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out, const char *fileName, const char *relPath, bool generateImageMap, - int graphId) const + int graphId, + bool linkRelations) const { QDir d(path); // store the original directory @@ -4006,7 +4007,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out, // compute md5 checksum of the graph were are about to generate QGString theGraph; FTextStream md5stream(&theGraph); - m_dir->writeDepGraph(md5stream); + //m_dir->writeDepGraph(md5stream); + writeDotDirDepGraph(md5stream,m_dir,linkRelations); uchar md5_sig[16]; QCString sigStr(33); MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig); @@ -4234,7 +4236,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, return; } - if (format==GOF_BITMAP) checkDotResult(absImgName); + if (format==GOF_BITMAP) checkDotResult(getDotImageExtension(),absImgName); Doxygen::indexList->addImageFile(imgName); @@ -4764,7 +4766,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t, t << " rankdir=LR;\n"; } -void writeDotDirDepGraph(FTextStream &t,DirDef *dd) +void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations) { t << "digraph \"" << dd->displayName() << "\" {\n"; if (Config_getBool("DOT_TRANSPARENT")) @@ -4896,11 +4898,14 @@ void writeDotDirDepGraph(FTextStream &t,DirDef *dd) new DirRelation(relationName,dir,udir)); } int nrefs = udir->filePairs().count(); - t << " " << dir->getOutputFileBase() << "->" + t << " " << dir->getOutputFileBase() << "->" << usedDir->getOutputFileBase(); t << " [headlabel=\"" << nrefs << "\", labeldistance=1.5"; - t << " headhref=\"" << relationName << Doxygen::htmlFileExtension - << "\"];\n"; + if (linkRelations) + { + t << " headhref=\"" << relationName << Doxygen::htmlFileExtension << "\""; + } + t << "];\n"; } } } @@ -262,7 +262,8 @@ class DotDirDeps const char *fileName, const char *relPath, bool writeImageMap=TRUE, - int graphId=-1) const; + int graphId=-1, + bool linkRelations=TRUE) const; private: DirDef *m_dir; }; @@ -325,6 +326,31 @@ class DotGroupCollaboration QList<Edge> m_edges; }; +/** Minimal constant string class that is thread safe, once initialized. */ +class DotConstString +{ + public: + DotConstString() { m_str=0; } + ~DotConstString() { delete[] m_str; } + DotConstString(const QCString &s) : m_str(0) { set(s); } + DotConstString(const DotConstString &s) : m_str(0) { set(s.data()); } + const char *data() const { return m_str; } + bool isEmpty() const { return m_str==0 || m_str[0]=='\0'; } + void set(const QCString &s) + { + delete[] m_str; + m_str=0; + if (!s.isEmpty()) + { + m_str=new char[s.length()+1]; + qstrcpy(m_str,s.data()); + } + } + private: + DotConstString &operator=(const DotConstString &); + char *m_str; +}; + /** Helper class to run dot from doxygen. */ class DotRunner @@ -332,8 +358,8 @@ class DotRunner public: struct CleanupItem { - QCString path; - QCString file; + DotConstString path; + DotConstString file; }; /** Creates a runner for a dot \a file. */ @@ -351,16 +377,19 @@ class DotRunner /** Runs dot for all jobs added. */ bool run(); - CleanupItem cleanup() const { return m_cleanupItem; } + const CleanupItem &cleanup() const { return m_cleanupItem; } private: - QList<QCString> m_jobs; - QCString m_postArgs; - QCString m_postCmd; - QCString m_file; - QCString m_path; + DotConstString m_dotExe; + bool m_multiTargets; + QList<DotConstString> m_jobs; + DotConstString m_postArgs; + DotConstString m_postCmd; + DotConstString m_file; + DotConstString m_path; bool m_checkResult; - QCString m_imageName; + DotConstString m_imageName; + DotConstString m_imgExt; bool m_cleanUp; CleanupItem m_cleanupItem; }; @@ -459,6 +488,4 @@ void writeDotImageMapFromFile(FTextStream &t, const QCString& relPath,const QCString& baseName, const QCString& context,int graphId=-1); -void writeDotDirDepGraph(FTextStream &t,DirDef *dd); - #endif diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 647b5c8..a3a3d2a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2015 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 + * 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. * @@ -106,7 +106,7 @@ extern void initResources(); do { if (var->children()) { \ EntryNavListIterator eli(*var->children()); \ for (;eli.current();++eli) func(eli.current()); \ - } } while(0) + } } while(0) #if !defined(_WIN32) || defined(__CYGWIN__) @@ -119,9 +119,9 @@ ClassSDict *Doxygen::classSDict = 0; ClassSDict *Doxygen::hiddenClasses = 0; NamespaceSDict *Doxygen::namespaceSDict = 0; MemberNameSDict *Doxygen::memberNameSDict = 0; -MemberNameSDict *Doxygen::functionNameSDict = 0; +MemberNameSDict *Doxygen::functionNameSDict = 0; FileNameList *Doxygen::inputNameList = 0; // all input files -FileNameDict *Doxygen::inputNameDict = 0; +FileNameDict *Doxygen::inputNameDict = 0; GroupSDict *Doxygen::groupSDict = 0; FormulaList *Doxygen::formulaList = 0; // all formulas FormulaDict *Doxygen::formulaDict = 0; // all formulas @@ -173,14 +173,14 @@ GenericsSDict *Doxygen::genericsDict; // locally accessible globals static QDict<EntryNav> g_classEntries(1009); -static StringList g_inputFiles; +static StringList g_inputFiles; static QDict<void> g_compoundKeywordDict(7); // keywords recognised as compounds static OutputList *g_outputList = 0; // list of output generating objects static QDict<FileDef> g_usingDeclarations(1009); // used classes static FileStorage *g_storage = 0; static bool g_successfulRun = FALSE; static bool g_dumpSymbolMap = FALSE; -static bool g_useOutputTemplate = FALSE; +static bool g_useOutputTemplate = FALSE; void clearAll() { @@ -209,7 +209,7 @@ void clearAll() delete Doxygen::mainPage; Doxygen::mainPage=0; } -class Statistics +class Statistics { public: Statistics() { stats.setAutoDelete(TRUE); } @@ -242,7 +242,7 @@ class Statistics if (restore) Debug::setFlag("time"); } private: - struct stat + struct stat { const char *name; double elapsed; @@ -423,7 +423,7 @@ static void addSTLMember(EntryNav *rootNav,const char *type,const char *name) memEntry->protection = Public; memEntry->section = Entry::VARIABLE_SEC; memEntry->brief = "STL member"; - memEntry->hidden = FALSE; + memEntry->hidden = FALSE; memEntry->artificial = TRUE; //memEntry->parent = root; //root->addSubEntry(memEntry); @@ -463,7 +463,7 @@ static void addSTLClasses(EntryNav *rootNav) EntryNav *namespaceEntryNav = new EntryNav(rootNav,namespaceEntry); namespaceEntryNav->setEntry(namespaceEntry); rootNav->addChild(namespaceEntryNav); - + STLInfo *info = g_stlinfo; while (info->className) { @@ -524,7 +524,7 @@ static void addSTLClasses(EntryNav *rootNav) memEntry->protection = Public; memEntry->section = Entry::FUNCTION_SEC; memEntry->brief = "STL member"; - memEntry->hidden = FALSE; + memEntry->hidden = FALSE; memEntry->artificial = FALSE; EntryNav *memEntryNav = new EntryNav(classEntryNav,memEntry); memEntryNav->setEntry(memEntry); @@ -567,7 +567,7 @@ static void addPageToContext(PageDef *pd,EntryNav *rootNav) scope = stripAnonymousNamespaceScope(scope); scope+="::"+pd->name(); Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,rootNav->tagInfo()); - if (d) + if (d) { pd->setPageScope(d); } @@ -611,7 +611,7 @@ static void addRelatedPage(EntryNav *rootNav) static void buildGroupListFiltered(EntryNav *rootNav,bool additional, bool includeExternal) { - if (rootNav->section()==Entry::GROUPDOC_SEC && !rootNav->name().isEmpty() && + if (rootNav->section()==Entry::GROUPDOC_SEC && !rootNav->name().isEmpty() && ((!includeExternal && rootNav->tagInfo()==0) || ( includeExternal && rootNav->tagInfo()!=0)) ) @@ -697,7 +697,7 @@ static void buildGroupList(EntryNav *rootNav) static void findGroupScope(EntryNav *rootNav) { - if (rootNav->section()==Entry::GROUPDOC_SEC && !rootNav->name().isEmpty() && + if (rootNav->section()==Entry::GROUPDOC_SEC && !rootNav->name().isEmpty() && rootNav->parent() && !rootNav->parent()->name().isEmpty()) { GroupDef *gd; @@ -711,7 +711,7 @@ static void findGroupScope(EntryNav *rootNav) scope = stripAnonymousNamespaceScope(scope); scope+="::"+gd->name(); Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,rootNav->tagInfo()); - if (d) + if (d) { gd->setGroupScope(d); } @@ -793,11 +793,11 @@ static void buildFileList(EntryNav *rootNav) #endif { //printf("Adding documentation!\n"); - // using FALSE in setDocumentation is small hack to make sure a file - // is documented even if a \file command is used without further + // using FALSE in setDocumentation is small hack to make sure a file + // is documented even if a \file command is used without further // documentation fd->setDocumentation(root->doc,root->docFile,root->docLine,FALSE); - fd->setBriefDescription(root->brief,root->briefFile,root->briefLine); + fd->setBriefDescription(root->brief,root->briefFile,root->briefLine); fd->addSectionsToDefinition(root->anchors); fd->setRefItems(root->sli); QListIterator<Grouping> gli(*root->groups); @@ -842,13 +842,13 @@ static void buildFileList(EntryNav *rootNav) static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) { - if ( - (!root->doc.stripWhiteSpace().isEmpty() || - !root->brief.stripWhiteSpace().isEmpty() || + if ( + (!root->doc.stripWhiteSpace().isEmpty() || + !root->brief.stripWhiteSpace().isEmpty() || Config_getBool("EXTRACT_ALL") ) && root->protection!=Private ) - { + { //printf(">>>>>> includeFile=%s\n",root->includeFile.data()); bool local=Config_getBool("FORCE_LOCAL_INCLUDES"); @@ -868,7 +868,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) FileDef *fd=0; // see if we need to include a verbatim copy of the header file //printf("root->includeFile=%s\n",root->includeFile.data()); - if (!includeFile.isEmpty() && + if (!includeFile.isEmpty() && (fd=findFileDef(Doxygen::inputNameDict,includeFile,ambig))==0 ) { // explicit request @@ -900,7 +900,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) // if a file is found, we mark it as a source file. if (fd) { - QCString iName = !root->includeName.isEmpty() ? + QCString iName = !root->includeName.isEmpty() ? root->includeName : includeFile; if (!iName.isEmpty()) // user specified include file { @@ -915,7 +915,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) iName=fd->name(); } } - else if (!Config_getList("STRIP_FROM_INC_PATH").isEmpty()) + else if (!Config_getList("STRIP_FROM_INC_PATH").isEmpty()) { iName=stripFromIncludePath(fd->absFilePath()); } @@ -960,7 +960,7 @@ static bool addNamespace(Entry *root,ClassDef *cd) } } e=e->parent; - } + } } return FALSE; } @@ -994,7 +994,7 @@ static Definition *findScope(Entry *root,int level=0) } #endif -/*! returns the Definition object belonging to the first \a level levels of +/*! returns the Definition object belonging to the first \a level levels of * full qualified name \a name. Creates an artificial scope if the scope is * not found and set the parent/child scope relation if the scope is found. */ @@ -1016,7 +1016,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name, fullScope+=nsName; NamespaceDef *nd=Doxygen::namespaceSDict->find(fullScope); Definition *innerScope = nd; - ClassDef *cd=0; + ClassDef *cd=0; if (nd==0) cd = getClass(fullScope); if (nd==0 && cd) // scope is a class { @@ -1066,7 +1066,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr QCString scope=stripTemplateSpecifiersFromScope(n,FALSE); int l1=0,i1; i1=getScopeFragment(scope,0,&l1); - if (i1==-1) + if (i1==-1) { //printf(">no fragments!\n"); return resultScope; @@ -1079,12 +1079,12 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr //printf(" nestedNameSpecifier=%s\n",nestedNameSpecifier.data()); resultScope = resultScope->findInnerCompound(nestedNameSpecifier); //printf(" resultScope=%p\n",resultScope); - if (resultScope==0) + if (resultScope==0) { NamespaceSDict *usedNamespaces; if (orgScope==Doxygen::globalScope && fileScope && - (usedNamespaces = fileScope->getUsedNamespaces())) - // also search for used namespaces + (usedNamespaces = fileScope->getUsedNamespaces())) + // also search for used namespaces { NamespaceSDict::Iterator ni(*usedNamespaces); NamespaceDef *nd; @@ -1093,7 +1093,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr // restart search within the used namespace resultScope = findScopeFromQualifiedName(nd,n,fileScope,tagInfo); } - if (resultScope) + if (resultScope) { // for a nested class A::I in used namespace N, we get // N::A::I while looking for A, so we should compare @@ -1107,10 +1107,10 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr } } - // also search for used classes. Complication: we haven't been able + // also search for used classes. Complication: we haven't been able // to put them in the right scope yet, because we are still resolving // the scope relations! - // Therefore loop through all used classes and see if there is a right + // Therefore loop through all used classes and see if there is a right // scope match between the used class and nestedNameSpecifier. QDictIterator<FileDef> ui(g_usingDeclarations); FileDef *usedFd; @@ -1126,14 +1126,14 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr resultScope = buildScopeFromQualifiedName(fqn,fqn.contains("::"), startScope->getLanguage(),0); //printf("Creating scope from fqn=%s result %p\n",fqn.data(),resultScope); - if (resultScope) + if (resultScope) { //printf("> Match! resultScope=%s\n",resultScope->name().data()); return resultScope; } } } - + //printf("> name %s not found in scope %s\n",nestedNameSpecifier.data(),orgScope->name().data()); return 0; } @@ -1151,7 +1151,7 @@ ArgumentList *getTemplateArgumentsFromName( const QList<ArgumentList> *tArgLists) { if (tArgLists==0) return 0; - + QListIterator<ArgumentList> ali(*tArgLists); // for each scope fragment, check if it is a template and advance through // the list if so. @@ -1178,18 +1178,18 @@ ArgumentList *getTemplateArgumentsFromName( static ClassDef::CompoundType convertToCompoundType(int section,uint64 specifier) { - ClassDef::CompoundType sec=ClassDef::Class; - if (specifier&Entry::Struct) + ClassDef::CompoundType sec=ClassDef::Class; + if (specifier&Entry::Struct) sec=ClassDef::Struct; - else if (specifier&Entry::Union) + else if (specifier&Entry::Union) sec=ClassDef::Union; - else if (specifier&Entry::Category) + else if (specifier&Entry::Category) sec=ClassDef::Category; - else if (specifier&Entry::Interface) + else if (specifier&Entry::Interface) sec=ClassDef::Interface; - else if (specifier&Entry::Protocol) + else if (specifier&Entry::Protocol) sec=ClassDef::Protocol; - else if (specifier&Entry::Exception) + else if (specifier&Entry::Exception) sec=ClassDef::Exception; else if (specifier&Entry::Service) sec=ClassDef::Service; @@ -1198,29 +1198,29 @@ ClassDef::CompoundType convertToCompoundType(int section,uint64 specifier) switch(section) { - //case Entry::UNION_SEC: - case Entry::UNIONDOC_SEC: - sec=ClassDef::Union; + //case Entry::UNION_SEC: + case Entry::UNIONDOC_SEC: + sec=ClassDef::Union; break; //case Entry::STRUCT_SEC: - case Entry::STRUCTDOC_SEC: - sec=ClassDef::Struct; + case Entry::STRUCTDOC_SEC: + sec=ClassDef::Struct; break; //case Entry::INTERFACE_SEC: case Entry::INTERFACEDOC_SEC: - sec=ClassDef::Interface; + sec=ClassDef::Interface; break; //case Entry::PROTOCOL_SEC: case Entry::PROTOCOLDOC_SEC: - sec=ClassDef::Protocol; + sec=ClassDef::Protocol; break; //case Entry::CATEGORY_SEC: case Entry::CATEGORYDOC_SEC: - sec=ClassDef::Category; + sec=ClassDef::Category; break; //case Entry::EXCEPTION_SEC: case Entry::EXCEPTIONDOC_SEC: - sec=ClassDef::Exception; + sec=ClassDef::Exception; break; case Entry::SERVICEDOC_SEC: sec=ClassDef::Service; @@ -1318,7 +1318,7 @@ static void addClassToContext(EntryNav *rootNav) tagName = tagInfo->tagName; refFileName = tagInfo->fileName; if (fullName.find("::")!=-1) - // symbols imported via tag files may come without the parent scope, + // symbols imported via tag files may come without the parent scope, // so we artificially create it here { buildScopeFromQualifiedName(fullName,fullName.contains("::"),root->lang,tagInfo); @@ -1343,26 +1343,26 @@ static void addClassToContext(EntryNav *rootNav) qPrint(fullName),sec,root->tArgLists ? (int)root->tArgLists->count() : -1, tagInfo); cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition cd->setBriefDescription(root->brief,root->briefFile,root->briefLine); - cd->setLanguage(root->lang); + cd->setLanguage(root->lang); cd->setId(root->id); - cd->setHidden(root->hidden); - cd->setArtificial(root->artificial); + cd->setHidden(root->hidden); + cd->setArtificial(root->artificial); cd->setClassSpecifier(root->spec); - cd->setTypeConstraints(root->typeConstr); - //printf("new ClassDef %s tempArgList=%p specScope=%s\n",fullName.data(),root->tArgList,root->scopeSpec.data()); + cd->setTypeConstraints(root->typeConstr); + //printf("new ClassDef %s tempArgList=%p specScope=%s\n",fullName.data(),root->tArgList,root->scopeSpec.data()); - //printf("class %s template args=%s\n",fullName.data(), - // tArgList ? tempArgListToString(tArgList,root->lang).data() : "<none>"); - cd->setTemplateArguments(tArgList); - cd->setProtection(root->protection); - cd->setIsStatic(root->stat); + //printf("class %s template args=%s\n",fullName.data(), + // tArgList ? tempArgListToString(tArgList,root->lang).data() : "<none>"); + cd->setTemplateArguments(tArgList); + cd->setProtection(root->protection); + cd->setIsStatic(root->stat); - // file definition containing the class cd - cd->setBodySegment(root->bodyLine,root->endBodyLine); - cd->setBodyDef(fd); + // file definition containing the class cd + cd->setBodySegment(root->bodyLine,root->endBodyLine); + cd->setBodyDef(fd); - // see if the class is found inside a namespace - //bool found=addNamespace(root,cd); + // see if the class is found inside a namespace + //bool found=addNamespace(root,cd); cd->insertUsedFile(fd); @@ -1383,7 +1383,7 @@ static void addClassToContext(EntryNav *rootNav) { addIncludeFile(cd,fd,root); } - if (fd && (root->section & Entry::COMPOUND_MASK)) + if (fd && (root->section & Entry::COMPOUND_MASK)) { //printf(">> Inserting class `%s' in file `%s' (root->fileName=`%s')\n", // cd->name().data(), @@ -1398,14 +1398,14 @@ static void addClassToContext(EntryNav *rootNav) rootNav->releaseEntry(); } - + //---------------------------------------------------------------------- // build a list of all classes mentioned in the documentation // and all classes that have a documentation block before their definition. static void buildClassList(EntryNav *rootNav) { if ( - ((rootNav->section() & Entry::COMPOUND_MASK) || + ((rootNav->section() & Entry::COMPOUND_MASK) || rootNav->section()==Entry::OBJCIMPL_SEC) && !rootNav->name().isEmpty() ) { @@ -1443,7 +1443,7 @@ static void resolveClassNestingRelations() { QCString name = stripAnonymousNamespaceScope(cd->name()); //printf("processing=%s, iteration=%d\n",cd->name().data(),iteration); - // also add class to the correct structural context + // also add class to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope, name,cd->getFileDef(),0); if (d) @@ -1473,7 +1473,7 @@ static void resolveClassNestingRelations() /// create the scope artificially // anyway, so we can at least relate scopes properly. Definition *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage(),0); - if (d!=cd && !cd->getDefFileName().isEmpty()) + if (d!=cd && !cd->getDefFileName().isEmpty()) // avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; } // for this case doxygen assumes the exitance of a namespace N::N in which C is to be found! // also avoid warning for stuff imported via a tagfile. @@ -1598,8 +1598,8 @@ static ClassDef *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,const QC } /** Look through the members of class \a cd and its public members. - * If there is a member m of a tag less struct/union, - * then we create a duplicate of the struct/union with the name of the + * If there is a member m of a tag less struct/union, + * then we create a duplicate of the struct/union with the name of the * member to identify it. * So if cd has name S, then the tag less struct/union will get name S.m * Since tag less structs can be nested we need to call this function @@ -1646,7 +1646,7 @@ static void processTagLessClasses(ClassDef *rootCd, // replace tag-less type for generated/original member // by newly created class name. // note the difference between changing cd and tagParentCd. - // for the initial call this is the same pointer, but for + // for the initial call this is the same pointer, but for // recursive calls cd is the original tag-less struct (of which // there is only one instance) and tagParentCd is the newly // generated tagged struct of which there can be multiple instances! @@ -1714,7 +1714,7 @@ static void buildNamespaceList(EntryNav *rootNav) (rootNav->section()==Entry::NAMESPACE_SEC || rootNav->section()==Entry::NAMESPACEDOC_SEC || rootNav->section()==Entry::PACKAGEDOC_SEC - ) && + ) && !rootNav->name().isEmpty() ) { @@ -1799,7 +1799,7 @@ static void buildNamespaceList(EntryNav *rootNav) // add class to the list Doxygen::namespaceSDict->inSort(fullName,nd); - // also add namespace to the correct structural context + // also add namespace to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName,0,tagInfo); //printf("adding namespace %s to context %s\n",nd->name().data(),d?d->name().data():"<none>"); if (d==0) // we didn't find anything, create the scope artificially @@ -1881,12 +1881,12 @@ static void findUsingDirectives(EntryNav *rootNav) // find the scope in which the `using' namespace is defined by prepending // the possible scopes in which the using statement was found, starting - // with the most inner scope and going to the most outer scope (i.e. - // file scope). + // with the most inner scope and going to the most outer scope (i.e. + // file scope). int scopeOffset = nsName.length(); do { - QCString scope=scopeOffset>0 ? + QCString scope=scopeOffset>0 ? nsName.left(scopeOffset)+"::" : QCString(); usingNd = getResolvedNamespace(scope+name); //printf("Trying with scope=`%s' usingNd=%p\n",(scope+name).data(),usingNd); @@ -1967,7 +1967,7 @@ static void findUsingDirectives(EntryNav *rootNav) } // insert the namespace in the file definition - if (fd) + if (fd) { fd->insertNamespace(nd); fd->addUsingDirective(nd); @@ -2014,7 +2014,7 @@ static void buildListOfUsingDecls(EntryNav *rootNav) RECURSE_ENTRYTREE(buildListOfUsingDecls,rootNav); } - + static void findUsingDeclarations(EntryNav *rootNav) { if (rootNav->section()==Entry::USINGDECL_SEC && @@ -2048,7 +2048,7 @@ static void findUsingDeclarations(EntryNav *rootNav) // Assume the using statement was used to import a class. // Find the scope in which the `using' namespace is defined by prepending // the possible scopes in which the using statement was found, starting - // with the most inner scope and going to the most outer scope (i.e. + // with the most inner scope and going to the most outer scope (i.e. // file scope). QCString name = substitute(root->name,".","::"); //Java/C# scope->internal @@ -2074,7 +2074,10 @@ static void findUsingDeclarations(EntryNav *rootNav) else { Debug::print(Debug::Classes,0," Found used class %s in scope=%s\n", - qPrint(usingCd->name()),nd?qPrint(nd->name()):qPrint(fd->name())); + qPrint(usingCd->name()), + nd?qPrint(nd->name()): + fd?qPrint(fd->name()): + "<unknown>"); } if (nd) @@ -2127,7 +2130,7 @@ static void findUsingDeclImports(EntryNav *rootNav) MemberNameInfo *mni = mndict->find(memName); if (mni) { - MemberNameInfoIterator mnii(*mni); + MemberNameInfoIterator mnii(*mni); MemberInfo *mi; for ( ; (mi=mnii.current()) ; ++mnii ) { @@ -2202,7 +2205,7 @@ static void findUsingDeclImports(EntryNav *rootNav) static void findIncludedUsingDirectives() { // first mark all files as not visited - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -2221,7 +2224,7 @@ static void findIncludedUsingDirectives() FileDef *fd; for (fni.toFirst();(fd=fni.current());++fni) { - if (!fd->visited) + if (!fd->visited) { //printf("----- adding using directives for file %s\n",fd->name().data()); fd->addIncludedUsingDirectives(); @@ -2256,7 +2259,7 @@ static MemberDef *addVariableToClass( " class variable:\n" " `%s' `%s'::`%s' `%s' prot=`%d ann=%d init=`%s'\n", qPrint(root->type), - qPrint(qualScope), + qPrint(qualScope), qPrint(name), qPrint(root->args), root->protection, @@ -2269,7 +2272,7 @@ static MemberDef *addVariableToClass( { if (related || mtype==MemberType_Friend || Config_getBool("HIDE_SCOPE_NAMES")) { - if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' + if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' { def="using "+name+" = "+root->type.mid(7); } @@ -2280,7 +2283,7 @@ static MemberDef *addVariableToClass( } else { - if (root->spec&Entry::Alias) // turn 'typedef B C::A' into 'using C::A = B' + if (root->spec&Entry::Alias) // turn 'typedef B C::A' into 'using C::A = B' { def="using "+qualScope+scopeSeparator+name+" = "+root->type.mid(7); } @@ -2315,13 +2318,13 @@ static MemberDef *addVariableToClass( { //printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n", // md->getClassDef(),cd,root->type.data(),md->typeString()); - if (md->getClassDef()==cd && - removeRedundantWhiteSpace(root->type)==md->typeString()) + if (md->getClassDef()==cd && + removeRedundantWhiteSpace(root->type)==md->typeString()) // member already in the scope { - if (root->lang==SrcLangExt_ObjC && - root->mtype==Property && + if (root->lang==SrcLangExt_ObjC && + root->mtype==Property && md->memberType()==MemberType_Variable) { // Objective-C 2.0 property // turn variable into a property @@ -2332,7 +2335,7 @@ static MemberDef *addVariableToClass( //printf(" Member already found!\n"); return md; } - } + } } QCString fileName = root->fileName; @@ -2374,7 +2377,7 @@ static MemberDef *addVariableToClass( md->setLanguage(root->lang); md->setId(root->id); addMemberToGroups(root,md); - //if (root->mGrpId!=-1) + //if (root->mGrpId!=-1) //{ // printf("memberdef %s in memberGroup %d\n",name.data(),root->mGrpId); // md->setMemberGroup(memberGroupDict[root->mGrpId]); @@ -2476,7 +2479,7 @@ static MemberDef *addVariableToFile( QCString def; // determine the definition of the global variable - if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@' && + if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@' && !Config_getBool("HIDE_SCOPE_NAMES") ) // variable is inside a namespace, so put the scope before the name @@ -2486,7 +2489,7 @@ static MemberDef *addVariableToFile( if (!root->type.isEmpty()) { - if (root->spec&Entry::Alias) // turn 'typedef B NS::A' into 'using NS::A = B' + if (root->spec&Entry::Alias) // turn 'typedef B NS::A' into 'using NS::A = B' { def="using "+nd->name()+sep+name+" = "+root->type; } @@ -2510,7 +2513,7 @@ static MemberDef *addVariableToFile( } else { - if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' + if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' { def="using "+root->name+" = "+root->type.mid(7); } @@ -2542,7 +2545,7 @@ static MemberDef *addVariableToFile( for (mni.toFirst();(md=mni.current());++mni) { if ( - ((nd==0 && md->getNamespaceDef()==0 && md->getFileDef() && + ((nd==0 && md->getNamespaceDef()==0 && md->getFileDef() && root->fileName==md->getFileDef()->absFilePath() ) // both variable names in the same file || (nd!=0 && md->getNamespaceDef()==nd) // both in same namespace @@ -2553,16 +2556,16 @@ static MemberDef *addVariableToFile( // variable already in the scope { bool isPHPArray = md->getLanguage()==SrcLangExt_PHP && - md->argsString()!=root->args && + md->argsString()!=root->args && root->args.find('[')!=-1; - bool staticsInDifferentFiles = - root->stat && md->isStatic() && + bool staticsInDifferentFiles = + root->stat && md->isStatic() && root->fileName!=md->getDefFileName(); if (md->getFileDef() && !isPHPArray && // not a php array !staticsInDifferentFiles - ) + ) // not a php array variable { @@ -2573,7 +2576,7 @@ static MemberDef *addVariableToFile( return md; } } - } + } } QCString fileName = root->fileName; @@ -2588,7 +2591,7 @@ static MemberDef *addVariableToFile( MemberDef *md=new MemberDef( fileName,root->startLine,root->startColumn, root->type,name,root->args,0, - Public, Normal,root->stat,Member, + root->protection, Normal,root->stat,Member, mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0); md->setTagInfo(rootNav->tagInfo()); md->setMemberSpecifiers(root->spec); @@ -2619,18 +2622,18 @@ static MemberDef *addVariableToFile( if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { md->setNamespace(nd); - nd->insertMember(md); + nd->insertMember(md); } // add member to the file (we do this even if we have already inserted - // it into the namespace. + // it into the namespace. if (fd) { - md->setFileDef(fd); + md->setFileDef(fd); fd->insertMember(md); } - // add member definition to the list of globals + // add member definition to the list of globals if (mn) { mn->append(md); @@ -2645,7 +2648,7 @@ static MemberDef *addVariableToFile( return md; } -/*! See if the return type string \a type is that of a function pointer +/*! See if the return type string \a type is that of a function pointer * \returns -1 if this is not a function pointer variable or * the index at which the closing brace of (...*name) was found. */ @@ -2706,12 +2709,12 @@ static bool isVarWithConstructor(EntryNav *rootNav) result=FALSE; goto done; } - if (root->type.isEmpty()) + if (root->type.isEmpty()) { result=FALSE; goto done; } - if (!rootNav->parent()->name().isEmpty()) + if (!rootNav->parent()->name().isEmpty()) { ctx=Doxygen::namespaceSDict->find(rootNav->parent()->name()); } @@ -2726,13 +2729,13 @@ static bool isVarWithConstructor(EntryNav *rootNav) { typeIsClass=getResolvedClass(ctx,fd,type.left(ti))!=0; } - if (typeIsClass) // now we still have to check if the arguments are + if (typeIsClass) // now we still have to check if the arguments are // types or values. Since we do not have complete type info // we need to rely on heuristics :-( { //printf("typeIsClass\n"); ArgumentList *al = root->argList; - if (al==0 || al->isEmpty()) + if (al==0 || al->isEmpty()) { result=FALSE; // empty arg list -> function prototype. goto done; @@ -2741,7 +2744,7 @@ static bool isVarWithConstructor(EntryNav *rootNav) Argument *a; for (ali.toFirst();(a=ali.current());++ali) { - if (!a->name.isEmpty() || !a->defval.isEmpty()) + if (!a->name.isEmpty() || !a->defval.isEmpty()) { if (a->name.find(initChars)==0) { @@ -2753,7 +2756,7 @@ static bool isVarWithConstructor(EntryNav *rootNav) } goto done; } - if (a->type.isEmpty() || getResolvedClass(ctx,fd,a->type)!=0) + if (a->type.isEmpty() || getResolvedClass(ctx,fd,a->type)!=0) { result=FALSE; // arg type is a known type goto done; @@ -2765,13 +2768,13 @@ static bool isVarWithConstructor(EntryNav *rootNav) goto done; } if (a->type.at(a->type.length()-1)=='*' || - a->type.at(a->type.length()-1)=='&') + a->type.at(a->type.length()-1)=='&') // type ends with * or & => pointer or reference { result=FALSE; goto done; } - if (a->type.find(initChars)==0) + if (a->type.find(initChars)==0) { result=TRUE; // argument type starts with typical initializer char goto done; @@ -2783,9 +2786,9 @@ static bool isVarWithConstructor(EntryNav *rootNav) { resType=resType.left(len); //printf("resType=%s\n",resType.data()); - if (resType=="int" || resType=="long" || resType=="float" || - resType=="double" || resType=="char" || resType=="signed" || - resType=="const" || resType=="unsigned" || resType=="void") + if (resType=="int" || resType=="long" || resType=="float" || + resType=="double" || resType=="char" || resType=="signed" || + resType=="const" || resType=="unsigned" || resType=="void") { result=FALSE; // type keyword -> function prototype goto done; @@ -2822,7 +2825,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) if (root->type.isEmpty() && root->name.find("operator")==-1 && (root->name.find('*')!=-1 || root->name.find('&')!=-1)) { - // recover from parse error caused by redundant braces + // recover from parse error caused by redundant braces // like in "int *(var[10]);", which is parsed as // type="" name="int *" args="(var[10])" @@ -2864,10 +2867,10 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) root->args.prepend(") "); } } - + QCString scope,name=removeRedundantWhiteSpace(root->name); - // find the scope of this variable + // find the scope of this variable EntryNav *p = rootNav->parent(); while ((p->section() & Entry::SCOPE_MASK)) { @@ -2879,7 +2882,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) } p=p->parent(); } - + MemberType mtype; QCString type=root->type.stripWhiteSpace(); ClassDef *cd=0; @@ -2890,9 +2893,9 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) classScope=stripTemplateSpecifiersFromScope(classScope,FALSE); QCString annScopePrefix=scope.left(scope.length()-classScope.length()); - if (root->name.findRev("::")!=-1) + if (root->name.findRev("::")!=-1) { - if (root->type=="friend class" || root->type=="friend struct" || + if (root->type=="friend class" || root->type=="friend struct" || root->type=="friend union") { cd=getClass(scope); @@ -2910,7 +2913,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) } } goto nextMember; - /* skip this member, because it is a + /* skip this member, because it is a * static variable definition (always?), which will be * found in a class scope as well, but then we know the * correct protection level, so only then it will be @@ -2918,9 +2921,9 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) */ } - if (type=="@") + if (type=="@") mtype=MemberType_EnumValue; - else if (type.left(8)=="typedef ") + else if (type.left(8)=="typedef ") mtype=MemberType_Typedef; else if (type.left(7)=="friend ") mtype=MemberType_Friend; @@ -2937,17 +2940,17 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) isMemberOf=(root->relatesType == MemberOf); if (getClass(root->relates)==0 && !scope.isEmpty()) scope=mergeScopes(scope,root->relates); - else + else scope=root->relates; } - + cd=getClass(scope); if (cd==0 && classScope!=scope) cd=getClass(classScope); if (cd) { MemberDef *md=0; - // if cd is an anonymous (=tag less) scope we insert the member + // if cd is an anonymous (=tag less) scope we insert the member // into a non-anonymous parent scope as well. This is needed to // be able to refer to it using \var or \fn @@ -2955,7 +2958,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) int si=scope.find('@'); //int anonyScopes = 0; //bool added=FALSE; - + static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS"); if (si!=-1 && !inlineSimpleStructs) // anonymous scope or type { @@ -2985,7 +2988,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) { if (mtype==MemberType_Variable) { - md=addVariableToFile(rootNav,mtype,pScope,name,TRUE,0); + md=addVariableToFile(rootNav,mtype,pScope,name,TRUE,0); } //added=TRUE; } @@ -3001,7 +3004,7 @@ static void addVariable(EntryNav *rootNav,int isFuncPtr=-1) name, // name of the member FALSE, // from anonymous scope md, // from anonymous member - root->protection, + root->protection, isMemberOf ? Foreign : isRelated ? Related : Member); } else if (!name.isEmpty()) // global variable @@ -3023,7 +3026,7 @@ static void buildTypedefList(EntryNav *rootNav) if (!rootNav->name().isEmpty() && rootNav->section()==Entry::VARIABLE_SEC && rootNav->type().find("typedef ")!=-1 // its a typedef - ) + ) { addVariable(rootNav); } @@ -3033,7 +3036,7 @@ static void buildTypedefList(EntryNav *rootNav) EntryNav *e; for (;(e=eli.current());++eli) { - if (e->section()!=Entry::ENUM_SEC) + if (e->section()!=Entry::ENUM_SEC) { buildTypedefList(e); } @@ -3054,13 +3057,13 @@ static void buildVarList(EntryNav *rootNav) ( (rootNav->section()==Entry::VARIABLE_SEC // it's a variable ) || - (rootNav->section()==Entry::FUNCTION_SEC && // or maybe a function pointer variable + (rootNav->section()==Entry::FUNCTION_SEC && // or maybe a function pointer variable (isFuncPtr=findFunctionPtr(rootNav->type(),rootNav->lang()))!=-1 ) || (rootNav->section()==Entry::FUNCTION_SEC && // class variable initialized by constructor isVarWithConstructor(rootNav) ) - ) + ) ) // documented variable { addVariable(rootNav,isFuncPtr); @@ -3071,7 +3074,7 @@ static void buildVarList(EntryNav *rootNav) EntryNav *e; for (;(e=eli.current());++eli) { - if (e->section()!=Entry::ENUM_SEC) + if (e->section()!=Entry::ENUM_SEC) { buildVarList(e); } @@ -3268,7 +3271,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, if ((fd==0 || fd->getLanguage()==SrcLangExt_Cpp) && name.left(9)!="operator " && (i=name.find('<'))!=-1 && name.find('>')!=-1) { - name=name.left(i); + name=name.left(i); } QCString fileName = root->fileName; @@ -3277,7 +3280,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, fileName = rootNav->tagInfo()->tagName; } - //printf("root->name=`%s; root->args=`%s' root->argList=`%s'\n", + //printf("root->name=`%s; root->args=`%s' root->argList=`%s'\n", // root->name.data(),root->args.data(),argListToString(root->argList).data() // ); @@ -3456,7 +3459,7 @@ static void buildFunctionList(EntryNav *rootNav) if (cd && scope+"::"==rname.left(scope.length()+2)) // found A::f inside A { // strip scope from name - rname=rname.right(rname.length()-rootNav->parent()->name().length()-2); + rname=rname.right(rname.length()-rootNav->parent()->name().length()-2); } NamespaceDef *nd = 0; @@ -3467,7 +3470,7 @@ static void buildFunctionList(EntryNav *rootNav) int te=rname.find('>'); if (memIndex>0 && (ts==-1 || te==-1)) { - // note: the following code was replaced by inMember=TRUE to deal with a + // note: the following code was replaced by inMember=TRUE to deal with a // function rname='X::foo' of class X inside a namespace also called X... // bug id 548175 //nd = Doxygen::namespaceSDict->find(rname.left(memIndex)); @@ -3491,11 +3494,11 @@ static void buildFunctionList(EntryNav *rootNav) int te=root->type.findRev('>'); int ti; if (!rootNav->parent()->name().isEmpty() && - (rootNav->parent()->section() & Entry::COMPOUND_MASK) && + (rootNav->parent()->section() & Entry::COMPOUND_MASK) && cd && - // do some fuzzy things to exclude function pointers - (root->type.isEmpty() || - ((ti=root->type.find(re,0))==-1 || // type does not contain ..(..* + // do some fuzzy things to exclude function pointers + (root->type.isEmpty() || + ((ti=root->type.find(re,0))==-1 || // type does not contain ..(..* (ts!=-1 && ts<te && ts<ti && ti<te) || // outside of < ... > root->args.find(")[")!=-1) || // and args not )[.. -> function pointer root->type.find(")(")!=-1 || root->type.find("operator")!=-1 || // type contains ..)(.. and not "operator" @@ -3507,14 +3510,14 @@ static void buildFunctionList(EntryNav *rootNav) qPrint(rname),qPrint(cd->name())); addMethodToClass(rootNav,cd,rname,isFriend); } - else if (!((rootNav->parent()->section() & Entry::COMPOUND_MASK) + else if (!((rootNav->parent()->section() & Entry::COMPOUND_MASK) || rootNav->parent()->section()==Entry::OBJCIMPL_SEC ) && !isMember && (root->relates.isEmpty() || root->relatesType == Duplicate) && - root->type.left(7)!="extern " && root->type.left(8)!="typedef " + root->type.left(7)!="extern " && root->type.left(8)!="typedef " ) - // no member => unrelated function + // no member => unrelated function { /* check the uniqueness of the function name in the file. * A file could contain a function prototype and a function definition @@ -3566,14 +3569,14 @@ static void buildFunctionList(EntryNav *rootNav) } } - bool staticsInDifferentFiles = + bool staticsInDifferentFiles = root->stat && md->isStatic() && root->fileName!=md->getDefFileName(); if ( matchArguments2(md->getOuterScope(),mfd,mdAl, rnd ? rnd : Doxygen::globalScope,rfd,root->argList, FALSE) && - sameNumTemplateArgs && + sameNumTemplateArgs && matchingReturnTypes && !staticsInDifferentFiles ) @@ -3759,7 +3762,7 @@ static void buildFunctionList(EntryNav *rootNav) md->setDefinition(def); md->enableCallGraph(root->callGraph); md->enableCallerGraph(root->callerGraph); - //if (root->mGrpId!=-1) + //if (root->mGrpId!=-1) //{ // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} @@ -3769,13 +3772,13 @@ static void buildFunctionList(EntryNav *rootNav) { // add member to namespace md->setNamespace(nd); - nd->insertMember(md); + nd->insertMember(md); } if (fd) { // add member to the file (we do this even if we have already // inserted it into the namespace) - md->setFileDef(fd); + md->setFileDef(fd); fd->insertMember(md); } @@ -3786,7 +3789,7 @@ static void buildFunctionList(EntryNav *rootNav) { mn->append(md); } - else + else { mn = new MemberName(name); mn->append(md); @@ -3796,7 +3799,7 @@ static void buildFunctionList(EntryNav *rootNav) if (root->relatesType == Simple) // if this is a relatesalso command, // allow find Member to pick it up { - rootNav->changeSection(Entry::EMPTY_SEC); // Otherwise we have finished + rootNav->changeSection(Entry::EMPTY_SEC); // Otherwise we have finished // with this entry. } @@ -3854,7 +3857,7 @@ static void findFriends() MemberDef *mmd; for (;(mmd=mni.current());++mni) // for each member with that name { - //printf("Checking for matching arguments + //printf("Checking for matching arguments // mmd->isRelated()=%d mmd->isFriend()=%d mmd->isFunction()=%d\n", // mmd->isRelated(),mmd->isFriend(),mmd->isFunction()); ArgumentList *mmdAl = mmd->argumentList(); @@ -3864,8 +3867,8 @@ static void findFriends() fmd->getOuterScope(), fmd->getFileDef(), fmdAl, TRUE ) - - ) // if the member is related and the arguments match then the + + ) // if the member is related and the arguments match then the // function is actually a friend. { mergeArguments(mmdAl,fmdAl); @@ -3937,7 +3940,7 @@ static void transferFunctionDocumentation() for (;(mdec=mni1.current());++mni1) { if (mdec->isPrototype() || - (mdec->isVariable() && mdec->isExternal()) + (mdec->isVariable() && mdec->isExternal()) ) { MemberNameIterator mni2(*mn); @@ -3963,12 +3966,12 @@ static void transferFunctionReferences() /* find a matching function declaration and definition for this function */ for (;(md=mni.current());++mni) { - if (md->isPrototype()) + if (md->isPrototype()) mdec=md; - else if (md->isVariable() && md->isExternal()) + else if (md->isVariable() && md->isExternal()) mdec=md; - - if (md->isFunction() && !md->isStatic() && !md->isPrototype()) + + if (md->isFunction() && !md->isStatic() && !md->isPrototype()) mdef=md; else if (md->isVariable() && !md->isExternal() && !md->isStatic()) mdef=md; @@ -4046,7 +4049,7 @@ static void transferFunctionReferences() static void transferRelatedFunctionDocumentation() { - // find match between function declaration and definition for + // find match between function declaration and definition for // related functions MemberNameSDict::Iterator mnli(*Doxygen::functionNameSDict); MemberName *mn; @@ -4083,9 +4086,9 @@ static void transferRelatedFunctionDocumentation() md->makeForeign(); else md->makeRelated(); - } + } } - } + } } } } @@ -4093,8 +4096,8 @@ static void transferRelatedFunctionDocumentation() //---------------------------------------------------------------------- /*! make a dictionary of all template arguments of class cd - * that are part of the base class name. - * Example: A template class A with template arguments <R,S,T> + * that are part of the base class name. + * Example: A template class A with template arguments <R,S,T> * that inherits from B<T,T,S> will have T and S in the dictionary. */ static QDict<int> *getTemplateArgumentsInName(ArgumentList *templateArguments,const QCString &name) @@ -4286,11 +4289,11 @@ static void findUsedClassesForClass(EntryNav *rootNav, //printf("Looking for used class %s: result=%s master=%s\n", // usedName.data(),usedCd?usedCd->name().data():"<none>",masterCd?masterCd->name().data():"<none>"); - if (usedCd) + if (usedCd) { found=TRUE; Debug::print(Debug::Classes,0," Adding used class `%s' (2)\n", qPrint(usedCd->name())); - instanceCd->addUsedClass(usedCd,md->name(),md->protection()); // class exists + instanceCd->addUsedClass(usedCd,md->name(),md->protection()); // class exists usedCd->addUsedByClass(instanceCd,md->name(),md->protection()); } } @@ -4322,7 +4325,7 @@ static void findUsedClassesForClass(EntryNav *rootNav, { if (isArtificial) usedCd->setArtificial(TRUE); Debug::print(Debug::Classes,0," Adding used class `%s' (3)\n", qPrint(usedCd->name())); - instanceCd->addUsedClass(usedCd,md->name(),md->protection()); + instanceCd->addUsedClass(usedCd,md->name(),md->protection()); usedCd->addUsedByClass(instanceCd,md->name(),md->protection()); } } @@ -4378,7 +4381,7 @@ static void findBaseClassesForClass( { // 1.8.2: decided to show inheritance relations even if not documented, // we do make them artificial, so they do not appear in the index - //if (!Config_getBool("HIDE_UNDOC_RELATIONS")) + //if (!Config_getBool("HIDE_UNDOC_RELATIONS")) bool b = Config_getBool("HIDE_UNDOC_RELATIONS") ? TRUE : isArtificial; //{ // no documented base class -> try to find an undocumented one @@ -4394,7 +4397,7 @@ static void findBaseClassesForClass( { delete templateNames; templateNames=0; - } + } } } @@ -4420,7 +4423,7 @@ static bool findTemplateInstanceRelation(Entry *root, // } //} //printf("\n"); - + bool existingClass = (templSpec == tempArgListToString(templateClass->templateArguments(),root->lang) ); @@ -4438,8 +4441,8 @@ static bool findTemplateInstanceRelation(Entry *root, Doxygen::classSDict->append(instanceClass->name(),instanceClass); instanceClass->setTemplateBaseClassNames(templateNames); - // search for new template instances caused by base classes of - // instanceClass + // search for new template instances caused by base classes of + // instanceClass EntryNav *templateRootNav = g_classEntries.find(templateClass->name()); if (templateRootNav) { @@ -4501,7 +4504,7 @@ static bool isRecursiveBaseClass(const QCString &scope,const QCString &name) * character position \a startPos. If the end was found the position * of the closing \> is returned, otherwise -1 is returned. * - * Handles exotic cases such as + * Handles exotic cases such as * \code * Class<(id<0)> * Class<bits<<2> @@ -4525,11 +4528,11 @@ static int findEndOfTemplate(const QCString &s,int startPos) char c=s.at(e); switch(c) { - case '<': + case '<': if (!insideString && !insideChar) { - if (e<len-1 && s.at(e+1)=='<') - e++; + if (e<len-1 && s.at(e+1)=='<') + e++; else if (roundCount==0) brCount++; } @@ -4537,24 +4540,24 @@ static int findEndOfTemplate(const QCString &s,int startPos) case '>': if (!insideString && !insideChar) { - if (e<len-1 && s.at(e+1)=='>') - e++; + if (e<len-1 && s.at(e+1)=='>') + e++; else if (roundCount==0) brCount--; } break; case '(': - if (!insideString && !insideChar) + if (!insideString && !insideChar) roundCount++; break; case ')': - if (!insideString && !insideChar) + if (!insideString && !insideChar) roundCount--; break; case '"': if (!insideChar) { - if (insideString && pc!='\\') + if (insideString && pc!='\\') insideString=FALSE; else insideString=TRUE; @@ -4612,7 +4615,7 @@ static bool findClassRelation( EntryNav *parentNode=rootNav->parent(); bool lastParent=FALSE; - do // for each parent scope, starting with the largest scope + do // for each parent scope, starting with the largest scope // (in case of nested classes) { QCString scopeName= parentNode ? parentNode->name().data() : ""; @@ -4634,7 +4637,7 @@ static bool findClassRelation( MemberDef *baseClassTypeDef=0; QCString templSpec; ClassDef *baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, - cd->getFileDef(), + cd->getFileDef(), baseClassName, &baseClassTypeDef, &templSpec, @@ -4680,7 +4683,7 @@ static bool findClassRelation( baseClass = Doxygen::genericsDict->find(baseClassName.left(i)); //printf("looking for '%s' result=%p\n",baseClassName.data(),baseClass); } - if (baseClass==0 && i!=-1) + if (baseClass==0 && i!=-1) // base class has template specifiers { // TODO: here we should try to find the correct template specialization @@ -4780,11 +4783,11 @@ static bool findClassRelation( // if templSpec is not empty then we should "instantiate" // the template baseClass. A new ClassDef should be created // to represent the instance. To be able to add the (instantiated) - // members and documentation of a template class - // (inserted in that template class at a later stage), - // the template should know about its instances. - // the instantiation process, should be done in a recursive way, - // since instantiating a template may introduce new inheritance + // members and documentation of a template class + // (inserted in that template class at a later stage), + // the template should know about its instances. + // the instantiation process, should be done in a recursive way, + // since instantiating a template may introduce new inheritance // relations. if (!templSpec.isEmpty() && mode==TemplateInstances) { @@ -4802,7 +4805,7 @@ static bool findClassRelation( { //printf(" => insert base class\n"); QCString usedName; - if (baseClassTypeDef || cd->isCSharp()) + if (baseClassTypeDef || cd->isCSharp()) { usedName=biName; //printf("***** usedName=%s templSpec=%s\n",usedName.data(),templSpec.data()); @@ -4903,7 +4906,7 @@ static bool findClassRelation( ); } // for mode==TemplateInstance this case is quite common and - // indicates a relation between a template class and a template + // indicates a relation between a template class and a template // instance with the same name. } if (scopeOffset==0) @@ -4942,13 +4945,13 @@ static bool isClassSection(EntryNav *rootNav) { return TRUE; } - else if (rootNav->section() & Entry::COMPOUNDDOC_MASK) + else if (rootNav->section() & Entry::COMPOUNDDOC_MASK) // is it a documentation block with inheritance info. { rootNav->loadEntry(g_storage); Entry *root = rootNav->entry(); bool extends = root->extends->count()>0; - rootNav->releaseEntry(); + rootNav->releaseEntry(); if (extends) return TRUE; } } @@ -4983,7 +4986,7 @@ static QCString extractClassName(EntryNav *rootNav) return bName; } -/*! Using the dictionary build by findClassEntries(), this +/*! Using the dictionary build by findClassEntries(), this * function will look for additional template specialization that * exists as inheritance relations only. These instances will be * added to the template they are derived from. @@ -5053,7 +5056,7 @@ static void computeClassRelations() bName.right(2)!="::") { if (!root->name.isEmpty() && root->name.find('@')==-1 && // normal name - (guessSection(root->fileName)==Entry::HEADER_SEC || + (guessSection(root->fileName)==Entry::HEADER_SEC || Config_getBool("EXTRACT_LOCAL_CLASSES")) && // not defined in source file protectionLevelVisible(root->protection) && // hidden by protection !Config_getBool("HIDE_UNDOC_CLASSES") // undocumented class are visible @@ -5081,7 +5084,7 @@ static void computeTemplateClassRelations() QCString bName=stripAnonymousNamespaceScope(root->name); bName=stripTemplateSpecifiersFromScope(bName); ClassDef *cd=getClass(bName); - // strip any anonymous scopes first + // strip any anonymous scopes first QDict<ClassDef> *templInstances = 0; if (cd && (templInstances=cd->getTemplateInstances())) { @@ -5115,7 +5118,7 @@ static void computeTemplateClassRelations() { int templIndex = *qdi.current(); Argument *actArg = 0; - if (templIndex<(int)templArgs->count()) + if (templIndex<(int)templArgs->count()) { actArg=templArgs->at(templIndex); } @@ -5129,7 +5132,7 @@ static void computeTemplateClassRelations() } } delete templateNames; - + tbi.name = substituteTemplateArgumentsInString(bi->name,tl,templArgs); // find a documented base class in the correct scope if (!findClassRelation(rootNav,cd,tcd,&tbi,actualTemplateNames,DocumentedOnly,FALSE)) @@ -5292,8 +5295,8 @@ static void generateXRefPages() //---------------------------------------------------------------------- // Copy the documentation in entry `root' to member definition `md' and -// set the function declaration of the member to `funcDecl'. If the boolean -// over_load is set the standard overload text is added. +// set the function declaration of the member to `funcDecl'. If the boolean +// over_load is set the standard overload text is added. static void addMemberDocs(EntryNav *rootNav, MemberDef *md, const char *funcDecl, @@ -5314,9 +5317,9 @@ static void addMemberDocs(EntryNav *rootNav, ClassDef *cd=md->getClassDef(); NamespaceDef *nd=md->getNamespaceDef(); QCString fullName; - if (cd) + if (cd) fullName = cd->name(); - else if (nd) + else if (nd) fullName = nd->name(); if (!fullName.isEmpty()) fullName+="::"; @@ -5334,12 +5337,12 @@ static void addMemberDocs(EntryNav *rootNav, } else { - if ( + if ( matchArguments2( md->getOuterScope(), md->getFileDef(), mdAl, rscope,rfd,root->argList, TRUE ) - ) + ) { //printf("merging arguments (2)\n"); mergeArguments(mdAl,root->argList,!root->doc.isEmpty()); @@ -5353,11 +5356,11 @@ static void addMemberDocs(EntryNav *rootNav, doc+="<p>"; doc+=root->doc; } - md->setDocumentation(doc,root->docFile,root->docLine); + md->setDocumentation(doc,root->docFile,root->docLine); md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); md->setDocsForDefinition(!root->proto); } - else + else { //printf("overwrite!\n"); md->setDocumentation(root->doc,root->docFile,root->docLine); @@ -5390,7 +5393,7 @@ static void addMemberDocs(EntryNav *rootNav, if (rfd) { - if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) + if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) ) { //printf("Setting new body segment [%d,%d]\n",root->bodyLine,root->endBodyLine); @@ -5432,7 +5435,7 @@ static void addMemberDocs(EntryNav *rootNav, } //---------------------------------------------------------------------- -// find a class definition given the scope name and (optionally) a +// find a class definition given the scope name and (optionally) a // template list specifier static ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, @@ -5448,12 +5451,12 @@ static ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, // with name `name' and argument list `args' (for overloading) and // function declaration `decl' to the corresponding member definition. -static bool findGlobalMember(EntryNav *rootNav, +static bool findGlobalMember(EntryNav *rootNav, const QCString &namespaceName, const char *type, - const char *name, + const char *name, const char *tempArg, - const char *, + const char *, const char *decl) { Entry *root = rootNav->entry(); @@ -5488,14 +5491,14 @@ static bool findGlobalMember(EntryNav *rootNav, //SDict<Definition> *cl = fd ? fd->getUsedClasses() : 0; //printf("NamespaceList %p\n",nl); - // search in the list of namespaces that are imported via a + // search in the list of namespaces that are imported via a // using declaration bool viaUsingDirective = nl && nd && nl->find(nd->qualifiedName())!=0; if ((namespaceName.isEmpty() && nd==0) || // not in a namespace - (nd && nd->name()==namespaceName) || // or in the same namespace + (nd && nd->name()==namespaceName) || // or in the same namespace viaUsingDirective // member in `using' namespace - ) + ) { Debug::print(Debug::FindMembers,0,"4. Try to add member `%s' to scope `%s'\n", qPrint(md->name()),qPrint(namespaceName)); @@ -5530,12 +5533,12 @@ static bool findGlobalMember(EntryNav *rootNav, // argListToString(md->argumentList()).data(), // argListToString(root->argList).data()); - // for static members we also check if the comment block was found in + // for static members we also check if the comment block was found in // the same file. This is needed because static members with the same // name can be in different files. Thus it would be wrong to just // put the comment block at the first syntactically matching member. - if (matching && md->isStatic() && - md->getDefFileName()!=root->fileName && + if (matching && md->isStatic() && + md->getDefFileName()!=root->fileName && mn->count()>1) { matching = FALSE; @@ -5561,7 +5564,7 @@ static bool findGlobalMember(EntryNav *rootNav, found=TRUE; } } - } + } if (!found && root->relatesType != Duplicate && root->section==Entry::FUNCTION_SEC) // no match { QCString fullFuncDecl=decl; @@ -5584,10 +5587,10 @@ static bool findGlobalMember(EntryNav *rootNav, } else // got docs for an undefined member! { - if (root->type!="friend class" && + if (root->type!="friend class" && root->type!="friend struct" && root->type!="friend union" && - (!Config_getBool("TYPEDEF_HIDES_STRUCT") || + (!Config_getBool("TYPEDEF_HIDES_STRUCT") || root->type.find("typedef ")==-1) ) { @@ -5635,7 +5638,7 @@ static QCString substituteTemplatesInString( QCString dst; QRegExp re( "[A-Za-z_][A-Za-z_0-9]*"); //printf("type=%s\n",sa->type.data()); - int i,p=0,l; + int i,p=0,l; while ((i=re.match(src,p,&l))!=-1) // for each word in srcType { bool found=FALSE; @@ -5698,7 +5701,7 @@ static QCString substituteTemplatesInString( // argListToString(dstlali.current()).data(), // funcTempArgList ? argListToString(funcTempArgList).data() : "<none>"); } - dst+=name; + dst+=name; p=i+l; } dst+=src.right(src.length()-p); @@ -5757,7 +5760,7 @@ static void substituteTemplatesInArgList( -/*! This function tries to find a member (in a documented class/file/namespace) +/*! This function tries to find a member (in a documented class/file/namespace) * that corresponds to the function/variable declaration given in \a funcDecl. * * The boolean \a overloaded is used to specify whether or not a standard @@ -5831,10 +5834,10 @@ static void findMember(EntryNav *rootNav, { funcDecl=(funcDecl.left(sep)+funcDecl.right(funcDecl.length()-sep-1)).stripWhiteSpace(); } - + // make sure the first character is a space to simplify searching. if (!funcDecl.isEmpty() && funcDecl[0]!=' ') funcDecl.prepend(" "); - + // remove some superfluous spaces funcDecl= substitute( substitute( @@ -5843,7 +5846,7 @@ static void findMember(EntryNav *rootNav, ), " ::","::" ).stripWhiteSpace(); - + //printf("funcDecl=`%s'\n",funcDecl.data()); if (isFriend && funcDecl.left(6)=="class ") { @@ -5872,7 +5875,7 @@ static void findMember(EntryNav *rootNav, // related field. //printf("scopeName=`%s' className=`%s' namespaceName=`%s'\n", // scopeName.data(),className.data(),namespaceName.data()); - if (!root->relates.isEmpty()) + if (!root->relates.isEmpty()) { // related member, prefix user specified scope isRelated=TRUE; isMemberOf=(root->relatesType == MemberOf); @@ -5880,21 +5883,21 @@ static void findMember(EntryNav *rootNav, { scopeName= mergeScopes(scopeName,root->relates); } - else + else { scopeName = root->relates; } } - if (root->relates.isEmpty() && rootNav->parent() && + if (root->relates.isEmpty() && rootNav->parent() && ((rootNav->parent()->section()&Entry::SCOPE_MASK) || (rootNav->parent()->section()==Entry::OBJCIMPL_SEC) ) && - !rootNav->parent()->name().isEmpty()) // see if we can combine scopeName + !rootNav->parent()->name().isEmpty()) // see if we can combine scopeName // with the scope in which it was found { QCString joinedName = rootNav->parent()->name()+"::"+scopeName; - if (!scopeName.isEmpty() && + if (!scopeName.isEmpty() && (getClass(joinedName) || Doxygen::namespaceSDict->find(joinedName))) { scopeName = joinedName; @@ -5928,27 +5931,27 @@ static void findMember(EntryNav *rootNav, } } scopeName=stripTemplateSpecifiersFromScope( - removeRedundantWhiteSpace(scopeName),FALSE,&funcSpec); + removeRedundantWhiteSpace(scopeName),FALSE,&funcSpec); // funcSpec contains the last template specifiers of the given scope. - // If this method does not have any template arguments or they are - // empty while funcSpec is not empty we assume this is a + // If this method does not have any template arguments or they are + // empty while funcSpec is not empty we assume this is a // specialization of a method. If not, we clear the funcSpec and treat // this as a normal method of a template class. - if (!(root->tArgLists && + if (!(root->tArgLists && root->tArgLists->count()>0 && root->tArgLists->getFirst()->count()==0 ) - ) + ) { funcSpec.resize(0); } - + // split scope into a namespace and a class part extractNamespaceName(scopeName,className,namespaceName,TRUE); //printf("scopeName=`%s' className=`%s' namespaceName=`%s'\n", // scopeName.data(),className.data(),namespaceName.data()); - + //namespaceName=removeAnonymousScopes(namespaceName); if (namespaceName.find('@')!=-1) return; // skip stuff in anonymous namespace... @@ -6046,10 +6049,10 @@ static void findMember(EntryNav *rootNav, } } } - + if (funcType=="template class" && !funcTempList.isEmpty()) return; // ignore explicit template instantiations - + Debug::print(Debug::FindMembers,0, "findMember() Parse results:\n" " namespaceName=`%s'\n" @@ -6060,7 +6063,7 @@ static void findMember(EntryNav *rootNav, " funcArgs=`%s'\n" " funcTempList=`%s'\n" " funcDecl=`%s'\n" - " related=`%s'\n" + " related=`%s'\n" " exceptions=`%s'\n" " isRelated=%d\n" " isMemberOf=%d\n" @@ -6074,7 +6077,7 @@ static void findMember(EntryNav *rootNav, MemberName *mn=0; if (!funcName.isEmpty()) // function name is valid - { + { Debug::print(Debug::FindMembers,0, "1. funcName=`%s'\n",funcName.data()); if (funcName.left(9)=="operator ") // strip class scope from cast operator @@ -6120,7 +6123,7 @@ static void findMember(EntryNav *rootNav, // stripTemplateSpecifiersFromScope(scopeName,FALSE).data()); ClassDef *tcd=findClassDefinition(fd,nd,scopeName); - if (tcd==0 && stripAnonymousNamespaceScope(cd->name())==scopeName) + if (tcd==0 && cd && stripAnonymousNamespaceScope(cd->name())==scopeName) { // don't be fooled by anonymous scopes tcd=cd; @@ -6150,8 +6153,8 @@ static void findMember(EntryNav *rootNav, bool substDone=FALSE; ArgumentList *argList=0; - /* substitute the occurrences of class template names in the - * argument list before matching + /* substitute the occurrences of class template names in the + * argument list before matching */ ArgumentList *mdAl = md->argumentList(); if (declTemplArgs.count()>0 && defTemplArgs && @@ -6183,9 +6186,9 @@ static void findMember(EntryNav *rootNav, bool matching= md->isVariable() || md->isTypedef() || // needed for function pointers - (mdAl==0 && root->argList->count()==0) || + (mdAl==0 && root->argList->count()==0) || matchArguments2( - md->getClassDef(),md->getFileDef(),argList, + md->getClassDef(),md->getFileDef(),argList, cd,fd,root->argList, TRUE); @@ -6201,6 +6204,8 @@ static void findMember(EntryNav *rootNav, memType.stripPrefix("static "); // see bug700696 funcType=substitute(stripTemplateSpecifiersFromScope(funcType,TRUE), className+"::",""); // see bug700693 & bug732594 + memType=substitute(stripTemplateSpecifiersFromScope(memType,TRUE), + className+"::",""); // see bug758900 Debug::print(Debug::FindMembers,0, "5b. Comparing return types '%s'<->'%s' #args %d<->%d\n", qPrint(md->typeString()),qPrint(funcType), @@ -6241,15 +6246,15 @@ static void findMember(EntryNav *rootNav, md->setDefinitionTemplateParameterLists(root->tArgLists); md->setArgumentList(argList); // new owner of the list => no delete } - else // no match + else // no match { - if (!funcTempList.isEmpty() && + if (!funcTempList.isEmpty() && isSpecialization(declTemplArgs,*defTemplArgs)) { // check if we are dealing with a partial template // specialization. In this case we add it to the class // even though the member arguments do not match. - + // TODO: copy other aspects? root->protection=md->protection(); // copy protection level addMethodToClass(rootNav,cd,md->name(),isFriend); @@ -6258,20 +6263,20 @@ static void findMember(EntryNav *rootNav, delete argList; } } - if (matching) + if (matching) { addMemberDocs(rootNav,md,funcDecl,0,overloaded,0/* TODO */); count++; memFound=TRUE; } - } + } else if (cd && cd!=tcd) // we did find a class with the same name as cd // but in a different namespace { noMatchCount++; } - } - if (count==0 && rootNav->parent() && + } + if (count==0 && rootNav->parent() && rootNav->parent()->section()==Entry::OBJCIMPL_SEC) { goto localObjCMethod; @@ -6289,12 +6294,12 @@ static void findMember(EntryNav *rootNav, ClassDef *ccd=md->getClassDef(); MemberDef *cmd=md; //printf("ccd->name()==%s className=%s\n",ccd->name().data(),className.data()); - if (ccd!=0 && rightScopeMatch(ccd->name(),className)) + if (ccd!=0 && rightScopeMatch(ccd->name(),className)) { ArgumentList *templAl = md->templateArguments(); if (root->tArgLists && templAl!=0 && root->tArgLists->getLast()->count()<=templAl->count()) - { + { addMethodToClass(rootNav,ccd,md->name(),isFriend); return; } @@ -6324,13 +6329,13 @@ static void findMember(EntryNav *rootNav, if (candidates==1 && ucd && umd) { // we didn't find an actual match on argument lists, but there is only 1 member with this - // name in the same scope, so that has to be the one. + // name in the same scope, so that has to be the one. addMemberDocs(rootNav,umd,funcDecl,0,overloaded,0); return; } else if (candidates>1 && ecd && emd) { - // we didn't find a unique match using type resolution, + // we didn't find a unique match using type resolution, // but one of the matches has the exact same signature so // we take that one. addMemberDocs(rootNav,emd,funcDecl,0,overloaded,0); @@ -6376,17 +6381,17 @@ static void findMember(EntryNav *rootNav, warnMsg+='\n'; } warnMsg+=" "; - if (md->typeString()) + if (md->typeString()) { warnMsg+=md->typeString(); warnMsg+=' '; } QCString qScope = cd->qualifiedNameWithTemplateParameters(); - if (!qScope.isEmpty()) + if (!qScope.isEmpty()) warnMsg+=qScope+"::"+md->name(); - if (md->argsString()) + if (md->argsString()) warnMsg+=md->argsString(); - if (noMatchCount>1) + if (noMatchCount>1) { warnMsg+="' at line "+QCString().setNum(md->getDefLine()) + " of file "+md->getDefFileName(); @@ -6406,7 +6411,7 @@ static void findMember(EntryNav *rootNav, MemberDef *md=0; for (mni.toFirst();(md=mni.current());++mni) { - if (md->getClassDef()==cd) + if (md->getClassDef()==cd) { // TODO: we should probably also check for matching arguments declMd = md; @@ -6454,10 +6459,10 @@ static void findMember(EntryNav *rootNav, // scopeName.data(),funcName.data(),funcArgs.data()); } } - else if (overloaded) // check if the function belongs to only one class + else if (overloaded) // check if the function belongs to only one class { // for unique overloaded member we allow the class to be - // omitted, this is to be Qt compatible. Using this should + // omitted, this is to be Qt compatible. Using this should // however be avoided, because it is error prone MemberNameIterator mni(*mn); MemberDef *md=mni.toFirst(); @@ -6470,8 +6475,8 @@ static void findMember(EntryNav *rootNav, for (;(md=mni.current());++mni) { ClassDef *cd=md->getClassDef(); - if (className!=cd->name()) unique=FALSE; - } + if (className!=cd->name()) unique=FALSE; + } if (unique) { MemberType mtype; @@ -6479,9 +6484,9 @@ static void findMember(EntryNav *rootNav, else if (root->mtype==Slot) mtype=MemberType_Slot; else if (root->mtype==DCOP) mtype=MemberType_DCOP; else mtype=MemberType_Function; - + // new overloaded member function - ArgumentList *tArgList = + ArgumentList *tArgList = getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); //printf("new related member %s args=`%s'\n",md->name().data(),funcArgs.data()); MemberDef *md=new MemberDef( @@ -6526,7 +6531,7 @@ static void findMember(EntryNav *rootNav, warn(root->fileName,root->startLine, "Cannot determine class for function\n%s", fullFuncDecl.data() - ); + ); } } } @@ -6540,7 +6545,7 @@ static void findMember(EntryNav *rootNav, if ((cd=getClass(scopeName))) { bool newMember=TRUE; // assume we have a new member - bool newMemberName=FALSE; + bool newMemberName=FALSE; MemberDef *mdDefine=0; bool isDefine=FALSE; { @@ -6592,9 +6597,9 @@ static void findMember(EntryNav *rootNav, MemberType mtype; if (isDefine) mtype=MemberType_Define; - else if (root->mtype==Signal) + else if (root->mtype==Signal) mtype=MemberType_Signal; - else if (root->mtype==Slot) + else if (root->mtype==Slot) mtype=MemberType_Slot; else if (root->mtype==DCOP) mtype=MemberType_DCOP; @@ -6607,7 +6612,7 @@ static void findMember(EntryNav *rootNav, funcType="#define"; funcArgs=mdDefine->argsString(); funcDecl=funcType + " " + funcName; - } + } //printf("New related name `%s' `%d'\n",funcName.data(), // root->argList ? (int)root->argList->count() : -1); @@ -6633,7 +6638,7 @@ static void findMember(EntryNav *rootNav, md->setInitializer(mdDefine->initializer()); } - // + // // we still have the problem that // MemberDef::writeDocumentation() in memberdef.cpp // writes the template argument list for the class, @@ -6654,7 +6659,7 @@ static void findMember(EntryNav *rootNav, // funcName.data(),funcDecl.data(),root->bodyLine); // try to find the matching line number of the body from the - // global function list + // global function list bool found=FALSE; if (root->bodyLine==-1) { @@ -6692,7 +6697,7 @@ static void findMember(EntryNav *rootNav, md->setBodyDef(fd); } - //if (root->mGrpId!=-1) + //if (root->mGrpId!=-1) //{ // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} @@ -6737,7 +6742,7 @@ static void findMember(EntryNav *rootNav, warn(root->fileName,root->startLine, "Cannot determine file/namespace for relatedalso function\n%s", fullFuncDecl.data() - ); + ); } } } @@ -6745,7 +6750,7 @@ static void findMember(EntryNav *rootNav, { warn_undoc(root->fileName,root->startLine, "class `%s' for related function `%s' is not " - "documented.", + "documented.", className.data(),funcName.data() ); } @@ -6791,7 +6796,7 @@ localObjCMethod: { mn->append(md); } - else + else { mn = new MemberName(root->name); mn->append(md); @@ -6811,7 +6816,7 @@ localObjCMethod: warn(root->fileName,root->startLine, "class for member `%s' cannot " "be found.", funcName.data() - ); + ); } else if (!className.isEmpty() && !globMem) { @@ -6828,7 +6833,7 @@ localObjCMethod: "member with no name found."); } return; -} +} //---------------------------------------------------------------------- // find the members corresponding to the different documentation blocks @@ -6854,7 +6859,7 @@ static void filterMemberDocumentation(EntryNav *rootNav) } if ( // detect func variable/typedef to func ptr - (i=findFunctionPtr(root->type,root->lang,&l))!=-1 + (i=findFunctionPtr(root->type,root->lang,&l))!=-1 ) { //printf("Fixing function pointer!\n"); @@ -6864,7 +6869,7 @@ static void filterMemberDocumentation(EntryNav *rootNav) //printf("Results type=%s,name=%s,args=%s\n",root->type.data(),root->name.data(),root->args.data()); isFunc=FALSE; } - else if ((root->type.left(8)=="typedef " && root->args.find('(')!=-1)) + else if ((root->type.left(8)=="typedef " && root->args.find('(')!=-1)) // detect function types marked as functions { isFunc=FALSE; @@ -6885,27 +6890,27 @@ static void filterMemberDocumentation(EntryNav *rootNav) findMember(rootNav,root->type+" "+root->name+root->args+root->exception,FALSE,isFunc); } } - else if (root->section==Entry::OVERLOADDOC_SEC) + else if (root->section==Entry::OVERLOADDOC_SEC) { //printf("Overloaded member %s found\n",root->name.data()); findMember(rootNav,root->name,TRUE,isFunc); } - else if + else if ((root->section==Entry::FUNCTION_SEC // function - || + || (root->section==Entry::VARIABLE_SEC && // variable !root->type.isEmpty() && // with a type - g_compoundKeywordDict.find(root->type)==0 // that is not a keyword + g_compoundKeywordDict.find(root->type)==0 // that is not a keyword // (to skip forward declaration of class etc.) ) - ) + ) ) { //printf("Documentation for member `%s' found args=`%s' excp=`%s'\n", // root->name.data(),root->args.data(),root->exception.data()); //if (root->relates.length()) printf(" Relates %s\n",root->relates.data()); //printf("Inside=%s\n Relates=%s\n",root->inside.data(),root->relates.data()); - if (root->type=="friend class" || root->type=="friend struct" || + if (root->type=="friend class" || root->type=="friend struct" || root->type=="friend union") { findMember(rootNav, @@ -6951,7 +6956,7 @@ static void filterMemberDocumentation(EntryNav *rootNav) } else { - // skip section + // skip section //printf("skip section\n"); } } @@ -7061,13 +7066,13 @@ static void findEnums(EntryNav *rootNav) name=root->name; } - if (!root->relates.isEmpty()) + if (!root->relates.isEmpty()) { // related member, prefix user specified scope isRelated=TRUE; isMemberOf=(root->relatesType == MemberOf); if (getClass(root->relates)==0 && !scope.isEmpty()) scope=mergeScopes(scope,root->relates); - else + else scope=root->relates.copy(); if ((cd=getClass(scope))==0) nd=getResolvedNamespace(scope); } @@ -7130,11 +7135,11 @@ static void findEnums(EntryNav *rootNav) { if (isRelated || Config_getBool("HIDE_SCOPE_NAMES")) { - md->setDefinition(name+baseType); + md->setDefinition(name+baseType); } else { - md->setDefinition(nd->name()+"::"+name+baseType); + md->setDefinition(nd->name()+"::"+name+baseType); } //printf("definition=%s\n",md->definition()); defSet=TRUE; @@ -7152,7 +7157,7 @@ static void findEnums(EntryNav *rootNav) { fd=rootNav->parent()->fileDef(); } - if (fd) + if (fd) { md->setFileDef(fd); fd->insertMember(md); @@ -7162,11 +7167,11 @@ static void findEnums(EntryNav *rootNav) { if (isRelated || Config_getBool("HIDE_SCOPE_NAMES")) { - md->setDefinition(name+baseType); + md->setDefinition(name+baseType); } else { - md->setDefinition(cd->name()+"::"+name+baseType); + md->setDefinition(cd->name()+"::"+name+baseType); } cd->insertMember(md); cd->insertUsedFile(fd); @@ -7241,12 +7246,12 @@ static void addEnumValuesToEnums(EntryNav *rootNav) name=root->name; } - if (!root->relates.isEmpty()) + if (!root->relates.isEmpty()) { // related member, prefix user specified scope isRelated=TRUE; if (getClass(root->relates)==0 && !scope.isEmpty()) scope=mergeScopes(scope,root->relates); - else + else scope=root->relates.copy(); if ((cd=getClass(scope))==0) nd=getResolvedNamespace(scope); } @@ -7321,7 +7326,7 @@ static void addEnumValuesToEnums(EntryNav *rootNav) MemberDef *fmd=new MemberDef( fileName,root->startLine,root->startColumn, root->type,root->name,root->args,0, - Public, Normal,root->stat,Member, + root->protection, Normal,root->stat,Member, MemberType_EnumValue,0,0); if (md->getClassDef()) fmd->setMemberClass(md->getClassDef()); else if (md->getNamespaceDef()) fmd->setNamespace(md->getNamespaceDef()); @@ -7346,7 +7351,7 @@ static void addEnumValuesToEnums(EntryNav *rootNav) { mn->append(fmd); } - else + else { mn = new MemberName(root->name); mn->append(fmd); @@ -7360,12 +7365,12 @@ static void addEnumValuesToEnums(EntryNav *rootNav) //printf("e->name=%s isRelated=%d\n",e->name().data(),isRelated); MemberName *fmn=0; MemberNameSDict *emnsd = isRelated ? Doxygen::functionNameSDict : mnsd; - if (!e->name().isEmpty() && (fmn=(*emnsd)[e->name()])) + if (!e->name().isEmpty() && (fmn=(*emnsd)[e->name()])) // get list of members with the same name as the field { MemberNameIterator fmni(*fmn); MemberDef *fmd; - for (fmni.toFirst(); (fmd=fmni.current()) ; ++fmni) + for (fmni.toFirst(); (fmd=fmni.current()) ; ++fmni) { if (fmd->isEnumValue() && fmd->getOuterScope()==md->getOuterScope()) // in same scope { @@ -7410,7 +7415,7 @@ static void addEnumValuesToEnums(EntryNav *rootNav) fmd->setEnumScope(md); // cross ref with enum name } } - } + } } } } @@ -7485,14 +7490,14 @@ static void findEnumDocumentation(EntryNav *rootNav) { // documentation outside a compound overrides the documentation inside it #if 0 - if (!md->documentation() || rootNav->parent()->name().isEmpty()) + if (!md->documentation() || rootNav->parent()->name().isEmpty()) #endif { md->setDocumentation(root->doc,root->docFile,root->docLine); md->setDocsForDefinition(!root->proto); } - // brief descriptions inside a compound override the documentation + // brief descriptions inside a compound override the documentation // outside it #if 0 if (!md->briefDescription() || !rootNav->parent()->name().isEmpty()) @@ -7529,7 +7534,7 @@ static void findEnumDocumentation(EntryNav *rootNav) //printf("MemberName %s not found!\n",name.data()); } } - else // enum outside class + else // enum outside class { //printf("Enum outside class: %s grpId=%d\n",name.data(),root->mGrpId); MemberName *mn=Doxygen::functionNameSDict->find(name); @@ -7558,7 +7563,7 @@ static void findEnumDocumentation(EntryNav *rootNav) } } } - } + } if (!found) { warn(root->fileName,root->startLine, @@ -7573,7 +7578,7 @@ static void findEnumDocumentation(EntryNav *rootNav) RECURSE_ENTRYTREE(findEnumDocumentation,rootNav); } -// search for each enum (member or function) in mnl if it has documented +// search for each enum (member or function) in mnl if it has documented // enum values. static void findDEV(const MemberNameSDict &mnsd) { @@ -7608,12 +7613,12 @@ static void findDEV(const MemberNameSDict &mnsd) } } -// search for each enum (member or function) if it has documented enum +// search for each enum (member or function) if it has documented enum // values. static void findDocumentedEnumValues() { findDEV(*Doxygen::memberNameSDict); - findDEV(*Doxygen::functionNameSDict); + findDEV(*Doxygen::functionNameSDict); } //---------------------------------------------------------------------- @@ -7682,12 +7687,12 @@ static void computeMemberRelations() // bmcd->name().data(),bmd->name().data(),bmd // ); if (md!=bmd && bmcd && mcd && bmcd!=mcd && - (bmd->virtualness()!=Normal || - bmcd->compoundType()==ClassDef::Interface || + (bmd->virtualness()!=Normal || + bmcd->compoundType()==ClassDef::Interface || bmcd->compoundType()==ClassDef::Protocol ) && - md->isFunction() && - mcd->isLinkable() && + md->isFunction() && + mcd->isLinkable() && bmcd->isLinkable() && mcd->isBaseClass(bmcd,TRUE)) { @@ -7698,11 +7703,11 @@ static void computeMemberRelations() // argListToString(bmdAl.pointer()).data(), // argListToString(mdAl.pointer()).data() // ); - if ( + if ( matchArguments2(bmd->getOuterScope(),bmd->getFileDef(),bmdAl, md->getOuterScope(), md->getFileDef(), mdAl, TRUE - ) + ) ) { MemberDef *rmd; @@ -7821,7 +7826,7 @@ static void generateFileSources() // create a dictionary with files to process QDict<void> g_filesToProcess(10007); - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { @@ -7844,7 +7849,7 @@ static void generateFileSources() QStrList filesInSameTu; fd->getAllIncludeFilesRecursively(filesInSameTu); fd->startParsing(); - if (fd->generateSourceFile()) // sources need to be shown in the output + if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { msg("Generating code for file %s...\n",fd->docName().data()); fd->writeSource(*g_outputList,FALSE,filesInSameTu); @@ -7867,7 +7872,7 @@ static void generateFileSources() FileDef *ifd=findFileDef(Doxygen::inputNameDict,incFile,ambig); if (ifd && !ifd->isReference()) { - if (ifd->generateSourceFile()) // sources need to be shown in the output + if (ifd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { msg(" Generating code for file %s...\n",ifd->docName().data()); ifd->writeSource(*g_outputList,TRUE,moreFiles); @@ -7900,7 +7905,7 @@ static void generateFileSources() { QStrList filesInSameTu; fd->startParsing(); - if (fd->generateSourceFile()) // sources need to be shown in the output + if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { msg("Generating code for file %s...\n",fd->docName().data()); fd->writeSource(*g_outputList,FALSE,filesInSameTu); @@ -7920,7 +7925,7 @@ static void generateFileSources() else #endif { - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -7930,7 +7935,7 @@ static void generateFileSources() { QStrList filesInSameTu; fd->startParsing(); - if (fd->generateSourceFile()) // sources need to be shown in the output + if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { msg("Generating code for file %s...\n",fd->docName().data()); fd->writeSource(*g_outputList,FALSE,filesInSameTu); @@ -7954,7 +7959,7 @@ static void generateFileSources() static void generateFileDocs() { if (documentedHtmlFiles==0) return; - + if (Doxygen::inputNameList->count()>0) { FileNameListIterator fnli(*Doxygen::inputNameList); @@ -8002,7 +8007,7 @@ static void addSourceReferences() fd->addSourceRef(nd->getStartBodyLine(),nd,0); } } - + // add source references for member names MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); MemberName *mn=0; @@ -8017,14 +8022,14 @@ static void addSourceReferences() // md->getBodyDef()?md->getBodyDef()->name().data():"<none>", // md->getStartBodyLine(),md->isLinkableInProject()); FileDef *fd=md->getBodyDef(); - if (fd && + if (fd && md->getStartBodyLine()!=-1 && md->isLinkableInProject() && (fd->generateSourceFile() || Doxygen::parseSourcesNeeded) ) { //printf("Found member `%s' in file `%s' at line `%d' def=%s\n", - // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); + // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); fd->addSourceRef(md->getStartBodyLine(),md->getOuterScope(),md); } } @@ -8042,16 +8047,16 @@ static void addSourceReferences() // md->getStartBodyLine(),md->getEndBodyLine(),fd, // md->isLinkableInProject(), // Doxygen::parseSourcesNeeded); - if (fd && - md->getStartBodyLine()!=-1 && - md->isLinkableInProject() && + if (fd && + md->getStartBodyLine()!=-1 && + md->isLinkableInProject() && (fd->generateSourceFile() || Doxygen::parseSourcesNeeded) ) { //printf("Found member `%s' in file `%s' at line `%d' def=%s\n", - // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); + // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); fd->addSourceRef(md->getStartBodyLine(),md->getOuterScope(),md); - } + } } } } @@ -8077,7 +8082,7 @@ static void sortMemberLists() } // sort file member lists - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { @@ -8100,14 +8105,14 @@ static void sortMemberLists() //---------------------------------------------------------------------------- // generate the documentation of all classes - + static void generateClassList(ClassSDict &classSDict) { ClassSDict::Iterator cli(classSDict); for ( ; cli.current() ; ++cli ) { ClassDef *cd=cli.current(); - + //printf("cd=%s getOuterScope=%p global=%p\n",cd->name().data(),cd->getOuterScope(),Doxygen::globalScope); if (cd && (cd->getOuterScope()==0 || // <-- should not happen, but can if we read an old tag file @@ -8153,7 +8158,7 @@ static void inheritDocumentation() if (md->documentation().isEmpty() && md->briefDescription().isEmpty()) { // no documentation yet MemberDef *bmd = md->reimplements(); - while (bmd && bmd->documentation().isEmpty() && + while (bmd && bmd->documentation().isEmpty() && bmd->briefDescription().isEmpty() ) { // search up the inheritance tree for a documentation member @@ -8214,7 +8219,7 @@ static void combineUsingRelations() } //---------------------------------------------------------------------------- - + static void addMembersToMemberGroup() { // for each class @@ -8393,9 +8398,9 @@ static void flushUnresolvedRelations() // Remove all unresolved references to classes from the cache. // This is needed before resolving the inheritance relations, since // it would otherwise not find the inheritance relation - // for C in the example below, as B::I was already found to be unresolvable + // for C in the example below, as B::I was already found to be unresolvable // (which is correct if you igore the inheritance relation between A and B). - // + // // class A { class I {} }; // class B : public A {}; // class C : public B::I {}; @@ -8444,7 +8449,7 @@ static void findDefineDocumentation(EntryNav *rootNav) { rootNav->loadEntry(g_storage); Entry *root = rootNav->entry(); - + //printf("found define `%s' `%s' brief=`%s' doc=`%s'\n", // root->name.data(),root->args.data(),root->brief.data(),root->doc.data()); @@ -8463,7 +8468,7 @@ static void findDefineDocumentation(EntryNav *rootNav) { mn->append(md); } - else + else { mn = new MemberName(root->name); mn->append(md); @@ -8517,7 +8522,7 @@ static void findDefineDocumentation(EntryNav *rootNav) if (md->memberType()==MemberType_Define) { FileDef *fd=md->getFileDef(); - if (fd && fd->absFilePath()==root->fileName) + if (fd && fd->absFilePath()==root->fileName) // doc and define in the same file assume they belong together. { #if 0 @@ -8593,7 +8598,7 @@ static void findDirDocumentation(EntryNav *rootNav) // root->docFile.data(),normalizedName.data()); if (root->docFile==normalizedName) // current dir? { - int lastSlashPos=normalizedName.findRev('/'); + int lastSlashPos=normalizedName.findRev('/'); if (lastSlashPos!=-1) // strip file name { normalizedName=normalizedName.left(lastSlashPos); @@ -8701,7 +8706,7 @@ static void findMainPage(EntryNav *rootNav) indexName, root->brief+root->doc+root->inbodyDocs,title); //setFileNameForSections(root->anchors,"index",Doxygen::mainPage); Doxygen::mainPage->setBriefDescription(root->brief,root->briefFile,root->briefLine); - Doxygen::mainPage->setFileName(indexName,TRUE); + Doxygen::mainPage->setFileName(indexName); Doxygen::mainPage->setShowToc(root->stat); addPageToContext(Doxygen::mainPage,rootNav); @@ -8761,7 +8766,7 @@ static void findMainPageTagFiles(EntryNav *rootNav) static void computePageRelations(EntryNav *rootNav) { - if ((rootNav->section()==Entry::PAGEDOC_SEC || + if ((rootNav->section()==Entry::PAGEDOC_SEC || rootNav->section()==Entry::MAINPAGEDOC_SEC ) && !rootNav->name().isEmpty() @@ -8771,8 +8776,8 @@ static void computePageRelations(EntryNav *rootNav) Entry *root = rootNav->entry(); PageDef *pd = root->section==Entry::PAGEDOC_SEC ? - Doxygen::pageSDict->find(root->name) : - Doxygen::mainPage; + Doxygen::pageSDict->find(root->name) : + Doxygen::mainPage; if (pd) { QListIterator<BaseInfo> bii(*root->extends); @@ -8828,10 +8833,10 @@ static void resolveUserReferences() // si->fileName.data()); PageDef *pd=0; - // hack: the items of a todo/test/bug/deprecated list are all fragments from - // different files, so the resulting section's all have the wrong file - // name (not from the todo/test/bug/deprecated list, but from the file in - // which they are defined). We correct this here by looking at the + // hack: the items of a todo/test/bug/deprecated list are all fragments from + // different files, so the resulting section's all have the wrong file + // name (not from the todo/test/bug/deprecated list, but from the file in + // which they are defined). We correct this here by looking at the // generated section labels! QDictIterator<RefList> rli(*Doxygen::xrefLists); RefList *rl; @@ -8851,7 +8856,7 @@ static void resolveUserReferences() { // if this section is in a page and the page is in a group, then we // have to adjust the link file name to point to the group. - if (!si->fileName.isEmpty() && + if (!si->fileName.isEmpty() && (pd=Doxygen::pageSDict->find(si->fileName)) && pd->getGroupDef()) { @@ -8912,7 +8917,7 @@ static void generatePageDocs() static void buildExampleList(EntryNav *rootNav) { - if (rootNav->section()==Entry::EXAMPLE_SEC && !rootNav->name().isEmpty()) + if (rootNav->section()==Entry::EXAMPLE_SEC && !rootNav->name().isEmpty()) { rootNav->loadEntry(g_storage); Entry *root = rootNav->entry(); @@ -8930,13 +8935,13 @@ static void buildExampleList(EntryNav *rootNav) PageDef *pd=new PageDef(root->fileName,root->startLine, root->name,root->brief+root->doc+root->inbodyDocs,root->args); pd->setBriefDescription(root->brief,root->briefFile,root->briefLine); - pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE),FALSE); + pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE)); pd->addSectionsToDefinition(root->anchors); pd->setLanguage(root->lang); //pi->addSections(root->anchors); Doxygen::exampleSDict->inSort(root->name,pd); - //we don't add example to groups + //we don't add example to groups //addExampleToGroups(root,pd); } @@ -8956,7 +8961,7 @@ void printNavTree(EntryNav *rootNav,int indent) indentStr.isEmpty()?"":indentStr.data(), rootNav->name().isEmpty()?"<empty>":rootNav->name().data(), rootNav->section()); - if (rootNav->children()) + if (rootNav->children()) { EntryNavListIterator eli(*rootNav->children()); for (;eli.current();++eli) printNavTree(eli.current(),indent+2); @@ -8965,7 +8970,7 @@ void printNavTree(EntryNav *rootNav,int indent) //---------------------------------------------------------------------------- -// generate the example documentation +// generate the example documentation static void generateExampleDocs() { @@ -9017,7 +9022,7 @@ static void generateGroupDocs() //static void generatePackageDocs() //{ // writePackageIndex(*g_outputList); -// +// // if (Doxygen::packageDict.count()>0) // { // PackageSDict::Iterator pdi(Doxygen::packageDict); @@ -9035,7 +9040,7 @@ static void generateGroupDocs() static void generateNamespaceDocs() { //writeNamespaceIndex(*g_outputList); - + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; // for each namespace... @@ -9053,9 +9058,9 @@ static void generateNamespaceDocs() ClassDef *cd; for ( ; (cd=cli.current()) ; ++cli ) { - if ( ( cd->isLinkableInProject() && + if ( ( cd->isLinkableInProject() && cd->templateMaster()==0 - ) // skip external references, anonymous compounds and + ) // skip external references, anonymous compounds and // template instances and nested classes && !cd->isHidden() && !cd->isEmbeddedInOuterScope() ) @@ -9079,9 +9084,9 @@ static QCString fixSlashes(QCString &s) { switch(s.at(i)) { - case '/': - case '\\': - result+="\\\\"; + case '/': + case '\\': + result+="\\\\"; break; default: result+=s.at(i); @@ -9094,31 +9099,6 @@ static QCString fixSlashes(QCString &s) //---------------------------------------------------------------------------- -static bool openOutputFile(const char *outFile,QFile &f) -{ - bool fileOpened=FALSE; - bool writeToStdout=(outFile[0]=='-' && outFile[1]=='\0'); - if (writeToStdout) // write to stdout - { - fileOpened = f.open(IO_WriteOnly,stdout); - } - else // write to file - { - QFileInfo fi(outFile); - if (fi.exists()) // create a backup - { - QDir dir=fi.dir(); - QFileInfo backup(fi.fileName()+".bak"); - if (backup.exists()) // remove existing backup - dir.remove(backup.fileName()); - dir.rename(fi.fileName(),fi.fileName()+".bak"); - } - f.setName(outFile); - fileOpened = f.open(IO_WriteOnly|IO_Translate); - } - return fileOpened; -} - /*! Generate a template version of the configuration file. * If the \a shortList parameter is TRUE a configuration file without * comments will be generated. @@ -9189,7 +9169,7 @@ static void readTagFile(Entry *root,const char *tl) { fileName = tagLine; } - + QFileInfo fi(fileName); if (!fi.exists() || !fi.isFile()) { @@ -9302,11 +9282,11 @@ static void copyExtraFiles(const QCString& filesOption,const QCString &outputOpt for (i=0; i<files.count(); ++i) { QCString fileName(files.at(i)); - + if (!fileName.isEmpty()) { QFileInfo fi(fileName); - if (!fi.exists()) + if (!fi.exists()) { err("Extra file '%s' specified in " + filesOption + " does not exist!\n", fileName.data()); } @@ -9364,7 +9344,7 @@ static void parseFile(ParserInterface *parser, QFileInfo fi(fileName); BufStr preBuf(fi.size()+4096); - if (Config_getBool("ENABLE_PREPROCESSING") && + if (Config_getBool("ENABLE_PREPROCESSING") && parser->needsPreprocessing(extension)) { BufStr inBuf(fi.size()+4096); @@ -9435,7 +9415,7 @@ static void parseFiles(Entry *root,EntryNav *rootNav) parseFile(parser,root,rootNav,fd,s->data(),FALSE,filesInSameTu); //printf(" got %d extra files in tu\n",filesInSameTu.count()); - // Now process any include files in the same translation unit + // Now process any include files in the same translation unit // first. When libclang is used this is much more efficient. char *incFile = filesInSameTu.first(); while (incFile && g_filesToProcess.find(incFile)) @@ -9507,9 +9487,9 @@ static QCString resolveSymlink(QCString path) { #ifdef WIN32 // UNC path, skip server and share name - if (sepPos==0 && (result.left(2)=="//" || result.left(2)=="\\\\")) + if (sepPos==0 && (result.left(2)=="//" || result.left(2)=="\\\\")) sepPos = result.find('/',2); - if (sepPos!=-1) + if (sepPos!=-1) sepPos = result.find('/',sepPos+1); #else sepPos = result.find('/',sepPos+1); @@ -9563,7 +9543,7 @@ static QCString resolveSymlink(QCString path) static QDict<void> g_pathsVisited(1009); //---------------------------------------------------------------------------- -// Read all files matching at least one pattern in `patList' in the +// Read all files matching at least one pattern in `patList' in the // directory represented by `fi'. // The directory is read iff the recusiveFlag is set. // The contents of all files is append to the input string @@ -9599,7 +9579,7 @@ int readDir(QFileInfo *fi, int totalSize=0; msg("Searching for files in directory %s\n", fi->absFilePath().data()); //printf("killDict=%p count=%d\n",killDict,killDict->count()); - + const QFileInfoList *list = dir.entryInfoList(); if (list) { @@ -9608,7 +9588,7 @@ int readDir(QFileInfo *fi, while ((cfi=it.current())) { - if (exclDict==0 || exclDict->find(cfi->absFilePath().utf8())==0) + if (exclDict==0 || exclDict->find(cfi->absFilePath().utf8())==0) { // file should not be excluded //printf("killDict->find(%s)\n",cfi->absFilePath().data()); if (!cfi->exists() || !cfi->isReadable()) @@ -9618,9 +9598,9 @@ int readDir(QFileInfo *fi, warn_uncond("source %s is not a readable file or directory... skipping.\n",cfi->absFilePath().data()); } } - else if (cfi->isFile() && + else if (cfi->isFile() && (!Config_getBool("EXCLUDE_SYMLINKS") || !cfi->isSymLink()) && - (patList==0 || patternMatch(*cfi,patList)) && + (patList==0 || patternMatch(*cfi,patList)) && !patternMatch(*cfi,exclPatList) && (killDict==0 || killDict->find(cfi->absFilePath().utf8())==0) ) @@ -9655,7 +9635,7 @@ int readDir(QFileInfo *fi, } else if (recursive && (!Config_getBool("EXCLUDE_SYMLINKS") || !cfi->isSymLink()) && - cfi->isDir() && + cfi->isDir() && !patternMatch(*cfi,exclPatList) && cfi->fileName().at(0)!='.') // skip "." ".." and ".dir" { @@ -9723,7 +9703,7 @@ int readFileOrDirectory(const char *s, //printf("killDict->find(%s)\n",fi.absFilePath().data()); if (killDict==0 || killDict->find(filePath)==0) { - totalSize+=fi.size()+fi.absFilePath().length()+4; //readFile(&fi,fiList,input); + totalSize+=fi.size()+fi.absFilePath().length()+4; //readFile(&fi,fiList,input); //fiList->inSort(new FileInfo(fi)); QCString name=fi.fileName().utf8(); //printf("New file %s\n",name.data()); @@ -9788,7 +9768,7 @@ void readFormulaRepository() else { QCString formName = line.left(se); - QCString formText = line.right(line.length()-se-1); + QCString formText = line.right(line.length()-se-1); Formula *f=new Formula(formText); Doxygen::formulaList->setAutoDelete(TRUE); Doxygen::formulaList->append(f); @@ -9826,15 +9806,15 @@ static void escapeAliases() { newValue+=value.mid(p,in-p); // expand \n's except if \n is part of a built-in command. - if (value.mid(in,5)!="\\note" && - value.mid(in,5)!="\\name" && - value.mid(in,10)!="\\namespace" && + if (value.mid(in,5)!="\\note" && + value.mid(in,5)!="\\name" && + value.mid(in,10)!="\\namespace" && value.mid(in,14)!="\\nosubgrouping" - ) + ) { newValue+="\\_linebr "; } - else + else { newValue+="\\n"; } @@ -9849,7 +9829,7 @@ static void escapeAliases() //---------------------------------------------------------------------------- void readAliases() -{ +{ // add aliases to a dictionary Doxygen::aliasDict.setAutoDelete(TRUE); QStrList &aliasList = Config_getList("ALIASES"); @@ -9864,7 +9844,7 @@ void readAliases() { QCString name=alias.left(i).stripWhiteSpace(); QCString value=alias.right(alias.length()-i-1); - //printf("Alias: found name=`%s' value=`%s'\n",name.data(),value.data()); + //printf("Alias: found name=`%s' value=`%s'\n",name.data(),value.data()); if (!name.isEmpty()) { QCString *dn=Doxygen::aliasDict[name]; @@ -9896,7 +9876,7 @@ static void dumpSymbol(FTextStream &t,Definition *d) anchor=":"+md->anchor(); } QCString scope; - if (d->getOuterScope() && d->getOuterScope()!=Doxygen::globalScope) + if (d->getOuterScope() && d->getOuterScope()!=Doxygen::globalScope) { scope = d->getOuterScope()->getOutputFileBase()+Doxygen::htmlFileExtension; } @@ -9910,7 +9890,7 @@ static void dumpSymbol(FTextStream &t,Definition *d) } static void dumpSymbolMap() -{ +{ QFile f("symbols.sql"); if (f.open(IO_WriteOnly)) { @@ -10033,16 +10013,16 @@ void initDoxygen() #endif Doxygen::inputNameList = new FileNameList; Doxygen::inputNameList->setAutoDelete(TRUE); - Doxygen::memberNameSDict = new MemberNameSDict(10000); + Doxygen::memberNameSDict = new MemberNameSDict(10000); Doxygen::memberNameSDict->setAutoDelete(TRUE); - Doxygen::functionNameSDict = new MemberNameSDict(10000); + Doxygen::functionNameSDict = new MemberNameSDict(10000); Doxygen::functionNameSDict->setAutoDelete(TRUE); - Doxygen::groupSDict = new GroupSDict(17); + Doxygen::groupSDict = new GroupSDict(17); Doxygen::groupSDict->setAutoDelete(TRUE); Doxygen::globalScope = new NamespaceDef("<globalScope>",1,1,"<globalScope>"); - Doxygen::namespaceSDict = new NamespaceSDict(20); + Doxygen::namespaceSDict = new NamespaceSDict(20); Doxygen::namespaceSDict->setAutoDelete(TRUE); - Doxygen::classSDict = new ClassSDict(1009); + Doxygen::classSDict = new ClassSDict(1009); Doxygen::classSDict->setAutoDelete(TRUE); Doxygen::hiddenClasses = new ClassSDict(257); Doxygen::hiddenClasses->setAutoDelete(TRUE); @@ -10076,7 +10056,7 @@ void initDoxygen() /************************************************************************** * Initialize some global constants **************************************************************************/ - + g_compoundKeywordDict.insert("template class",(void *)8); g_compoundKeywordDict.insert("template struct",(void *)8); g_compoundKeywordDict.insert("class",(void *)8); @@ -10103,7 +10083,7 @@ void cleanUpDoxygen() delete Doxygen::mscFileNameDict; delete Doxygen::diaFileNameDict; delete Doxygen::mainPage; - delete Doxygen::pageSDict; + delete Doxygen::pageSDict; delete Doxygen::exampleSDict; delete Doxygen::globalScope; delete Doxygen::xrefLists; @@ -10131,7 +10111,7 @@ void cleanUpDoxygen() { ++dli; } - } + } } delete Doxygen::inputNameList; @@ -10143,7 +10123,7 @@ void cleanUpDoxygen() delete Doxygen::namespaceSDict; delete Doxygen::directories; - //delete Doxygen::symbolMap; <- we cannot do this unless all static lists + //delete Doxygen::symbolMap; <- we cannot do this unless all static lists // (such as Doxygen::namespaceSDict) // with objects based on Definition are made // dynamic first @@ -10154,7 +10134,7 @@ static int computeIdealCacheParam(uint v) //printf("computeIdealCacheParam(v=%u)\n",v); int r=0; - while (v!=0) v>>=1,r++; + while (v!=0) v>>=1,r++; // r = log2(v) // convert to a valid cache size value @@ -10177,8 +10157,8 @@ void readConfiguration(int argc, char **argv) bool updateConfig=FALSE; bool genLayout=FALSE; int retVal; - while (optind<argc && argv[optind][0]=='-' && - (isalpha(argv[optind][1]) || argv[optind][1]=='?' || + while (optind<argc && argv[optind][0]=='-' && + (isalpha(argv[optind][1]) || argv[optind][1]=='?' || argv[optind][1]=='-') ) { @@ -10189,7 +10169,7 @@ void readConfiguration(int argc, char **argv) configName=getArg(argc,argv,optind); if (optind+1<argc && qstrcmp(argv[optind+1],"-")==0) { configName="-"; optind++; } - if (!configName) + if (!configName) { configName="Doxyfile"; } break; case 'l': @@ -10248,7 +10228,7 @@ void readConfiguration(int argc, char **argv) err("option \"-e\" has invalid format specifier.\n"); cleanUpDoxygen(); exit(1); - break; + break; case 'w': formatName=getArg(argc,argv,optind); if (!formatName) @@ -10256,7 +10236,7 @@ void readConfiguration(int argc, char **argv) err("option \"-w\" is missing format specifier rtf, html or latex\n"); cleanUpDoxygen(); exit(1); - } + } if (qstricmp(formatName,"rtf")==0) { if (optind+1>=argc) @@ -10323,7 +10303,7 @@ void readConfiguration(int argc, char **argv) if (openOutputFile(argv[optind+3],f)) { HtmlGenerator::writeStyleSheetFile(f); - } + } cleanUpDoxygen(); exit(0); } @@ -10390,7 +10370,7 @@ void readConfiguration(int argc, char **argv) g_dumpSymbolMap = TRUE; break; case 'v': - msg("%s\n",versionString); + msg("%s\n",versionString); cleanUpDoxygen(); exit(0); break; @@ -10402,7 +10382,7 @@ void readConfiguration(int argc, char **argv) } else if (qstrcmp(&argv[optind][2],"version")==0) { - msg("%s\n",versionString); + msg("%s\n",versionString); cleanUpDoxygen(); exit(0); } @@ -10435,7 +10415,7 @@ void readConfiguration(int argc, char **argv) } optind++; } - + /************************************************************************** * Parse or generate the config file * **************************************************************************/ @@ -10457,8 +10437,8 @@ void readConfiguration(int argc, char **argv) QFileInfo configFileInfo1("Doxyfile"),configFileInfo2("doxyfile"); if (optind>=argc) - { - if (configFileInfo1.exists()) + { + if (configFileInfo1.exists()) { configName="Doxyfile"; } @@ -10512,11 +10492,11 @@ void readConfiguration(int argc, char **argv) /** check and resolve config options */ void checkConfiguration() { - + Config::instance()->substituteEnvironmentVars(); Config::instance()->convertStrToVal(); Config::instance()->check(); - + initWarningFormat(); } @@ -10538,19 +10518,19 @@ void adjustConfiguration() s=includePath.next(); } - /* Set the global html file extension. */ + /* Set the global html file extension. */ Doxygen::htmlFileExtension = Config_getString("HTML_FILE_EXTENSION"); Doxygen::xrefLists->setAutoDelete(TRUE); - Doxygen::parseSourcesNeeded = Config_getBool("CALL_GRAPH") || + Doxygen::parseSourcesNeeded = Config_getBool("CALL_GRAPH") || Config_getBool("CALLER_GRAPH") || Config_getBool("REFERENCES_RELATION") || Config_getBool("REFERENCED_BY_RELATION"); Doxygen::markdownSupport = Config_getBool("MARKDOWN_SUPPORT"); - + /************************************************************************** * Add custom extension mappings **************************************************************************/ @@ -10568,7 +10548,7 @@ void adjustConfiguration() if (!updateLanguageMapping(ext,language)) { err("Failed to map file extension '%s' to unsupported language '%s'.\n" - "Check the EXTENSION_MAPPING setting in the config file.\n", + "Check the EXTENSION_MAPPING setting in the config file.\n", ext.data(),language.data()); } else @@ -10774,14 +10754,14 @@ void searchInputFiles() while (s) { QStrList &pl = Config_getList("INCLUDE_FILE_PATTERNS"); - if (pl.count()==0) + if (pl.count()==0) { pl = Config_getList("FILE_PATTERNS"); } readFileOrDirectory(s,0,Doxygen::includeNameDict,0,&pl, &exclPatterns,0,0, alwaysRecursive); - s=includePathList.next(); + s=includePathList.next(); } g_s.end(); @@ -10794,7 +10774,7 @@ void searchInputFiles() &Config_getList("EXAMPLE_PATTERNS"), 0,0,0, (alwaysRecursive || Config_getBool("EXAMPLE_RECURSIVE"))); - s=examplePathList.next(); + s=examplePathList.next(); } g_s.end(); @@ -10806,7 +10786,7 @@ void searchInputFiles() readFileOrDirectory(s,0,Doxygen::imageNameDict,0,0, 0,0,0, alwaysRecursive); - s=imagePathList.next(); + s=imagePathList.next(); } g_s.end(); @@ -10818,7 +10798,7 @@ void searchInputFiles() readFileOrDirectory(s,0,Doxygen::dotFileNameDict,0,0, 0,0,0, alwaysRecursive); - s=dotFileList.next(); + s=dotFileList.next(); } g_s.end(); @@ -10830,7 +10810,7 @@ void searchInputFiles() readFileOrDirectory(s,0,Doxygen::mscFileNameDict,0,0, 0,0,0, alwaysRecursive); - s=mscFileList.next(); + s=mscFileList.next(); } g_s.end(); @@ -10896,7 +10876,7 @@ void searchInputFiles() g_s.end(); } - + void parseInput() { atexit(exitDoxygen); @@ -10906,7 +10886,7 @@ void parseInput() * Make sure the output directory exists **************************************************************************/ QCString &outputDirectory = Config_getString("OUTPUT_DIRECTORY"); - if (outputDirectory.isEmpty()) + if (outputDirectory.isEmpty()) { outputDirectory=QDir::currentDirPath().utf8(); } @@ -10956,7 +10936,7 @@ void parseInput() Doxygen::objDBFileName.prepend(outputDirectory+"/"); Doxygen::entryDBFileName.sprintf("doxygen_entrydb_%d.tmp",pid); Doxygen::entryDBFileName.prepend(outputDirectory+"/"); - + if (Doxygen::symbolStorage->open(Doxygen::objDBFileName)==-1) { err("Failed to open temporary file %s\n",Doxygen::objDBFileName.data()); @@ -10983,7 +10963,7 @@ void parseInput() bool &generateXml = Config_getBool("GENERATE_XML"); if (generateXml) xmlOutput = createOutputDirectory(outputDirectory,"XML_OUTPUT","/xml"); - + QCString latexOutput; bool &generateLatex = Config_getBool("GENERATE_LATEX"); if (generateLatex) @@ -11043,7 +11023,7 @@ void parseInput() if (layoutFile.open(IO_ReadOnly)) { msg("Parsing layout file %s...\n",layoutFileName.data()); - QTextStream t(&layoutFile); + QTextStream t(&layoutFile); t.setEncoding(QTextStream::Latin1); LayoutDocManager::instance().parse(t,layoutFileName); } @@ -11055,7 +11035,7 @@ void parseInput() /************************************************************************** * Read and preprocess input * **************************************************************************/ - + // prevent search in the output directories QStrList &exclPatterns = Config_getList("EXCLUDE_PATTERNS"); if (generateHtml) exclPatterns.append(htmlOutput); @@ -11068,12 +11048,12 @@ void parseInput() searchInputFiles(); // Notice: the order of the function calls below is very important! - + if (Config_getBool("GENERATE_HTML")) { readFormulaRepository(); } - + /************************************************************************** * Handle Tag Files * **************************************************************************/ @@ -11090,7 +11070,7 @@ void parseInput() EntryNav *rootNav = new EntryNav(0,root); rootNav->setEntry(root); msg("Reading and parsing tag files\n"); - + QStrList &tagFileList = Config_getList("TAGFILES"); char *s=tagFileList.first(); while (s) @@ -11099,9 +11079,9 @@ void parseInput() root->createNavigationIndex(rootNav,g_storage,0); s=tagFileList.next(); } - + /************************************************************************** - * Parse source files * + * Parse source files * **************************************************************************/ if (Config_getBool("BUILTIN_STL_SUPPORT")) @@ -11128,7 +11108,7 @@ void parseInput() } /************************************************************************** - * Gather information * + * Gather information * **************************************************************************/ g_s.begin("Building group list...\n"); @@ -11166,7 +11146,7 @@ void parseInput() resolveClassNestingRelations(); g_s.end(); // 1.8.2-20121111: no longer add nested classes to the group as well - //distributeClassGroupRelations(); + //distributeClassGroupRelations(); // calling buildClassList may result in cached relations that // become invalid after resolveClassNestingRelations(), that's why @@ -11421,7 +11401,7 @@ void generateOutput() g_outputList = new OutputList(TRUE); - if (generateHtml) + if (generateHtml) { g_outputList->add(new HtmlGenerator); HtmlGenerator::init(); @@ -11439,21 +11419,11 @@ void generateOutput() if (generateDocSet) Doxygen::indexList->addIndex(new DocSets); Doxygen::indexList->initialize(); HtmlGenerator::writeTabData(); - - // copy static stuff - copyStyleSheet(); - copyLogo(); - copyExtraFiles("HTML_EXTRA_FILES","HTML_OUTPUT"); - FTVHelp::generateTreeViewImages(); } - if (generateLatex) + if (generateLatex) { g_outputList->add(new LatexGenerator); LatexGenerator::init(); - - copyLatexStyleSheet(); - // copy static stuff - copyExtraFiles("LATEX_EXTRA_FILES","LATEX_OUTPUT"); } if (generateMan) { @@ -11474,7 +11444,7 @@ void generateOutput() if (!Htags::loadFilemap(htmldir)) err("htags(1) ended normally but failed to load the filemap. \n"); } - + /************************************************************************** * Generate documentation * **************************************************************************/ @@ -11491,12 +11461,17 @@ void generateOutput() static bool searchEngine = Config_getBool("SEARCHENGINE"); static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); + g_s.begin("Generating search indices...\n"); + if (searchEngine && !serverBasedSearch && (generateHtml || g_useOutputTemplate)) + { + createJavascriptSearchIndex(); + } + // generate search indices (need to do this before writing other HTML // pages as these contain a drop down menu with options depending on // what categories we find in this function. if (generateHtml && searchEngine) { - g_s.begin("Generating search indices...\n"); QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search"; QDir searchDir(searchDirName); if (!searchDir.exists() && !searchDir.mkdir(searchDirName)) @@ -11510,8 +11485,8 @@ void generateOutput() { writeJavascriptSearchIndex(); } - g_s.end(); } + g_s.end(); g_s.begin("Generating example documentation...\n"); generateExampleDocs(); @@ -11573,7 +11548,7 @@ void generateOutput() gd->sortSubGroups(); } } - + if (g_outputList->count()>0) { writeIndexHierarchy(*g_outputList); @@ -11591,9 +11566,9 @@ void generateOutput() { if (generateHtml) removeDoxFont(Config_getString("HTML_OUTPUT")); - if (generateRtf) + if (generateRtf) removeDoxFont(Config_getString("RTF_OUTPUT")); - if (generateLatex) + if (generateLatex) removeDoxFont(Config_getString("LATEX_OUTPUT")); } @@ -11675,8 +11650,22 @@ void generateOutput() g_s.end(); } + // copy static stuff + if (generateHtml) + { + FTVHelp::generateTreeViewImages(); + copyStyleSheet(); + copyLogo(); + copyExtraFiles("HTML_EXTRA_FILES","HTML_OUTPUT"); + } + if (generateLatex) + { + copyLatexStyleSheet(); + copyExtraFiles("LATEX_EXTRA_FILES","LATEX_OUTPUT"); + } + if (generateHtml && - Config_getBool("GENERATE_HTMLHELP") && + Config_getBool("GENERATE_HTMLHELP") && !Config_getString("HHC_LOCATION").isEmpty()) { g_s.begin("Running html help compiler...\n"); @@ -11692,7 +11681,7 @@ void generateOutput() g_s.end(); } if ( generateHtml && - Config_getBool("GENERATE_QHP") && + Config_getBool("GENERATE_QHP") && !Config_getString("QHG_LOCATION").isEmpty()) { g_s.begin("Running qhelpgenerator...\n"); diff --git a/src/doxygen.h b/src/doxygen.h index 0d38d5b..2195a35 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 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 + * 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. * @@ -71,7 +71,7 @@ typedef QListIterator<QCString> StringListIterator; class StringDict : public QDict<QCString> { - public: + public: StringDict(uint size=17) : QDict<QCString>(size) {} virtual ~StringDict() {} }; @@ -79,7 +79,7 @@ class StringDict : public QDict<QCString> struct LookupInfo { LookupInfo() : classDef(0), typeDef(0) {} - LookupInfo(ClassDef *cd,MemberDef *td,QCString ts,QCString rt) + LookupInfo(ClassDef *cd,MemberDef *td,QCString ts,QCString rt) : classDef(cd), typeDef(td), templSpec(ts),resolvedType(rt) {} ClassDef *classDef; MemberDef *typeDef; @@ -121,8 +121,8 @@ class Doxygen static FormulaList *formulaList; static FormulaDict *formulaDict; static FormulaDict *formulaNameDict; - static StringDict tagDestinationDict; - static StringDict aliasDict; + static StringDict tagDestinationDict; + static StringDict aliasDict; static QIntDict<MemberGroupInfo> memGrpInfoDict; static QDict<void> expandAsDefinedDict; static NamespaceDef *globalScope; diff --git a/src/filedef.cpp b/src/filedef.cpp index d6e49a2..2a09c41 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1737,7 +1737,8 @@ bool FileDef::isDocumentationFile() const void FileDef::acquireFileVersion() { QCString vercmd = Config_getString("FILE_VERSION_FILTER"); - if (!vercmd.isEmpty() && !m_filePath.isEmpty() && m_filePath!="generated") + if (!vercmd.isEmpty() && !m_filePath.isEmpty() && + m_filePath!="generated" && m_filePath!="graph_legend") { msg("Version of %s : ",m_filePath.data()); QCString cmd = vercmd+" \""+m_filePath+"\""; diff --git a/src/filedef.h b/src/filedef.h index 17a5e60..712128c 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -44,7 +44,7 @@ class FTextStream; /** Class representing the data associated with a \#include statement. */ struct IncludeInfo { - IncludeInfo() { fileDef=0; local=FALSE; indirect=FALSE; } + IncludeInfo() : fileDef(0), local(FALSE), imported(FALSE), indirect(FALSE) {} ~IncludeInfo() {} FileDef *fileDef; QCString includeName; diff --git a/src/formula.cpp b/src/formula.cpp index ad37782..182ddaa 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -132,6 +132,7 @@ void FormulaList::generateBitmaps(const char *path) { err("Problems running dvips. Check your installation!\n"); portable_sysTimerStop(); + QDir::setCurrent(oldDir); return; } portable_sysTimerStop(); @@ -192,6 +193,7 @@ void FormulaList::generateBitmaps(const char *path) { err("Problem running ghostscript %s %s. Check your installation!\n",portable_ghostScriptCommand(),gsArgs); portable_sysTimerStop(); + QDir::setCurrent(oldDir); return; } portable_sysTimerStop(); diff --git a/src/fortrancode.l b/src/fortrancode.l index af1a82e..82e78c1 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -795,7 +795,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I codifyLines(yytext); endFontClass(); } -<Start>"implicit"{BS}"none" { +<Start>"implicit"{BS}("none"|{TYPE_SPEC}) { startFontClass("keywordtype"); codifyLines(yytext); endFontClass(); @@ -1302,11 +1302,11 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri return; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) +#if !defined(YY_FLEX_SUBMINOR_VERSION) extern "C" { // some bogus code to keep the compiler happy - void fortrancodeYYdummy() { yy_flex_realloc(0,0); } + void fortrancodeYYdummy() { yy_flex_realloc(0,0); } } -#elif YY_FLEX_SUBMINOR_VERSION<33 +#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 #error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" #else extern "C" { // some bogus code to keep the compiler happy diff --git a/src/fortranscanner.l b/src/fortranscanner.l index cbe13fd..bd1fe83 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -100,13 +100,14 @@ struct SymbolModifiers { bool pass; bool contiguous; bool volat; /* volatile is a reserverd name */ + bool value; /* volatile is a reserverd name */ QCString passVar; SymbolModifiers() : type(), returnName(), protection(NONE_P), direction(NONE_D), optional(FALSE), protect(FALSE), dimension(), allocatable(FALSE), external(FALSE), intrinsic(FALSE), parameter(FALSE), pointer(FALSE), target(FALSE), save(FALSE), deferred(FALSE), nonoverridable(FALSE), - nopass(FALSE), pass(FALSE), contiguous(FALSE), volat(FALSE), passVar() {} + nopass(FALSE), pass(FALSE), contiguous(FALSE), volat(FALSE), value(FALSE), passVar() {} SymbolModifiers& operator|=(const SymbolModifiers &mdfs); SymbolModifiers& operator|=(QCString mdfrString); @@ -259,7 +260,7 @@ CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS})) TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE{ARGS}|CLASS{ARGS}|PROCEDURE{ARGS}?) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" -ATTR_SPEC (EXTERNAL|ALLOCATABLE|DIMENSION{ARGS}|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE|CONTIGUOUS|VOLATILE) +ATTR_SPEC (EXTERNAL|ALLOCATABLE|DIMENSION{ARGS}|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE|CONTIGUOUS|VOLATILE|VALUE) ACCESS_SPEC (PRIVATE|PUBLIC) LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")" /* Assume that attribute statements are almost the same as attributes. */ @@ -1652,6 +1653,7 @@ SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs) passVar = mdfs.passVar; contiguous |= mdfs.contiguous; volat |= mdfs.volat; + value |= mdfs.value; return *this; } @@ -1738,6 +1740,10 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString) { newMdf.volat = TRUE; } + else if (mdfString=="value") + { + newMdf.value = TRUE; + } else if (mdfString.contains("pass")) { newMdf.pass = TRUE; @@ -1902,6 +1908,11 @@ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs) if (!typeName.isEmpty()) typeName += ", "; typeName += "volatile"; } + if (mdfs.value) + { + if (!typeName.isEmpty()) typeName += ", "; + typeName += "value"; + } return typeName; } diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index e2774a9..a70e243 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -171,6 +171,7 @@ void FTVHelp::decContentsDepth() /*! Add a list item to the contents file. * \param isDir TRUE if the item is a directory, FALSE if it is a text + * \param name The name of the item. * \param ref the URL of to the item. * \param file the file containing the definition of the item * \param anchor the anchor within the file. diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 2d7674d..7a74c65 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -824,6 +824,7 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) FileDef *fd; for (;(fd=it.current());++it) { + if (!fd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); @@ -877,6 +878,7 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) { if (gd->isVisible()) { + if (!gd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(gd->getOutputFileBase(),0); //ol.docify(theTranslator->trGroup(FALSE,TRUE)); @@ -910,6 +912,7 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) DirDef *dd; for (;(dd=it.current());++it) { + if (!dd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); ol.parseText(theTranslator->trDir(FALSE,TRUE)); @@ -1071,7 +1074,7 @@ void GroupDef::writeDocumentation(OutputList &ol) { //static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); ol.pushGeneratorState(); - startFile(ol,getOutputFileBase(),name(),title,HLI_None); + startFile(ol,getOutputFileBase(),name(),title,HLI_Modules); ol.startHeaderSection(); writeSummaryLinks(ol); diff --git a/src/htags.cpp b/src/htags.cpp index c910eb6..460d54d 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -59,7 +59,7 @@ bool Htags::execute(const QCString &htmldir) } else { - err("If you use USE_HTAGS then INPUT should specific a single directory. \n"); + err("If you use USE_HTAGS then INPUT should specify a single directory.\n"); return FALSE; } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 99d6fdd..0533f87 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -42,7 +42,7 @@ static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"}; static QCString convertIndexWordToAnchor(const QString &word) { static char hex[] = "0123456789abcdef"; - QCString result; + QCString result="a"; const char *str = word.data(); unsigned char c; if (str) @@ -54,8 +54,7 @@ static QCString convertIndexWordToAnchor(const QString &word) (c >= '0' && c <= '9') || // DIGIT c == '-' || c == '.' || - c == '_' || - c == '~' + c == '_' ) { result += c; @@ -63,7 +62,7 @@ static QCString convertIndexWordToAnchor(const QString &word) else { char enc[4]; - enc[0] = '%'; + enc[0] = ':'; enc[1] = hex[(c & 0xf0) >> 4]; enc[2] = hex[c & 0xf]; enc[3] = 0; @@ -1037,7 +1036,7 @@ void HtmlDocVisitor::visitPre(DocPara *p) void HtmlDocVisitor::visitPost(DocPara *p) { bool needsTag = FALSE; - if (p && p->parent()) + if (p->parent()) { switch (p->parent()->kind()) { @@ -1067,7 +1066,7 @@ void HtmlDocVisitor::visitPost(DocPara *p) // the paragraph (<ul>,<dl>,<table>) then that will already have ended the // paragraph and we don't need to do it here int nodeIndex = p->children().count()-1; - if (p && nodeIndex>=0) + if (nodeIndex>=0) { while (nodeIndex>=0 && p->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace) { @@ -1301,6 +1300,11 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t) forceEndParagraph(t); + if (t->hasCaption()) + { + m_t << "<a class=\"anchor\" id=\"" << t->caption()->anchor() << "\"></a>\n"; + } + QString attrs = htmlAttribsToString(t->attribs()); if (attrs.isEmpty()) { @@ -1356,13 +1360,8 @@ void HtmlDocVisitor::visitPre(DocHtmlCaption *c) 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 << ">"; + QCString id; + m_t << "<caption" << htmlAttribsToString(c->attribs()) << ">"; } void HtmlDocVisitor::visitPost(DocHtmlCaption *) @@ -1808,7 +1807,6 @@ void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b) { if (m_hide) return; forceEndParagraph(b); - QString attrs = htmlAttribsToString(b->attribs()); if (attrs.isEmpty()) { @@ -1902,24 +1900,8 @@ void HtmlDocVisitor::filterQuotedCdataAttr(const char* str) { case '&': m_t << "&"; break; case '"': m_t << """; break; - // For SGML compliance, and given the SGML declaration for HTML syntax, - // it's enough to replace these two, provided that the declaration - // for the HTML version we generate (and as supported by the browser) - // specifies that all the other symbols used in rawVal are - // within the right character class (i.e., they're not - // some multinational weird characters not in the BASESET). - // We assume that 1) the browser will support whatever is remaining - // in the formula and 2) the TeX formulae are generally governed - // by even stricter character restrictions so it should be enough. - // - // On some incompliant browsers, additional translation of - // '>' and '<' into ">" and "<", respectively, might be needed; - // but I'm unaware of particular modern (last 4 years) versions - // with such problems, so let's not do it for performance. - // Also, some brousers will (wrongly) not process the entity references - // inside the attribute value and show the &...; form instead, - // so we won't create entites unless necessary to minimize clutter there. - // --vassilii + case '<': m_t << "<"; break; + case '>': m_t << ">"; break; default: m_t << c; } } @@ -1944,7 +1926,7 @@ void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file, if (!file.isEmpty()) m_t << file << Doxygen::htmlFileExtension; if (!anchor.isEmpty()) m_t << "#" << anchor; m_t << "\""; - if (!tooltip.isEmpty()) m_t << " title=\"" << substitute(tooltip,"\"",""") << "\""; + if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\""; m_t << ">"; } @@ -2061,6 +2043,42 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, } } +/** Returns TRUE if the child nodes in paragraph \a para until \a nodeIndex + contain a style change node that is still active and that style change is one that + must be located outside of a paragraph, i.e. it is a center, div, or pre tag. + See also bug746162. + */ +static bool insideStyleChangeThatIsOutsideParagraph(DocPara *para,int nodeIndex) +{ + //printf("insideStyleChangeThatIsOutputParagraph(index=%d)\n",nodeIndex); + int styleMask=0; + bool styleOutsideParagraph=FALSE; + while (nodeIndex>=0 && !styleOutsideParagraph) + { + DocNode *n = para->children().at(nodeIndex); + if (n->kind()==DocNode::Kind_StyleChange) + { + DocStyleChange *sc = (DocStyleChange*)n; + if (!sc->enable()) // remember styles that has been closed already + { + styleMask|=(int)sc->style(); + } + bool paraStyle = sc->style()==DocStyleChange::Center || + sc->style()==DocStyleChange::Div || + sc->style()==DocStyleChange::Preformatted; + //printf("Found style change %s enabled=%d\n",sc->styleString(),sc->enable()); + if (sc->enable() && (styleMask&(int)sc->style())==0 && // style change that is still active + paraStyle + ) + { + styleOutsideParagraph=TRUE; + } + } + nodeIndex--; + } + return styleOutsideParagraph; +} + /** Used for items found inside a paragraph, which due to XHTML restrictions * have to be outside of the paragraph. This method will forcefully end * the current paragraph and forceStartParagraph() will restart it. @@ -2074,7 +2092,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) int nodeIndex = para->children().findRef(n); nodeIndex--; if (nodeIndex<0) return; // first node - while (nodeIndex>=0 && + while (nodeIndex>=0 && para->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace ) { @@ -2086,12 +2104,14 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) //printf("n=%p kind=%d outside=%d\n",n,n->kind(),mustBeOutsideParagraph(n)); if (mustBeOutsideParagraph(n)) return; } - + nodeIndex--; + bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); bool isFirst; bool isLast; getParagraphContext(para,isFirst,isLast); - //printf("forceEnd first=%d last=%d\n",isFirst,isLast); + //printf("forceEnd first=%d last=%d styleOutsideParagraph=%d\n",isFirst,isLast,styleOutsideParagraph); if (isFirst && isLast) return; + if (styleOutsideParagraph) return; m_t << "</p>"; } @@ -2109,9 +2129,11 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n) DocPara *para = (DocPara*)n->parent(); int nodeIndex = para->children().findRef(n); int numNodes = para->children().count(); + bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); + if (styleOutsideParagraph) return; nodeIndex++; if (nodeIndex==numNodes) return; // last node - while (nodeIndex<numNodes && + while (nodeIndex<numNodes && para->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace ) { diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp index c4c601f..ff3c574 100644 --- a/src/htmlentity.cpp +++ b/src/htmlentity.cpp @@ -312,7 +312,9 @@ static struct htmlEntityInfo { SYM(Percent), "%", "%", "%", "%", "\\%", "%", "%", { "%", DocSymbol::Perl_char }}, { SYM(Pipe), "|", "|", "|", "|", "$|$", "|", "|", { "|", DocSymbol::Perl_char }}, { SYM(Quot), "\"", "\"", "\"", """, "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }}, - { SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }} + { SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }}, + { SYM(Plus), "+", "+", "+", "+", "+", "+", "+", { "+", DocSymbol::Perl_char }}, + { SYM(Dot), ".", ".", ".", ".", ".", ".", ".", { ".", DocSymbol::Perl_char }} }; static const int g_numHtmlEntities = (int)(sizeof(g_htmlEntities)/ sizeof(*g_htmlEntities)); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index a2dd473..9e02dee 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -333,10 +333,6 @@ static QCString substituteHtmlKeywords(const QCString &s, if (mathJax) { QCString path = Config_getString("MATHJAX_RELPATH"); - if (!path.isEmpty() && path.at(path.length()-1)!='/') - { - path+="/"; - } if (path.isEmpty() || path.left(2)=="..") // relative path { path.prepend(relPath); @@ -364,7 +360,7 @@ static QCString substituteHtmlKeywords(const QCString &s, mathJaxJs += "\n"; } mathJaxJs += "</script>"; - mathJaxJs += "<script src=\"" + path + "MathJax.js\"></script>\n"; + mathJaxJs += "<script type=\"text/javascript\" src=\"" + path + "MathJax.js\"></script>\n"; } // first substitute generic keywords @@ -553,7 +549,7 @@ void HtmlCodeGenerator::_writeCodeLink(const char *className, if (f) m_t << f << Doxygen::htmlFileExtension; if (anchor) m_t << "#" << anchor; m_t << "\""; - if (tooltip) m_t << " title=\"" << tooltip << "\""; + if (tooltip) m_t << " title=\"" << convertToHtml(tooltip) << "\""; m_t << ">"; docify(name); m_t << "</a>"; @@ -593,7 +589,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, if (desc) { m_t << "<div class=\"ttdoc\">"; - m_t << desc; // desc is already HTML escaped + docify(desc); // desc is already HTML escaped; but there are still < and > signs m_t << "</div>"; } if (!defInfo.file.isEmpty()) @@ -653,7 +649,7 @@ void HtmlCodeGenerator::startCodeLine(bool hasLineNumbers) void HtmlCodeGenerator::endCodeLine() { - if (m_streamSet) m_t << "</div>\n"; + if (m_streamSet) m_t << "</div>"; } void HtmlCodeGenerator::startFontClass(const char *s) @@ -736,25 +732,17 @@ void HtmlGenerator::init() QFile f(dname+"/dynsections.js"); if (f.open(IO_WriteOnly)) { - const Resource *res = mgr.get("dynsections.js"); - if (res) - { - FTextStream t(&f); - t << (const char *)res->data; - if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS")) - { - t << endl << - "$(document).ready(function() {\n" - " $('.code,.codeRef').each(function() {\n" - " $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n" - " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n" - " });\n" - "});\n"; - } - } - else + FTextStream t(&f); + t << mgr.getAsString("dynsections.js"); + if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS")) { - err("Resource dynsections.js not compiled in"); + t << endl << + "$(document).ready(function() {\n" + " $('.code,.codeRef').each(function() {\n" + " $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n" + " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n" + " });\n" + "});\n"; } } } @@ -819,20 +807,16 @@ void HtmlGenerator::writeSearchData(const char *dir) QFile f(searchDirName+"/search.css"); if (f.open(IO_WriteOnly)) { - const Resource *res = mgr.get("search.css"); - if (res) + FTextStream t(&f); + QCString searchCss = replaceColorMarkers(mgr.getAsString("search.css")); + searchCss = substitute(searchCss,"$doxygenversion",versionString); + if (Config_getBool("DISABLE_INDEX")) { - FTextStream t(&f); - QCString searchCss = replaceColorMarkers((const char *)res->data); - searchCss = substitute(searchCss,"$doxygenversion",versionString); - if (Config_getBool("DISABLE_INDEX")) - { - // move up the search box if there are no tabs - searchCss = substitute(searchCss,"margin-top: 8px;","margin-top: 0px;"); - } - t << searchCss; - Doxygen::indexList->addStyleSheetFile("search/search.css"); + // move up the search box if there are no tabs + searchCss = substitute(searchCss,"margin-top: 8px;","margin-top: 0px;"); } + t << searchCss; + Doxygen::indexList->addStyleSheetFile("search/search.css"); } } @@ -1356,11 +1340,9 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d, startSectionContent(t,m_sectionCount); t << " <div class=\"center\">" << endl; t << " <img src=\""; - t << relPath << fileName << ".png\" usemap=\"#"; - docify(name); + t << relPath << fileName << ".png\" usemap=\"#" << convertToId(name); t << "_map\" alt=\"\"/>" << endl; - t << " <map id=\""; - docify(name); + t << " <map id=\"" << convertToId(name); t << "_map\" name=\""; docify(name); t << "_map\">" << endl; @@ -1952,11 +1934,6 @@ static void endQuickIndexItem(FTextStream &t,const char *l) t << "</li>\n"; } -static QCString fixSpaces(const QCString &s) -{ - return substitute(s," "," "); -} - static bool quickLinkVisible(LayoutNavEntry::Kind kind) { static bool showFiles = Config_getBool("SHOW_FILES"); @@ -2443,6 +2420,7 @@ void HtmlGenerator::endConstraintDocs() void HtmlGenerator::endConstraintList() { t << "</table>" << endl; + t << "</dd>" << endl; t << "</dl>" << endl; t << "</div>" << endl; } diff --git a/src/increasebuffer.py b/src/increasebuffer.py deleted file mode 100755 index e2b2d0c..0000000 --- a/src/increasebuffer.py +++ /dev/null @@ -1,7 +0,0 @@ -# Since the internal token buffer of a generated flex file is hardcoded -# to 16K, this script is used to increase the buffer size of a flex -# generated scanner to 256K. -import sys -sys.stdout.write(sys.stdin.read(). - replace('YY_BUF_SIZE 16384','YY_BUF_SIZE 262144'). - replace('YY_READ_BUF_SIZE 8192','YY_READ_BUF_SIZE 262144')) diff --git a/src/index.cpp b/src/index.cpp index e7ba8e7..15303c7 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -1640,7 +1640,7 @@ static void writeAnnotatedClassList(OutputList &ol) static QCString letterToLabel(uint startLetter) { char s[11]; // max 0x12345678 + '\0' - if (startLetter>0x20 && startLetter<=0x7f) // printable ASCII character + if (isId(startLetter)) // printable ASCII character { s[0]=(char)startLetter; s[1]=0; @@ -1901,7 +1901,7 @@ static void writeAlphabeticalClassList(OutputList &ol) } } - ol.writeString("<table style=\"margin: 10px; white-space: nowrap;\" align=\"center\" width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"); + ol.writeString("<table class=\"classindex\">\n"); // generate table for (i=0;i<=maxRows;i++) // foreach table row { @@ -2476,8 +2476,8 @@ static void writeQuickMemberIndex(OutputList &ol, anchor=fullName+extension+"#index_"; else anchor=fullName+"_"+letterToLabel(i)+extension+"#index_"; - startQuickIndexItem(ol,anchor+ci,i==page,TRUE,first); - ol.writeString(is); + startQuickIndexItem(ol,anchor+is,i==page,TRUE,first); + ol.writeString(ci); endQuickIndexItem(ol); first=FALSE; } @@ -3787,7 +3787,7 @@ static void writeIndex(OutputList &ol) { title = theTranslator->trMainPage(); } - else + else if (Doxygen::mainPage) { title = filterTitle(Doxygen::mainPage->title()); } @@ -4086,7 +4086,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const QList<LayoutNavEntry for (i=oldSize;i<newSize;i++) indexWritten.at(i)=FALSE; } //printf("starting %s kind=%d\n",lne->title().data(),lne->kind()); - bool addToIndex=lne==0 || lne->visible(); + bool addToIndex=lne->visible(); bool needsClosing=FALSE; if (!indexWritten.at(index)) { diff --git a/src/index.h b/src/index.h index 150d23f..ace3614 100644 --- a/src/index.h +++ b/src/index.h @@ -284,5 +284,6 @@ void initNamespaceMemberIndices(); void addClassMemberNameToIndex(MemberDef *md); void addFileMemberNameToIndex(MemberDef *md); void addNamespaceMemberNameToIndex(MemberDef *md); +QCString fixSpaces(const QCString &s); #endif diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 37c2130..5e7278c 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -171,11 +171,10 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s) LatexDocVisitor::LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci, const char *langExt,bool insideTabbing) : DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), - m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing), - m_insideTable(FALSE), m_langExt(langExt), m_currentColumn(0), - m_inRowspan(FALSE), m_inColspan(FALSE) + m_insideItem(FALSE), m_hide(FALSE), m_hideCaption(FALSE), m_insideTabbing(insideTabbing), + m_langExt(langExt) { - m_rowSpans.setAutoDelete(TRUE); + m_tableStateStack.setAutoDelete(TRUE); } //-------------------------------------- @@ -890,7 +889,7 @@ void LatexDocVisitor::visitPost(DocHtmlDescData *) { } -static const char *getTableName(const DocNode *n) +static bool tableIsNested(const DocNode *n) { bool isNested=FALSE; while (n && !isNested) @@ -898,68 +897,115 @@ static const char *getTableName(const DocNode *n) isNested = n->kind()==DocNode::Kind_HtmlTable || n->kind()==DocNode::Kind_ParamSect; n = n->parent(); } - return isNested ? "TabularNC" : "TabularC"; + return isNested; } -void LatexDocVisitor::visitPre(DocHtmlTable *t) +static void writeStartTableCommand(FTextStream &t,const DocNode *n,int cols) { - m_rowSpans.clear(); - m_insideTable=TRUE; - if (m_hide) return; - if (t->hasCaption()) + if (tableIsNested(n)) { - m_t << "\\begin{table}[h]"; + t << "\\begin{tabularx}{\\linewidth}{|*{" << cols << "}{>{\\raggedright\\arraybackslash}X|}}"; } - m_t << "\\begin{" << getTableName(t->parent()) << "}{" << t->numColumns() << "}\n"; - m_numCols = t->numColumns(); - m_t << "\\hline\n"; + else + { + t << "\\tabulinesep=1mm\n\\begin{longtabu} spread 0pt [c]{*" << cols << "{|X[-1]}|}\n"; + } + //return isNested ? "TabularNC" : "TabularC"; } -void LatexDocVisitor::visitPost(DocHtmlTable *t) +static void writeEndTableCommand(FTextStream &t,const DocNode *n) { - m_insideTable=FALSE; - if (m_hide) return; - if (t->hasCaption()) + if (tableIsNested(n)) { - m_t << "\\end{table}\n"; + t << "\\end{tabularx}\n"; } else { - m_t << "\\end{" << getTableName(t->parent()) << "}\n"; + t << "\\end{longtabu}\n"; } + //return isNested ? "TabularNC" : "TabularC"; } -void LatexDocVisitor::visitPre(DocHtmlCaption *c) +void LatexDocVisitor::visitPre(DocHtmlTable *t) { if (m_hide) return; - m_t << "\\end{" << getTableName(c->parent()->parent()) << "}\n\\centering\n\\caption{"; + pushTableState(); + if (t->hasCaption()) + { + DocHtmlCaption *c = t->caption(); + static bool pdfHyperLinks = Config_getBool("PDF_HYPERLINKS"); + if (!c->file().isEmpty() && pdfHyperLinks) + { + m_t << "\\hypertarget{" << stripPath(c->file()) << "_" << c->anchor() + << "}{}"; + } + m_t << endl; + } + + writeStartTableCommand(m_t,t->parent(),t->numColumns()); + + if (t->hasCaption()) + { + DocHtmlCaption *c = t->caption(); + m_t << "\\caption{"; + visitCaption(this, c->children()); + m_t << "}"; + m_t << "\\label{" << stripPath(c->file()) << "_" << c->anchor() << "}"; + m_t << "\\\\\n"; + } + + setNumCols(t->numColumns()); + m_t << "\\hline\n"; + + // check if first row is a heading and then render the row already here + // and end it with \endfirsthead (triggered via m_firstRow==TRUE) + // then repeat the row as normal and end it with \endhead (m_firstRow==FALSE) + DocHtmlRow *firstRow = t->firstRow(); + if (firstRow && firstRow->isHeading()) + { + setFirstRow(TRUE); + firstRow->accept(this); + setFirstRow(FALSE); + } } -void LatexDocVisitor::visitPost(DocHtmlCaption *) +void LatexDocVisitor::visitPost(DocHtmlTable *t) { if (m_hide) return; - m_t << "}\n"; + writeEndTableCommand(m_t,t->parent()); + popTableState(); +} + +void LatexDocVisitor::visitPre(DocHtmlCaption *c) +{ + m_hideCaption = m_hide; + m_hide = TRUE; +} + +void LatexDocVisitor::visitPost(DocHtmlCaption *c) +{ + m_hide = m_hideCaption; } void LatexDocVisitor::visitPre(DocHtmlRow *r) { - m_currentColumn = 0; - if (r->isHeading()) m_t << "\\rowcolor{lightgray}"; + setCurrentColumn(0); + if (r->isHeading()) m_t << "\\rowcolor{\\tableheadbgcolor}"; } void LatexDocVisitor::visitPost(DocHtmlRow *row) { if (m_hide) return; - int c=m_currentColumn; - while (c<=m_numCols) // end of row while inside a row span? + int c=currentColumn(); + while (c<=numCols()) // end of row while inside a row span? { uint i; - for (i=0;i<m_rowSpans.count();i++) + for (i=0;i<rowSpans().count();i++) { - ActiveRowSpan *span = m_rowSpans.at(i); - //printf(" founc row span: column=%d rs=%d cs=%d rowIdx=%d cell->rowIdx=%d\n", - // span->column, span->rowSpan,span->colSpan,row->rowIndex(),span->cell->rowIndex()); + ActiveRowSpan *span = rowSpans().at(i); + //printf(" found row span: column=%d rs=%d cs=%d rowIdx=%d cell->rowIdx=%d i=%d c=%d\n", + // span->column, span->rowSpan,span->colSpan,row->rowIndex(),span->cell->rowIndex(),i,c); if (span->rowSpan>0 && span->column==c && // we are at a cell in a row span row->rowIndex()>span->cell->rowIndex() // but not the row that started the span ) @@ -969,9 +1015,9 @@ void LatexDocVisitor::visitPost(DocHtmlRow *row) { m_t << "\\multicolumn{" << span->colSpan << "}{"; m_t << "p{(\\linewidth-\\tabcolsep*" - << m_numCols << "-\\arrayrulewidth*" + << numCols() << "-\\arrayrulewidth*" << row->visibleCells() << ")*" - << span->colSpan <<"/"<< m_numCols << "}|}{}"; + << span->colSpan <<"/"<< numCols() << "}|}{}"; } else // solitary row span { @@ -986,9 +1032,9 @@ void LatexDocVisitor::visitPost(DocHtmlRow *row) int col = 1; uint i; - for (i=0;i<m_rowSpans.count();i++) + for (i=0;i<rowSpans().count();i++) { - ActiveRowSpan *span = m_rowSpans.at(i); + ActiveRowSpan *span = rowSpans().at(i); if (span->rowSpan>0) span->rowSpan--; if (span->rowSpan<=0) { @@ -1005,12 +1051,27 @@ void LatexDocVisitor::visitPost(DocHtmlRow *row) } } - if (col <= m_numCols) + if (col <= numCols()) { - m_t << "\\cline{" << col << "-" << m_numCols << "}"; + m_t << "\\cline{" << col << "-" << numCols() << "}"; } m_t << "\n"; + + if (row->isHeading() && row->rowIndex()==1) + { + if (firstRow()) + { + m_t << "\\endfirsthead" << endl; + m_t << "\\hline" << endl; + m_t << "\\endfoot" << endl; + m_t << "\\hline" << endl; + } + else + { + m_t << "\\endhead" << endl; + } + } } void LatexDocVisitor::visitPre(DocHtmlCell *c) @@ -1022,68 +1083,60 @@ void LatexDocVisitor::visitPre(DocHtmlCell *c) { row = (DocHtmlRow*)c->parent(); } - - m_currentColumn++; + + setCurrentColumn(currentColumn()+1); //Skip columns that span from above. uint i; - for (i=0;i<m_rowSpans.count();i++) + for (i=0;i<rowSpans().count();i++) { - ActiveRowSpan *span = m_rowSpans.at(i); - if (span->rowSpan>0 && span->column==m_currentColumn) + ActiveRowSpan *span = rowSpans().at(i); + if (span->rowSpan>0 && span->column==currentColumn()) { if (row && span->colSpan>1) { m_t << "\\multicolumn{" << span->colSpan << "}{"; - if (m_currentColumn /*c->columnIndex()*/==1) // add extra | for first column + if (currentColumn() /*c->columnIndex()*/==1) // add extra | for first column { m_t << "|"; } m_t << "p{(\\linewidth-\\tabcolsep*" - << m_numCols << "-\\arrayrulewidth*" + << numCols() << "-\\arrayrulewidth*" << row->visibleCells() << ")*" - << span->colSpan <<"/"<< m_numCols << "}|}{}"; - m_currentColumn+=span->colSpan; + << span->colSpan <<"/"<< numCols() << "}|}{}"; + setCurrentColumn(currentColumn()+span->colSpan); } else { - m_currentColumn++; + setCurrentColumn(currentColumn()+1); } m_t << "&"; } } -#if 0 - QMap<int, int>::Iterator it = m_rowspanIndices.find(m_currentColumn); - if (it!=m_rowspanIndices.end() && it.data()>0) - { - m_t << "&"; - m_currentColumn++; - it++; - } -#endif - int cs = c->colSpan(); if (cs>1 && row) { - m_inColspan = TRUE; + setInColSpan(TRUE); m_t << "\\multicolumn{" << cs << "}{"; if (c->columnIndex()==1) // add extra | for first column { m_t << "|"; } m_t << "p{(\\linewidth-\\tabcolsep*" - << m_numCols << "-\\arrayrulewidth*" + << numCols() << "-\\arrayrulewidth*" << row->visibleCells() << ")*" - << cs <<"/"<< m_numCols << "}|}{"; - if (c->isHeading()) m_t << "\\cellcolor{lightgray}"; + << cs <<"/"<< numCols() << "}|}{"; + if (c->isHeading()) m_t << "\\cellcolor{\\tableheadbgcolor}"; } int rs = c->rowSpan(); if (rs>0) { - m_inRowspan = TRUE; - //m_rowspanIndices[m_currentColumn] = rs; - m_rowSpans.append(new ActiveRowSpan(c,rs,cs,m_currentColumn)); + setInRowSpan(TRUE); + //printf("adding row span: cell={r=%d c=%d rs=%d cs=%d} curCol=%d\n", + // c->rowIndex(),c->columnIndex(),c->rowSpan(),c->colSpan(), + // currentColumn()); + addRowSpan(new ActiveRowSpan(c,rs,cs,currentColumn())); m_t << "\\multirow{" << rs << "}{\\linewidth}{"; } int a = c->alignment(); @@ -1101,7 +1154,7 @@ void LatexDocVisitor::visitPre(DocHtmlCell *c) } if (cs>1) { - m_currentColumn+=cs-1; + setCurrentColumn(currentColumn()+cs-1); } } @@ -1112,14 +1165,14 @@ void LatexDocVisitor::visitPost(DocHtmlCell *c) { m_t << "}"; } - if (m_inRowspan) + if (inRowSpan()) { - m_inRowspan = FALSE; + setInRowSpan(FALSE); m_t << "}"; } - if (m_inColspan) + if (inColSpan()) { - m_inColspan = FALSE; + setInColSpan(FALSE); m_t << "}"; } if (!c->isLast()) m_t << "&"; @@ -1258,7 +1311,7 @@ void LatexDocVisitor::visitPre(DocRef *ref) } else { - if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor(),ref->refToTable()); } if (!ref->hasLinkText()) filter(ref->targetTitle()); } @@ -1574,22 +1627,34 @@ void LatexDocVisitor::filter(const char *str) filterLatexString(m_t,str,m_insideTabbing,m_insidePre,m_insideItem); } -void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor,bool refToTable) { - if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) // internal PDF link + static bool pdfHyperLinks = Config_getBool("PDF_HYPERLINKS"); + if (ref.isEmpty() && pdfHyperLinks) // internal PDF link { - m_t << "\\hyperlink{"; + if (refToTable) + { + m_t << "\\doxytablelink{"; + } + else + { + m_t << "\\hyperlink{"; + } if (!file.isEmpty()) m_t << stripPath(file); if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; if (!anchor.isEmpty()) m_t << anchor; m_t << "}{"; } + else if (ref.isEmpty() && refToTable) + { + m_t << "\\doxytableref{"; + } else if (ref.isEmpty()) // internal non-PDF link { m_t << "\\doxyref{"; } else // external link - { + { m_t << "{\\bf "; } } @@ -1597,9 +1662,10 @@ void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const Q void LatexDocVisitor::endLink(const QCString &ref,const QCString &file,const QCString &anchor) { m_t << "}"; - if (ref.isEmpty() && !Config_getBool("PDF_HYPERLINKS")) + static bool pdfHyperLinks = Config_getBool("PDF_HYPERLINKS"); + if (ref.isEmpty() && !pdfHyperLinks) { - m_t << "{"; + m_t << "{"; filter(theTranslator->trPageAbbreviation()); m_t << "}{" << file; if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index d3aeaea..02df1ef 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -159,7 +159,7 @@ class LatexDocVisitor : public DocVisitor void filter(const char *str); void startLink(const QCString &ref,const QCString &file, - const QCString &anchor); + const QCString &anchor,bool refToTable=FALSE); void endLink(const QCString &ref,const QCString &file, const QCString &anchor); QCString escapeMakeIndexChars(const char *s); @@ -190,15 +190,87 @@ class LatexDocVisitor : public DocVisitor bool m_insidePre; bool m_insideItem; bool m_hide; + bool m_hideCaption; bool m_insideTabbing; - bool m_insideTable; - int m_numCols; QStack<bool> m_enabled; QCString m_langExt; - RowSpanList m_rowSpans; - int m_currentColumn; - bool m_inRowspan; - bool m_inColspan; + + struct TableState + { + TableState() : numCols(0), currentColumn(0), inRowSpan(FALSE), + inColSpan(FALSE), firstRow(FALSE) + { rowSpans.setAutoDelete(TRUE); } + RowSpanList rowSpans; + int numCols; + int currentColumn; + bool inRowSpan; + bool inColSpan; + bool firstRow; + }; + QStack<TableState> m_tableStateStack; // needed for nested tables + RowSpanList m_emptyRowSpanList; + + void pushTableState() + { + m_tableStateStack.push(new TableState); + } + void popTableState() + { + delete m_tableStateStack.pop(); + } + int currentColumn() const + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->currentColumn : 0; + } + void setCurrentColumn(int col) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->currentColumn = col; + } + int numCols() const + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->numCols : 0; + } + void setNumCols(int num) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->numCols = num; + } + bool inRowSpan() const + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->inRowSpan : FALSE; + } + void setInRowSpan(bool b) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->inRowSpan = b; + } + bool inColSpan() const + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->inColSpan : FALSE; + } + void setInColSpan(bool b) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->inColSpan = b; + } + bool firstRow() const + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->firstRow : FALSE; + } + void setFirstRow(bool b) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->firstRow = b; + } + const RowSpanList &rowSpans() + { + return !m_tableStateStack.isEmpty() ? m_tableStateStack.top()->rowSpans : m_emptyRowSpanList; + } + void addRowSpan(ActiveRowSpan *span) + { + if (!m_tableStateStack.isEmpty()) m_tableStateStack.top()->rowSpans.append(span); + } + bool insideTable() const + { + return !m_tableStateStack.isEmpty(); + } + }; #endif diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 042dd7c..66a1f8e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -38,11 +38,214 @@ #include "filename.h" #include "resourcemgr.h" +//------------------------------- + +LatexCodeGenerator::LatexCodeGenerator(FTextStream &t,const QCString &relPath,const QCString &sourceFileName) + : m_relPath(relPath), m_sourceFileName(sourceFileName), m_col(0) +{ + m_prettyCode=Config_getBool("LATEX_SOURCE_CODE"); + setTextStream(t); +} + +LatexCodeGenerator::LatexCodeGenerator() : m_col(0), m_streamSet(FALSE) +{ + m_prettyCode=Config_getBool("LATEX_SOURCE_CODE"); +} + +void LatexCodeGenerator::setTextStream(FTextStream &t) +{ + m_streamSet = t.device()!=0; + m_t.setDevice(t.device()); +} + +void LatexCodeGenerator::setRelativePath(const QCString &path) +{ + m_relPath = path; +} + +void LatexCodeGenerator::setSourceFileName(const QCString &name) +{ + m_sourceFileName = name; +} + +void LatexCodeGenerator::codify(const char *str) +{ + if (str) + { + const char *p=str; + char c; + //char cs[5]; + int spacesToNextTabStop; + static int tabSize = Config_getInt("TAB_SIZE"); + const int maxLineLen = 108; + QCString result(4*maxLineLen+1); // worst case for 1 line of 4-byte chars + int i; + while ((c=*p)) + { + switch(c) + { + case 0x0c: p++; // remove ^L + break; + case '\t': spacesToNextTabStop = + tabSize - (m_col%tabSize); + m_t << Doxygen::spaces.left(spacesToNextTabStop); + m_col+=spacesToNextTabStop; + p++; + break; + case '\n': m_t << '\n'; m_col=0; p++; + break; + default: + i=0; + +#undef COPYCHAR +// helper macro to copy a single utf8 character, dealing with multibyte chars. +#define COPYCHAR() do { \ + result[i++]=c; p++; \ + if (c<0) /* multibyte utf-8 character */ \ + { \ + /* 1xxx.xxxx: >=2 byte character */ \ + result[i++]=*p++; \ + if (((uchar)c&0xE0)==0xE0) \ + { \ + /* 111x.xxxx: >=3 byte character */ \ + result[i++]=*p++; \ + } \ + if (((uchar)c&0xF0)==0xF0) \ + { \ + /* 1111.xxxx: 4 byte character */ \ + result[i++]=*p++; \ + } \ + } \ + m_col++; \ + } while(0) + + // gather characters until we find whitespace or are at + // the end of a line + COPYCHAR(); + if (m_col>=maxLineLen) // force line break + { + m_t << "\n "; + m_col=0; + } + else // copy more characters + { + while (m_col<maxLineLen && (c=*p) && + c!=0x0c && c!='\t' && c!='\n' && c!=' ' + ) + { + COPYCHAR(); + } + if (m_col>=maxLineLen) // force line break + { + m_t << "\n "; + m_col=0; + } + } + result[i]=0; // add terminator + //if (m_prettyCode) + //{ + filterLatexString(m_t,result,FALSE,TRUE); + //} + //else + //{ + // t << result; + //} + break; + } + } + } +} + + +void LatexCodeGenerator::writeCodeLink(const char *ref,const char *f, + const char *anchor,const char *name, + const char *) +{ + static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); + static bool usePDFLatex = Config_getBool("USE_PDFLATEX"); + int l = qstrlen(name); + if (m_col+l>80) + { + m_t << "\n "; + m_col=0; + } + if (!ref && usePDFLatex && pdfHyperlinks) + { + m_t << "\\hyperlink{"; + if (f) m_t << stripPath(f); + if (f && anchor) m_t << "_"; + if (anchor) m_t << anchor; + m_t << "}{"; + codify(name); + m_t << "}"; + } + else + { + m_t << name; + } + m_col+=l; +} + +void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) +{ + static bool usePDFLatex = Config_getBool("USE_PDFLATEX"); + static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); + if (m_prettyCode) + { + QCString lineNumber; + lineNumber.sprintf("%05d",l); + + if (fileName && !m_sourceFileName.isEmpty()) + { + QCString lineAnchor; + lineAnchor.sprintf("_l%05d",l); + lineAnchor.prepend(m_sourceFileName); + //if (!m_prettyCode) return; + if (usePDFLatex && pdfHyperlinks) + { + m_t << "\\hypertarget{" << stripPath(lineAnchor) << "}{}"; + } + writeCodeLink(ref,fileName,anchor,lineNumber,0); + } + else + { + codify(lineNumber); + } + m_t << " "; + } + else + { + m_t << l << " "; + } +} + + +void LatexCodeGenerator::startCodeLine(bool) +{ + m_col=0; +} + +void LatexCodeGenerator::endCodeLine() +{ + codify("\n"); +} + +void LatexCodeGenerator::startFontClass(const char *name) +{ + m_t << "\\textcolor{" << name << "}{"; +} + +void LatexCodeGenerator::endFontClass() +{ + m_t << "}"; +} + + +//------------------------------- LatexGenerator::LatexGenerator() : OutputGenerator() { dir=Config_getString("LATEX_OUTPUT"); - col=0; //printf("LatexGenerator::LatexGenerator() insideTabbing=FALSE\n"); insideTabbing=FALSE; firstDescItem=TRUE; @@ -332,13 +535,8 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\n"; // Define page & text layout - QCString paperName; - QCString &paperType=Config_getEnum("PAPER_TYPE"); + QCString paperName=Config_getEnum("PAPER_TYPE"); // "a4wide" package is obsolete (see bug 563698) - if (paperType=="a4wide") - paperName="a4"; - else - paperName=paperType; t << "% Page & text layout\n" "\\usepackage{geometry}\n" "\\geometry{%\n" @@ -355,7 +553,7 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\\hbadness=750\n" "\\setlength{\\emergencystretch}{15pt}\n" "\\setlength{\\parindent}{0cm}\n" - "\\setlength{\\parskip}{0.2cm}\n"; + "\\setlength{\\parskip}{3ex plus 2ex minus 2ex}\n"; // Redefine paragraph/subparagraph environments, using sectsty fonts t << "\\makeatletter\n" "\\renewcommand{\\paragraph}{%\n" @@ -373,11 +571,18 @@ static void writeDefaultHeaderPart1(FTextStream &t) // Headers & footers QGString genString; + QCString generatedBy; + static bool timeStamp = Config_getBool("LATEX_TIMESTAMP"); FTextStream tg(&genString); - filterLatexString(tg, - theTranslator->trGeneratedAt(dateToString(TRUE), - Config_getString("PROJECT_NAME")), - FALSE,FALSE,FALSE); + if (timeStamp) + { + generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), Config_getString("PROJECT_NAME")); + } + else + { + generatedBy = theTranslator->trGeneratedBy(); + } + filterLatexString(tg, generatedBy, FALSE,FALSE,FALSE); t << "% Headers & footers\n" "\\usepackage{fancyhdr}\n" "\\pagestyle{fancyplain}\n" @@ -455,9 +660,12 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\\newcommand{\\clearemptydoublepage}{%\n" " \\newpage{\\pagestyle{empty}\\cleardoublepage}%\n" "}\n" - "\n" "\n"; + // caption style definition + t << "\\usepackage{caption}\n" + << "\\captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top}\n\n"; + // End of preamble, now comes the document contents t << "%===== C O N T E N T S =====\n" "\n" @@ -474,7 +682,7 @@ static void writeDefaultHeaderPart1(FTextStream &t) // To avoid duplicate page anchors due to reuse of same numbers for // the index (be it as roman numbers) t << "\\hypersetup{pageanchor=false,\n" - << " bookmarks=true,\n" + // << " bookmarks=true,\n" // commented out to prevent warning << " bookmarksnumbered=true,\n" << " pdfencoding=unicode\n" << " }\n"; @@ -499,10 +707,11 @@ static void writeDefaultHeaderPart3(FTextStream &t) { // part 3 // Finalize project number - t << " Doxygen " << versionString << "}\\\\\n" - "\\vspace*{0.5cm}\n" - "{\\small " << dateToString(TRUE) << "}\\\\\n" - "\\end{center}\n" + t << " Doxygen " << versionString << "}\\\\\n"; + if (Config_getBool("LATEX_TIMESTAMP")) + t << "\\vspace*{0.5cm}\n" + "{\\small " << dateToString(TRUE) << "}\\\\\n"; + t << "\\end{center}\n" "\\end{titlepage}\n"; bool compactLatex = Config_getBool("COMPACT_LATEX"); if (!compactLatex) @@ -590,15 +799,17 @@ void LatexGenerator::startFile(const char *name,const char *,const char *) #endif QCString fileName=name; relPath = relativePathToRoot(fileName); - sourceFileName = stripPath(fileName); if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex"; startPlainFile(fileName); + m_codeGen.setTextStream(t); + m_codeGen.setRelativePath(relPath); + m_codeGen.setSourceFileName(stripPath(fileName)); } void LatexGenerator::endFile() { endPlainFile(); - sourceFileName.resize(0); + m_codeGen.setSourceFileName(""); } //void LatexGenerator::writeIndex() @@ -611,14 +822,6 @@ void LatexGenerator::startProjectNumber() t << "\\\\[1ex]\\large "; } -static QCString convertToLaTeX(const QCString &s) -{ - QGString result; - FTextStream t(&result); - filterLatexString(t,s,FALSE,FALSE,FALSE); - return result.data(); -} - void LatexGenerator::startIndexSection(IndexSections is) { bool &compactLatex = Config_getBool("COMPACT_LATEX"); @@ -1201,7 +1404,8 @@ void LatexGenerator::endTextLink() void LatexGenerator::writeObjectLink(const char *ref, const char *f, const char *anchor, const char *text) { - if (!disableLinks && !ref && Config_getBool("PDF_HYPERLINKS")) + static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); + if (!disableLinks && !ref && pdfHyperlinks) { t << "\\hyperlink{"; if (f) t << stripPath(f); @@ -1232,34 +1436,6 @@ void LatexGenerator::endPageRef(const char *clname, const char *anchor) t << "}"; } -void LatexGenerator::writeCodeLink(const char *ref,const char *f, - const char *anchor,const char *name, - const char *) -{ - static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); - static bool usePDFLatex = Config_getBool("USE_PDFLATEX"); - int l = qstrlen(name); - if (col+l>80) - { - t << "\n "; - col=0; - } - if (/*m_prettyCode &&*/ !disableLinks && !ref && usePDFLatex && pdfHyperlinks) - { - t << "\\hyperlink{"; - if (f) t << stripPath(f); - if (f && anchor) t << "_"; - if (anchor) t << anchor; - t << "}{"; - codify(name); - t << "}"; - } - else - { - t << name; - } - col+=l; -} void LatexGenerator::startTitleHead(const char *fileName) { @@ -1285,9 +1461,9 @@ void LatexGenerator::endTitleHead(const char *fileName,const char *name) if (name) { t << "\\label{" << stripPath(fileName) << "}\\index{"; - escapeLabelName(name); + t << latexEscapeLabelName(name,insideTabbing); t << "@{"; - escapeMakeIndexChars(name); + t << latexEscapeIndexChars(name,insideTabbing); t << "}}" << endl; } } @@ -1366,53 +1542,56 @@ void LatexGenerator::startMemberDoc(const char *clname, t << "\\index{"; if (clname) { - escapeLabelName(clname); + t << latexEscapeLabelName(clname,insideTabbing); t << "@{"; - escapeMakeIndexChars(clname); + t << latexEscapeIndexChars(clname,insideTabbing); t << "}!"; } - escapeLabelName(memname); + t << latexEscapeLabelName(memname,insideTabbing); t << "@{"; - escapeMakeIndexChars(memname); + t << latexEscapeIndexChars(memname,insideTabbing); t << "}}" << endl; t << "\\index{"; - escapeLabelName(memname); + t << latexEscapeLabelName(memname,insideTabbing); t << "@{"; - escapeMakeIndexChars(memname); + t << latexEscapeIndexChars(memname,insideTabbing); t << "}"; if (clname) { t << "!"; - escapeLabelName(clname); + t << latexEscapeLabelName(clname,insideTabbing); t << "@{"; - escapeMakeIndexChars(clname); + t << latexEscapeIndexChars(clname,insideTabbing); t << "}"; } t << "}" << endl; } static const char *levelLab[] = { "subsubsection","paragraph","subparagraph", "subparagraph" }; static bool compactLatex = Config_getBool("COMPACT_LATEX"); + static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); int level=0; if (showInline) level+=2; if (compactLatex) level++; t << "\\" << levelLab[level]; - //if (Config_getBool("PDF_HYPERLINKS") && memname) - //{ - // t << "["; - // escapeMakeIndexChars(this,t,memname); - // t << "]"; - //} t << "[{"; - escapeMakeIndexChars(title); + if (pdfHyperlinks) + { + t << "\\texorpdfstring{"; + } + t << latexEscapeIndexChars(title,insideTabbing); + if (pdfHyperlinks) + { + t << "}{" << latexEscapePDFString(title) << "}"; + } t << "}]"; t << "{\\setlength{\\rightskip}{0pt plus 5cm}"; disableLinks=TRUE; } -void LatexGenerator::endMemberDoc(bool) -{ +void LatexGenerator::endMemberDoc(bool) +{ disableLinks=FALSE; t << "}"; //if (Config_getBool("COMPACT_LATEX")) t << "\\hfill"; @@ -1422,6 +1601,10 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *, const char *anchor, const char *, const char *) { +} + +void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) +{ static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); static bool usePDFLatex = Config_getBool("USE_PDFLATEX"); if (usePDFLatex && pdfHyperlinks) @@ -1431,10 +1614,6 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *, if (anchor) t << "_" << anchor; t << "}{}"; } -} - -void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) -{ t << "\\label{"; if (fName) t << stripPath(fName); if (anchor) t << "_" << anchor; @@ -1471,16 +1650,16 @@ void LatexGenerator::addIndexItem(const char *s1,const char *s2) if (s1) { t << "\\index{"; - escapeLabelName(s1); + t << latexEscapeLabelName(s1,insideTabbing); t << "@{"; - escapeMakeIndexChars(s1); + t << latexEscapeIndexChars(s1,insideTabbing); t << "}"; if (s2) { t << "!"; - escapeLabelName(s2); + t << latexEscapeLabelName(s2,insideTabbing); t << "@{"; - escapeMakeIndexChars(s2); + t << latexEscapeIndexChars(s2,insideTabbing); t << "}"; } t << "}"; @@ -1536,94 +1715,6 @@ void LatexGenerator::docify(const char *str) filterLatexString(t,str,insideTabbing,FALSE,FALSE); } -void LatexGenerator::codify(const char *str) -{ - if (str) - { - const char *p=str; - char c; - //char cs[5]; - int spacesToNextTabStop; - static int tabSize = Config_getInt("TAB_SIZE"); - const int maxLineLen = 108; - QCString result(4*maxLineLen+1); // worst case for 1 line of 4-byte chars - int i; - while ((c=*p)) - { - switch(c) - { - case 0x0c: p++; // remove ^L - break; - case '\t': spacesToNextTabStop = - tabSize - (col%tabSize); - t << Doxygen::spaces.left(spacesToNextTabStop); - col+=spacesToNextTabStop; - p++; - break; - case '\n': t << '\n'; col=0; p++; - break; - default: - i=0; - -#undef COPYCHAR -// helper macro to copy a single utf8 character, dealing with multibyte chars. -#define COPYCHAR() do { \ - result[i++]=c; p++; \ - if (c<0) /* multibyte utf-8 character */ \ - { \ - /* 1xxx.xxxx: >=2 byte character */ \ - result[i++]=*p++; \ - if (((uchar)c&0xE0)==0xE0) \ - { \ - /* 111x.xxxx: >=3 byte character */ \ - result[i++]=*p++; \ - } \ - if (((uchar)c&0xF0)==0xF0) \ - { \ - /* 1111.xxxx: 4 byte character */ \ - result[i++]=*p++; \ - } \ - } \ - col++; \ - } while(0) - - // gather characters until we find whitespace or are at - // the end of a line - COPYCHAR(); - if (col>=maxLineLen) // force line break - { - t << "\n "; - col=0; - } - else // copy more characters - { - while (col<maxLineLen && (c=*p) && - c!=0x0c && c!='\t' && c!='\n' && c!=' ' - ) - { - COPYCHAR(); - } - if (col>=maxLineLen) // force line break - { - t << "\n "; - col=0; - } - } - result[i]=0; // add terminator - //if (m_prettyCode) - //{ - filterLatexString(t,result,insideTabbing,TRUE); - //} - //else - //{ - // t << result; - //} - break; - } - } - } -} - void LatexGenerator::writeChar(char c) { char cs[2]; @@ -2006,76 +2097,6 @@ void LatexGenerator::endConstraintList() t << "\\end{Desc}" << endl; } -void LatexGenerator::escapeLabelName(const char *s) -{ - if (s==0) return; - const char *p=s; - char c; - QCString result(qstrlen(s)+1); // worst case allocation - int i; - while ((c=*p++)) - { - switch (c) - { - case '|': t << "\\texttt{\"|}"; break; - case '!': t << "\"!"; break; - case '%': t << "\\%"; break; - case '{': t << "\\lcurly{}"; break; - case '}': t << "\\rcurly{}"; break; - case '~': t << "````~"; break; // to get it a bit better in index together with other special characters - // NOTE: adding a case here, means adding it to while below as well! - default: - i=0; - // collect as long string as possible, before handing it to docify - result[i++]=c; - while ((c=*p) && c!='|' && c!='!' && c!='%' && c!='{' && c!='}' && c!='~') - { - result[i++]=c; - p++; - } - result[i]=0; - docify(result); - break; - } - } -} - -void LatexGenerator::escapeMakeIndexChars(const char *s) -{ - if (s==0) return; - const char *p=s; - char c; - QCString result(qstrlen(s)+1); // worst case allocation - int i; - while ((c=*p++)) - { - switch (c) - { - case '!': t << "\"!"; break; - case '"': t << "\"\""; break; - case '@': t << "\"@"; break; - case '|': t << "\\texttt{\"|}"; break; - case '[': t << "["; break; - case ']': t << "]"; break; - case '{': t << "\\lcurly{}"; break; - case '}': t << "\\rcurly{}"; break; - // NOTE: adding a case here, means adding it to while below as well! - default: - i=0; - // collect as long string as possible, before handing it to docify - result[i++]=c; - while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|') - { - result[i++]=c; - p++; - } - result[i]=0; - docify(result); - break; - } - } -} - void LatexGenerator::startCodeFragment() { t << "\n\\begin{DoxyCode}\n"; @@ -2086,61 +2107,6 @@ void LatexGenerator::endCodeFragment() t << "\\end{DoxyCode}\n"; } -void LatexGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) -{ - static bool usePDFLatex = Config_getBool("USE_PDFLATEX"); - static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS"); - if (m_prettyCode) - { - QCString lineNumber; - lineNumber.sprintf("%05d",l); - - if (fileName && !sourceFileName.isEmpty()) - { - QCString lineAnchor; - lineAnchor.sprintf("_l%05d",l); - lineAnchor.prepend(sourceFileName); - //if (!m_prettyCode) return; - if (usePDFLatex && pdfHyperlinks) - { - t << "\\hypertarget{" << stripPath(lineAnchor) << "}{}"; - } - writeCodeLink(ref,fileName,anchor,lineNumber,0); - } - else - { - codify(lineNumber); - } - t << " "; - } - else - { - t << l << " "; - } -} - -void LatexGenerator::startCodeLine(bool) -{ - col=0; -} - -void LatexGenerator::endCodeLine() -{ - codify("\n"); -} - -void LatexGenerator::startFontClass(const char *name) -{ - //if (!m_prettyCode) return; - t << "\\textcolor{" << name << "}{"; -} - -void LatexGenerator::endFontClass() -{ - //if (!m_prettyCode) return; - t << "}"; -} - void LatexGenerator::startInlineHeader() { if (Config_getBool("COMPACT_LATEX")) @@ -2224,3 +2190,4 @@ void LatexGenerator::endLabels() { } + diff --git a/src/latexgen.h b/src/latexgen.h index ee67803..84382a7 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -24,6 +24,48 @@ class QFile; static const char *latexStyleExtension = ".sty"; +class LatexCodeGenerator : public CodeOutputInterface +{ + public: + LatexCodeGenerator(FTextStream &t,const QCString &relPath,const QCString &sourceFile); + LatexCodeGenerator(); + void setTextStream(FTextStream &t); + void setRelativePath(const QCString &path); + void setSourceFileName(const QCString &sourceFileName); + void codify(const char *text); + void writeCodeLink(const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip); + void writeTooltip(const char *, + const DocLinkInfo &, + const char *, + const char *, + const SourceLinkInfo &, + const SourceLinkInfo & + ) {} + void writeLineNumber(const char *,const char *,const char *,int); + void startCodeLine(bool); + void endCodeLine(); + void startFontClass(const char *); + void endFontClass(); + void writeCodeAnchor(const char *) {} + void setCurrentDoc(Definition *,const char *,bool) {} + void addWord(const char *,bool) {} + + private: + void _writeCodeLink(const char *className, + const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip); + void docify(const char *str); + bool m_streamSet; + FTextStream m_t; + QCString m_relPath; + QCString m_sourceFileName; + int m_col; + bool m_prettyCode; +}; + /** Generator for LaTeX output. */ class LatexGenerator : public OutputGenerator { @@ -47,6 +89,32 @@ class LatexGenerator : public OutputGenerator bool isEnabled(OutputType o) { return (o==Latex && active); } OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; } + // --- CodeOutputInterface + void codify(const char *text) + { m_codeGen.codify(text); } + void writeCodeLink(const char *ref, const char *file, + const char *anchor,const char *name, + const char *tooltip) + { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); } + void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber) + { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); } + void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, + const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo + ) + { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); } + void startCodeLine(bool hasLineNumbers) + { m_codeGen.startCodeLine(hasLineNumbers); } + void endCodeLine() + { m_codeGen.endCodeLine(); } + void startFontClass(const char *s) + { m_codeGen.startFontClass(s); } + void endFontClass() + { m_codeGen.endFontClass(); } + void writeCodeAnchor(const char *anchor) + { m_codeGen.writeCodeAnchor(anchor); } + // --------------------------- + + void writeDoc(DocNode *,Definition *ctx,MemberDef *); void startFile(const char *name,const char *manName,const char *title); @@ -83,15 +151,9 @@ class LatexGenerator : public OutputGenerator void startIndexItem(const char *ref,const char *file); void endIndexItem(const char *ref,const char *file); void docify(const char *text); - void codify(const char *text); void writeObjectLink(const char *ref,const char *file, const char *anchor,const char *name); - void writeCodeLink(const char *ref, const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & - ) {} + void startTextLink(const char *,const char *); void endTextLink(); void startHtmlLink(const char *url); @@ -137,9 +199,6 @@ class LatexGenerator : public OutputGenerator void writeAnchor(const char *fileName,const char *name); void startCodeFragment(); void endCodeFragment(); - void writeLineNumber(const char *,const char *,const char *,int l); - void startCodeLine(bool hasLineNumbers); - void endCodeLine(); void startEmphasis() { t << "{\\em "; } void endEmphasis() { t << "}"; } void startBold() { t << "{\\bfseries "; } @@ -267,10 +326,6 @@ class LatexGenerator : public OutputGenerator void writeLabel(const char *l,bool isLast); void endLabels(); - void startFontClass(const char *); // {} - void endFontClass(); // {} - - void writeCodeAnchor(const char *) {} void setCurrentDoc(Definition *,const char *,bool) {} void addWord(const char *,bool) {} @@ -278,17 +333,14 @@ class LatexGenerator : public OutputGenerator private: LatexGenerator(const LatexGenerator &); LatexGenerator &operator=(const LatexGenerator &); - void escapeLabelName(const char *s); - void escapeMakeIndexChars(const char *s); - int col; bool insideTabbing; bool firstDescItem; bool disableLinks; QCString relPath; - QCString sourceFileName; int m_indent; bool templateMemberItem; bool m_prettyCode; + LatexCodeGenerator m_codeGen; }; #endif diff --git a/src/layout.cpp b/src/layout.cpp index 75cb6b3..2835e77 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -888,7 +888,7 @@ class LayoutParser : public QXmlDefaultHandler // no MainPage node... add one as the first item of the root node... new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE, /*Config_getBool("GENERATE_TREEVIEW") ? "main" :*/ "index", - theTranslator->trMainPage(),TRUE); + theTranslator->trMainPage(),"",TRUE); } } @@ -1269,6 +1269,7 @@ class LayoutParser : public QXmlDefaultHandler private: LayoutParser() : m_sHandler(163), m_eHandler(17), m_invalidEntry(FALSE) { } + ~LayoutParser() { delete m_rootNav; } QDict<StartElementHandler> m_sHandler; QDict<EndElementHandler> m_eHandler; @@ -1396,7 +1397,8 @@ void LayoutDocManager::parse(QTextStream &t,const char *fileName) void writeDefaultLayoutFile(const char *fileName) { QFile f(fileName); - if (!f.open(IO_WriteOnly)) + bool ok = openOutputFile(fileName,f); + if (!ok) { err("Failed to open file %s for writing!\n",fileName); return; diff --git a/src/lodepng.cpp b/src/lodepng.cpp index 084f1c8..dbbced5 100644 --- a/src/lodepng.cpp +++ b/src/lodepng.cpp @@ -2347,7 +2347,7 @@ unsigned LodePNG_InfoRaw_copy(LodePNG_InfoRaw* dest, const LodePNG_InfoRaw* sour LodePNG_InfoRaw_cleanup(dest); *dest = *source; LodePNG_InfoColor_init(&dest->color); - error = LodePNG_InfoColor_copy(&dest->color, &source->color); if(error) return error; + error = LodePNG_InfoColor_copy(&dest->color, &source->color); return error; } diff --git a/src/main.cpp b/src/main.cpp index cfd38ce..2061087 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 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 + * 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. * @@ -25,7 +25,7 @@ */ /*! Default main. The idea of separating this from the rest of doxygen, - * is to make it possible to write your own main, with a different + * is to make it possible to write your own main, with a different * generateOutput() function for instance. */ int main(int argc,char **argv) diff --git a/src/markdown.cpp b/src/markdown.cpp index 02d1416..6ff8344 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -589,8 +589,8 @@ static int processHtmlTag(GrowBuf &out,const char *data,int offset,int size) static int processEmphasis(GrowBuf &out,const char *data,int offset,int size) { if ((offset>0 && !isOpenEmphChar(-1)) || // invalid char before * or _ - (size>1 && data[0]!=data[1] && !isIdChar(1)) || // invalid char after * or _ - (size>2 && data[0]==data[1] && !isIdChar(2))) // invalid char after ** or __ + (size>1 && data[0]!=data[1] && !(isIdChar(1) || data[1]=='[')) || // invalid char after * or _ + (size>2 && data[0]==data[1] && !(isIdChar(2) || data[2]=='['))) // invalid char after ** or __ { return 0; } @@ -695,14 +695,26 @@ static int processLink(GrowBuf &out,const char *data,int,int size) if (i<size && data[i]=='<') i++; linkStart=i; nl=0; - while (i<size && data[i]!='\'' && data[i]!='"' && data[i]!=')') + int braceCount=1; + while (i<size && data[i]!='\'' && data[i]!='"' && braceCount>0) { - if (data[i]=='\n') + if (data[i]=='\n') // unexpected EOL { nl++; if (nl>1) return 0; } - i++; + else if (data[i]=='(') + { + braceCount++; + } + else if (data[i]==')') + { + braceCount--; + } + if (braceCount>0) + { + i++; + } } if (i>=size || data[i]=='\n') return 0; convertStringFragment(link,data+linkStart,i-linkStart); @@ -720,7 +732,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) nl=0; while (i<size && data[i]!=')') { - if (data[i]=='\n') + if (data[i]=='\n') { if (nl>1) return 0; nl++; @@ -889,7 +901,8 @@ static int processLink(GrowBuf &out,const char *data,int,int size) out.addStr("\""); } out.addStr(">"); - out.addStr(content.simplifyWhiteSpace()); + content = content.simplifyWhiteSpace(); + processInline(out,content,content.length()); out.addStr("</a>"); } else // avoid link to e.g. F[x](y) @@ -1005,8 +1018,8 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int if (size>1 && data[0]=='\\') { char c=data[1]; - if (c=='[' || c==']' || c=='*' || c=='+' || c=='-' || - c=='!' || c=='(' || c==')' || c=='.' || c=='`' || c=='_') + if (c=='[' || c==']' || c=='*' || /* c=='+' || c=='-' || c=='.' || */ + c=='!' || c=='(' || c==')' || c=='`' || c=='_') { if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \--- { @@ -1018,7 +1031,11 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int out.addStr(&data[1],2); return 3; } - out.addStr(&data[1],1); + else if (c=='-') // \- + { + out.addChar(c); + } + out.addChar(data[1]); return 2; } } @@ -2351,21 +2368,22 @@ void MarkdownFileParser::parseInput(const char *fileName, QCString fn = QFileInfo(fileName).fileName().utf8(); static QCString mdfileAsMainPage = Config_getString("USE_MDFILE_AS_MAINPAGE"); if (id.isEmpty()) id = markdownFileNameToId(fileName); - if (title.isEmpty()) title = titleFn; if (!mdfileAsMainPage.isEmpty() && (fn==mdfileAsMainPage || // name reference QFileInfo(fileName).absFilePath()== QFileInfo(mdfileAsMainPage).absFilePath()) // file reference with path ) { - docs.prepend("@mainpage\n"); + docs.prepend("@mainpage "+title+"\n"); } else if (id=="mainpage" || id=="index") { + if (title.isEmpty()) title = titleFn; docs.prepend("@mainpage "+title+"\n"); } else { + if (title.isEmpty()) title = titleFn; docs.prepend("@page "+id+" "+title+"\n"); } int lineNr=1; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7f93b51..af4a690 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -967,7 +967,7 @@ QCString MemberDef::getOutputFileBase() const return baseName; } } - else if (m_impl->nspace) + else if (m_impl->nspace && m_impl->nspace->isLinkableInProject()) { baseName=m_impl->nspace->getOutputFileBase(); } @@ -1092,7 +1092,8 @@ void MemberDef::_computeLinkableInProject() m_isLinkableCached = 1; // in class but class not linkable return; } - if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject()) + if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject() + && (m_impl->fileDef==0 || !m_impl->fileDef->isLinkableInProject())) { //printf("in a namespace but namespace not linkable!\n"); m_isLinkableCached = 1; // in namespace but namespace not linkable @@ -1417,6 +1418,7 @@ void MemberDef::writeDeclaration(OutputList &ol, // are explicitly grouped. if (!inGroup && m_impl->mtype==MemberType_EnumValue) return; + Definition *d=0; ASSERT (cd!=0 || nd!=0 || fd!=0 || gd!=0); // member should belong to something if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd; @@ -1443,19 +1445,21 @@ void MemberDef::writeDeclaration(OutputList &ol, // If there is no detailed description we need to write the anchor here. bool detailsVisible = isDetailedSectionLinkable(); - if (!detailsVisible) + bool writeAnchor = (inGroup || m_impl->group==0) && // only write anchors for member that have no details and are + !detailsVisible && !m_impl->annMemb; // rendered inside the group page or are not grouped at all + if (writeAnchor) { QCString doxyArgs=argsString(); - if (!m_impl->annMemb) + QCString doxyName=name(); + if (!cname.isEmpty()) { - QCString doxyName=name(); - if (!cname.isEmpty()) - { - doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage())); - } - ol.startDoxyAnchor(cfname,cname,anchor(),doxyName,doxyArgs); + doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage())); } + ol.startDoxyAnchor(cfname,cname,anchor(),doxyName,doxyArgs); + } + if (!detailsVisible) + { ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Latex); @@ -1512,12 +1516,17 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.writeNonBreakableSpace(3); } QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); - //printf(">>>>>> indDepth=%d ltype=`%s' varName=`%s'\n",indDepth,ltype.data(),varName.data()); + //printf(">>>>>> ltype=`%s' varName=`%s'\n",ltype.data(),varName.data()); ol.docify("}"); if (varName.isEmpty() && (name().isEmpty() || name().at(0)=='@')) { ol.docify(";"); } + else if (!varName.isEmpty() && (varName.at(0)=='*' || varName.at(0)=='&')) + { + ol.docify(" "); + ol.docify(varName); + } endAnonScopeNeeded=TRUE; } else @@ -1774,7 +1783,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.endTypewriter(); } - if (!detailsVisible && !m_impl->annMemb) + if (writeAnchor) { ol.endDoxyAnchor(cfname,anchor()); } @@ -1914,7 +1923,7 @@ bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS"); static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages; - bool fileFilter = getNamespaceDef()==0 || !inFile; + bool fileFilter = getNamespaceDef()==0 || !getNamespaceDef()->isLinkable() || !inFile; bool simpleFilter = (hasBriefDescription() || !hideUndocMembers) && inlineSimpleStructs && getClassDef()!=0 && getClassDef()->isSimple(); @@ -2261,7 +2270,7 @@ void MemberDef::_writeCategoryRelation(OutputList &ol) text = theTranslator->trExtendsClass(); name = m_impl->classDef->categoryOf()->displayName(); } - i=text.find("@1"); + i=text.find("@0"); if (i!=-1) { MemberDef *md = m_impl->categoryRelation; @@ -2495,7 +2504,7 @@ void MemberDef::_writeGroupInclude(OutputList &ol,bool inGroup) if (isIDLorJava) ol.docify("\""); else ol.docify("<"); - if (fd && fd->isLinkable()) + if (fd->isLinkable()) { ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),fd->anchor(),nm); } @@ -3223,10 +3232,9 @@ void MemberDef::warnIfUndocumented() t="file", d=fd; static bool extractAll = Config_getBool("EXTRACT_ALL"); - //printf("warnIfUndoc: d->isLinkable()=%d isLinkable()=%d " - // "isDocumentedFriendClass()=%d name()=%s prot=%d isReference=%d\n", - // d->isLinkable(),isLinkable(),isDocumentedFriendClass(), - // name().data(),m_impl->prot,isReference()); + //printf("%s:warnIfUndoc: hasUserDocs=%d isFriendClass=%d protection=%d isRef=%d isDel=%d\n", + // name().data(), + // hasUserDocumentation(),isFriendClass(),protectionLevelVisible(m_impl->prot),isReference(),isDeleted()); if ((!hasUserDocumentation() && !extractAll) && !isFriendClass() && name().find('@')==-1 && d && d->name().find('@')==-1 && @@ -3234,7 +3242,7 @@ void MemberDef::warnIfUndocumented() !isReference() && !isDeleted() ) { - warn_undoc(d->getDefFileName(),d->getDefLine(),"Member %s%s (%s) of %s %s is not documented.", + warn_undoc(getDefFileName(),getDefLine(),"Member %s%s (%s) of %s %s is not documented.", qPrint(name()),qPrint(argsString()),qPrint(memberTypeName()),t,qPrint(d->name())); } } @@ -4481,6 +4489,11 @@ MemberDef *MemberDef::getEnumScope() const return m_impl->enumScope; } +bool MemberDef::livesInsideEnum() const +{ + return m_impl->livesInsideEnum; +} + MemberList *MemberDef::enumFieldList() const { return m_impl->enumFields; diff --git a/src/memberdef.h b/src/memberdef.h index f60fb54..19a37ea 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -176,6 +176,7 @@ class MemberDef : public Definition bool protectionVisible() const; bool showInCallGraph() const; bool isStrongEnumValue() const; + bool livesInsideEnum() const; // derived getters bool isFriendToHide() const; diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 4bf7721..cbda94d 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -42,7 +42,7 @@ MemberGroup::MemberGroup() } MemberGroup::MemberGroup(Definition *parent, - int id,const char *hdr,const char *d,const char *docFile) + int id,const char *hdr,const char *d,const char *docFile,int docLine) { //printf("New member group id=%d header=%s desc=%s\n",id,hdr,d); memberList = new MemberList(MemberListType_memberGroup); @@ -56,6 +56,7 @@ MemberGroup::MemberGroup(Definition *parent, m_numDocMembers = -1; m_parent = parent; m_docFile = docFile; + m_docLine = docLine; m_xrefListItems = 0; //printf("Member group docs=`%s'\n",doc.data()); } @@ -76,7 +77,7 @@ void MemberGroup::insertMember(MemberDef *md) // md,md->name().data()); MemberDef *firstMd = memberList->getFirst(); - if (inSameSection && memberList->count()>0 && + if (inSameSection && firstMd && firstMd->getSectionList(m_parent)!=md->getSectionList(m_parent)) { inSameSection=FALSE; diff --git a/src/membergroup.h b/src/membergroup.h index fa5520e..c42efc9 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -42,7 +42,7 @@ class MemberGroup public: MemberGroup(); MemberGroup(Definition *parent,int id,const char *header, - const char *docs,const char *docFile); + const char *docs,const char *docFile,int docLine); ~MemberGroup(); QCString header() const { return grpHeader; } int groupId() const { return grpId; } @@ -89,6 +89,9 @@ class MemberGroup Definition *parent() const { return m_parent; } QCString anchor() const; + QCString docFile() const { return m_docFile; } + int docLine() const { return m_docLine; } + void marshal(StorageIntf *s); void unmarshal(StorageIntf *s); @@ -105,6 +108,7 @@ class MemberGroup int m_numDocMembers; Definition *m_parent; QCString m_docFile; + int m_docLine; QList<ListItemInfo> *m_xrefListItems; }; @@ -137,12 +141,13 @@ class MemberGroupSDict : public SIntDict<MemberGroup> /** Data collected for a member group */ struct MemberGroupInfo { - MemberGroupInfo() : m_sli(0) {} + MemberGroupInfo() : m_sli(0), docLine(-1) {} ~MemberGroupInfo() { delete m_sli; m_sli=0; } void setRefItems(const QList<ListItemInfo> *sli); QCString header; QCString doc; QCString docFile; + int docLine; QCString compoundName; QList<ListItemInfo> *m_sli; }; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 64fe44a..f58ade4 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -324,6 +324,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, ) { //printf("----- writePlainDeclaration() ----\n"); + static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); countDecMembers(); if (numDecMembers()==0) { @@ -387,7 +388,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, } // if this is an anonymous enum and there are variables of this // enum type (i.e. enumVars>0), then we do not show the enum here. - if (enumVars==0) // show enum here + if (enumVars==0 && !hideUndocMembers) // show enum here { //printf("Enum!!\n"); if (first) @@ -435,8 +436,8 @@ void MemberList::writePlainDeclarations(OutputList &ol, } delete rootNode; } - ol.endMemberDeclaration(md->anchor(),inheritId); ol.endMemberItem(); + ol.endMemberDeclaration(md->anchor(),inheritId); } md->warnIfUndocumented(); break; @@ -627,7 +628,7 @@ void MemberList::writeDeclarations(OutputList &ol, { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); - ol.generateDoc("[generated]",-1,ctx,0,mg->documentation()+"\n",FALSE,FALSE); + ol.generateDoc(mg->docFile(),mg->docLine(),ctx,0,mg->documentation()+"\n",FALSE,FALSE); ol.endMemberGroupDocs(); } ol.startMemberGroup(); @@ -681,7 +682,7 @@ void MemberList::writeDocumentation(OutputList &ol, } if (memberGroupList) { - //printf("MemberList::writeDocumentation() -- member groups\n"); + printf("MemberList::writeDocumentation() -- member groups %d\n",memberGroupList->count()); MemberGroupListIterator mgli(*memberGroupList); MemberGroup *mg; for (;(mg=mgli.current());++mgli) diff --git a/src/message.cpp b/src/message.cpp index 8f89c11..c61de68 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -69,10 +69,10 @@ void initWarningFormat() // { // warnFormatOrder = 6; // } -// outputFormat = +// outputFormat = // substitute( // substitute( -// substitute( +// substitute( // Config_getString("WARN_FORMAT"), // "$file","%s" // ), @@ -96,6 +96,11 @@ void initWarningFormat() { warnFile = stderr; } + + if (Config_getBool("WARN_AS_ERROR")) + { + warning_str = error_str; + } } @@ -130,23 +135,33 @@ static void format_warn(const char *file,int line,const char *text) } } // substitute markers by actual values - QCString msgText = + bool warnAsError = Config_getBool("WARN_AS_ERROR"); + QCString msgText = substitute( substitute( substitute( - substitute( + substitute( outputFormat, "$file",fileSubst ), - "$text",textSubst + "$line",lineSubst ), - "$line",lineSubst + "$version",versionSubst ), - "$version",versionSubst - )+'\n'; + "$text",textSubst + ); + if (warnAsError) + { + msgText += " (warning treated as error, aborting now)"; + } + msgText += '\n'; // print resulting message fwrite(msgText.data(),1,msgText.length(),warnFile); + if (warnAsError) + { + exit(1); + } } static void do_warn(const char *tag, const char *file, int line, const char *prefix, const char *fmt, va_list args) @@ -170,7 +185,7 @@ void warn(const char *file,int line,const char *fmt, ...) va_list args; va_start(args, fmt); do_warn("WARNINGS", file, line, warning_str, fmt, args); - va_end(args); + va_end(args); } void va_warn(const char *file,int line,const char *fmt,va_list args) @@ -191,7 +206,7 @@ void warn_undoc(const char *file,int line,const char *fmt, ...) do_warn("WARN_IF_UNDOCUMENTED", file, line, warning_str, fmt, args); va_end(args); } - + void warn_doc_error(const char *file,int line,const char *fmt, ...) { va_list args; @@ -205,7 +220,7 @@ void warn_uncond(const char *fmt, ...) va_list args; va_start(args, fmt); vfprintf(warnFile, (QCString(warning_str) + fmt).data(), args); - va_end(args); + va_end(args); } void err(const char *fmt, ...) @@ -213,7 +228,7 @@ void err(const char *fmt, ...) va_list args; va_start(args, fmt); vfprintf(warnFile, (QCString(error_str) + fmt).data(), args); - va_end(args); + va_end(args); } extern void err_full(const char *file,int line,const char *fmt, ...) @@ -221,7 +236,7 @@ extern void err_full(const char *file,int line,const char *fmt, ...) va_list args; va_start(args, fmt); do_warn(NULL, file, line, error_str, fmt, args); - va_end(args); + va_end(args); } void printlex(int dbg, bool enter, const char *lexName, const char *fileName) diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index a2341c7..948c86a 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -984,7 +984,7 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title, ol.startMemberList(); for (ni.toFirst();(nd=ni.current());++ni) { - if (nd->isLinkable()) + if (nd->isLinkable() && nd->hasDocumentation()) { SrcLangExt lang = nd->getLanguage(); if (lang==SrcLangExt_IDL && (isConstantGroup != nd->isConstantGroup())) diff --git a/src/outputgen.cpp b/src/outputgen.cpp index 31f682e..53d2d7f 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -44,11 +44,6 @@ void OutputGenerator::startPlainFile(const char *name) //printf("startPlainFile(%s)\n",name); fileName=dir+"/"+name; file = new QFile(fileName); - if (!file) - { - err("Could not create file object for %s\n",fileName.data()); - exit(1); - } if (!file->open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fileName.data()); diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 18a8205..20ace23 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -34,6 +34,8 @@ PageDef::PageDef(const char *f,int l,const char *n, m_subPageDict = new PageSDict(7); m_pageScope = 0; m_nestingLevel = 0; + static bool shortNames = Config_getBool("SHORT_NAMES"); + m_fileName = shortNames ? convertNameToFile(n) : QCString(n); m_showToc = FALSE; } @@ -61,20 +63,11 @@ QCString PageDef::getOutputFileBase() const return m_fileName; } -void PageDef::setFileName(const char *name,bool dontEscape) -{ - static bool shortNames = Config_getBool("SHORT_NAMES"); - if (shortNames && !dontEscape) - { - m_fileName = convertNameToFile(name); - } - else - { - m_fileName = name; - } +void PageDef::setFileName(const char *name) +{ + m_fileName = name; } - void PageDef::addInnerCompound(Definition *def) { if (def->definitionType()==Definition::TypePage) diff --git a/src/pagedef.h b/src/pagedef.h index c3e54a3..41b84cb 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -33,7 +33,7 @@ class PageDef : public Definition ~PageDef(); // setters - void setFileName(const char *name,bool dontEscape); + void setFileName(const char *name); void setShowToc(bool b); // getters diff --git a/src/plantuml.cpp b/src/plantuml.cpp index e3a85e4..7d28688 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -96,12 +96,12 @@ void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutp pumlArgs+=" \""; pumlArgs+=baseName; pumlArgs+=".pu\" "; - pumlArgs+="-charset " + Config_getString("INPUT_ENCODING") + " "; + pumlArgs+="-charset UTF-8 "; int exitCode; //printf("*** running: %s %s outDir:%s %s\n",pumlExe.data(),pumlArgs.data(),outDir,outFile); msg("Running PlantUML on generated file %s.pu\n",baseName); portable_sysTimerStart(); - if ((exitCode=portable_system(pumlExe,pumlArgs,FALSE))!=0) + if ((exitCode=portable_system(pumlExe,pumlArgs,TRUE))!=0) { err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n", plantumlJarPath.data(),exitCode); diff --git a/src/portable_c.c b/src/portable_c.c index 944c996..3a79741 100644 --- a/src/portable_c.c +++ b/src/portable_c.c @@ -1,9 +1,13 @@ #if (defined(__APPLE__) || defined(macintosh)) && !defined(DMG_BUILD) +#include <AvailabilityMacros.h> +// this hack doesn't seem to be needed on El Captain (10.11) +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11 // define this before including iconv.h to avoid a mapping of // iconv_open and friends to libicon_open (done by mac ports), // while the symbols without 'lib' are linked from /usr/lib/libiconv #define LIBICONV_PLUG #endif +#endif #include <iconv.h> // These functions are implemented in a C file, because there are different @@ -1659,6 +1659,7 @@ static void endCondSection() { CondCtx *ctx = g_condStack.pop(); g_skip=ctx->skip; + delete ctx; } //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); } @@ -1667,7 +1668,7 @@ static void forceEndCondSection() { while (!g_condStack.isEmpty()) { - g_condStack.pop(); + delete g_condStack.pop(); } g_skip=FALSE; } @@ -3010,8 +3011,8 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) g_includeStack.clear(); g_expandedDict->setAutoDelete(FALSE); g_expandedDict->clear(); - g_condStack.clear(); g_condStack.setAutoDelete(TRUE); + g_condStack.clear(); //g_fileDefineDict->clear(); setFileName(fileName); @@ -3161,6 +3162,7 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label %s ",ctx->sectionId.data()); warn(fileName,ctx->lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); + delete ctx; } // make sure we don't extend a \cond with missing \endcond over multiple files (see bug 624829) forceEndCondSection(); diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 95e7e47..b86670a 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -536,10 +536,11 @@ class PrintDocVisitor : public DocVisitor indent_pre(); printf("<ref ref=\"%s\" file=\"%s\" " "anchor=\"%s\" targetTitle=\"%s\"" - " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\">\n", + " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\" refToTable=\"%s\">\n", ref->ref().data(),ref->file().data(),ref->anchor().data(), ref->targetTitle().data(),ref->hasLinkText()?"yes":"no", - ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no"); + ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no", + ref->refToTable()?"yes":"no"); } void visitPost(DocRef *) { diff --git a/src/pycode.l b/src/pycode.l index 3c41a69..b8ca5ed 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -90,6 +90,9 @@ static int g_stringContext; static QValueStack<uint> g_indents; //!< Tracks indentation levels for scoping in python +static QCString g_docBlock; //!< contents of all lines of a documentation block +static bool g_endComment; + static void endFontClass(); static void adjustScopesAndSuites(unsigned indentLength); @@ -361,11 +364,13 @@ static void startCodeLine() Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr); //printf("startCodeLine %d d=%p\n",g_yyLineNr,d); //g_code->startLineNumber(); + if (!g_includeCodeFragment && d && d->isLinkableInProject()) { g_currentDefinition = d; g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr); //g_insideBody = FALSE; + g_endComment = FALSE; g_searchingForBody = TRUE; g_realScope = d->name().copy(); g_classScope = d->name().copy(); @@ -467,6 +472,26 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol, } } +static void startFontClass(const char *s) +{ + // if font class is already set don't stop and start it. + // strcmp does not like null pointers as input. + if (!g_currentFontClass || !s || strcmp(g_currentFontClass,s)) + { + endFontClass(); + g_code->startFontClass(s); + g_currentFontClass=s; + } +} + +static void endFontClass() +{ + if (g_currentFontClass) + { + g_code->endFontClass(); + g_currentFontClass=0; + } +} static void codifyLines(char *text) { @@ -474,6 +499,7 @@ static void codifyLines(char *text) char *p=text,*sp=p; char c; bool done=FALSE; + const char * tmp_currentFontClass = g_currentFontClass; while (!done) { sp=p; @@ -483,7 +509,15 @@ static void codifyLines(char *text) g_yyLineNr++; *(p-1)='\0'; g_code->codify(sp); - nextCodeLine(); + endCodeLine(); + if (g_yyLineNr<g_inputLines) + { + startCodeLine(); + } + if (tmp_currentFontClass) + { + startFontClass(tmp_currentFontClass); + } } else { @@ -493,6 +527,13 @@ static void codifyLines(char *text) } } +static void codifyLines(const QCString &str) +{ + char *tmp= (char *)malloc(str.length()+1); + qstrcpy(tmp, str); + codifyLines(tmp); + free(tmp); +} static bool getLinkInScope(const QCString &c, // scope const QCString &m, // member @@ -796,22 +837,6 @@ static void findMemberLink(CodeOutputInterface &ol,char *symName) codify(symName); } -static void startFontClass(const char *s) -{ - endFontClass(); - g_code->startFontClass(s); - g_currentFontClass=s; -} - -static void endFontClass() -{ - if (g_currentFontClass) - { - g_code->endFontClass(); - g_currentFontClass=0; - } -} - #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); @@ -842,7 +867,7 @@ PARAMNONEMPTY [^ \t\n():] IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")* BORDER ([^A-Za-z0-9]) -POUNDCOMMENT "#".* +POUNDCOMMENT "##" TRISINGLEQUOTE "'''" TRIDOUBLEQUOTE "\"\"\"" @@ -938,7 +963,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT %option noyywrap -%option nounput +%option stack %x Body @@ -960,6 +985,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT %x DoubleQuoteString %x TripleString +%x DocBlock %% <Body,Suite>{ @@ -989,6 +1015,14 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT codify("self."); findMemberLink(*g_code,&yytext[5]); } + "cls."{IDENTIFIER}/"(" { + codify("cls."); + findMemberLink(*g_code,&yytext[4]); + } + "cls."{IDENTIFIER} { + codify("cls."); + findMemberLink(*g_code,&yytext[4]); + } } <ClassDec>{IDENTIFIER} { @@ -1168,11 +1202,16 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT {POUNDCOMMENT} { - // This eats EVERYTHING - // except the newline - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + if (YY_START==SingleQuoteString || + YY_START==DoubleQuoteString || + YY_START==TripleString + ) + { + REJECT; + } + yy_push_state(YY_START); + BEGIN(DocBlock); + g_docBlock=yytext; } {NEWLINE} { @@ -1341,6 +1380,28 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT codify(yytext); BEGIN(DoubleQuoteString); } +<DocBlock>.* { // contents of current comment line + g_docBlock+=yytext; + } +<DocBlock>"\n"{B}("#") { // comment block (next line is also comment line) + g_docBlock+=yytext; + } +<DocBlock>{NEWLINE} { // comment block ends at the end of this line + // remove special comment (default config) + if (Config_getBool("STRIP_CODE_COMMENTS")) + { + g_yyLineNr+=((QCString)g_docBlock).contains('\n'); + g_endComment=TRUE; + } + else // do not remove comment + { + startFontClass("comment"); + codifyLines(g_docBlock); + endFontClass(); + } + unput(*yytext); + yy_pop_state(); + } <*>{POUNDCOMMENT} { if (YY_START==SingleQuoteString || YY_START==DoubleQuoteString || @@ -1349,14 +1410,31 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT { REJECT; } - // This eats EVERYTHING - // except the newline + yy_push_state(YY_START); + BEGIN(DocBlock); + g_docBlock=yytext; + } +<*>"#".* { // normal comment + if (YY_START==SingleQuoteString || + YY_START==DoubleQuoteString || + YY_START==TripleString + ) + { + REJECT; + } startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + codifyLines(yytext); + endFontClass(); } <*>{NEWLINE} { - codifyLines(yytext); + if (g_endComment) + { + g_endComment=FALSE; + } + else + { + codifyLines(yytext); + } //printf("[pycode] %d NEWLINE [line %d] no match\n", // YY_START, g_yyLineNr); @@ -1377,6 +1455,17 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT BEGIN(Body); } +<*><<EOF>> { + if (YY_START == DocBlock) { + if (!Config_getBool("STRIP_CODE_COMMENTS")) + { + startFontClass("comment"); + codifyLines(g_docBlock); + endFontClass(); + } + } + yyterminate(); + } %% /*@ ---------------------------------------------------------------------------- @@ -1503,7 +1592,7 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, extern "C" { // some bogus code to keep the compiler happy void pycodeYYdummy() { yy_flex_realloc(0,0); } } -#elif YY_FLEX_SUBMINOR_VERSION<33 +#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 #error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." #endif diff --git a/src/pyscanner.l b/src/pyscanner.l index 8332a36..9ec69be 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -113,6 +113,9 @@ static int g_braceCount; static bool g_lexInit = FALSE; static bool g_packageCommentAllowed; +static bool g_start_init = FALSE; +static int g_search_count = 0; + //----------------------------------------------------------------------------- @@ -398,7 +401,6 @@ static void searchFoundDef() current->startLine = yyLineNr; current->bodyLine = yyLineNr; current->section = Entry::FUNCTION_SEC; - current->protection = protection = Public; current->lang = SrcLangExt_Python; current->virt = Normal; current->stat = gstat; @@ -458,6 +460,7 @@ OCTNUMBER "0"[0-7]+[lL]? NUMBER {DIGIT}+[lLjJ]? INTNUMBER {HEXNUMBER}|{OCTNUMBER}|{NUMBER} FLOATNUMBER {DIGIT}+"."{DIGIT}+([eE][+\-]?{DIGIT}+)?[jJ]? +BOOL ("True"|"False") LETTER [A-Za-z\x80-\xFF] NONEMPTY [A-Za-z0-9_\x80-\xFF] EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-] @@ -483,6 +486,7 @@ STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR") KEYWORD ("lambda"|"import"|"class"|"assert"|"as"|"from"|"global"|"def"|"True"|"False") FLOWKW ("or"|"and"|"is"|"not"|"print"|"for"|"in"|"if"|"try"|"except"|"yield"|"raise"|"break"|"continue"|"pass"|"if"|"return"|"while"|"elif"|"else"|"finally") POUNDCOMMENT "#"[^#\n][^\n]* +SCRIPTCOMMENT "#!".* STARTDOCSYMS "##" @@ -580,6 +584,7 @@ STARTDOCSYMS "##" BEGIN(VariableDec); } ^{B}{IDENTIFIER}/{B}"="[^=] { // variable + if (g_search_count) REJECT; g_indent=computeIndent(yytext); current->section = Entry::VARIABLE_SEC; current->name = QCString(yytext).stripWhiteSpace(); @@ -589,6 +594,20 @@ STARTDOCSYMS "##" g_packageCommentAllowed = FALSE; BEGIN(VariableDec); } + {B}{IDENTIFIER}/({B},{B}{IDENTIFIER})*{B}")"*{B}"="[^=] { // list of variables, we cannot place the default value + // so we will skip it later on in a general rule + // Also note ")" this is to catch also (a,b). the "(" + // is caught in the rule: [(], the ")" will be handled in [)] + if (g_search_count > 1) REJECT; + g_indent=computeIndent(yytext); + current->section = Entry::VARIABLE_SEC; + current->name = QCString(yytext).stripWhiteSpace(); + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + g_packageCommentAllowed = FALSE; + newVariable(); + } "'" { // start of a single quoted string g_stringContext=YY_START; g_copyString=0; @@ -604,6 +623,9 @@ STARTDOCSYMS "##" "@staticmethod" { gstat=TRUE; } + {SCRIPTCOMMENT} { // Unix type script comment + if (yyLineNr != 1) REJECT; + } {POUNDCOMMENT} { // normal comment g_packageCommentAllowed = FALSE; } @@ -634,6 +656,12 @@ STARTDOCSYMS "##" initSpecialBlock(); BEGIN(SpecialComment); } + [(] { // we have to do something with ( + g_search_count += 1; + } + [)] { // we have to do something with ) + g_search_count -= 1; + } [^\n] { // any other character... // This is the major default // that should catch everything @@ -734,7 +762,7 @@ STARTDOCSYMS "##" <SearchMemVars>{ "self."{IDENTIFIER}/{B}"=" { - DBG_CTX((stderr,"Found member variable %s in %s at %d\n",&yytext[5],current_root->name.data(),yyLineNr)); + DBG_CTX((stderr,"Found instance method variable %s in %s at %d\n",&yytext[5],current_root->name.data(),yyLineNr)); current->name=&yytext[5]; current->section=Entry::VARIABLE_SEC; current->fileName = yyFileName; @@ -745,9 +773,19 @@ STARTDOCSYMS "##" { current->protection=Private; } - else + newEntry(); + } + "cls."{IDENTIFIER}/{B}"=" { + DBG_CTX((stderr,"Found class method variable %s in %s at %d\n",&yytext[4],current_root->name.data(),yyLineNr)); + current->name=&yytext[4]; + current->section=Entry::VARIABLE_SEC; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + current->type.resize(0); + if (current->name.at(0)=='_') // mark as private { - current->protection=Public; + current->protection=Private; } newEntry(); } @@ -963,11 +1001,13 @@ STARTDOCSYMS "##" { current->argList->getLast()->defval=g_defVal.stripWhiteSpace(); } - BEGIN(FunctionParams); + if (*yytext == ')') + current->args = argListToString(current->argList); + BEGIN(FunctionParams); } else // continue { - g_braceCount--; + if (*yytext == ')')g_braceCount--; g_defVal+=*yytext; } } @@ -1158,6 +1198,7 @@ STARTDOCSYMS "##" <VariableDec>{ "=" { // the assignment operator //printf("====== VariableDec at line %d\n",yyLineNr); + g_start_init = TRUE; current->initializer = yytext; current->initializer += " "; } @@ -1173,6 +1214,11 @@ STARTDOCSYMS "##" current->initializer += yytext; BEGIN(VariableEnd); } + {BOOL} { // boolean value + current->type = "bool"; + current->initializer += yytext; + BEGIN(VariableEnd); + } {STRINGPREFIX}?"'" { // string current->type = "string"; current->initializer += yytext; @@ -1204,8 +1250,8 @@ STARTDOCSYMS "##" g_stringContext=VariableEnd; BEGIN(TripleString); } - "(" { // tuple - if (current->mtype!=Property) + "(" { // tuple, only when direct after = + if (current->mtype!=Property && g_start_init) { current->type = "tuple"; } @@ -1216,7 +1262,7 @@ STARTDOCSYMS "##" BEGIN( VariableAtom ); } "[" { // list - current->type = "list"; + if (g_start_init) current->type = "list"; current->initializer+=*yytext; g_atomStart='['; g_atomEnd=']'; @@ -1224,7 +1270,7 @@ STARTDOCSYMS "##" BEGIN( VariableAtom ); } "{" { // dictionary - current->type = "dictionary"; + if (g_start_init) current->type = "dictionary"; current->initializer+=*yytext; g_atomStart='{'; g_atomEnd='}'; @@ -1235,9 +1281,11 @@ STARTDOCSYMS "##" BEGIN( VariableEnd ); } {IDENTIFIER} { + g_start_init = FALSE; current->initializer+=yytext; } . { + g_start_init = FALSE; current->initializer+=*yytext; } \n { @@ -1262,7 +1310,8 @@ STARTDOCSYMS "##" } if (g_atomCount==0) { - BEGIN(VariableEnd); + g_start_init = FALSE; + BEGIN(VariableDec); } } {TRIDOUBLEQUOTE} { // start of a comment block @@ -1278,6 +1327,12 @@ STARTDOCSYMS "##" initTriSingleQuoteBlock(); BEGIN(TripleComment); } + "'" { + g_stringContext=YY_START; + current->initializer+="'"; + g_copyString=¤t->initializer; + BEGIN( SingleQuoteString ); + } "\"" { g_stringContext=YY_START; current->initializer+="\""; @@ -1376,13 +1431,16 @@ STARTDOCSYMS "##" docBlock += yytext; } } - [^"'\n \t]+ { + [^"'\n \t\\]+ { docBlock += yytext; } \n { incLineNr(); docBlock += yytext; } + \\. { // espaced char + docBlock += yytext; + } . { docBlock += yytext; } diff --git a/src/reflist.cpp b/src/reflist.cpp index 8b41caa..5a80b19 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -37,6 +37,7 @@ RefList::RefList(const char *listName, m_dictIterator = 0; m_id = 0; m_listName = listName; + m_fileName = convertNameToFile(listName,FALSE,TRUE); m_pageTitle = pageTitle; m_secTitle = secTitle; } @@ -99,6 +100,11 @@ QCString RefList::listName() const return m_listName; } +QCString RefList::fileName() const +{ + return m_fileName; +} + QCString RefList::pageTitle() const { return m_pageTitle; @@ -147,9 +153,12 @@ void RefList::generatePage() doc += "\n"; if (item->scope) { - doc += "\\_setscope "; - doc += item->scope->name(); - doc += " "; + if (item->scope->name() != "<globalScope>") + { + doc += "\\_setscope "; + doc += item->scope->name(); + doc += " "; + } } doc += item->prefix; doc += " \\_internalref "; @@ -174,6 +183,6 @@ void RefList::generatePage() } doc += "</dl>\n"; //printf("generatePage('%s')\n",doc.data()); - addRelatedPage(m_listName,m_pageTitle,doc,0,m_listName,1,0,0,0); + addRelatedPage(m_listName,m_pageTitle,doc,0,m_fileName,1,0,0,0); } diff --git a/src/reflist.h b/src/reflist.h index 0d40e80..d064c58 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -72,6 +72,7 @@ class RefList RefItem *getFirstRefItem(); RefItem *getNextRefItem(); QCString listName() const; + QCString fileName() const; QCString pageTitle() const; QCString sectionTitle() const; @@ -85,6 +86,7 @@ class RefList private: int m_id; QCString m_listName; + QCString m_fileName; QCString m_pageTitle; QCString m_secTitle; SortedRefItems *m_itemList; diff --git a/src/resourcemgr.h b/src/resourcemgr.h index 220202c..57b3e37 100644 --- a/src/resourcemgr.h +++ b/src/resourcemgr.h @@ -47,13 +47,13 @@ class ResourceMgr /** Copies a registered resource to a given target directory under a given target name */ bool copyResourceAs(const char *name,const char *targetDir,const char *targetName) const; - /** Returns a pointer to the resource object with the given name. */ - const Resource *get(const char *name) const; - /** Gets the resource data as a C string */ QCString getAsString(const char *name) const; private: + /** Returns a pointer to the resource object with the given name. */ + const Resource *get(const char *name) const; + ResourceMgr(); ~ResourceMgr(); class Private; diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 7baaa3c..749f57b 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -541,6 +541,7 @@ void RTFGenerator::endIndexSection(IndexSections is) bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); static bool sourceBrowser = Config_getBool("SOURCE_BROWSER"); + static QCString projectName = Config_getString("PROJECT_NAME"); switch (is) { @@ -549,7 +550,7 @@ void RTFGenerator::endIndexSection(IndexSections is) // User has overridden document title in extensions file t << "}" << rtf_title; else - t << "}" << Config_getString("PROJECT_NAME"); + t << "}" << projectName; break; case isTitlePageAuthor: { @@ -578,7 +579,17 @@ void RTFGenerator::endIndexSection(IndexSections is) } t << rtf_Style_Reset << rtf_Style["Title"]->reference << endl; // set to title style - t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt TITLE}}\\par" << endl; + if (rtf_title) + // User has overridden document title in extensions file + t << "{\\field\\fldedit {\\*\\fldinst " << rtf_title << " \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par" << endl; + else + { + DocText *root = validatingParseText(projectName); + t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; + writeDoc(root,0,0); + t << "}}\\par" << endl; + + } t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style t << "\\par\n"; @@ -593,10 +604,14 @@ void RTFGenerator::endIndexSection(IndexSections is) t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to subtitle style - t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl; - t << "Version " << Config_getString("PROJECT_NUMBER") << "\\par"; + if (rtf_author) + t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par" << endl; + else + t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl; + + t << theTranslator->trVersion() << " " << Config_getString("PROJECT_NUMBER") << "\\par"; t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" - "{\\fldrslt CREATEDATE}}\\par"<<endl; + "{\\fldrslt "<< dateToString(FALSE) << " }}\\par"<<endl; t << "\\page\\page"; DBG_RTF(t << "{\\comment End title page}" << endl) @@ -2363,7 +2378,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl // files because the first line before the body // ALWAYS contains "{\comment begin body}" int len; - do + for(;;) { lineBuf.resize(maxLineLength); if ((len=f.readLine(lineBuf.rawData(),maxLineLength))==-1) @@ -2372,8 +2387,9 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl return FALSE; } lineBuf.resize(len+1); + if (lineBuf.find("\\comment begin body")!=-1) break; if (bIncludeHeader) encodeForOutput(t,lineBuf.data()); - } while (lineBuf.find("\\comment begin body")==-1); + } lineBuf.resize(maxLineLength); @@ -2590,6 +2606,7 @@ bool RTFGenerator::preProcessFileInplace(const char *path,const char *name) if (!outf.open(IO_WriteOnly)) { err("Failed to open %s for writing!\n",combinedName.data()); + QDir::setCurrent(oldDir); return FALSE; } FTextStream outt(&outf); @@ -2680,6 +2697,7 @@ void RTFGenerator::startSimpleSect(SectionTypes,const char *file,const char *anc void RTFGenerator::endSimpleSect() { DBG_RTF(t << "{\\comment (endSimpleSect)}" << endl) + m_omitParagraph = FALSE; newParagraph(); decrementIndentLevel(); m_omitParagraph = TRUE; diff --git a/src/scanner.l b/src/scanner.l index 328dc3f..fc6dc84 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -75,6 +75,7 @@ static int lastCSConstraint; static int lastHereDocContext; static int lastDefineContext; static int lastAlignAsContext; +static int lastC11AttributeContext; static Protection protection; static Protection baseProt; static int sharpCount = 0 ; @@ -668,6 +669,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %x SkipPHPString %x SkipInits %x SkipC11Inits +%x SkipC11Attribute %x SkipCPP %x SkipCPPBlock %x SkipComment @@ -2431,6 +2433,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { + externC=FALSE; // see bug759247 BEGIN(FindMembers); } } @@ -3417,6 +3420,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { current->args += yytext ; squareCount=1; + externC=FALSE; // see bug759247 BEGIN( Array ) ; } } @@ -4089,6 +4093,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current_root->addSubEntry( current ) ; current=new Entry; initEntry(); + language = current->lang = SrcLangExt_Cpp; // see bug746361 insideObjC=FALSE; BEGIN( FindMembers ); } @@ -5022,6 +5027,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(SkipInits); } } +<SkipC11Attribute>"]]" { + BEGIN(lastC11AttributeContext); + } <SkipInits>"{" { // C++11 style initializer unput('{'); BEGIN( Function ); @@ -5125,7 +5133,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //addToBody(yytext); BEGIN( SkipCurlyCpp ); } -<SkipCurly,SkipC11Inits,SkipInits>\n { +<SkipCurly,SkipC11Inits,SkipInits,SkipC11Attribute>\n { lineCount(); //addToBody(yytext); } @@ -5154,22 +5162,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //addToBody(yytext); lineCount(); } -<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp>"/*" { +<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"/*" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipComment); } -<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp>"//" { +<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"//" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipCxxComment); } -<SkipInits,SkipC11Inits>"(" { +<SkipInits,SkipC11Inits,SkipC11Attribute>"(" { roundCount=0; lastSkipRoundContext=YY_START; BEGIN(SkipRound); } -<SkipInits,SkipC11Inits>\" { +<SkipInits,SkipC11Inits,SkipC11Attribute>\" { lastStringContext=YY_START; BEGIN( SkipString ); } @@ -5204,7 +5212,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(SkipPHPString); } } -<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp>. { } +<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>. { } <SkipString,SkipPHPString>\\. { } <SkipString>\" { BEGIN( lastStringContext ); @@ -5325,8 +5333,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <ClassTemplSpec>"<" { - current->name += yytext; - sharpCount++; + current->name += yytext; + if (roundCount==0) sharpCount++; } <ClassTemplSpec>. { current->name += yytext; @@ -5375,6 +5383,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); current->reset(); initEntry(); + if (insideObjC) // see bug746361 + { + language = current->lang = SrcLangExt_Cpp; + insideObjC = FALSE; + } if (isTypedef) // typedef of a class, put typedef keyword back { current->type.prepend("typedef"); @@ -5999,7 +6012,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <Comment>. { current->program += *yytext ; } -<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,Bases,OldStyleArgs>("//"{B}*)?"/*!" { +<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>("//"{B}*)?"/*!" { //printf("Start doc block at %d\n",yyLineNr); removeSlashes=(yytext[1]=='/'); tmpDocType=-1; @@ -6272,14 +6285,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - docBlock+=yytext; + docBlock+=substitute(yytext,"*"," "); docBlockName="~~~"; g_fencedSize=yyleng; g_nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - docBlock+=yytext; + docBlock+=substitute(yytext,"*"," "); docBlockName="```"; g_fencedSize=yyleng; g_nestedComment=FALSE; @@ -6397,14 +6410,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - docBlock+=yytext; + docBlock+=substitute(yytext,"*"," "); if (g_fencedSize==yyleng) { BEGIN(DocBlock); } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - docBlock+=yytext; + docBlock+=substitute(yytext,"*"," "); if (g_fencedSize==yyleng) { BEGIN(DocBlock); @@ -6528,6 +6541,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( lastCContext ) ; } <SkipComment>[^\*\n]+ + +"[[" { // C++11 attribute + lastC11AttributeContext = YY_START; + BEGIN( SkipC11Attribute ); + } + <*>\n { lineCount(); } <*>\" { if (insideIDL && insideCppQuote) @@ -6749,7 +6768,7 @@ static void parseCompounds(Entry *rt) // deep copy group list from parent (see bug 727732) static bool autoGroupNested = Config_getBool("GROUP_NESTED_COMPOUNDS"); - if (rt->groups && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) + if (autoGroupNested && rt->groups && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) { QListIterator<Grouping> gli(*rt->groups); Grouping *g; diff --git a/src/searchindex.cpp b/src/searchindex.cpp index ee545bf..9bfe7b0 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -583,70 +583,9 @@ void SearchIndexExternal::write(const char *fileName) #include "doxygen.h" #include "message.h" -//static const char search_script[]= -//#include "search.js.h" -//; - -#define SEARCH_INDEX_ALL 0 -#define SEARCH_INDEX_CLASSES 1 -#define SEARCH_INDEX_NAMESPACES 2 -#define SEARCH_INDEX_FILES 3 -#define SEARCH_INDEX_FUNCTIONS 4 -#define SEARCH_INDEX_VARIABLES 5 -#define SEARCH_INDEX_TYPEDEFS 6 -#define SEARCH_INDEX_ENUMS 7 -#define SEARCH_INDEX_ENUMVALUES 8 -#define SEARCH_INDEX_PROPERTIES 9 -#define SEARCH_INDEX_EVENTS 10 -#define SEARCH_INDEX_RELATED 11 -#define SEARCH_INDEX_DEFINES 12 -#define SEARCH_INDEX_GROUPS 13 -#define SEARCH_INDEX_PAGES 14 -#define NUM_SEARCH_INDICES 15 - -class SearchDefinitionList : public QList<Definition> -{ - public: - SearchDefinitionList(uint letter) : m_letter(letter) {} - uint letter() const { return m_letter; } - private: - uint m_letter; -}; +static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]; -class SearchIndexList : public SDict< SearchDefinitionList > -{ - public: - typedef Definition ElementType; - SearchIndexList(uint letter) : SDict<SearchDefinitionList>(17,FALSE), m_letter(letter) - { - setAutoDelete(TRUE); - } - ~SearchIndexList() {} - void append(Definition *d) - { - SearchDefinitionList *l = find(d->name()); - if (l==0) - { - l=new SearchDefinitionList(m_letter); - SDict<SearchDefinitionList>::append(d->name(),l); - } - l->append(d); - } - uint letter() const { return m_letter; } - private: - int compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const - { - QCString n1 = md1->getFirst()->localName(); - QCString n2 = md2->getFirst()->localName(); - return qstricmp(n1.data(),n2.data()); - } - uint m_letter; -}; - -static void addMemberToSearchIndex( - LetterToIndexMap<SearchIndexList> symbols[NUM_SEARCH_INDICES], - int symbolCount[NUM_SEARCH_INDICES], - MemberDef *md) +static void addMemberToSearchIndex(MemberDef *md) { static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS"); bool isLinkable = md->isLinkable(); @@ -654,7 +593,7 @@ static void addMemberToSearchIndex( NamespaceDef *nd=0; FileDef *fd=0; GroupDef *gd=0; - if (isLinkable && + if (isLinkable && ( ((cd=md->getClassDef()) && cd->isLinkable() && cd->templateMaster()==0) || ((gd=md->getGroupDef()) && gd->isLinkable()) @@ -662,58 +601,49 @@ static void addMemberToSearchIndex( ) { QCString n = md->name(); - if (!n.isEmpty()) + if (!n.isEmpty()) { uint letter = getUtf8CodeToLower(n,0); bool isFriendToHide = hideFriendCompounds && - (QCString(md->typeString())=="friend class" || + (QCString(md->typeString())=="friend class" || QCString(md->typeString())=="friend struct" || QCString(md->typeString())=="friend union"); if (!(md->isFriend() && isFriendToHide)) { - symbols[SEARCH_INDEX_ALL].append(letter,md); - symbolCount[SEARCH_INDEX_ALL]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,md); } if (md->isFunction() || md->isSlot() || md->isSignal()) { - symbols[SEARCH_INDEX_FUNCTIONS].append(letter,md); - symbolCount[SEARCH_INDEX_FUNCTIONS]++; - } + g_searchIndexInfo[SEARCH_INDEX_FUNCTIONS].symbolList.append(letter,md); + } else if (md->isVariable()) { - symbols[SEARCH_INDEX_VARIABLES].append(letter,md); - symbolCount[SEARCH_INDEX_VARIABLES]++; + g_searchIndexInfo[SEARCH_INDEX_VARIABLES].symbolList.append(letter,md); } else if (md->isTypedef()) { - symbols[SEARCH_INDEX_TYPEDEFS].append(letter,md); - symbolCount[SEARCH_INDEX_TYPEDEFS]++; + g_searchIndexInfo[SEARCH_INDEX_TYPEDEFS].symbolList.append(letter,md); } else if (md->isEnumerate()) { - symbols[SEARCH_INDEX_ENUMS].append(letter,md); - symbolCount[SEARCH_INDEX_ENUMS]++; + g_searchIndexInfo[SEARCH_INDEX_ENUMS].symbolList.append(letter,md); } else if (md->isEnumValue()) { - symbols[SEARCH_INDEX_ENUMVALUES].append(letter,md); - symbolCount[SEARCH_INDEX_ENUMVALUES]++; + g_searchIndexInfo[SEARCH_INDEX_ENUMVALUES].symbolList.append(letter,md); } else if (md->isProperty()) { - symbols[SEARCH_INDEX_PROPERTIES].append(letter,md); - symbolCount[SEARCH_INDEX_PROPERTIES]++; + g_searchIndexInfo[SEARCH_INDEX_PROPERTIES].symbolList.append(letter,md); } else if (md->isEvent()) { - symbols[SEARCH_INDEX_EVENTS].append(letter,md); - symbolCount[SEARCH_INDEX_EVENTS]++; + g_searchIndexInfo[SEARCH_INDEX_EVENTS].symbolList.append(letter,md); } else if (md->isRelated() || md->isForeign() || (md->isFriend() && !isFriendToHide)) { - symbols[SEARCH_INDEX_RELATED].append(letter,md); - symbolCount[SEARCH_INDEX_RELATED]++; + g_searchIndexInfo[SEARCH_INDEX_RELATED].symbolList.append(letter,md); } } } @@ -727,38 +657,31 @@ static void addMemberToSearchIndex( if (!n.isEmpty()) { uint letter = getUtf8CodeToLower(n,0); - symbols[SEARCH_INDEX_ALL].append(letter,md); - symbolCount[SEARCH_INDEX_ALL]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,md); if (md->isFunction()) { - symbols[SEARCH_INDEX_FUNCTIONS].append(letter,md); - symbolCount[SEARCH_INDEX_FUNCTIONS]++; + g_searchIndexInfo[SEARCH_INDEX_FUNCTIONS].symbolList.append(letter,md); } else if (md->isVariable()) { - symbols[SEARCH_INDEX_VARIABLES].append(letter,md); - symbolCount[SEARCH_INDEX_VARIABLES]++; + g_searchIndexInfo[SEARCH_INDEX_VARIABLES].symbolList.append(letter,md); } else if (md->isTypedef()) { - symbols[SEARCH_INDEX_TYPEDEFS].append(letter,md); - symbolCount[SEARCH_INDEX_TYPEDEFS]++; + g_searchIndexInfo[SEARCH_INDEX_TYPEDEFS].symbolList.append(letter,md); } else if (md->isEnumerate()) { - symbols[SEARCH_INDEX_ENUMS].append(letter,md); - symbolCount[SEARCH_INDEX_ENUMS]++; + g_searchIndexInfo[SEARCH_INDEX_ENUMS].symbolList.append(letter,md); } else if (md->isEnumValue()) { - symbols[SEARCH_INDEX_ENUMVALUES].append(letter,md); - symbolCount[SEARCH_INDEX_ENUMVALUES]++; + g_searchIndexInfo[SEARCH_INDEX_ENUMVALUES].symbolList.append(letter,md); } else if (md->isDefine()) { - symbols[SEARCH_INDEX_DEFINES].append(letter,md); - symbolCount[SEARCH_INDEX_DEFINES]++; + g_searchIndexInfo[SEARCH_INDEX_DEFINES].symbolList.append(letter,md); } } } @@ -792,55 +715,43 @@ static QCString searchId(const QCString &s) return result; } -static int g_searchIndexCount[NUM_SEARCH_INDICES]; -static LetterToIndexMap<SearchIndexList> g_searchIndexSymbols[NUM_SEARCH_INDICES]; -static const char *g_searchIndexName[NUM_SEARCH_INDICES] = -{ - "all", - "classes", - "namespaces", - "files", - "functions", - "variables", - "typedefs", - "enums", - "enumvalues", - "properties", - "events", - "related", - "defines", - "groups", - "pages" -}; - - -class SearchIndexCategoryMapping +void createJavascriptSearchIndex() { - public: - SearchIndexCategoryMapping() - { - categoryLabel[SEARCH_INDEX_ALL] = theTranslator->trAll(); - categoryLabel[SEARCH_INDEX_CLASSES] = theTranslator->trClasses(); - categoryLabel[SEARCH_INDEX_NAMESPACES] = theTranslator->trNamespace(TRUE,FALSE); - categoryLabel[SEARCH_INDEX_FILES] = theTranslator->trFile(TRUE,FALSE); - categoryLabel[SEARCH_INDEX_FUNCTIONS] = theTranslator->trFunctions(); - categoryLabel[SEARCH_INDEX_VARIABLES] = theTranslator->trVariables(); - categoryLabel[SEARCH_INDEX_TYPEDEFS] = theTranslator->trTypedefs(); - categoryLabel[SEARCH_INDEX_ENUMS] = theTranslator->trEnumerations(); - categoryLabel[SEARCH_INDEX_ENUMVALUES] = theTranslator->trEnumerationValues(); - categoryLabel[SEARCH_INDEX_PROPERTIES] = theTranslator->trProperties(); - categoryLabel[SEARCH_INDEX_EVENTS] = theTranslator->trEvents(); - categoryLabel[SEARCH_INDEX_RELATED] = theTranslator->trFriends(); - categoryLabel[SEARCH_INDEX_DEFINES] = theTranslator->trDefines(); - categoryLabel[SEARCH_INDEX_GROUPS] = theTranslator->trGroup(TRUE,FALSE); - categoryLabel[SEARCH_INDEX_PAGES] = theTranslator->trPage(TRUE,FALSE); - } - QCString categoryLabel[NUM_SEARCH_INDICES]; -}; - -void writeJavascriptSearchIndex() -{ - if (!Config_getBool("GENERATE_HTML")) return; + // set index names + g_searchIndexInfo[SEARCH_INDEX_ALL].name = "all"; + g_searchIndexInfo[SEARCH_INDEX_CLASSES].name = "classes"; + g_searchIndexInfo[SEARCH_INDEX_NAMESPACES].name = "namespaces"; + g_searchIndexInfo[SEARCH_INDEX_FILES].name = "files"; + g_searchIndexInfo[SEARCH_INDEX_FUNCTIONS].name = "functions"; + g_searchIndexInfo[SEARCH_INDEX_VARIABLES].name = "variables"; + g_searchIndexInfo[SEARCH_INDEX_TYPEDEFS].name = "typedefs"; + g_searchIndexInfo[SEARCH_INDEX_ENUMS].name = "enums"; + g_searchIndexInfo[SEARCH_INDEX_ENUMVALUES].name = "enumvalues"; + g_searchIndexInfo[SEARCH_INDEX_PROPERTIES].name = "properties"; + g_searchIndexInfo[SEARCH_INDEX_EVENTS].name = "events"; + g_searchIndexInfo[SEARCH_INDEX_RELATED].name = "related"; + g_searchIndexInfo[SEARCH_INDEX_DEFINES].name = "defines"; + g_searchIndexInfo[SEARCH_INDEX_GROUPS].name = "groups"; + g_searchIndexInfo[SEARCH_INDEX_PAGES].name = "pages"; + + // set index texts + g_searchIndexInfo[SEARCH_INDEX_ALL].text = theTranslator->trAll(); + g_searchIndexInfo[SEARCH_INDEX_CLASSES].text = theTranslator->trClasses(); + g_searchIndexInfo[SEARCH_INDEX_NAMESPACES].text = theTranslator->trNamespace(TRUE,FALSE); + g_searchIndexInfo[SEARCH_INDEX_FILES].text = theTranslator->trFile(TRUE,FALSE); + g_searchIndexInfo[SEARCH_INDEX_FUNCTIONS].text = theTranslator->trFunctions(); + g_searchIndexInfo[SEARCH_INDEX_VARIABLES].text = theTranslator->trVariables(); + g_searchIndexInfo[SEARCH_INDEX_TYPEDEFS].text = theTranslator->trTypedefs(); + g_searchIndexInfo[SEARCH_INDEX_ENUMS].text = theTranslator->trEnumerations(); + g_searchIndexInfo[SEARCH_INDEX_ENUMVALUES].text = theTranslator->trEnumerationValues(); + g_searchIndexInfo[SEARCH_INDEX_PROPERTIES].text = theTranslator->trProperties(); + g_searchIndexInfo[SEARCH_INDEX_EVENTS].text = theTranslator->trEvents(); + g_searchIndexInfo[SEARCH_INDEX_RELATED].text = theTranslator->trFriends(); + g_searchIndexInfo[SEARCH_INDEX_DEFINES].text = theTranslator->trDefines(); + g_searchIndexInfo[SEARCH_INDEX_GROUPS].text = theTranslator->trGroup(TRUE,FALSE); + g_searchIndexInfo[SEARCH_INDEX_PAGES].text = theTranslator->trPage(TRUE,FALSE); + + // add symbols to letter -> symbol list map // index classes ClassSDict::Iterator cli(*Doxygen::classSDict); @@ -850,10 +761,8 @@ void writeJavascriptSearchIndex() uint letter = getUtf8CodeToLower(cd->localName(),0); if (cd->isLinkable() && isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,cd); - g_searchIndexSymbols[SEARCH_INDEX_CLASSES].append(letter,cd); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_CLASSES]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,cd); + g_searchIndexInfo[SEARCH_INDEX_CLASSES].symbolList.append(letter,cd); } } @@ -865,10 +774,8 @@ void writeJavascriptSearchIndex() uint letter = getUtf8CodeToLower(nd->name(),0); if (nd->isLinkable() && isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,nd); - g_searchIndexSymbols[SEARCH_INDEX_NAMESPACES].append(letter,nd); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_NAMESPACES]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,nd); + g_searchIndexInfo[SEARCH_INDEX_NAMESPACES].symbolList.append(letter,nd); } } @@ -884,10 +791,8 @@ void writeJavascriptSearchIndex() uint letter = getUtf8CodeToLower(fd->name(),0); if (fd->isLinkable() && isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,fd); - g_searchIndexSymbols[SEARCH_INDEX_FILES].append(letter,fd); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_FILES]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,fd); + g_searchIndexInfo[SEARCH_INDEX_FILES].symbolList.append(letter,fd); } } } @@ -904,7 +809,7 @@ void writeJavascriptSearchIndex() // for each member definition for (mni.toFirst();(md=mni.current());++mni) { - addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md); + addMemberToSearchIndex(md); } } } @@ -921,7 +826,7 @@ void writeJavascriptSearchIndex() // for each member definition for (mni.toFirst();(md=mni.current());++mni) { - addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md); + addMemberToSearchIndex(md); } } } @@ -940,10 +845,8 @@ void writeJavascriptSearchIndex() uint letter = charCode<128 ? tolower(charCode) : charCode; if (isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,gd); - g_searchIndexSymbols[SEARCH_INDEX_GROUPS].append(letter,gd); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_GROUPS]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,gd); + g_searchIndexInfo[SEARCH_INDEX_GROUPS].symbolList.append(letter,gd); } } } @@ -963,10 +866,8 @@ void writeJavascriptSearchIndex() uint letter = charCode<128 ? tolower(charCode) : charCode; if (isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,pd); - g_searchIndexSymbols[SEARCH_INDEX_PAGES].append(letter,pd); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_PAGES]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,pd); + g_searchIndexInfo[SEARCH_INDEX_PAGES].symbolList.append(letter,pd); } } } @@ -980,38 +881,40 @@ void writeJavascriptSearchIndex() uint letter = charCode<128 ? tolower(charCode) : charCode; if (isId(letter)) { - g_searchIndexSymbols[SEARCH_INDEX_ALL].append(letter,Doxygen::mainPage); - g_searchIndexSymbols[SEARCH_INDEX_PAGES].append(letter,Doxygen::mainPage); - g_searchIndexCount[SEARCH_INDEX_ALL]++; - g_searchIndexCount[SEARCH_INDEX_PAGES]++; + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,Doxygen::mainPage); + g_searchIndexInfo[SEARCH_INDEX_PAGES].symbolList.append(letter,Doxygen::mainPage); } } } - + // sort all lists int i; for (i=0;i<NUM_SEARCH_INDICES;i++) { - SIntDict<SearchIndexList>::Iterator it(g_searchIndexSymbols[i]); + SIntDict<SearchIndexList>::Iterator it(g_searchIndexInfo[i].symbolList); SearchIndexList *sl; for (it.toFirst();(sl=it.current());++it) { sl->sort(); } } +} +void writeJavascriptSearchIndex() +{ + int i; // write index files QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search"; for (i=0;i<NUM_SEARCH_INDICES;i++) // for each index { - SIntDict<SearchIndexList>::Iterator it(g_searchIndexSymbols[i]); + SIntDict<SearchIndexList>::Iterator it(g_searchIndexInfo[i].symbolList); SearchIndexList *sl; int p=0; for (it.toFirst();(sl=it.current());++it,++p) // for each letter { QCString baseName; - baseName.sprintf("%s_%x",g_searchIndexName[i],p); + baseName.sprintf("%s_%x",g_searchIndexInfo[i].name.data(),p); QCString fileName = searchDirName + "/"+baseName+".html"; QCString dataFileName = searchDirName + "/"+baseName+".js"; @@ -1083,17 +986,7 @@ void writeJavascriptSearchIndex() } firstEntry=FALSE; - QCString dispName = d->localName(); - if (d->definitionType()==Definition::TypeGroup) - { - dispName = ((GroupDef*)d)->groupTitle(); - } - else if (d->definitionType()==Definition::TypePage) - { - dispName = ((PageDef*)d)->title(); - } - ti << " ['" << searchId(dispName) << "',['" - << convertToXML(dispName) << "',["; + ti << " ['" << dl->id() << "',['" << convertToXML(dl->name()) << "',["; if (dl->count()==1) // item with a unique name { @@ -1274,12 +1167,12 @@ void writeJavascriptSearchIndex() int j=0; for (i=0;i<NUM_SEARCH_INDICES;i++) { - if (g_searchIndexCount[i]>0) + if (g_searchIndexInfo[i].symbolList.count()>0) { if (!first) t << "," << endl; t << " " << j << ": \""; - SIntDict<SearchIndexList>::Iterator it(g_searchIndexSymbols[i]); + SIntDict<SearchIndexList>::Iterator it(g_searchIndexInfo[i].symbolList); SearchIndexList *sl; for (it.toFirst();(sl=it.current());++it) // for each letter { @@ -1298,10 +1191,10 @@ void writeJavascriptSearchIndex() j=0; for (i=0;i<NUM_SEARCH_INDICES;i++) { - if (g_searchIndexCount[i]>0) + if (g_searchIndexInfo[i].symbolList.count()>0) { if (!first) t << "," << endl; - t << " " << j << ": \"" << g_searchIndexName[i] << "\""; + t << " " << j << ": \"" << g_searchIndexInfo[i].name << "\""; first=FALSE; j++; } @@ -1311,14 +1204,13 @@ void writeJavascriptSearchIndex() t << "var indexSectionLabels =" << endl; t << "{" << endl; first=TRUE; - static SearchIndexCategoryMapping map; j=0; for (i=0;i<NUM_SEARCH_INDICES;i++) { - if (g_searchIndexCount[i]>0) + if (g_searchIndexInfo[i].symbolList.count()>0) { if (!first) t << "," << endl; - t << " " << j << ": \"" << convertToXML(map.categoryLabel[i]) << "\""; + t << " " << j << ": \"" << convertToXML(g_searchIndexInfo[i].text) << "\""; first=FALSE; j++; } @@ -1352,6 +1244,55 @@ void writeJavascriptSearchIndex() Doxygen::indexList->addStyleSheetFile("search/search.js"); } +const SearchIndexInfo *getSearchIndices() +{ + return g_searchIndexInfo; +} + +//--------------------------------------------------------------------------------------------- + +SearchIndexList::SearchIndexList(uint letter) + : SDict< SearchDefinitionList >(17,FALSE), m_letter(letter) +{ + setAutoDelete(TRUE); +} + +SearchIndexList::~SearchIndexList() +{ +} + +void SearchIndexList::append(Definition *d) +{ + SearchDefinitionList *l = find(d->name()); + if (l==0) + { + QCString dispName = d->localName(); + if (d->definitionType()==Definition::TypeGroup) + { + dispName = ((GroupDef*)d)->groupTitle(); + } + else if (d->definitionType()==Definition::TypePage) + { + dispName = ((PageDef*)d)->title(); + } + l=new SearchDefinitionList(searchId(dispName),dispName); + SDict< SearchDefinitionList >::append(d->name(),l); + } + l->append(d); +} + +uint SearchIndexList::letter() const +{ + return m_letter; +} + +int SearchIndexList::compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const +{ + QCString n1 = md1->getFirst()->localName(); + QCString n2 = md2->getFirst()->localName(); + return qstricmp(n1.data(),n2.data()); +} + //--------------------------------------------------------------------------------------------- void initSearchIndexer() diff --git a/src/searchindex.h b/src/searchindex.h index b9f45c6..e491f47 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -23,6 +23,9 @@ #include <qdict.h> #include <qintdict.h> #include <qvector.h> +#include "sortdict.h" +#include "definition.h" +#include "util.h" class FTextStream; class Definition; @@ -109,6 +112,56 @@ class SearchIndexExternal : public SearchIndexIntf //------- client side search index ---------------------- +#define SEARCH_INDEX_ALL 0 +#define SEARCH_INDEX_CLASSES 1 +#define SEARCH_INDEX_NAMESPACES 2 +#define SEARCH_INDEX_FILES 3 +#define SEARCH_INDEX_FUNCTIONS 4 +#define SEARCH_INDEX_VARIABLES 5 +#define SEARCH_INDEX_TYPEDEFS 6 +#define SEARCH_INDEX_ENUMS 7 +#define SEARCH_INDEX_ENUMVALUES 8 +#define SEARCH_INDEX_PROPERTIES 9 +#define SEARCH_INDEX_EVENTS 10 +#define SEARCH_INDEX_RELATED 11 +#define SEARCH_INDEX_DEFINES 12 +#define SEARCH_INDEX_GROUPS 13 +#define SEARCH_INDEX_PAGES 14 +#define NUM_SEARCH_INDICES 15 + +class SearchDefinitionList : public QList<Definition> +{ + public: + SearchDefinitionList(const QCString &id,const QCString &name) : m_id(id), m_name(name) {} + QCString id() const { return m_id; } + QCString name() const { return m_name; } + private: + QCString m_id; + QCString m_name; +}; + +class SearchIndexList : public SDict< SearchDefinitionList > +{ + public: + typedef Definition ElementType; + SearchIndexList(uint letter); + ~SearchIndexList(); + void append(Definition *d); + uint letter() const; + private: + int compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const; + uint m_letter; +}; + +struct SearchIndexInfo +{ + LetterToIndexMap<SearchIndexList> symbolList; + QCString name; + QCString text; +}; + +void createJavascriptSearchIndex(); void writeJavascriptSearchIndex(); +const SearchIndexInfo *getSearchIndices(); #endif diff --git a/src/section.h b/src/section.h index 51668a2..b6268a9 100644 --- a/src/section.h +++ b/src/section.h @@ -31,7 +31,8 @@ struct SectionInfo Subsection = 2, Subsubsection = 3, Paragraph = 4, - Anchor = 5 + Anchor = 5, + Table = 6 }; SectionInfo(const char *f,const int lin,const char *l,const char *t, SectionType st,int lev,const char *r=0) : diff --git a/src/settings.py b/src/settings.py deleted file mode 100755 index a9dfa13..0000000 --- a/src/settings.py +++ /dev/null @@ -1,29 +0,0 @@ -# - -import sys -import os - -f_sqlite3 = sys.argv[1] -f_libclang = sys.argv[2] - -f1 = open(os.path.join(sys.argv[3],'settings.h'),'w') -f1.write("#ifndef SETTINGS_H\n") -f1.write("#define SETTINGS_H\n") -f1.write("\n") -if (f_sqlite3 != "NO"): - f1.write("#define USE_SQLITE3 1\n") -else: - f1.write("#define USE_SQLITE3 0\n") - -if (f_libclang != "NO"): - f1.write("#define USE_LIBCLANG 1\n") -else: - f1.write("#define USE_LIBCLANG 0\n") - -f1.write("\n") -f1.write("#define IS_SUPPORTED(x) \\\n") -f1.write(" ((USE_SQLITE3 && strcmp(\"USE_SQLITE3\",(x))==0) || \\\n") -f1.write(" (USE_LIBCLANG && strcmp(\"USE_LIBCLANG\",(x))==0) || \\\n") -f1.write(" 0)\n") -f1.write("\n") -f1.write("#endif\n") diff --git a/src/template.cpp b/src/template.cpp index 4250f08..527148c 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -98,6 +98,36 @@ static QValueList<QCString> split(const QCString &str,const QCString &sep, //---------------------------------------------------------------------------- +/** Strips spaces surrounding `=` from string \a in, so + * `foo = 10 bar=5 baz= 'hello'` will become `foo=10 bar=5 baz='hello'` + */ +static QCString removeSpacesAroundEquals(const char *s) +{ + QCString result(s); + const char *p=result.data(); + char *q = result.rawData(); + char c; + while ((c=*p++)) + { + if (c==' ') // found a space, see if there is a = as well + { + const char *t = p; + bool found=FALSE; + while (*t==' ' || *t=='=') { if (*t++=='=') found=TRUE; } + if (found) + { + c='='; + p=t; // move p to end of '\s*=\s*' sequence + } + } + *q++=c; + } + if (q<p) result.resize(q-result.data()+1); + return result; +} + +//---------------------------------------------------------------------------- + #if ENABLE_TRACING static QCString replace(const char *s,char csrc,char cdst) { @@ -112,92 +142,38 @@ static QCString replace(const char *s,char csrc,char cdst) //- TemplateVariant implementation ------------------------------------------- -/** @brief Private data of a template variant object */ -class TemplateVariant::Private -{ - public: - Private(Type t) : type(t), intVal(0), boolVal(TRUE), strukt(0), list(0), raw(FALSE) {} - Type type; - int intVal; - QCString strVal; - bool boolVal; - TemplateStructIntf *strukt; - TemplateListIntf *list; - Delegate delegate; - bool raw; -}; - -TemplateVariant::TemplateVariant() -{ - p = new Private(None); -} - -TemplateVariant::TemplateVariant(bool b) -{ - p = new Private(Bool); - p->boolVal = b; -} - -TemplateVariant::TemplateVariant(int v) -{ - p = new Private(Integer); - p->intVal = v; -} - -TemplateVariant::TemplateVariant(const char *s,bool raw) -{ - p = new Private(String); - p->strVal = s; - p->raw = raw; -} - -TemplateVariant::TemplateVariant(const QCString &s,bool raw) -{ - p = new Private(String); - p->strVal = s; - p->raw = raw; -} TemplateVariant::TemplateVariant(TemplateStructIntf *s) + : m_type(Struct), m_strukt(s), m_raw(FALSE) { - p = new Private(Struct); - p->strukt = s; - p->strukt->addRef(); + m_strukt->addRef(); } TemplateVariant::TemplateVariant(TemplateListIntf *l) + : m_type(List), m_list(l), m_raw(FALSE) { - p = new Private(List); - p->list = l; - p->list->addRef(); -} - -TemplateVariant::TemplateVariant(const TemplateVariant::Delegate &delegate) -{ - p = new Private(Function); - p->delegate = delegate; + m_list->addRef(); } TemplateVariant::~TemplateVariant() { - if (p->type==Struct) p->strukt->release(); - else if (p->type==List) p->list->release(); - delete p; + if (m_type==Struct) m_strukt->release(); + else if (m_type==List) m_list->release(); } TemplateVariant::TemplateVariant(const TemplateVariant &v) + : m_type(v.m_type), m_strukt(0), m_raw(FALSE) { - p = new Private(v.p->type); - p->raw = v.p->raw; - switch (p->type) + m_raw = v.m_raw; + switch (m_type) { case None: break; - case Bool: p->boolVal = v.p->boolVal; break; - case Integer: p->intVal = v.p->intVal; break; - case String: p->strVal = v.p->strVal; break; - case Struct: p->strukt = v.p->strukt; p->strukt->addRef(); break; - case List: p->list = v.p->list; p->list->addRef(); break; - case Function: p->delegate= v.p->delegate;break; + case Bool: m_boolVal = v.m_boolVal; break; + case Integer: m_intVal = v.m_intVal; break; + case String: m_strVal = v.m_strVal; break; + case Struct: m_strukt = v.m_strukt; m_strukt->addRef(); break; + case List: m_list = v.m_list; m_list->addRef(); break; + case Function: m_delegate= v.m_delegate;break; } } @@ -205,21 +181,21 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) { // assignment can change the type of the variable, so we have to be // careful with reference counted content. - TemplateStructIntf *tmpStruct = p->type==Struct ? p->strukt : 0; - TemplateListIntf *tmpList = p->type==List ? p->list : 0; - Type tmpType = p->type; + TemplateStructIntf *tmpStruct = m_type==Struct ? m_strukt : 0; + TemplateListIntf *tmpList = m_type==List ? m_list : 0; + Type tmpType = m_type; - p->type = v.p->type; - p->raw = v.p->raw; - switch (p->type) + m_type = v.m_type; + m_raw = v.m_raw; + switch (m_type) { case None: break; - case Bool: p->boolVal = v.p->boolVal; break; - case Integer: p->intVal = v.p->intVal; break; - case String: p->strVal = v.p->strVal; break; - case Struct: p->strukt = v.p->strukt; p->strukt->addRef(); break; - case List: p->list = v.p->list; p->list->addRef(); break; - case Function: p->delegate= v.p->delegate;break; + case Bool: m_boolVal = v.m_boolVal; break; + case Integer: m_intVal = v.m_intVal; break; + case String: m_strVal = v.m_strVal; break; + case Struct: m_strukt = v.m_strukt; m_strukt->addRef(); break; + case List: m_list = v.m_list; m_list->addRef(); break; + case Function: m_delegate= v.m_delegate;break; } // release overwritten reference counted values @@ -228,161 +204,34 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) return *this; } -QCString TemplateVariant::toString() const -{ - QCString result; - switch (p->type) - { - case None: - break; - case Bool: - result=p->boolVal ? "true" : "false"; - break; - case Integer: - result=QCString().setNum(p->intVal); - break; - case String: - result=p->strVal; - break; - case Struct: - result="[struct]"; - break; - case List: - result="[list]"; - break; - case Function: - result="[function]"; - break; - } - return result; -} - bool TemplateVariant::toBool() const { - bool result=FALSE; - switch (p->type) + switch (m_type) { - case None: - break; - case Bool: - result = p->boolVal; - break; - case Integer: - result = p->intVal!=0; - break; - case String: - result = !p->strVal.isEmpty(); // && p->strVal!="false" && p->strVal!="0"; - break; - case Struct: - result = TRUE; - break; - case List: - result = p->list->count()!=0; - break; - case Function: - result = FALSE; - break; + case None: return FALSE; + case Bool: return m_boolVal; + case Integer: return m_intVal!=0; + case String: return !m_strVal.isEmpty(); + case Struct: return TRUE; + case List: return m_list->count()!=0; + case Function: return FALSE; } - return result; + return FALSE; } int TemplateVariant::toInt() const { - int result=0; - switch (p->type) - { - case None: - break; - case Bool: - result = p->boolVal ? 1 : 0; - break; - case Integer: - result = p->intVal; - break; - case String: - result = p->strVal.toInt(); - break; - case Struct: - break; - case List: - result = p->list->count(); - break; - case Function: - result = 0; - break; - } - return result; -} - -TemplateStructIntf *TemplateVariant::toStruct() const -{ - return p->type==Struct ? p->strukt : 0; -} - -TemplateListIntf *TemplateVariant::toList() const -{ - return p->type==List ? p->list : 0; -} - -TemplateVariant TemplateVariant::call(const QValueList<TemplateVariant> &args) -{ - if (p->type==Function) return p->delegate(args); - return TemplateVariant(); -} - -bool TemplateVariant::operator==(TemplateVariant &other) -{ - if (p->type==None) - { - return FALSE; - } - if (p->type==TemplateVariant::List && other.p->type==TemplateVariant::List) - { - return p->list==other.p->list; // TODO: improve me - } - else if (p->type==TemplateVariant::Struct && other.p->type==TemplateVariant::Struct) - { - return p->strukt==other.p->strukt; // TODO: improve me - } - else - { - return toString()==other.toString(); - } -} - -TemplateVariant::Type TemplateVariant::type() const -{ - return p->type; -} - -QCString TemplateVariant::typeAsString() const -{ - switch (p->type) + switch (m_type) { - case None: return "none"; - case Bool: return "bool"; - case Integer: return "integer"; - case String: return "string"; - case Struct: return "struct"; - case List: return "list"; - case Function: return "function"; + case None: return 0; + case Bool: return m_boolVal ? 1 : 0; + case Integer: return m_intVal; + case String: return m_strVal.toInt(); + case Struct: return 0; + case List: return m_list->count(); + case Function: return 0; } - return "invalid"; -} - -bool TemplateVariant::isValid() const -{ - return p->type!=None; -} - -void TemplateVariant::setRaw(bool b) -{ - p->raw = b; -} - -bool TemplateVariant::raw() const -{ - return p->raw; + return 0; } //- Template struct implementation -------------------------------------------- @@ -699,6 +548,10 @@ class TemplateContextImpl : public TemplateContext m_spacelessEnabled=b; } bool spacelessEnabled() const { return m_spacelessEnabled && m_spacelessIntf; } + void enableTabbing(bool b) { m_tabbingEnabled=b; + if (m_activeEscapeIntf) m_activeEscapeIntf->enableTabbing(b); + } + bool tabbingEnabled() const { return m_tabbingEnabled; } void warn(const char *fileName,int line,const char *fmt,...) const; // index related functions @@ -717,6 +570,7 @@ class TemplateContextImpl : public TemplateContext TemplateEscapeIntf *m_activeEscapeIntf; TemplateSpacelessIntf *m_spacelessIntf; bool m_spacelessEnabled; + bool m_tabbingEnabled; TemplateAutoRef<TemplateStruct> m_indices; QDict< QStack<TemplateVariant> > m_indexStacks; }; @@ -783,6 +637,87 @@ class FilterGet } }; +//----------------------------------------------------------------------------- + +/** @brief The implementation of the "raw" filter */ +class FilterRaw +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && (v.type()==TemplateVariant::String || v.type()==TemplateVariant::Integer)) + { + return TemplateVariant(v.toString(),TRUE); + } + else + { + return v; + } + } +}; + +//----------------------------------------------------------------------------- + +/** @brief The implementation of the "list" filter */ +class FilterList +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid()) + { + if (v.type()==TemplateVariant::List) // input is already a list + { + return v; + } + // create a list with v as the only element + TemplateList *list = TemplateList::alloc(); + list->append(v); + return list; + } + else + { + return v; + } + } +}; + +//----------------------------------------------------------------------------- +/** @brief The implementation of the "texlabel" filter */ +class FilterTexLabel +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && (v.type()==TemplateVariant::String)) + { + return TemplateVariant(latexEscapeLabelName(v.toString(),FALSE),TRUE); + } + else + { + return v; + } + } +}; + +//----------------------------------------------------------------------------- + +/** @brief The implementation of the "texindex" filter */ +class FilterTexIndex +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && (v.type()==TemplateVariant::String)) + { + return TemplateVariant(latexEscapeIndexChars(v.toString(),FALSE),TRUE); + } + else + { + return v; + } + } +}; //----------------------------------------------------------------------------- @@ -793,7 +728,7 @@ class FilterAppend static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &arg) { if ((v.type()==TemplateVariant::String || v.type()==TemplateVariant::Integer) && - arg.type()==TemplateVariant::String) + (arg.type()==TemplateVariant::String || arg.type()==TemplateVariant::Integer)) { return TemplateVariant(v.toString() + arg.toString()); } @@ -1088,6 +1023,25 @@ class FilterGroupBy //-------------------------------------------------------------------- +/** @brief The implementation of the "relative" filter */ +class FilterRelative +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && v.type()==TemplateVariant::String && v.toString().left(2)=="..") + { + return TRUE; + } + else + { + return FALSE; + } + } +}; + +//-------------------------------------------------------------------- + /** @brief The implementation of the "paginate" filter */ class FilterPaginate { @@ -1158,16 +1112,19 @@ class FilterAlphaIndex static QCString keyToLabel(uint startLetter) { char s[11]; // 0x12345678 + '\0' - if (startLetter>0x20 && startLetter<=0x7f) // printable ASCII character + if ((startLetter>='0' && startLetter<='9') || + (startLetter>='a' && startLetter<='z') || + (startLetter>='A' && startLetter<='Z')) { - s[0]=tolower((char)startLetter); - s[1]=0; + int i=0; + if (startLetter>='0' && startLetter<='9') s[i++] = 'x'; + s[i++]=tolower((char)startLetter); + s[i++]=0; } else { const char hex[]="0123456789abcdef"; int i=0; - s[i++]='0'; s[i++]='x'; if (startLetter>(1<<24)) // 4 byte character { @@ -1381,6 +1338,8 @@ class TemplateFilterFactory // register a handlers for each filter we support static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add"); static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get"); +static TemplateFilterFactory::AutoRegister<FilterRaw> fRaw("raw"); +static TemplateFilterFactory::AutoRegister<FilterList> fList("list"); static TemplateFilterFactory::AutoRegister<FilterAppend> fAppend("append"); static TemplateFilterFactory::AutoRegister<FilterLength> fLength("length"); static TemplateFilterFactory::AutoRegister<FilterNoWrap> fNoWrap("nowrap"); @@ -1388,7 +1347,10 @@ static TemplateFilterFactory::AutoRegister<FilterFlatten> fFlatten("flatten" static TemplateFilterFactory::AutoRegister<FilterDefault> fDefault("default"); static TemplateFilterFactory::AutoRegister<FilterPrepend> fPrepend("prepend"); static TemplateFilterFactory::AutoRegister<FilterGroupBy> fGroupBy("groupBy"); +static TemplateFilterFactory::AutoRegister<FilterRelative> fRelative("relative"); static TemplateFilterFactory::AutoRegister<FilterListSort> fListSort("listsort"); +static TemplateFilterFactory::AutoRegister<FilterTexLabel> fTexLabel("texLabel"); +static TemplateFilterFactory::AutoRegister<FilterTexIndex> fTexIndex("texIndex"); static TemplateFilterFactory::AutoRegister<FilterPaginate> fPaginate("paginate"); static TemplateFilterFactory::AutoRegister<FilterStripPath> fStripPath("stripPath"); static TemplateFilterFactory::AutoRegister<FilterAlphaIndex> fAlphaIndex("alphaIndex"); @@ -1447,6 +1409,10 @@ class ExprAstFunctionVariable : public ExprAst { TRACE(("ExprAstFunctionVariable()\n")); m_args.setAutoDelete(TRUE); } + ~ExprAstFunctionVariable() + { + delete m_var; + } virtual TemplateVariant resolve(TemplateContext *c) { QValueList<TemplateVariant> args; @@ -1978,17 +1944,6 @@ class ExpressionParser TRACE(("{parseLiteral(%s)\n",m_curToken.id.data())); ExprAst *expr = new ExprAstLiteral(m_curToken.id); getNextToken(); - if (expr) - { - while (m_curToken.type==ExprToken::Operator && - m_curToken.op==Operator::Filter) - { - getNextToken(); - ExprAstFilter *filter = parseFilter(); - if (!filter) break; - expr = new ExprAstFilterAppl(expr,filter); - } - } TRACE(("}parseLiteral()\n")); return expr; } @@ -2307,7 +2262,9 @@ class TemplateNodeList : public QList<TemplateNode> class TemplateImpl : public TemplateNode, public Template { public: - TemplateImpl(TemplateEngine *e,const QCString &name,const char *data,int size); + TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data, + const QCString &extension); + ~TemplateImpl(); void render(FTextStream &ts, TemplateContext *c); TemplateEngine *engine() const { return m_engine; } @@ -2322,10 +2279,26 @@ class TemplateImpl : public TemplateNode, public Template //---------------------------------------------------------- +/** @brief Weak reference wrapper for TemplateStructIntf that provides access to the + * wrapped struct without holding a reference. + */ +class TemplateStructWeakRef : public TemplateStructIntf +{ + public: + TemplateStructWeakRef(TemplateStructIntf *ref) : m_ref(ref), m_refCount(0) {} + virtual TemplateVariant get(const char *name) const { return m_ref->get(name); } + virtual int addRef() { return ++m_refCount; } + virtual int release() { int count=--m_refCount; if (count<=0) { delete this; } return count; } + private: + TemplateStructIntf *m_ref; + int m_refCount; +}; + +//---------------------------------------------------------- TemplateContextImpl::TemplateContextImpl(const TemplateEngine *e) : m_engine(e), m_templateName("<unknown>"), m_line(1), m_activeEscapeIntf(0), - m_spacelessIntf(0), m_spacelessEnabled(FALSE), m_indices(TemplateStruct::alloc()) + m_spacelessIntf(0), m_spacelessEnabled(FALSE), m_tabbingEnabled(FALSE), m_indices(TemplateStruct::alloc()) { m_indexStacks.setAutoDelete(TRUE); m_contextStack.setAutoDelete(TRUE); @@ -2358,9 +2331,8 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const } else // obj.prop { - TemplateVariant v; QCString objName = name.left(i); - v = getPrimary(objName); + TemplateVariant v = getPrimary(objName); QCString propName = name.mid(i+1); while (!propName.isEmpty()) { @@ -2467,7 +2439,7 @@ void TemplateContextImpl::warn(const char *fileName,int line,const char *fmt,... void TemplateContextImpl::openSubIndex(const QCString &indexName) { - //printf("TemplateContextImpl::openSubIndex(%s)\n",indexName.data()); + printf("TemplateContextImpl::openSubIndex(%s)\n",indexName.data()); QStack<TemplateVariant> *stack = m_indexStacks.find(indexName); if (!stack || stack->isEmpty() || stack->top()->type()==TemplateVariant::List) // error: no stack yet or no entry { @@ -2488,7 +2460,7 @@ void TemplateContextImpl::openSubIndex(const QCString &indexName) void TemplateContextImpl::closeSubIndex(const QCString &indexName) { - //printf("TemplateContextImpl::closeSubIndex(%s)\n",indexName.data()); + printf("TemplateContextImpl::closeSubIndex(%s)\n",indexName.data()); QStack<TemplateVariant> *stack = m_indexStacks.find(indexName); if (!stack || stack->count()<3) { @@ -2511,6 +2483,7 @@ void TemplateContextImpl::closeSubIndex(const QCString &indexName) } } } + //fprintf(stderr,"TemplateContextImpl::closeSubIndex(%s) end g_count=%d\n\n",indexName.data(),g_count); } static void getPathListFunc(TemplateStructIntf *entry,TemplateList *list) @@ -2569,7 +2542,9 @@ void TemplateContextImpl::addIndexEntry(const QCString &indexName,const QValueLi if (stack->count()>1) { TemplateVariant *tmp = stack->pop(); - parent = *stack->top(); + // To prevent a cyclic dependency between parent and child which causes a memory + // leak, we wrap the parent into a weak reference version. + parent = new TemplateStructWeakRef(stack->top()->toStruct()); stack->push(tmp); ASSERT(parent.type()==TemplateVariant::Struct); } @@ -2661,7 +2636,6 @@ class TemplateNodeVariable : public TemplateNode { v = v.call(QValueList<TemplateVariant>()); } - //printf("TemplateNodeVariable::render(%s) raw=%d\n",value.data(),v.raw()); if (ci->escapeIntf() && !v.raw()) { ts << ci->escapeIntf()->escape(v.toString()); @@ -3482,6 +3456,24 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> //---------------------------------------------------------- +static void stripLeadingWhiteSpace(QGString &s) +{ + const char *src = s.data(); + if (src) + { + char *dst = s.data(); + char c; + bool skipSpaces=TRUE; + while ((c=*src++)) + { + if (c=='\n') { *dst++=c; skipSpaces=TRUE; } + else if (c==' ' && skipSpaces) {} + else { *dst++=c; skipSpaces=FALSE; } + } + *dst='\0'; + } +} + /** @brief Class representing an 'create' tag in a template */ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> { @@ -3545,17 +3537,18 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> TemplateImpl *t = getTemplate(); if (t) { + QCString extension=outputFile; + int i=extension.findRev('.'); + if (i!=-1) + { + extension=extension.right(extension.length()-i-1); + } + t->engine()->setOutputExtension(extension); Template *ct = t->engine()->loadByName(templateFile,m_line); TemplateImpl *createTemplate = ct ? dynamic_cast<TemplateImpl*>(ct) : 0; if (createTemplate) { mkpath(ci,outputFile); - QCString extension=outputFile; - int i=extension.findRev('.'); - if (i!=-1) - { - extension=extension.right(extension.length()-i-1); - } if (!ci->outputDirectory().isEmpty()) { outputFile.prepend(ci->outputDirectory()+"/"); @@ -3567,7 +3560,11 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> TemplateEscapeIntf *escIntf = ci->escapeIntf(); ci->selectEscapeIntf(extension); FTextStream ts(&f); - createTemplate->render(ts,c); + QGString out; + FTextStream os(&out); + createTemplate->render(os,c); + stripLeadingWhiteSpace(out); + ts << out; t->engine()->unload(t); ci->setActiveEscapeIntf(escIntf); } @@ -3580,6 +3577,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> { ci->warn(m_templateName,m_line,"failed to load template '%s' for include",templateFile.data()); } + t->engine()->setOutputExtension(""); } } } @@ -3678,6 +3676,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> } } c->pop(); + delete it; return result.data(); } void render(FTextStream &ts, TemplateContext *c) @@ -3868,7 +3867,8 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> TRACE(("{TemplateNodeWith(%s)\n",data.data())); m_args.setAutoDelete(TRUE); ExpressionParser expParser(parser,line); - QValueList<QCString> args = split(data," "); + QCString filteredData = removeSpacesAroundEquals(data); + QValueList<QCString> args = split(filteredData," "); QValueListIterator<QCString> it = args.begin(); while (it!=args.end()) { @@ -3920,7 +3920,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> //---------------------------------------------------------- -/** @brief Class representing an 'set' tag in a template */ +/** @brief Class representing an 'cycle' tag in a template */ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> { public: @@ -4083,6 +4083,11 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> parser->removeNextToken(); // skip over endmarkers TRACE(("}TemplateNodeMarkers(%s)\n",data.data())); } + ~TemplateNodeMarkers() + { + delete m_listExpr; + delete m_patternExpr; + } void render(FTextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); @@ -4134,6 +4139,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> } ts << str.right(str.length()-index); // write text after last marker c->pop(); + delete it; } else { @@ -4155,6 +4161,36 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> //---------------------------------------------------------- +/** @brief Class representing an 'tabbing' tag in a template */ +class TemplateNodeTabbing : public TemplateNodeCreator<TemplateNodeTabbing> +{ + public: + TemplateNodeTabbing(TemplateParser *parser,TemplateNode *parent,int line,const QCString &) + : TemplateNodeCreator<TemplateNodeTabbing>(parser,parent,line) + { + TRACE(("{TemplateNodeTabbing()\n")); + QStrList stopAt; + stopAt.append("endtabbing"); + parser->parse(this,line,stopAt,m_nodes); + parser->removeNextToken(); // skip over endtabbing + TRACE(("}TemplateNodeTabbing()\n")); + } + void render(FTextStream &ts, TemplateContext *c) + { + TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + if (ci==0) return; // should not happen + ci->setLocation(m_templateName,m_line); + bool wasTabbing = ci->tabbingEnabled(); + ci->enableTabbing(TRUE); + m_nodes.render(ts,c); + ci->enableTabbing(wasTabbing); + } + private: + TemplateNodeList m_nodes; +}; + +//---------------------------------------------------------- + /** @brief Class representing an 'markers' tag in a template */ class TemplateNodeResource : public TemplateNodeCreator<TemplateNodeResource> { @@ -4290,6 +4326,7 @@ static TemplateNodeFactory::AutoRegister<TemplateNodeCreate> autoRefCreat static TemplateNodeFactory::AutoRegister<TemplateNodeRepeat> autoRefRepeat("repeat"); static TemplateNodeFactory::AutoRegister<TemplateNodeInclude> autoRefInclude("include"); static TemplateNodeFactory::AutoRegister<TemplateNodeMarkers> autoRefMarkers("markers"); +static TemplateNodeFactory::AutoRegister<TemplateNodeTabbing> autoRefTabbing("tabbing"); static TemplateNodeFactory::AutoRegister<TemplateNodeResource> autoRefResource("resource"); static TemplateNodeFactory::AutoRegister<TemplateNodeSpaceless> autoRefSpaceless("spaceless"); static TemplateNodeFactory::AutoRegister<TemplateNodeIndexEntry> autoRefIndexEntry("indexentry"); @@ -4378,8 +4415,10 @@ void TemplateBlockContext::push(TemplateNodeBlock *block) class TemplateLexer { public: - TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const char *data,int size); + TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data); void tokenize(QList<TemplateToken> &tokens); + void setOpenCloseCharacters(char openChar,char closeChar) + { m_openChar=openChar; m_closeChar=closeChar; } private: void addToken(QList<TemplateToken> &tokens, const char *data,int line,int startPos,int endPos, @@ -4388,14 +4427,15 @@ class TemplateLexer const TemplateEngine *m_engine; QCString m_fileName; QCString m_data; + char m_openChar; + char m_closeChar; }; -TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const char *data,int size) : - m_engine(engine), m_fileName(fileName) +TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data) : + m_engine(engine), m_fileName(fileName), m_data(data) { - m_data.resize(size+1); - memcpy(m_data.rawData(),data,size); - m_data[size]=0; + m_openChar='{'; + m_closeChar='}'; } void TemplateLexer::tokenize(QList<TemplateToken> &tokens) @@ -4414,6 +4454,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) }; const char *p=m_data.data(); + if (p==0) return; int state=StateText; int pos=0; int lastTokenPos=0; @@ -4427,7 +4468,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) switch (state) { case StateText: - if (c=='{') // {{ or {% or {# or something else + if (c==m_openChar) // {{ or {% or {# or something else { state=StateBeginTemplate; } @@ -4448,7 +4489,14 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) markStartPos=pos-1; break; case '{': // {{ - state=StateMaybeVar; + if (m_openChar=='{') + { + state=StateMaybeVar; + } + else + { + state=StateVariable; + } markStartPos=pos-1; break; default: @@ -4460,7 +4508,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) case StateTag: if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {%%...%%} block"); + warn(m_fileName,line,"unexpected new line inside %c%%...%%%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } else if (c=='%') // %} or something else @@ -4469,7 +4517,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) } break; case StateEndTag: - if (c=='}') // %} + if (c==m_closeChar) // %} { // found tag! state=StateText; @@ -4484,7 +4532,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) { if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {%%...%%} block"); + warn(m_fileName,line,"unexpected new line inside %c%%...%%%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } state=StateTag; @@ -4493,7 +4541,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) case StateComment: if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {#...#} block"); + warn(m_fileName,line,"unexpected new line inside %c#...#%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } else if (c=='#') // #} or something else @@ -4502,7 +4550,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) } break; case StateEndComment: - if (c=='}') // #} + if (c==m_closeChar) // #} { // found comment tag! state=StateText; @@ -4515,7 +4563,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) { if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {#...#} block"); + warn(m_fileName,line,"unexpected new line inside %c#...#%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } state=StateComment; @@ -4538,9 +4586,10 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) } break; case StateVariable: + emptyOutputLine=FALSE; // assume a variable expands to content if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {{...}} block"); + warn(m_fileName,line,"unexpected new line inside %c{...}%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } else if (c=='}') // }} or something else @@ -4549,7 +4598,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) } break; case StateEndVariable: - if (c=='}') // }} + if (c==m_closeChar) // }} { // found variable tag! state=StateText; @@ -4564,7 +4613,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) { if (c=='\n') { - warn(m_fileName,line,"unexpected new line inside {{...}} block"); + warn(m_fileName,line,"unexpected new line inside %c{...}%c block",m_openChar,m_closeChar); m_engine->printIncludeContext(m_fileName,line); } state=StateVariable; @@ -4666,7 +4715,7 @@ void TemplateParser::parse( command=="endrecursetree" || command=="endspaceless" || command=="endmarkers" || command=="endmsg" || command=="endrepeat" || command=="elif" || - command=="endrange") + command=="endrange" || command=="endtabbing") { warn(m_templateName,tok->line,"Found tag '%s' without matching start tag",command.data()); } @@ -4734,12 +4783,17 @@ void TemplateParser::warn(const char *fileName,int line,const char *fmt,...) con //---------------------------------------------------------- -TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const char *data,int size) +TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const QCString &data, + const QCString &extension) : TemplateNode(0) { m_name = name; m_engine = engine; - TemplateLexer lexer(engine,name,data,size); + TemplateLexer lexer(engine,name,data); + if (extension=="tex") + { + lexer.setOpenCloseCharacters('<','>'); + } QList<TemplateToken> tokens; tokens.setAutoDelete(TRUE); lexer.tokenize(tokens); @@ -4747,6 +4801,11 @@ TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const cha parser.parse(this,1,QStrList(),m_nodes); } +TemplateImpl::~TemplateImpl() +{ + //printf("deleting template %s\n",m_name.data()); +} + void TemplateImpl::render(FTextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); @@ -4809,30 +4868,12 @@ class TemplateEngine::Private Template *templ = m_templateCache.find(fileName); if (templ==0) { - const Resource *res = ResourceMgr::instance().get(fileName); - if (res) + const QCString data = ResourceMgr::instance().getAsString(fileName); + if (!data.isEmpty()) { - templ = new TemplateImpl(m_engine,fileName,(const char *)res->data,res->size); + templ = new TemplateImpl(m_engine,fileName,data,m_extension); m_templateCache.insert(fileName,templ); } -#if 0 - QFile f(fileName); - if (f.open(IO_ReadOnly)) - { - uint size=f.size(); - char *data = new char[size+1]; - if (data) - { - data[size]=0; - if (f.readBlock(data,f.size())) - { - templ = new TemplateImpl(m_engine,fileName,data); - m_templateCache.insert(fileName,templ); - } - delete[] data; - } - } -#endif else { err("Cound not open template file %s\n",fileName.data()); @@ -4889,11 +4930,22 @@ class TemplateEngine::Private } } + void setOutputExtension(const char *extension) + { + m_extension = extension; + } + + QCString outputExtension() const + { + return m_extension; + } + private: QDict<Template> m_templateCache; //mutable int m_indent; TemplateEngine *m_engine; QList<IncludeEntry> m_includeStack; + QCString m_extension; }; TemplateEngine::TemplateEngine() @@ -4941,3 +4993,15 @@ void TemplateEngine::printIncludeContext(const char *fileName,int line) const p->printIncludeContext(fileName,line); } +void TemplateEngine::setOutputExtension(const char *extension) +{ + p->setOutputExtension(extension); +} + +QCString TemplateEngine::outputExtension() const +{ + return p->outputExtension(); +} + + + diff --git a/src/template.h b/src/template.h index c6c918c..7d6e2ff 100644 --- a/src/template.h +++ b/src/template.h @@ -139,28 +139,41 @@ class TemplateVariant enum Type { None, Bool, Integer, String, Struct, List, Function }; /** Returns the type of the value stored in the variant */ - Type type() const; + Type type() const { return m_type; } /** Return a string representation of the type of the value stored in the variant */ - QCString typeAsString() const; + QCString typeAsString() const + { + switch (m_type) + { + case None: return "none"; + case Bool: return "bool"; + case Integer: return "integer"; + case String: return "string"; + case Struct: return "struct"; + case List: return "list"; + case Function: return "function"; + } + return "invalid"; + } /** Returns TRUE if the variant holds a valid value, or FALSE otherwise */ - bool isValid() const; + bool isValid() const { return m_type!=None; } /** Constructs an invalid variant. */ - TemplateVariant(); + TemplateVariant() : m_type(None), m_strukt(0), m_raw(FALSE) {} /** Constructs a new variant with a boolean value \a b. */ - explicit TemplateVariant(bool b); + explicit TemplateVariant(bool b) : m_type(Bool), m_boolVal(b), m_raw(FALSE) {} /** Constructs a new variant with a integer value \a v. */ - TemplateVariant(int v); + TemplateVariant(int v) : m_type(Integer), m_intVal(v), m_raw(FALSE) {} /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const char *s,bool raw=FALSE); + TemplateVariant(const char *s,bool raw=FALSE) : m_type(String), m_strVal(s), m_strukt(0), m_raw(raw) {} /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const QCString &s,bool raw=FALSE); + TemplateVariant(const QCString &s,bool raw=FALSE) : m_type(String), m_strVal(s), m_strukt(0), m_raw(raw) {} /** Constructs a new variant with a struct value \a s. * @note. The variant will hold a reference to the object. @@ -179,7 +192,7 @@ class TemplateVariant * TemplateVariant::Delegate::fromFunction() to create * Delegate objects. */ - TemplateVariant(const Delegate &delegate); + TemplateVariant(const Delegate &delegate) : m_type(Function), m_strukt(0), m_delegate(delegate), m_raw(FALSE) {} /** Destroys the Variant object */ ~TemplateVariant(); @@ -195,46 +208,96 @@ class TemplateVariant /** Compares this QVariant with v and returns true if they are equal; * otherwise returns false. */ - bool operator==(TemplateVariant &other); + bool operator==(TemplateVariant &other) + { + if (m_type==None) + { + return FALSE; + } + if (m_type==TemplateVariant::List && other.m_type==TemplateVariant::List) + { + return m_list==other.m_list; // TODO: improve me + } + else if (m_type==TemplateVariant::Struct && other.m_type==TemplateVariant::Struct) + { + return m_strukt==other.m_strukt; // TODO: improve me + } + else + { + return toString()==other.toString(); + } + } /** Returns the variant as a string. */ - QCString toString() const; + QCString toString() const + { + switch (m_type) + { + case None: return QCString(); + case Bool: return m_boolVal ? "true" : "false"; + case Integer: return QCString().setNum(m_intVal); + case String: return m_strVal; + case Struct: return "[struct]"; + case List: return "[list]"; + case Function: return "[function]"; + } + return QCString(); + } /** Returns the variant as a boolean. */ - bool toBool() const; + bool toBool() const; /** Returns the variant as an integer. */ - int toInt() const; + int toInt() const; /** Returns the pointer to list referenced by this variant * or 0 if this variant does not have list type. */ - TemplateListIntf *toList() const; + TemplateListIntf *toList() const + { + return m_type==List ? m_list : 0; + } /** Returns the pointer to struct referenced by this variant * or 0 if this variant does not have struct type. */ - TemplateStructIntf *toStruct() const; + TemplateStructIntf *toStruct() const + { + return m_type==Struct ? m_strukt : 0; + } /** Return the result of apply this function with \a args. * Returns an empty string if the variant type is not a function. */ - TemplateVariant call(const QValueList<TemplateVariant> &args); + TemplateVariant call(const QValueList<TemplateVariant> &args) + { + if (m_type==Function) return m_delegate(args); + return TemplateVariant(); + } /** Sets whether or not the value of the Variant should be * escaped or written as-is (raw). * @param[in] b TRUE means write as-is, FALSE means apply escaping. */ - void setRaw(bool b); + void setRaw(bool b) { m_raw = b; } /** Returns whether or not the value of the Value is raw. * @see setRaw() */ - bool raw() const; + bool raw() const { return m_raw; } private: - class Private; - Private *p; + Type m_type; + QCString m_strVal; + union + { + int m_intVal; + bool m_boolVal; + TemplateStructIntf *m_strukt; + TemplateListIntf *m_list; + }; + Delegate m_delegate; + bool m_raw; }; //------------------------------------------------------------------------ @@ -396,6 +459,8 @@ class TemplateEscapeIntf public: /** Returns the \a input after escaping certain characters */ virtual QCString escape(const QCString &input) = 0; + /** Setting tabbing mode on or off (for LaTeX) */ + virtual void enableTabbing(bool b) = 0; }; //------------------------------------------------------------------------ @@ -453,7 +518,7 @@ class TemplateContext */ virtual const TemplateVariant *getRef(const QCString &name) const = 0; - /** When files are create (i.e. by {% create ... %}) they written + /** When files are created (i.e. by {% create ... %}) they written * to the directory \a dir. */ virtual void setOutputDirectory(const QCString &dir) = 0; @@ -510,11 +575,10 @@ class TemplateEngine */ void destroyContext(TemplateContext *ctx); - /** Creates a new template whole contents are in a file. - * @param[in] fileName The name of the file containing the - * template data + /** Creates a new template whose contents are in a file. + * @param[in] fileName The name of the file containing the template data * @param[in] fromLine The line number of the statement that triggered the load - * @return the new template, the caller will be the owner. + * @return the new template, the engine will keep ownership of the object. */ Template *loadByName(const QCString &fileName,int fromLine); @@ -523,13 +587,24 @@ class TemplateEngine */ void unload(Template *t); + /** Prints the current template file include stack */ void printIncludeContext(const char *fileName,int line) const; private: friend class TemplateNodeBlock; + friend class TemplateNodeCreate; + void enterBlock(const QCString &fileName,const QCString &blockName,int line); void leaveBlock(); + /** Sets the extension of the output file. This is used to control the + * format of 'special' tags in the template + */ + void setOutputExtension(const char *extension); + + /** Returns the output extension, set via setOutputExtension() */ + QCString outputExtension() const; + class Private; Private *p; }; diff --git a/src/translator_br.h b/src/translator_br.h index 6a7966f..f9fe664 100644 --- a/src/translator_br.h +++ b/src/translator_br.h @@ -1903,7 +1903,7 @@ class TranslatorBrazilian : public Translator */ virtual QCString trProvidedByCategory() { - return "Provido pela categoria @1."; + return "Provido pela categoria @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1912,7 +1912,7 @@ class TranslatorBrazilian : public Translator */ virtual QCString trExtendsClass() { - return "estende a classe @1."; + return "estende a classe @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_cn.h b/src/translator_cn.h index 26160d4..eae4014 100644 --- a/src/translator_cn.h +++ b/src/translator_cn.h @@ -110,7 +110,7 @@ class TranslatorChinese : public Translator /*! this is the first part of a sentence that is followed by a class name */ virtual QCString trThisIsTheListOfAllMembers() - { return "成员的完整列表,这些成员属于"CN_SPC; } + { return "成员的完整列表,这些成员属于" CN_SPC; } /*! this is the remainder of the sentence after the class name */ virtual QCString trIncludingInheritedMembers() @@ -121,8 +121,8 @@ class TranslatorChinese : public Translator */ virtual QCString trGeneratedAutomatically(const char *s) { QCString result; - result = "由"CN_SPC"Doyxgen"CN_SPC"通过分析"CN_SPC; - if (s) result += ((QCString)s+CN_SPC"的"CN_SPC); + result = "由" CN_SPC "Doyxgen" CN_SPC "通过分析" CN_SPC; + if (s) result += ((QCString)s+CN_SPC "的" CN_SPC); result+= "源代码自动生成."; return result; } @@ -137,7 +137,7 @@ class TranslatorChinese : public Translator /*! put after an undocumented member in the list of all members */ virtual QCString trDefinedIn() - { return "定义于"CN_SPC; } + { return "定义于" CN_SPC; } // quick reference sections @@ -199,7 +199,7 @@ class TranslatorChinese : public Translator { return "搜索"; } virtual QCString trClassHierarchyDescription() - { return "此继承关系列表按字典顺序粗略的排序:"CN_SPC; } + { return "此继承关系列表按字典顺序粗略的排序:" CN_SPC; } virtual QCString trFileListDescription(bool extractAll) { @@ -376,15 +376,15 @@ class TranslatorChinese : public Translator } virtual QCString trGeneratedAt(const char *date,const char *projName) - { QCString result=(QCString)"生成于"CN_SPC+date; - if (projName) result+=(QCString)CN_SPC", 为"CN_SPC+projName; - result+=(QCString)"使用"CN_SPC; + { QCString result=(QCString)"生成于" CN_SPC+date; + if (projName) result+=(QCString)CN_SPC ", 为" CN_SPC+projName; + result+=(QCString)"使用" CN_SPC; return result; } virtual QCString trClassDiagram(const char *clName) { - return (QCString)"类"CN_SPC+clName+CN_SPC"继承关系图:"; + return (QCString)"类" CN_SPC+clName+CN_SPC "继承关系图:"; } virtual QCString trForInternalUseOnly() @@ -449,7 +449,7 @@ class TranslatorChinese : public Translator // used as the title of the HTML page of a class/struct/union { QCString result=(QCString)clName; - if (isTemplate) result+=CN_SPC"模板"; + if (isTemplate) result+=CN_SPC "模板"; switch(compType) { case ClassDef::Class: result+="类"; break; @@ -461,7 +461,7 @@ class TranslatorChinese : public Translator case ClassDef::Exception: result+="异常"; break; default: break; } - result+=CN_SPC"参考"; + result+=CN_SPC "参考"; return result; } @@ -469,14 +469,14 @@ class TranslatorChinese : public Translator virtual QCString trFileReference(const char *fileName) { QCString result=fileName; - result+=CN_SPC"文件参考"; + result+=CN_SPC "文件参考"; return result; } /*! used as the title of the HTML page of a namespace */ virtual QCString trNamespaceReference(const char *namespaceName) { QCString result=namespaceName; - result+=CN_SPC"命名空间参考"; + result+=CN_SPC "命名空间参考"; return result; } @@ -528,9 +528,9 @@ class TranslatorChinese : public Translator if (i!=numEntries-1) // not the last entry, so we need a separator { if (i<numEntries-2) // not the fore last entry - result+=","CN_SPC; + result+="," CN_SPC; else // the fore last entry - result+=CN_SPC", 以及"CN_SPC; + result+=CN_SPC ", 以及" CN_SPC; } } return result; @@ -540,14 +540,14 @@ class TranslatorChinese : public Translator * if class diagrams are disabled. */ virtual QCString trInheritsList(int numEntries) - { return "继承自"CN_SPC+trWriteList(numEntries)+CN_SPC"."; } + { return "继承自" CN_SPC+trWriteList(numEntries)+CN_SPC "."; } /*! used in class documentation to produce a list of super classes, * if class diagrams are disabled. */ virtual QCString trInheritedByList(int numEntries) { - return "被"CN_SPC+trWriteList(numEntries)+CN_SPC"继承."; + return "被" CN_SPC+trWriteList(numEntries)+CN_SPC "继承."; } /*! used in member documentation blocks to produce a list of @@ -555,7 +555,7 @@ class TranslatorChinese : public Translator */ virtual QCString trReimplementedFromList(int numEntries) { - return "重载"CN_SPC+trWriteList(numEntries)+CN_SPC"."; + return "重载" CN_SPC+trWriteList(numEntries)+CN_SPC "."; } /*! used in member documentation blocks to produce a list of @@ -563,7 +563,7 @@ class TranslatorChinese : public Translator */ virtual QCString trReimplementedInList(int numEntries) { - return "被"CN_SPC+trWriteList(numEntries)+CN_SPC"重载."; + return "被" CN_SPC+trWriteList(numEntries)+CN_SPC "重载."; } /*! This is put above each page as a link to all members of namespaces. */ @@ -659,12 +659,12 @@ class TranslatorChinese : public Translator virtual QCString trDefinedAtLineInSourceFile() { - return "在文件"CN_SPC"@1"CN_SPC"第"CN_SPC"@0"CN_SPC"行定义."; + return "在文件" CN_SPC "@1" CN_SPC "第" CN_SPC "@0" CN_SPC "行定义."; } virtual QCString trDefinedInSourceFile() { - return "在文件"CN_SPC"@0"CN_SPC"中定义."; + return "在文件" CN_SPC "@0" CN_SPC "中定义."; } ////////////////////////////////////////////////////////////////////////// @@ -683,13 +683,13 @@ class TranslatorChinese : public Translator /*! this text is put before a collaboration diagram */ virtual QCString trCollaborationDiagram(const char *clName) { - return (QCString)clName+CN_SPC"的协作图:"; + return (QCString)clName+CN_SPC "的协作图:"; } /*! this text is put before an include dependency graph */ virtual QCString trInclDepGraph(const char *fName) { - return (QCString)fName+CN_SPC"的引用(Include)关系图:"; + return (QCString)fName+CN_SPC "的引用(Include)关系图:"; } /*! header that is put before the list of constructor/destructors. */ @@ -879,7 +879,7 @@ class TranslatorChinese : public Translator /*! page explaining how the dot graph's should be interpreted */ virtual QCString trLegendDocs() { - return "本页将向您解释如何理解由"CN_SPC"doxygen"CN_SPC"生成的图.<p>\n" + return "本页将向您解释如何理解由" CN_SPC "doxygen" CN_SPC "生成的图.<p>\n" "考虑如下例子:\n" "\\code\n" "/*! 由于截断而使 Invisible 不可见 */\n" @@ -991,7 +991,7 @@ class TranslatorChinese : public Translator /*! Used as the title of a Java package */ virtual QCString trPackage(const char *name) { - return (QCString)"包"CN_SPC+name; + return (QCString)"包" CN_SPC+name; } /*! Title of the package index page */ @@ -1028,7 +1028,7 @@ class TranslatorChinese : public Translator virtual QCString trBugList () { - return "Bug"CN_SPC"列表"; + return "Bug" CN_SPC "列表"; } ////////////////////////////////////////////////////////////////////////// @@ -1217,7 +1217,7 @@ class TranslatorChinese : public Translator virtual QCString trImplementedFromList(int numEntries) { /* return "Implements "+trWriteList(numEntries)+"."; */ - return "实现了"CN_SPC+trWriteList(numEntries)+"."; + return "实现了" CN_SPC+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of @@ -1226,7 +1226,7 @@ class TranslatorChinese : public Translator virtual QCString trImplementedInList(int numEntries) { /* return "Implemented in "+trWriteList(numEntries)+"."; */ - return "在"CN_SPC+trWriteList(numEntries)+CN_SPC"内被实现."; + return "在" CN_SPC+trWriteList(numEntries)+CN_SPC "内被实现."; } ////////////////////////////////////////////////////////////////////////// @@ -1386,7 +1386,7 @@ class TranslatorChinese : public Translator virtual QCString trSourceFile(QCString& filename) { /* return filename + " Source File"; */ - return filename + CN_SPC"源文件"; + return filename + CN_SPC "源文件"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.9 @@ -1419,7 +1419,7 @@ class TranslatorChinese : public Translator */ virtual QCString trDirDescription() { - return "此继承关系列表按字典顺序粗略的排序:"CN_SPC; + return "此继承关系列表按字典顺序粗略的排序:" CN_SPC; } /*! This returns the title of a directory page. The name of the @@ -1428,7 +1428,7 @@ class TranslatorChinese : public Translator virtual QCString trDirReference(const char *dirName) { QCString result=dirName; - result+=CN_SPC"目录参考"; + result+=CN_SPC "目录参考"; return result; } @@ -1565,16 +1565,16 @@ class TranslatorChinese : public Translator QCString result=(QCString)clName; switch(compType) { - case ClassDef::Class: result+=CN_SPC"模块"; break; - case ClassDef::Struct: result+=CN_SPC"类型"; break; - case ClassDef::Union: result+=CN_SPC"联合体"; break; - case ClassDef::Interface: result+=CN_SPC"接口"; break; - case ClassDef::Protocol: result+=CN_SPC"协议"; break; - case ClassDef::Category: result+=CN_SPC"目录"; break; - case ClassDef::Exception: result+=CN_SPC"异常"; break; + case ClassDef::Class: result+=CN_SPC "模块"; break; + case ClassDef::Struct: result+=CN_SPC "类型"; break; + case ClassDef::Union: result+=CN_SPC "联合体"; break; + case ClassDef::Interface: result+=CN_SPC "接口"; break; + case ClassDef::Protocol: result+=CN_SPC "协议"; break; + case ClassDef::Category: result+=CN_SPC "目录"; break; + case ClassDef::Exception: result+=CN_SPC "异常"; break; default: break; } - if (isTemplate) result+="模板"CN_SPC; + if (isTemplate) result+="模板" CN_SPC; result+="参考手册"; return result; } @@ -1583,7 +1583,7 @@ class TranslatorChinese : public Translator virtual QCString trModuleReference(const char *namespaceName) { QCString result=namespaceName; - result += CN_SPC"模块参考手册"; + result += CN_SPC "模块参考手册"; return result; } @@ -1640,16 +1640,16 @@ class TranslatorChinese : public Translator QCString result="该"; switch(compType) { - case ClassDef::Class: result+=CN_SPC"模块"; break; - case ClassDef::Struct: result+=CN_SPC"结构体"; break; - case ClassDef::Union: result+=CN_SPC"联合体"; break; - case ClassDef::Interface: result+=CN_SPC"接口"; break; - case ClassDef::Protocol: result+=CN_SPC"协议"; break; - case ClassDef::Category: result+=CN_SPC"目录"; break; - case ClassDef::Exception: result+=CN_SPC"异常"; break; + case ClassDef::Class: result+=CN_SPC "模块"; break; + case ClassDef::Struct: result+=CN_SPC "结构体"; break; + case ClassDef::Union: result+=CN_SPC "联合体"; break; + case ClassDef::Interface: result+=CN_SPC "接口"; break; + case ClassDef::Protocol: result+=CN_SPC "协议"; break; + case ClassDef::Category: result+=CN_SPC "目录"; break; + case ClassDef::Exception: result+=CN_SPC "异常"; break; default: break; } - result+=CN_SPC"的文档由以下文件生成:"; + result+=CN_SPC "的文档由以下文件生成:"; return result; } @@ -1684,7 +1684,7 @@ class TranslatorChinese : public Translator { // return QCString(name)+" Relation"; // unsure - return QCString(name)+CN_SPC"关系"; + return QCString(name)+CN_SPC "关系"; } virtual QCString trLoading() @@ -1718,7 +1718,7 @@ class TranslatorChinese : public Translator virtual QCString trIncludesFileIn(const char *name) { - return (QCString)"在"CN_SPC+name+CN_SPC"中引用"; + return (QCString)"在" CN_SPC+name+CN_SPC "中引用"; } virtual QCString trDateTime(int year,int month,int day,int dayOfWeek, @@ -1730,7 +1730,7 @@ class TranslatorChinese : public Translator QCString sdate; - sdate.sprintf("%d年"CN_SPC"%s月"CN_SPC"%d日"CN_SPC"星期%s",year, months[month-1], day, days[dayOfWeek-1]); + sdate.sprintf("%d年" CN_SPC "%s月" CN_SPC "%d日" CN_SPC "星期%s",year, months[month-1], day, days[dayOfWeek-1]); if (includeTime) { @@ -1756,7 +1756,7 @@ class TranslatorChinese : public Translator /*! Header for the graph showing the directory dependencies */ virtual QCString trDirDepGraph(const char *name) { - return QCString(name)+CN_SPC"的目录依赖关系图"; + return QCString(name)+CN_SPC "的目录依赖关系图"; } ////////////////////////////////////////////////////////////////////////// @@ -1773,7 +1773,7 @@ class TranslatorChinese : public Translator /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ virtual QCString trAndMore(const QCString &number) - { return "和"CN_SPC+number+CN_SPC"更多..."; } + { return "和" CN_SPC+number+CN_SPC "更多..."; } /*! Used file list for a Java enum */ virtual QCString trEnumGeneratedFromFiles(bool /*single*/) @@ -1781,11 +1781,11 @@ class TranslatorChinese : public Translator /*! Header of a Java enum page (Java enums are represented as classes). */ virtual QCString trEnumReference(const char *name) - { return QCString(name)+CN_SPC"枚举类型参考"; } + { return QCString(name)+CN_SPC "枚举类型参考"; } /*! Used for a section containing inherited members */ virtual QCString trInheritedFrom(const char *members,const char *what) - { return QCString(members)+CN_SPC"继承自"CN_SPC+what; } + { return QCString(members)+CN_SPC "继承自" CN_SPC+what; } /*! Header of the sections with inherited members specific for the * base class(es) @@ -1806,7 +1806,7 @@ class TranslatorChinese : public Translator virtual QCString trPanelSynchronisationTooltip(bool enable) { QCString opt = enable ? "开启" : "关闭"; - return "点击"CN_SPC+opt+CN_SPC"面板同步"; + return "点击" CN_SPC+opt+CN_SPC "面板同步"; } /*! Used in a method of an Objective-C class that is declared in a @@ -1815,7 +1815,7 @@ class TranslatorChinese : public Translator */ virtual QCString trProvidedByCategory() { - return "由 category @1 提供."; + return "由 category @0 提供."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1824,7 +1824,7 @@ class TranslatorChinese : public Translator */ virtual QCString trExtendsClass() { - return "扩展类 @1."; + return "扩展类 @0."; } /*! Used as the header of a list of class methods in Objective-C. @@ -1878,21 +1878,21 @@ class TranslatorChinese : public Translator virtual QCString trConstantGroupReference(const char *namespaceName) { QCString result=namespaceName; - result+= CN_SPC"常量组参考"; + result+= CN_SPC "常量组参考"; return result; } /** UNO IDL service page title */ virtual QCString trServiceReference(const char *sName) { QCString result=(QCString)sName; - result+= CN_SPC"服务参考"; + result+= CN_SPC "服务参考"; return result; } /** UNO IDL singleton page title */ virtual QCString trSingletonReference(const char *sName) { QCString result=(QCString)sName; - result+= CN_SPC"单例参考"; + result+= CN_SPC "单例参考"; return result; } /** UNO IDL service page */ diff --git a/src/translator_cz.h b/src/translator_cz.h index 2ddc029..e4a5692 100644 --- a/src/translator_cz.h +++ b/src/translator_cz.h @@ -1936,7 +1936,7 @@ class TranslatorCzech : public Translator */ virtual QCString trProvidedByCategory() { - return "Deklarováno v kategorii @1."; + return "Deklarováno v kategorii @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1945,7 +1945,7 @@ class TranslatorCzech : public Translator */ virtual QCString trExtendsClass() { - return "Rozšiřuje třídu @1."; + return "Rozšiřuje třídu @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_de.h b/src/translator_de.h index f2ca676..7d3d63a 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -1995,7 +1995,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_4 */ virtual QCString trProvidedByCategory() { - return "Bestandteil der Kategorie @1."; + return "Bestandteil der Kategorie @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -2004,7 +2004,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_4 */ virtual QCString trExtendsClass() { - return "Erweitert Klasse @1."; + return "Erweitert Klasse @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_en.h b/src/translator_en.h index ba89726..a72c05a 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -1893,7 +1893,7 @@ class TranslatorEnglish : public Translator */ virtual QCString trProvidedByCategory() { - return "Provided by category @1."; + return "Provided by category @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1902,7 +1902,7 @@ class TranslatorEnglish : public Translator */ virtual QCString trExtendsClass() { - return "Extends class @1."; + return "Extends class @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_eo.h b/src/translator_eo.h index 65f7e82..5415e81 100644 --- a/src/translator_eo.h +++ b/src/translator_eo.h @@ -1898,7 +1898,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 */ virtual QCString trProvidedByCategory() { - return "Provizita de kategorio @1."; + return "Provizita de kategorio @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1907,7 +1907,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 */ virtual QCString trExtendsClass() { - return "Etendi klason @1."; + return "Etendi klason @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_es.h b/src/translator_es.h index 97d1d26..1b75465 100644 --- a/src/translator_es.h +++ b/src/translator_es.h @@ -1957,7 +1957,7 @@ class TranslatorSpanish : public Translator */ virtual QCString trProvidedByCategory() { - return "Proporcionado por categoría @1."; + return "Proporcionado por categoría @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1966,7 +1966,7 @@ class TranslatorSpanish : public Translator */ virtual QCString trExtendsClass() { - return "Extiende la clase @1."; + return "Extiende la clase @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_fr.h b/src/translator_fr.h index e1fb5e6..65e77df 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -1954,7 +1954,7 @@ class TranslatorFrench : public Translator */ virtual QCString trProvidedByCategory() { - return "Déclarée dans la catégorie @1."; + return "Déclarée dans la catégorie @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1963,7 +1963,7 @@ class TranslatorFrench : public Translator */ virtual QCString trExtendsClass() { - return "Dérive la classe @1."; + return "Dérive la classe @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_gr.h b/src/translator_gr.h index e264deb..713b4bb 100644 --- a/src/translator_gr.h +++ b/src/translator_gr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2014 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 @@ -20,13 +20,29 @@ * Harry Kalogirou <no email> * * 01 Jan 2009 : Greek maintenance by - * Paul Gessos <gessos.paul@yahoo.gr> + * Paul Gessos <gessos.paul@gmail.com> + * + * Last update : 06 Jan 2015 */ +/* English to Greek keyword dictionary + (Many words have more clear meaning in English than Greek) + template -> πρότυπο + instance -> υπόσταση + module -> υπομονάδα + interface -> διεπαφή (ενναλλακτικά μπορεί να χρησιμοποιηθεί: διασύνδεση) + singleton -> μονοσύνολο + service -> υπηρεσία + exception -> εξαίρεση + namespace -> χώρος ονομάτων + enumeration -> απαρίθμηση +*/ + + #ifndef TRANSLATOR_GR_H #define TRANSLATOR_GR_H -class TranslatorGreek : public TranslatorAdapter_1_8_4 +class TranslatorGreek : public Translator { public: @@ -63,7 +79,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! header that is put before the list of typedefs. */ virtual QCString trMemberTypedefDocumentation() - { return "Τεκμηρίωση Μελών Typedef"; } + { return "Τεκμηρίωση Μελών Ορισμών Τύπων"; } /*! header that is put before the list of enumerations. */ virtual QCString trMemberEnumerationDocumentation() @@ -118,7 +134,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! put after an enum name in the list of all members */ virtual QCString trEnumName() - { return "όνομα απαρύθμισης"; } + { return "όνομα απαρίθμησης"; } /*! put after an enum value in the list of all members */ virtual QCString trEnumValue() @@ -134,7 +150,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 * compounds or files (see the \\group command). */ virtual QCString trModules() - { return "Κομμάτια"; } + { return "Υπομονάδες"; } /*! This is put above each page as a link to the class hierarchy */ virtual QCString trClassHierarchy() @@ -214,12 +230,12 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Ακολουθούνε οι δομές δεδομένων με σύντομες περιγραφές:"; + return "Ακολουθούν οι δομές δεδομένων με σύντομες περιγραφές:"; } else { - return "Ακολουθούνε οι κλάσεις, δομές, " - "ενώσεις και οι διασυνδέσεις με σύντομες περιγραφές:"; + return "Ακολουθούν οι κλάσεις, οι δομές, " + "οι ενώσεις και οι διασυνδέσεις με σύντομες περιγραφές:"; } } @@ -297,7 +313,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! This is an introduction to the page with the list of class/file groups */ virtual QCString trModulesDescription() - { return "Ακολουθεί η λίστα όλων των μονάδων:"; } + { return "Ακολουθεί η λίστα όλων των υπομονάδων:"; } // index titles (the project name is prepended for these) @@ -310,7 +326,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 * index of all groups. */ virtual QCString trModuleIndex() - { return "Ευρετήριο μονάδων"; } + { return "Ευρετήριο υπομονάδων"; } /*! This is used in LaTeX as the title of the chapter with the * class hierarchy. @@ -337,13 +353,13 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 * list of all files. */ virtual QCString trFileIndex() - { return "Ευρετήτιο Αρχείων"; } + { return "Ευρετήριο Αρχείων"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all groups. */ virtual QCString trModuleDocumentation() - { return "Τεκμηρίωση Μονάδων"; } + { return "Τεκμηρίωση Υπομονάδων"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. @@ -380,7 +396,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! This is used in LaTeX as the title of the document */ virtual QCString trReferenceManual() - { return "Εγχειρίδιο Αναφοράς"; } + { return "Εγχειρίδιο Τεκμηρίωσης"; } /*! This is used in the documentation of a file as a header before the * list of defines @@ -494,7 +510,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! this text is generated when the \\date command is used. */ virtual QCString trDate() - { return "Ημ/νια"; } + { return "Ημερομηνία"; } /*! this text is generated when the \\return command is used. */ virtual QCString trReturns() @@ -558,14 +574,14 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 ClassDef::CompoundType compType, bool isTemplate) { - QCString result=(QCString)"Αναφορά"; + QCString result=(QCString)"Τεκμηρίωση"; if (isTemplate) result+=" Προτύπου"; switch(compType) { case ClassDef::Class: result+=" Κλάσης "; break; case ClassDef::Struct: result+=" Δομής "; break; case ClassDef::Union: result+=" Ένωσης "; break; - case ClassDef::Interface: result+=" Διασύνδεσης "; break; + case ClassDef::Interface: result+=" Διεπαφής "; break; case ClassDef::Protocol: result+=" Πρωτοκόλλου "; break; case ClassDef::Category: result+=" Κατηγορίας "; break; case ClassDef::Exception: result+=" Εξαίρεσης "; break; @@ -578,7 +594,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! used as the title of the HTML page of a file */ virtual QCString trFileReference(const char *fileName) { - QCString result="Αναφορά Αρχείου "; + QCString result="Τεκμηρίωση Αρχείου "; result+=fileName; return result; } @@ -586,7 +602,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! used as the title of the HTML page of a namespace */ virtual QCString trNamespaceReference(const char *namespaceName) { - QCString result="Αναφορά Χώρου Ονομάτων "; + QCString result="Τεκμηρίωση Χώρου Ονομάτων "; result+=namespaceName; return result; } @@ -594,21 +610,21 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 virtual QCString trPublicMembers() { return "Δημόσιες Μέθοδοι"; } virtual QCString trPublicSlots() - { return "Δημόσια Slots"; } + { return "Δημόσιες Υποδοχές"; } virtual QCString trSignals() { return "Σήματα"; } virtual QCString trStaticPublicMembers() - { return "Στατικές Δημόσιες Μέδοδοι"; } + { return "Στατικές Δημόσιες Μέθοδοι"; } virtual QCString trProtectedMembers() - { return "Προστατευμένες Μέδοδοι"; } + { return "Προστατευμένες Μέθοδοι"; } virtual QCString trProtectedSlots() - { return "Προστατευμένα Slots"; } + { return "Προστατευμένες Υποδοχές"; } virtual QCString trStaticProtectedMembers() - { return "Στατικές Προστατευμένες Μέδοδοι"; } + { return "Στατικές Προστατευμένες Μέθοδοι"; } virtual QCString trPrivateMembers() { return "Ιδιωτικές Μέθοδοι"; } virtual QCString trPrivateSlots() - { return "Ιδιοτικά Slots"; } + { return "Ιδιωτικές Υποδοχές"; } virtual QCString trStaticPrivateMembers() { return "Στατικές Ιδιωτικές Μέθοδοι"; } @@ -642,7 +658,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trInheritsList(int numEntries) { - return "Κληρονομεί "+trWriteList(numEntries)+"."; + return QCString("Κληρονομεί ")+(numEntries==1?"την ":"τις ")+trWriteList(numEntries)+"."; } /*! used in class documentation to produce a list of super classes, @@ -650,7 +666,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trInheritedByList(int numEntries) { - return "Κληρονομείται από "+trWriteList(numEntries)+"."; + return QCString("Κληρονομείται από ")+(numEntries==1?"την ":"τις ")+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of @@ -658,7 +674,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trReimplementedFromList(int numEntries) { - return "Επαναϋλοποιείται από "+trWriteList(numEntries)+"."; + return QCString("Επαναϋλοποιείται από ")+(numEntries==1?"την ":"τις ")+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of @@ -666,7 +682,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trReimplementedInList(int numEntries) { - return "Επαναϋλοποιείται στην "+trWriteList(numEntries)+"."; + return QCString("Επαναϋλοποιείται ")+(numEntries==1?"στην ":"στις ")+trWriteList(numEntries)+"."; } /*! This is put above each page as a link to all members of namespaces. */ @@ -724,14 +740,14 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 case ClassDef::Class: result+="αυτή την κλάση"; break; case ClassDef::Struct: result+="αυτή τη δομή"; break; case ClassDef::Union: result+="αυτή την ένωση"; break; - case ClassDef::Interface: result+="αυτή τη διασύνδεση"; break; + case ClassDef::Interface: result+="αυτή τη διεπαφή"; break; case ClassDef::Protocol: result+="αυτό το πρωτόκολλο"; break; case ClassDef::Category: result+="αυτή την κατηγορία"; break; case ClassDef::Exception: result+="αυτή την εξαίρεση"; break; default: break; } - result+=" δημιουργήθηκε απο τ"; - if (single) result+="ο ακόλουθο αρχείο:"; else result+="α ακόλουθα αρχεία:"; + result+=" δημιουργήθηκε από "; + if (single) result+="το ακόλουθο αρχείο:"; else result+="τα ακόλουθα αρχεία:"; return result; } @@ -783,7 +799,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 /*! this text is put before a collaboration diagram */ virtual QCString trCollaborationDiagram(const char *clName) { - return (QCString)"Δίαγραμμα Συνεργασίας για την κλάση "+clName+":"; + return (QCString)"Διάγραμμα Συνεργασίας για την κλάση "+clName+":"; } /*! this text is put before an include dependency graph */ virtual QCString trInclDepGraph(const char *fName) @@ -1011,8 +1027,8 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 "<li>Ένα μωβ διακεκομένο βέλος χρησιμοποιείται αν μία κλάση περιέχεται ή χρησιμοποιείται " "από μία άλλη κλάση. Το βέλος ονομάζεται από το όνομα της μεταβλητής(ων) " "μέσω της οποίας η κλάση ή δομή είναι προσβάσιμη.</li>\n" - "<li>Ένα κίτρινο διακεκομμένο βέλος χρησιμοποιείται για μια σχέση μεταξύ ενός template αντικειμένου και " - "της template κλάσης από την οποία δημιουργήθηκε. Το βέλος ονομάζεται με τις παραμέτρους του template " + "<li>Ένα κίτρινο διακεκομμένο βέλος χρησιμοποιείται για μια σχέση μεταξύ ενός προτύπου αντικειμένου και " + "της πρότυπης κλάσης από την οποία δημιουργήθηκε. Το βέλος ονομάζεται με τις παραμέτρους του προτύπου " "του αντικειμένου.</li>\n" "</ul>\n"; } @@ -1185,8 +1201,9 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trNamespace(bool first_capital, bool singular) { - QCString result((first_capital ? "Namespace" : "namespace")); - if (!singular) result+="s"; + QCString result((first_capital ? "Χ" : "χ")); + if (!singular) result+="ώροι"; else result+="ώρος"; + result+=" ονομάτων"; return result; } @@ -1503,7 +1520,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 * of documentation blocks for enumeration values */ virtual QCString trEnumerationValueDocumentation() - { return "Enumerator Documentation"; } + { return "Τεκμηρίωση Απαρίθμησης"; } ////////////////////////////////////////////////////////////////////////// // new since 1.5.4 (mainly for Fortran) @@ -1600,7 +1617,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 case ClassDef::Class: result+=" Υπομονάδα"; break; case ClassDef::Struct: result+=" Τύπος"; break; case ClassDef::Union: result+=" Ένωση"; break; - case ClassDef::Interface: result+=" Interface"; break; + case ClassDef::Interface: result+=" Διεπαφή"; break; case ClassDef::Protocol: result+=" Πρωτόκολλο"; break; case ClassDef::Category: result+=" Κατηγορία"; break; case ClassDef::Exception: result+=" Εξαίρεση"; break; @@ -1668,7 +1685,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 case ClassDef::Class: result+="αυτή την υπομονάδα"; break; case ClassDef::Struct: result+="αυτό τον τύπο δεδομένων"; break; case ClassDef::Union: result+="αυτή την ένωση"; break; - case ClassDef::Interface: result+="αυτό το interface"; break; + case ClassDef::Interface: result+="αυτή τη διεπαφή"; break; case ClassDef::Protocol: result+="αυτό το πρωτόκολλο"; break; case ClassDef::Category: result+="αυτή την κατηγορία"; break; case ClassDef::Exception: result+="αυτή την εξαίρεση"; break; @@ -1864,7 +1881,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trProvidedByCategory() { - return "Παρέχεται από την κατηγορία @1."; + return "Παρέχεται από την κατηγορία @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1873,7 +1890,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trExtendsClass() { - return "Κληρονομει την κλάση @1."; + return "Κληρονομει την κλάση @0."; } /*! Used as the header of a list of class methods in Objective-C. @@ -1889,7 +1906,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 */ virtual QCString trInstanceMethods() { - return "Μέθοδοι Αντικειμένου"; + return "Μέθοδοι Υπόστασης"; } /*! Used as the header of the member functions of an Objective-C class. @@ -1907,15 +1924,61 @@ class TranslatorGreek : public TranslatorAdapter_1_8_4 return "Επισκόπηση σχεδίασης"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.8.4 +////////////////////////////////////////////////////////////////////////// -/* Future strategy of changes - Many words have more clear meaning in English and not in Greek: - template -> πρότυπο - instance -> αντικείμενο? (μπορεί να μιλάμε για template instantiation ή class instantiation) - interface -> διασύνδεση -*/ + /** old style UNO IDL services: implemented interfaces */ + virtual QCString trInterfaces() + { return "Εξαγόμενες Διεπαφές"; } -////////////////////////////////////////////////////////////////////////// + /** old style UNO IDL services: inherited services */ + virtual QCString trServices() + { return "Συμπεριλαμβανόμενες Υπηρεσίες"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroups() + { return "Ομάδες Σταθερών"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroupReference(const char *namespaceName) + { + QCString result=namespaceName; + result+=" Τεκμηρίωση Ομάδας Σταθερών"; + return result; + } + /** UNO IDL service page title */ + virtual QCString trServiceReference(const char *sName) + { + QCString result=(QCString)sName; + result+=" Τεκμηρίωση Υπηρεσίας"; + return result; + } + /** UNO IDL singleton page title */ + virtual QCString trSingletonReference(const char *sName) + { + QCString result=(QCString)sName; + result+=" Τεκμηρίωση Μονοσύνολου"; + return result; + } + /** UNO IDL service page */ + virtual QCString trServiceGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"Η τεκμηρίωση για την υπηρεσία αυτή " + "δημιουργήθηκε από "; + if (single) result+="το ακόλουθο αρχείο:"; else result+="τα ακόλουθα αρχεία:"; + return result; + } + /** UNO IDL singleton page */ + virtual QCString trSingletonGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"Η τεκμηρίωση για αυτό το μονοσύνολο " + "δημιουργήθηκε από "; + if (single) result+="το ακόλουθο αρχείο:"; else result+="τα ακόλουθα αρχεία:"; + return result; + } }; diff --git a/src/translator_it.h b/src/translator_it.h index c52aa50..e2c51c7 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -19,13 +19,17 @@ * * Revision history * + * 2015/07: updated translation of new items used since version 1.8.2 and 1.8.4 + * corrected a typo + * updated translator mail address * 2012/04: updated translation of new items used since version 1.7.5 and 1.8.0 * 2010/08: updated translation of new items used since version 1.6.0 and 1.6.3 * completely reviewed the translation in the trLegendDocs() function * corrected some typos all around * reviewed some translations all around * 2007/11: updated translation of new items used since version 1.5.4 - * 2007/10: Included corrections provided by Arialdo Martini <arialdomartini@bebox.it>, updated some strings marked with 'translate me' comment + * 2007/10: Included corrections provided by Arialdo Martini <arialdomartini@bebox.it> + * updated some strings marked with 'translate me' comment * 2006/10: made class to derive directly from Translator class (reported in Petr Prikryl October 9 translator report) * 2006/06: updated translation of new items used since version 1.4.6 * 2006/05: translated new items used since version 1.4.6 @@ -79,13 +83,13 @@ * tecnica (ad es. "lista dei file" e non "lista dei files") * * Se avete suggerimenti sulla traduzione di alcuni termini o volete segnalare - * eventuali sviste potete scrivermi all'indirizzo: alessandro@falappa.net + * eventuali sviste potete scrivermi all'indirizzo: alex.falappa@gmail.com */ #ifndef TRANSLATOR_IT_H #define TRANSLATOR_IT_H -class TranslatorItalian : public TranslatorAdapter_1_8_2 +class TranslatorItalian : public Translator { public: @@ -1832,7 +1836,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_2 /*! Used file list for a Java enum */ virtual QCString trEnumGeneratedFromFiles(bool single) - { QCString result = "La documentazione per questo tipo enumerato è stata generata"; + { QCString result = "La documentazione per questo tipo enumerato è stata generata a partire"; if (!single) result += " dai seguenti"; else result += " dal seguente"; result+=" file:"; @@ -1853,6 +1857,127 @@ class TranslatorItalian : public TranslatorAdapter_1_8_2 virtual QCString trAdditionalInheritedMembers() { return "Altri membri ereditati"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.8.2 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a tooltip for the toggle button that appears in the + * navigation tree in the HTML output when GENERATE_TREEVIEW is + * enabled. This tooltip explains the meaning of the button. + */ + virtual QCString trPanelSynchronisationTooltip(bool enable) + { + QCString opt = enable ? "abilitare" : "disabilitare"; + return "cliccare per "+opt+" la sincronizzazione del pannello"; + } + + /*! Used in a method of an Objective-C class that is declared in a + * a category. Note that the @1 marker is required and is replaced + * by a link. + */ + virtual QCString trProvidedByCategory() + { + return "Fornito dalla categoria @0."; + } + + /*! Used in a method of an Objective-C category that extends a class. + * Note that the @1 marker is required and is replaced by a link to + * the class method. + */ + virtual QCString trExtendsClass() + { + return "Estende la classe @0."; + } + + /*! Used as the header of a list of class methods in Objective-C. + * These are similar to static public member functions in C++. + */ + virtual QCString trClassMethods() + { + return "Metodi della classe"; + } + + /*! Used as the header of a list of instance methods in Objective-C. + * These are similar to public member functions in C++. + */ + virtual QCString trInstanceMethods() + { + return "Metodi di instanza"; + } + + /*! Used as the header of the member functions of an Objective-C class. + */ + virtual QCString trMethodDocumentation() + { + return "Documentazione dei metodi"; + } + + /*! Used as the title of the design overview picture created for the + * VHDL output. + */ + virtual QCString trDesignOverview() + { + return "Panoramica del progetto"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.8.4 +////////////////////////////////////////////////////////////////////////// + + /** old style UNO IDL services: implemented interfaces */ + virtual QCString trInterfaces() + { return "Interfacce esportate"; } + + /** old style UNO IDL services: inherited services */ + virtual QCString trServices() + { return "Servizi inclusi"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroups() + { return "Gruppi di costanti"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroupReference(const char *namespaceName) + { + QCString result="Riferimenti per il gruppo di costanti "; + result+=namespaceName; + return result; + } + /** UNO IDL service page title */ + virtual QCString trServiceReference(const char *sName) + { + QCString result=(QCString)"Riferimenti per il servizio "; + result+=sName; + return result; + } + /** UNO IDL singleton page title */ + virtual QCString trSingletonReference(const char *sName) + { + QCString result=(QCString)"Riferimenti per il singleton "; + result+=sName; + return result; + } + /** UNO IDL service page */ + virtual QCString trServiceGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"La documentazione per questo servizio " + "è stata generata a partire "; + if (single) result+="dal seguente file:"; else result+="dai seguenti file:"; + return result; + } + /** UNO IDL singleton page */ + virtual QCString trSingletonGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"La documentazione per questo singleton " + "è stata generata a partire "; + if (single) result+="dal seguente file:"; else result+="dai seguenti file:"; + return result; + } + +////////////////////////////////////////////////////////////////////////// + }; #endif diff --git a/src/translator_jp.h b/src/translator_jp.h index 66f1ac6..4dc9cba 100644 --- a/src/translator_jp.h +++ b/src/translator_jp.h @@ -1878,7 +1878,7 @@ class TranslatorJapanese : public Translator */ virtual QCString trProvidedByCategory() { - return "@1 カテゴリーから提供されています。"; + return "@0 カテゴリーから提供されています。"; } /*! Used in a method of an Objective-C category that extends a class. @@ -1887,7 +1887,7 @@ class TranslatorJapanese : public Translator */ virtual QCString trExtendsClass() { - return "@1 を拡張しています。"; + return "@0 を拡張しています。"; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_kr.h b/src/translator_kr.h index 7d669a5..2ef50e8 100644 --- a/src/translator_kr.h +++ b/src/translator_kr.h @@ -1903,7 +1903,7 @@ class TranslatorKorean : public Translator */ virtual QCString trProvidedByCategory() { - return "카테고리 @1에 의해 제공됨."; + return "카테고리 @0에 의해 제공됨."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1912,7 +1912,7 @@ class TranslatorKorean : public Translator */ virtual QCString trExtendsClass() { - return "클래스 @1 확장."; + return "클래스 @0 확장."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_lv.h b/src/translator_lv.h index 20b2a38..35aab0f 100644 --- a/src/translator_lv.h +++ b/src/translator_lv.h @@ -1901,7 +1901,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 */ virtual QCString trProvidedByCategory() { - return "Nodrošina kategorija @1."; + return "Nodrošina kategorija @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1910,7 +1910,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 */ virtual QCString trExtendsClass() { - return "Paplašina klasi @1."; + return "Paplašina klasi @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_nl.h b/src/translator_nl.h index ab811a5..241cf97 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -1488,7 +1488,7 @@ class TranslatorDutch : public Translator */ virtual QCString trProvidedByCategory() { - return "Wordt aangeboden door category @1."; + return "Wordt aangeboden door category @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1497,7 +1497,7 @@ class TranslatorDutch : public Translator */ virtual QCString trExtendsClass() { - return "Uitbereiding van klasse @1."; + return "Uitbereiding van klasse @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_pt.h b/src/translator_pt.h index 5edfdf6..5df58d7 100644 --- a/src/translator_pt.h +++ b/src/translator_pt.h @@ -1903,7 +1903,7 @@ class TranslatorPortuguese : public Translator */ virtual QCString trProvidedByCategory() { - return "Provido pela categoria @1."; + return "Provido pela categoria @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1912,7 +1912,7 @@ class TranslatorPortuguese : public Translator */ virtual QCString trExtendsClass() { - return "estende a classe @1."; + return "estende a classe @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_ro.h b/src/translator_ro.h index 394e570..eba7d47 100644 --- a/src/translator_ro.h +++ b/src/translator_ro.h @@ -1908,7 +1908,7 @@ class TranslatorRomanian : public Translator */ virtual QCString trProvidedByCategory() { - return "Furnizat de categoria @1."; + return "Furnizat de categoria @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1917,7 +1917,7 @@ class TranslatorRomanian : public Translator */ virtual QCString trExtendsClass() { - return "Extinde clasa @1."; + return "Extinde clasa @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_ru.h b/src/translator_ru.h index c06027c..2162a34 100644 --- a/src/translator_ru.h +++ b/src/translator_ru.h @@ -1869,7 +1869,7 @@ class TranslatorRussian : public Translator */ virtual QCString trProvidedByCategory() { - return "По группам @1."; + return "По группам @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1878,7 +1878,7 @@ class TranslatorRussian : public Translator */ virtual QCString trExtendsClass() { - return "Расширяет класс @1."; + return "Расширяет класс @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_sk.h b/src/translator_sk.h index 875e92c..d6d94a6 100644 --- a/src/translator_sk.h +++ b/src/translator_sk.h @@ -1866,7 +1866,7 @@ class TranslatorSlovak : public Translator */ virtual QCString trProvidedByCategory() { - return "Deklarované v kategórii @1."; + return "Deklarované v kategórii @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1875,7 +1875,7 @@ class TranslatorSlovak : public Translator */ virtual QCString trExtendsClass() { - return "Rozširuje triedu @1."; + return "Rozširuje triedu @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_sv.h b/src/translator_sv.h index 68b8a1b..d491632 100644 --- a/src/translator_sv.h +++ b/src/translator_sv.h @@ -1764,7 +1764,7 @@ class TranslatorSwedish : public Translator */ virtual QCString trProvidedByCategory() { - return "Tillhandahålls av kategori @1."; + return "Tillhandahålls av kategori @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1773,7 +1773,7 @@ class TranslatorSwedish : public Translator */ virtual QCString trExtendsClass() { - return "Utökar klass @1."; + return "Utökar klass @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/translator_tw.h b/src/translator_tw.h index e61ab5c..79bf6f5 100644 --- a/src/translator_tw.h +++ b/src/translator_tw.h @@ -749,8 +749,7 @@ class TranslatorChinesetraditional : public Translator /*! This is put at the bottom of a class documentation page and is * followed by a list of files that were used to generate the page. */ - virtual QCString trGeneratedFromFiles(ClassDef::CompoundType compType, - bool single) + virtual QCString trGeneratedFromFiles(ClassDef::CompoundType compType,bool) { // here s is one of " Class", " Struct" or " Union" // single is true implies a single file QCString result=(QCString)"此"; @@ -766,7 +765,7 @@ class TranslatorChinesetraditional : public Translator default: break; } result+=" 文件是由下列檔案中產生"; - if (single) result+=":"; else result+=":"; + result+=":"; return result; } @@ -1867,7 +1866,7 @@ class TranslatorChinesetraditional : public Translator */ virtual QCString trProvidedByCategory() { - return "由 @1 分類所提供."; + return "由 @0 分類所提供."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1876,7 +1875,7 @@ class TranslatorChinesetraditional : public Translator */ virtual QCString trExtendsClass() { - return "延伸 @1 類別 ."; + return "延伸 @0 類別 ."; } /*! Used as the header of a list of class methods in Objective-C. @@ -1948,21 +1947,21 @@ class TranslatorChinesetraditional : public Translator return result; } /** UNO IDL service page */ - virtual QCString trServiceGeneratedFromFiles(bool single) + virtual QCString trServiceGeneratedFromFiles(bool) { // single is true implies a single file QCString result=(QCString)"本服務的文件由以下的檔案" "所產生"; - if (single) result+=":"; else result+=":"; + result+=":"; return result; } /** UNO IDL singleton page */ - virtual QCString trSingletonGeneratedFromFiles(bool single) + virtual QCString trSingletonGeneratedFromFiles(bool) { // single is true implies a single file QCString result=(QCString)"本singleton的文件由下面的檔案" "所產生"; - if (single) result+=":"; else result+=":"; + result+=":"; return result; } diff --git a/src/translator_ua.h b/src/translator_ua.h index 871acd1..964285b 100644 --- a/src/translator_ua.h +++ b/src/translator_ua.h @@ -1866,7 +1866,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 */ virtual QCString trProvidedByCategory() { - return "Забезпечено категорією @1."; + return "Забезпечено категорією @0."; } /*! Used in a method of an Objective-C category that extends a class. @@ -1875,7 +1875,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 */ virtual QCString trExtendsClass() { - return "Розширює клас @1."; + return "Розширює клас @0."; } /*! Used as the header of a list of class methods in Objective-C. diff --git a/src/util.cpp b/src/util.cpp index 3ee7ae5..6f3bc40 100644..100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -18,6 +18,7 @@ #include <ctype.h> #include <errno.h> #include <math.h> +#include <limits.h> #include "md5.h" @@ -2472,6 +2473,35 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) QCString dateToString(bool includeTime) { QDateTime current = QDateTime::currentDateTime(); + QCString sourceDateEpoch = portable_getenv("SOURCE_DATE_EPOCH"); + if (!sourceDateEpoch.isEmpty()) + { + bool ok; + uint64 epoch = sourceDateEpoch.toUInt64(&ok); + if (!ok) + { + static bool warnedOnce=FALSE; + if (!warnedOnce) + { + warn_uncond("Environment variable SOURCE_DATE_EPOCH does not contain a valid number; value is '%s'\n", + sourceDateEpoch.data()); + warnedOnce=TRUE; + } + } + else if (epoch>UINT_MAX) + { + static bool warnedOnce=FALSE; + if (!warnedOnce) + { + warn_uncond("Environment variable SOURCE_DATA_EPOCH must have a value smaller than or equal to %llu; actual value %llu\n",UINT_MAX,epoch); + warnedOnce=TRUE; + } + } + else // all ok, replace current time with epoch value + { + current.setTime_t((ulong)epoch); // TODO: add support for 64bit epoch value + } + } return theTranslator->trDateTime(current.date().year(), current.date().month(), current.date().day(), @@ -3975,6 +4005,11 @@ bool getDefs(const QCString &scName, MemberDef *tmd=0; ClassDef *fcd=getResolvedClass(Doxygen::globalScope,0,className,&tmd); + if (fcd==0 && className.find('<')!=-1) // try without template specifiers as well + { + QCString nameWithoutTemplates = stripTemplateSpecifiersFromScope(className,FALSE); + fcd=getResolvedClass(Doxygen::globalScope,0,nameWithoutTemplates,&tmd); + } //printf("Trying class scope %s: fcd=%p tmd=%p\n",className.data(),fcd,tmd); // todo: fill in correct fileScope! if (fcd && // is it a documented class @@ -4261,7 +4296,7 @@ bool getDefs(const QCString &scName, bool found=FALSE; MemberListIterator mmli(*mn); MemberDef *mmd; - for (mmli.toFirst();((mmd=mmli.current()) && !found);++mmli) + for (mmli.toFirst();(mmd=mmli.current());++mmli) { MemberDef *tmd = mmd->getEnumScope(); //printf("try member %s tmd=%s\n",mmd->name().data(),tmd?tmd->name().data():"<none>"); @@ -4726,7 +4761,7 @@ bool resolveLink(/* in */ const char *scName, QCString linkRef=lr; QCString linkRefWithoutTemplates = stripTemplateSpecifiersFromScope(linkRef,FALSE); - //printf("ResolveLink linkRef=%s inSee=%d\n",lr,inSeeBlock); + //printf("ResolveLink linkRef=%s\n",lr); FileDef *fd; GroupDef *gd; PageDef *pd; @@ -5646,6 +5681,37 @@ QCString stripScope(const char *name) return name; } +/*! Converts a string to a HTML id string */ +QCString convertToId(const char *s) +{ + static const char hex[] = "0123456789ABCDEF"; + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const char *p=s; + char c; + bool first=TRUE; + while ((c=*p++)) + { + char encChar[4]; + if ((c>='0' && c<='9') || (c>='a' && c<='z') || (c>='A' && c<='Z') || c=='-' || c==':' || c=='.') + { // any permissive character except _ + if (first && c>='0' && c<='9') growBuf.addChar('a'); // don't start with a digit + growBuf.addChar(c); + } + else + { + encChar[0]='_'; + encChar[1]=hex[((unsigned char)c)>>4]; + encChar[2]=hex[((unsigned char)c)&0xF]; + encChar[3]=0; + growBuf.addStr(encChar); + } + first=FALSE; + } + growBuf.addChar(0); + return growBuf.get(); +} /*! Converts a string to an XML-encoded string */ QCString convertToXML(const char *s) @@ -5743,6 +5809,15 @@ QCString convertToJSString(const char *s) return convertCharEntitiesToUTF8(growBuf.get()); } +QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces) +{ + QGString result; + FTextStream t(&result); + filterLatexString(t,s,insideTabbing,FALSE,FALSE,keepSpaces); + return result.data(); +} + + QCString convertCharEntitiesToUTF8(const QCString &s) { @@ -5831,7 +5906,8 @@ void addMembersToMemberGroup(MemberList *ml, groupId, info->header, info->doc, - info->docFile + info->docFile, + info->docLine ); (*ppMemberGroupSDict)->append(groupId,mg); } @@ -5863,7 +5939,8 @@ void addMembersToMemberGroup(MemberList *ml, groupId, info->header, info->doc, - info->docFile + info->docFile, + info->docLine ); (*ppMemberGroupSDict)->append(groupId,mg); } @@ -6324,11 +6401,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, if (tagInfo) { pd->setReference(tagInfo->tagName); - pd->setFileName(tagInfo->fileName,TRUE); - } - else - { - pd->setFileName(convertNameToFile(pd->name(),FALSE,TRUE),FALSE); + pd->setFileName(tagInfo->fileName); } //printf("Appending page `%s'\n",baseName.data()); @@ -6458,10 +6531,9 @@ void addGroupListToTitle(OutputList &ol,Definition *d) } void filterLatexString(FTextStream &t,const char *str, - bool insideTabbing,bool insidePre,bool insideItem) + bool insideTabbing,bool insidePre,bool insideItem,bool keepSpaces) { if (str==0) return; - //printf("filterLatexString(%s)\n",str); //if (strlen(str)<2) stackTrace(); const unsigned char *p=(const unsigned char *)str; const unsigned char *q; @@ -6480,8 +6552,11 @@ void filterLatexString(FTextStream &t,const char *str, case '{': t << "\\{"; break; case '}': t << "\\}"; break; case '_': t << "\\_"; break; - default: + case ' ': if (keepSpaces) t << "~"; else t << ' '; + break; + default: t << (char)c; + break; } } else @@ -6551,11 +6626,13 @@ void filterLatexString(FTextStream &t,const char *str, break; case '\'': t << "\\textquotesingle{}"; break; + case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' '; + break; default: //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ') if (!insideTabbing && - ((c>='A' && c<='Z' && pc!=' ' && pc!='\0') || (c==':' && pc!=':') || (pc=='.' && isId(c))) + ((c>='A' && c<='Z' && pc!=' ' && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c))) ) { t << "\\+"; @@ -6567,6 +6644,102 @@ void filterLatexString(FTextStream &t,const char *str, } } +QCString latexEscapeLabelName(const char *s,bool insideTabbing) +{ + QGString result; + QCString tmp(qstrlen(s)+1); + FTextStream t(&result); + const char *p=s; + char c; + int i; + while ((c=*p++)) + { + switch (c) + { + case '|': t << "\\texttt{\"|}"; break; + case '!': t << "\"!"; break; + case '%': t << "\\%"; break; + case '{': t << "\\lcurly{}"; break; + case '}': t << "\\rcurly{}"; break; + case '~': t << "````~"; break; // to get it a bit better in index together with other special characters + // NOTE: adding a case here, means adding it to while below as well! + default: + i=0; + // collect as long string as possible, before handing it to docify + tmp[i++]=c; + while ((c=*p) && c!='|' && c!='!' && c!='%' && c!='{' && c!='}' && c!='~') + { + tmp[i++]=c; + p++; + } + tmp[i]=0; + filterLatexString(t,tmp.data(),insideTabbing); + break; + } + } + return result.data(); +} + +QCString latexEscapeIndexChars(const char *s,bool insideTabbing) +{ + QGString result; + QCString tmp(qstrlen(s)+1); + FTextStream t(&result); + const char *p=s; + char c; + int i; + while ((c=*p++)) + { + switch (c) + { + case '!': t << "\"!"; break; + case '"': t << "\"\""; break; + case '@': t << "\"@"; break; + case '|': t << "\\texttt{\"|}"; break; + case '[': t << "["; break; + case ']': t << "]"; break; + case '{': t << "\\lcurly{}"; break; + case '}': t << "\\rcurly{}"; break; + // NOTE: adding a case here, means adding it to while below as well! + default: + i=0; + // collect as long string as possible, before handing it to docify + tmp[i++]=c; + while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|') + { + tmp[i++]=c; + p++; + } + tmp[i]=0; + filterLatexString(t,tmp.data(),insideTabbing); + break; + } + } + return result.data(); +} + +QCString latexEscapePDFString(const char *s) +{ + QGString result; + FTextStream t(&result); + const char *p=s; + char c; + int i; + while ((c=*p++)) + { + switch (c) + { + case '\\': t << "\\textbackslash{}"; break; + case '{': t << "\\{"; break; + case '}': t << "\\}"; break; + default: + t << c; + break; + } + } + return result.data(); +} + QCString rtfFormatBmkStr(const char *name) { @@ -6825,6 +6998,7 @@ bool updateLanguageMapping(const QCString &extension,const QCString &language) void initDefaultExtensionMapping() { + // NOTE: when adding an extension, also add the extension in config.xml g_extLookup.setAutoDelete(TRUE); // extension parser id updateLanguageMapping(".dox", "c"); @@ -6864,8 +7038,9 @@ void initDefaultExtensionMapping() updateLanguageMapping(".phtml", "php"); updateLanguageMapping(".m", "objective-c"); updateLanguageMapping(".M", "objective-c"); - updateLanguageMapping(".mm", "objective-c"); + updateLanguageMapping(".mm", "c"); // see bug746361 updateLanguageMapping(".py", "python"); + updateLanguageMapping(".pyw", "python"); updateLanguageMapping(".f", "fortran"); updateLanguageMapping(".for", "fortran"); updateLanguageMapping(".f90", "fortran"); @@ -8324,7 +8499,7 @@ void convertProtectionLevel( if (extractPrivate) { *outListType1=MemberListType_pubSlots; - *outListType1=MemberListType_proSlots; + *outListType2=MemberListType_proSlots; } else { @@ -8390,3 +8565,48 @@ QCString getDotImageExtension(void) imgExt = imgExt.replace( QRegExp(":.*"), "" ); return imgExt; } + +void initFilePattern(void) +{ + // add default pattern if needed + QStrList &filePatternList = Config_getList("FILE_PATTERNS"); + if (filePatternList.isEmpty()) + { + QDictIterator<int> it( g_extLookup ); + QCString pattern; + bool caseSens = portable_fileSystemIsCaseSensitive(); + for (;it.current();++it) + { + pattern = "*"; + pattern += it.currentKey(); + filePatternList.append(pattern.data()); + if (caseSens) filePatternList.append(pattern.upper().data()); + } + } +} + +bool openOutputFile(const char *outFile,QFile &f) +{ + bool fileOpened=FALSE; + bool writeToStdout=(outFile[0]=='-' && outFile[1]=='\0'); + if (writeToStdout) // write to stdout + { + fileOpened = f.open(IO_WriteOnly,stdout); + } + else // write to file + { + QFileInfo fi(outFile); + if (fi.exists()) // create a backup + { + QDir dir=fi.dir(); + QFileInfo backup(fi.fileName()+".bak"); + if (backup.exists()) // remove existing backup + dir.remove(backup.fileName()); + dir.rename(fi.fileName(),fi.fileName()+".bak"); + } + f.setName(outFile); + fileOpened = f.open(IO_WriteOnly|IO_Translate); + } + return fileOpened; +} + diff --git a/src/util.h b/src/util.h index 43d8752..3f976e3 100644..100755 --- a/src/util.h +++ b/src/util.h @@ -57,6 +57,7 @@ class BufStr; class QFileInfo; class QStrList; class FTextStream; +class QFile; //-------------------------------------------------------------------- @@ -274,8 +275,12 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te QCString stripScope(const char *name); +QCString convertToId(const char *s); + QCString convertToHtml(const char *s,bool keepEntities=TRUE); +QCString convertToLaTeX(const QCString &s,bool insideTabbing=FALSE,bool keepSpaces=FALSE); + QCString convertToXML(const char *s); QCString convertToJSString(const char *s); @@ -334,7 +339,12 @@ void addGroupListToTitle(OutputList &ol,Definition *d); void filterLatexString(FTextStream &t,const char *str, bool insideTabbing=FALSE, bool insidePre=FALSE, - bool insideItem=FALSE); + bool insideItem=FALSE, + bool keepSpaces=FALSE); + +QCString latexEscapeLabelName(const char *s,bool insideTabbing); +QCString latexEscapeIndexChars(const char *s,bool insideTabbing); +QCString latexEscapePDFString(const char *s); QCString rtfFormatBmkStr(const char *name); @@ -464,6 +474,8 @@ void convertProtectionLevel( ); bool mainPageHasTitle(); +void initFilePattern(void); +bool openOutputFile(const char *outFile,QFile &f); #endif diff --git a/src/version.py b/src/version.py deleted file mode 100755 index a99ede3..0000000 --- a/src/version.py +++ /dev/null @@ -1,61 +0,0 @@ -# - -# script to read the version information from `../configure` -# relevant lines are starting with: -# `doxygen_version_major` -# `doxygen_version_minor` -# `doxygen_version_revision` -# `doxygen_version_mmn` -# the collected information is written to: `../VERSION` and `../src/version.cpp` -# -import sys -import os -# -# set 'default' values -# -major = 0 -minor = 0 -revision = 0 -mnt = 'NO' -configure = '../configure' -if len(sys.argv) > 2: - configure = sys.argv[2] -# -# open input file -# read file and get relevant information -# close -# -f = open(configure, 'r') -for line in f: - # check if line can match (saves 3 comparisons) - if (line.startswith('doxygen_version')): - if (line.startswith('doxygen_version_major')): - major = line.replace('doxygen_version_major=','') - elif (line.startswith('doxygen_version_minor')): - minor = line.replace('doxygen_version_minor=','') - elif (line.startswith('doxygen_version_revision')): - revision = line.replace('doxygen_version_revision=','') - elif (line.startswith('doxygen_version_mmn')): - mnt = line.replace('doxygen_version_mmn=','') -f.close() - -# strip superfluous '\n` -major = major.replace('\n','') -minor = minor.replace('\n','') -revision = revision.replace('\n','') -mnt = mnt.replace('\n','') -# -# open output files -# write relevant infomation -# close files -# -f1 = open('../VERSION','w') -f2 = open(os.path.join(sys.argv[1],'version.cpp'),'w') -if (mnt == 'NO'): - f1.write(major + '.' + minor + '.' + revision) - f2.write('char versionString[]="' + major + '.' + minor + '.' + revision + '";') -else: - f1.write(major + '.' + minor + '.' + revision + '-' + mnt) - f2.write('char versionString[]="' + major + '.' + minor + '.' + revision + '-' + mnt + '";') -f1.close() -f2.close() diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 369ae48..e4ae0e7 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -1613,7 +1613,7 @@ void codeFreeVhdlScanner() extern "C" { // some bogus code to keep the compiler happy void vhdlcodeYYdummy() { yy_flex_realloc(0,0); } } -#elif YY_FLEX_SUBMINOR_VERSION<33 +#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 #error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" #endif diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 029d0bd..2d473b2 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -27,10 +27,7 @@ #include <qcstring.h> #include <qfileinfo.h> #include <qstringlist.h> - -//#ifdef DEBUGFLOW #include <qmap.h> -//#endif /* --------------------------------------------------------------- */ @@ -47,7 +44,6 @@ #include "searchindex.h" #include "outputlist.h" #include "parserintf.h" - #include "layout.h" #include "arguments.h" #include "portable.h" @@ -59,11 +55,12 @@ #include "filename.h" #include "membergroup.h" #include "memberdef.h" - +#include "plantuml.h" #include "vhdljjparser.h" #include "VhdlParser.h" - #include "vhdlcode.h" +#include "plantuml.h" +//#define DEBUGFLOW #define theTranslator_vhdlType VhdlDocGen::trVhdlType static QDict<QCString> g_vhdlKeyDict0(17,FALSE); @@ -95,7 +92,7 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem) flowMember=mem; } -const MemberDef* VhdlDocGen::getFlowMember() + const MemberDef* VhdlDocGen::getFlowMember() { return flowMember; } @@ -967,7 +964,6 @@ QCString VhdlDocGen::getClassTitle(const ClassDef *cd) { QCString pageTitle; if (cd==0) return ""; - pageTitle+=cd->displayName(); pageTitle=VhdlDocGen::getClassName(cd); int ii=cd->protection(); pageTitle+=" "; @@ -2163,7 +2159,6 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, { if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) { - nn=mdef->getOutputFileBase(); nn=ltype; } else @@ -2268,10 +2263,11 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.endMemberItem(); if (!mdef->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */) { - ol.startMemberDescription(mdef->anchor()); + QCString s=mdef->briefDescription(); + ol.startMemberDescription(mdef->anchor()); ol.generateDoc(mdef->briefFile(),mdef->briefLine(), mdef->getOuterScope()?mdef->getOuterScope():d, - mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE); + mdef,s.data(),TRUE,FALSE,0,TRUE,FALSE); if (detailsVisible) { ol.pushGeneratorState(); @@ -2612,7 +2608,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname) codeFragment, // input SrcLangExt_VHDL, // lang FALSE, // isExample - 0, // exampleName + 0, // exampleName mdef->getFileDef(), // fileDef mdef->getStartBodyLine(), // startLine mdef->getEndBodyLine(), // endLine @@ -3561,7 +3557,7 @@ void FlowChart::printNode(const FlowChart* flo) } else { - printf("\n NO: %s%s[%d,%d]",q.data(),t.data(),flo->stamp,flo->id); + printf("\n NO: %s[%d,%d]",t.data(),flo->stamp,flo->id); } } } @@ -3747,8 +3743,13 @@ void FlowChart::buildCommentNodes(FTextStream & t) FlowChart *fll=flowList.at(j); if (fll->type & (COMMENT_NO | BEGIN_NO)) { + int diff=FLOWLEN-(j+1); flowList.remove(j); - delete fll; + + if ((fll->type & COMMENT_NO) && diff > 1) + flowList.at(j+1)->label=fll->label; + + delete fll; fll=0; size--; if (j>0) j--; @@ -3843,7 +3844,6 @@ void FlowChart::addFlowChart(int type,const char* text,const char* exp, const ch { flowList.append(fl); } - } void FlowChart::moveToPrevLevel() @@ -3852,6 +3852,88 @@ void FlowChart::moveToPrevLevel() ifcounter--; } +QCString FlowChart::printPlantUmlNode(const FlowChart *flo,bool ca,bool endL) +{ + QCString t; + QCString exp=flo->exp.stripWhiteSpace(); + QCString text=flo->text.stripWhiteSpace(); + switch (flo->type) + { + case START_NO: t=":"+text+"|"; break; + case IF_NO : t="\nif ("+exp+") then (yes)"; break; + case ELSIF_NO: t="\nelseif ("+exp+") then (yes)"; break; + case ELSE_NO: t="\nelse"; break; + case CASE_NO: t="\n:"+exp+";"; break; + case WHEN_NO: t="\n"; + if (!ca) t+="else"; + t+="if ("+exp+") then (yes)"; + break; + case EXIT_NO: break; + case END_NO: if (text.contains(" function")==0) t="\n:"+text+";"; + break; + case TEXT_NO: t="\n:"+text+"]"; break; + case ENDIF_NO: t="\nendif"; break; + case FOR_NO: t="\nwhile ("+exp+") is (yes)"; break; + case WHILE_NO: t="\nwhile ("+exp+") is (yes)"; break; + case END_LOOP: t="\nendwhile"; break; + case END_CASE: t="\nendif\n:end case;"; break; + case VARIABLE_NO:t="\n:"+text+";"; break; + case RETURN_NO: t="\n:"+text+";"; + if (!endL) t+="\nstop"; + break; + case LOOP_NO: t="\nwhile (infinite loop)"; break; + case NEXT_NO: break; + case EMPTY_NO: break; + case COMMENT_NO: t="\n note left \n "+flo->label+"\nend note \n"; break; + case BEGIN_NO: t="\n:begin;"; break; + default: assert(false); break; + } + return t; +} + +void FlowChart::printUmlTree() +{ + int caseCounter = 0; + int whenCounter = 0; + + QCString qcs; + uint size=flowList.count(); + bool endList; + for (uint j=0;j<size;j++) + { + endList=j==FLOWLEN; + FlowChart *flo=flowList.at(j); + if (flo->type==CASE_NO) + { + caseCounter++; + whenCounter=0; + } + + if (flo->type==END_CASE) + { + caseCounter--; + } + + bool ca = (caseCounter>0 && whenCounter==0); + + qcs+=printPlantUmlNode(flo,ca,endList); + + if (flo->type==WHEN_NO) + { + whenCounter++; + } + + } + qcs+="\n"; + + QCString & outDir = Config_getString("OUTPUT_DIRECTORY"); + QCString & htmlOutDir = Config_getString("HTML_OUTPUT"); + + QCString n=convertNameToFileName(); + QCString tmp=htmlOutDir; + n=writePlantUMLSource(tmp,n,qcs); + generatePlantUMLOutput(n.data(),tmp.data(),PUML_SVG); +} QCString FlowChart::convertNameToFileName() { @@ -3859,16 +3941,19 @@ QCString FlowChart::convertNameToFileName() QCString temp,qcs; const MemberDef* md=VhdlDocGen::getFlowMember(); - temp.sprintf("%p",md); + // temp.sprintf("%p",md); qcs=md->name(); + #if 0 if (qcs.find(exp,0)>=0) { qcs.prepend("Z"); qcs=qcs.replace(exp,"_"); } + #endif - return qcs+temp; + //QCString tt= qcs;VhdlDocGen::getRecordNumber(); + return qcs; } const char* FlowChart::getNodeType(int c) @@ -3891,7 +3976,7 @@ const char* FlowChart::getNodeType(int c) case END_CASE: return "end_case "; case VARIABLE_NO: return "variable_decl "; case RETURN_NO: return "return "; - case LOOP_NO: return "infinte loop "; + case LOOP_NO: return "infinite loop "; case NEXT_NO: return "next "; case COMMENT_NO: return "comment "; case EMPTY_NO: return "empty "; @@ -3951,14 +4036,23 @@ void FlowChart::writeFlowChart() } colTextNodes(); + // buildCommentNodes(t); #ifdef DEBUGFLOW - printFlowTree(); + printFlowTree(); #endif + const MemberDef *p=VhdlDocGen::getFlowMember(); + + if (p->isStatic()) + { + printUmlTree(); + delFlowList(); + f.close(); + return; + } startDot(t); buildCommentNodes(t); - uint size=flowList.count(); for (uint j=0;j <size ;j++) @@ -4460,4 +4554,9 @@ parseVhdlCode(codeOutIntf, ); -} + + + + + +}// class diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 2d1ecf1..36d97a7 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -326,6 +326,9 @@ class FlowChart static void buildCommentNodes(FTextStream &t); static void alignCommentNode(FTextStream &t,QCString com); + static void printUmlTree(); + static QCString printPlantUmlNode(const FlowChart *flo,bool,bool); + static QList<FlowChart> flowList; FlowChart(int typ,const char* t,const char* ex,const char* label=0); diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index ea43341..c29bc69 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -164,6 +164,9 @@ void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,En g_thisParser=this; bool inLine=false; inputString=fileBuf; + + // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf); + if (strlen(fileName)==0) { inLine=true; @@ -291,6 +294,8 @@ bool checkInlineCode(QCString & doc) void VhdlParser::handleFlowComment(const char* doc) { + lineCount(doc); + if (VhdlDocGen::getFlowMember()) { QCString qcs(doc); @@ -305,7 +310,9 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief) { int position=0; static bool isIn; - QCString doc(doc1); + QCString doc; + doc.append(doc1); + // fprintf(stderr,"\n %s",doc.data()); if (doc.isEmpty()) return; if (checkMultiComment(doc,yyLineNr)) @@ -359,6 +366,14 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief) current->docLine = yyLineNr; } // printf("parseCommentBlock file<%s>\n [%s]\n at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine); + + int j=doc.find("[plant]"); + if (j>=0) + { + doc=doc.remove(j,7); + current->stat=true; + } + while (parseCommentBlock( g_thisParser, current, @@ -407,7 +422,10 @@ void VhdlParser::addCompInst(const char *n, const char* instName, const char* co current->type=instName; // foo:instname e.g proto or work. proto(ttt) current->exception=genLabels.lower(); // |arch|label1:label2... current->name=n; // foo - current->args=lastCompound->name; // architecture name + if (lastCompound) + { + current->args=lastCompound->name; // architecture name + } current->includeName=comp; // component/enity/configuration int u=genLabels.find("|",1); if (u>0) diff --git a/src/xmlcode.l b/src/xmlcode.l index 15b5d7e..fd36ebb 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -407,7 +407,7 @@ void resetXmlCodeParserState() extern "C" { // some bogus code to keep the compiler happy void xmlcodeYYdummy() { yy_flex_realloc(0,0); } } -#elif YY_FLEX_SUBMINOR_VERSION<33 +#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 #error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." #endif diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 27f7274..c5550f0 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -223,33 +223,15 @@ void XmlDocVisitor::visit(DocVerbatim *s) m_t << "</verbatim>"; break; case DocVerbatim::HtmlOnly: - m_t << "<htmlonly>"; - filter(s->text()); - m_t << "</htmlonly>"; - break; case DocVerbatim::RtfOnly: - m_t << "<rtfonly>"; - filter(s->text()); - m_t << "</rtfonly>"; - break; case DocVerbatim::ManOnly: - m_t << "<manonly>"; - filter(s->text()); - m_t << "</manonly>"; - break; case DocVerbatim::LatexOnly: - m_t << "<latexonly>"; - filter(s->text()); - m_t << "</latexonly>"; + case DocVerbatim::DocbookOnly: + /* nothing */ break; case DocVerbatim::XmlOnly: m_t << s->text(); break; - case DocVerbatim::DocbookOnly: - m_t << "<docbookonly>"; - filter(s->text()); - m_t << "</docbookonly>"; - break; case DocVerbatim::Dot: visitPreStart(m_t, "dot", s->hasCaption(), this, s->children(), QCString(""), FALSE, DocImage::Html, s->width(), s->height()); filter(s->text()); |