diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:51:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:51:13 +0900 |
commit | b65cb2d67b946445ba89e1938cee8527969922cd (patch) | |
tree | e3aff002a9b580aef8a80eb3823786993c3a5c64 /src | |
parent | 738086af77ab085837d0044a33a5d954a3edc6f5 (diff) | |
download | doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.tar.gz doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.tar.bz2 doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.zip |
Imported Upstream version 1.8.7upstream/1.8.7
Diffstat (limited to 'src')
252 files changed, 7868 insertions, 5100 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 7d1d0d9..875cf1d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -2,7 +2,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -14,6 +14,8 @@ # input used in their production; they are not affected by this license. # +GENERATED_SRC = ../generated_src/doxygen + all: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile $(MAKE) -f Makefile.libdoxycfg $@ $(MAKE) -f Makefile.libdoxygen $@ @@ -42,20 +44,11 @@ clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen # also clean flex/bison generated files distclean: clean - -$(RM) scanner.cpp code.cpp config.cpp pre.cpp constexp.cpp \ + -cd $(GENERATED_SRC) && $(RM) scanner.cpp code.cpp config.cpp pre.cpp constexp.cpp \ ce_parse.cpp ce_parse.h tag.cpp commentscan.cpp \ declinfo.cpp defargs.cpp commentcnv.cpp doctokenizer.cpp \ pycode.cpp pyscanner.cpp fortrancode.cpp fortranscanner.cpp \ vhdlscanner.cpp vhdlcode.cpp tclscanner.cpp vhdlparser.h \ vhdlparser.cpp -# clean also the generated files which are in SVN -realclean: distclean - -$(RM) index.xsd.h compound.xsd.h layout_default.xml.h \ - header.html.h footer.html.h search_functions.php.h search_opensearch.php.h \ - search.js.h search.css.h doxygen.css.h navtree.js.h resize.js.h \ - doxygen.sty.h jquery_fx.js.h jquery_p1.js.h jquery_p2.js.h \ - jquery_p3.js.h jquery_ui.js.h navtree.css.h svgpan.js.h dynsections.js.h \ - doxygen.bst.h bib2xhtml.pl.h configoptions.cpp jquery_pt.js.h extsearch.js.h - FORCE: diff --git a/src/arguments.h b/src/arguments.h index eba452c..ed09869 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/bufstr.h b/src/bufstr.h index cfb89c4..7fb7d40 100644 --- a/src/bufstr.h +++ b/src/bufstr.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/cite.cpp b/src/cite.cpp index 3e3eb43..a3056ba 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -239,6 +239,7 @@ void CiteDict::generatePage() const QFileInfo fi(citeListFile); QCString input(fi.size()+1); f.readBlock(input.data(),fi.size()); + f.close(); input.at(fi.size())='\0'; int p=0,s; //printf("input=[%s]\n",input.data()); @@ -310,7 +311,7 @@ void CiteDict::generatePage() const thisDir.remove(bib2xhtmlFile); while (!tempFiles.isEmpty()) { - QCString *s=tempFiles.take(); + QCString *s=tempFiles.take(0); thisDir.remove(*s); } } diff --git a/src/classdef.cpp b/src/classdef.cpp index 6404431..eded587 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -897,8 +897,9 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, for (spi.toFirst();(al=spi.current());++spi) { ol.docify("template<"); - Argument *a=al->first(); - while (a) + QListIterator<Argument> ali(*al); + Argument *a; + while ((a=ali.current())) { ol.docify(a->type); if (!a->name.isEmpty()) @@ -911,7 +912,8 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, ol.docify(" = "); ol.docify(a->defval); } - a=al->next(); + ++ali; + a=ali.current(); if (a) ol.docify(", "); } ol.docify(">"); @@ -1084,8 +1086,9 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.parseText(generatedFromFiles()); bool first=TRUE; - FileDef *fd = m_impl->files.first(); - while (fd) + QListIterator<FileDef> li(m_impl->files); + FileDef *fd; + for (;(fd=li.current());++li) { if (first) { @@ -1139,8 +1142,6 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.popGeneratorState(); ol.endItemListItem(); - - fd=m_impl->files.next(); } if (!first) ol.endItemList(); @@ -1153,22 +1154,20 @@ int ClassDef::countInheritanceNodes() BaseClassDef *ibcd; if (m_impl->inheritedBy) { - ibcd=m_impl->inheritedBy->first(); - while (ibcd) + BaseClassListIterator it(*m_impl->inheritedBy); + for (;(ibcd=it.current());++it) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_impl->inheritedBy->next(); } } if (m_impl->inherits) { - ibcd=m_impl->inherits->first(); - while (ibcd) + BaseClassListIterator it(*m_impl->inherits); + for (;(ibcd=it.current());++it) { ClassDef *icd=ibcd->classDef; if ( icd->isVisibleInHierarchy()) count++; - ibcd=m_impl->inherits->next(); } } return count; @@ -1767,20 +1766,24 @@ void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor) } } +bool ClassDef::visibleInParentsDeclList() const +{ + static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); + static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES"); + static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES"); + bool linkable = isLinkable(); + return (name().find('@')==-1 && !isExtension() && + (protection()!=::Private || extractPrivate) && + (linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses))) + ); +} void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames) { //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); - static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES"); - static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES"); - bool isLink = isLinkable(); SrcLangExt lang = getLanguage(); - if (isLink || - (!hideUndocClasses && - (!isLocal() || extractLocalClasses) - ) - ) + if (visibleInParentsDeclList()) { if (!found) // first class { @@ -1820,7 +1823,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade ol.writeString(" "); ol.insertMemberAlign(); } - if (isLink) + if (isLinkable()) { ol.writeObjectLink(getReference(), getOutputFileBase(), @@ -2100,7 +2103,8 @@ void ClassDef::writeMemberPages(OutputList &ol) MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) { - if (ml->listType()&MemberListType_detailedLists) + ml->countDocMembers(); + if (ml->numDocMembers()>0 && (ml->listType()&MemberListType_detailedLists)) { ml->writeDocumentationPage(ol,displayName(),this); } @@ -2127,7 +2131,7 @@ void ClassDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const for (mnii.toFirst();(mi=mnii.current());++mnii) { MemberDef *md=mi->memberDef; - if (md->getClassDef()==this && md->isLinkable()) + if (md->getClassDef()==this && md->isLinkable() && !md->isEnumValue()) { ol.writeString(" <tr><td class=\"navtab\">"); if (md->isLinkableInProject()) @@ -2224,8 +2228,9 @@ void ClassDef::writeMemberList(OutputList &ol) MemberNameInfo *mni; for (mnii.toFirst();(mni=mnii.current());++mnii) { - MemberInfo *mi=mni->first(); - while (mi) + MemberNameInfoIterator it(*mni); + MemberInfo *mi; + for (;(mi=it.current());++it) { MemberDef *md=mi->memberDef; ClassDef *cd=md->getClassDef(); @@ -2421,7 +2426,6 @@ void ClassDef::writeMemberList(OutputList &ol) ol.writeString("</tr>\n"); } } - mi=mni->next(); } } //ol.endItemList(); @@ -3407,10 +3411,11 @@ QCString ClassDef::compoundTypeString() const QCString ClassDef::getOutputFileBase() const { - if (!Doxygen::generatingXmlOutput) + static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES"); + static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS"); + static bool separateMemberPages = Config_getBool("SEPARATE_MEMBER_PAGES"); + if (!Doxygen::generatingXmlOutput && !separateMemberPages) { - static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES"); - static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS"); Definition *scope=0; if (inlineGroupedClasses && partOfGroups()!=0) { @@ -3728,7 +3733,7 @@ void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const } QCString ClassDef::qualifiedNameWithTemplateParameters( - QList<ArgumentList> *actualParams) const + QList<ArgumentList> *actualParams,int *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES"); @@ -3740,7 +3745,7 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( if (d->definitionType()==Definition::TypeClass) { ClassDef *cd=(ClassDef *)d; - scName = cd->qualifiedNameWithTemplateParameters(actualParams); + scName = cd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } else if (!hideScopeNames) { @@ -3765,13 +3770,14 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( ArgumentList *al=0; if (templateArguments()) { - if (actualParams && (al=actualParams->current())) + if (actualParams && *actualParamIndex<(int)actualParams->count()) { + al = actualParams->at(*actualParamIndex); if (!isSpecialization) { scName+=tempArgListToString(al); } - actualParams->next(); + (*actualParamIndex)++; } else { @@ -3893,14 +3899,14 @@ MemberList *ClassDef::createMemberList(MemberListType lt) MemberList *ClassDef::getMemberList(MemberListType lt) { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = m_impl->memberLists.next(); } return 0; } @@ -3919,11 +3925,15 @@ void ClassDef::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief) void ClassDef::sortMemberLists() { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_impl->memberLists.next(); + } + if (m_impl->innerClasses) + { + m_impl->innerClasses->sort(); } } @@ -3948,6 +3958,17 @@ int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, count+=ml2->numDecMembers(); //printf("-> ml2=%d\n",ml2->numDecMembers()); } + // also include grouped members that have their own section in the class (see bug 722759) + if (inheritedFrom && m_impl->memberGroupSDict) + { + MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + count+=mg->countGroupedInheritedMembers(lt); + if (lt2!=1) count+=mg->countGroupedInheritedMembers((MemberListType)lt2); + } + } static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB"); if (!inlineInheritedMembers) // show inherited members as separate lists { @@ -4437,11 +4458,11 @@ MemberDef *ClassDef::isSmartPointer() const void ClassDef::reclassifyMember(MemberDef *md,MemberType t) { md->setMemberType(t); - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { ml->remove(md); - ml = m_impl->memberLists.next(); } insertMember(md); } @@ -4526,11 +4547,11 @@ void ClassDef::setTagLessReference(ClassDef *cd) void ClassDef::removeMemberFromLists(MemberDef *md) { - MemberList *ml = m_impl->memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_impl->memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { ml->remove(md); - ml = m_impl->memberLists.next(); } } diff --git a/src/classdef.h b/src/classdef.h index 4e76117..8c5bebf 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -168,6 +168,9 @@ class ClassDef : public Definition /** the class is visible in a class diagram, or class hierarchy */ bool isVisibleInHierarchy(); + /** show this class in the declaration section of its parent? */ + bool visibleInParentsDeclList() const; + /** Returns the template arguments of this class * Will return 0 if not applicable. */ @@ -243,7 +246,7 @@ class ClassDef : public Definition void getTemplateParameterLists(QList<ArgumentList> &lists) const; QCString qualifiedNameWithTemplateParameters( - QList<ArgumentList> *actualParams=0) const; + QList<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; /** Returns TRUE if there is at least one pure virtual member in this * class. @@ -310,14 +313,13 @@ class ClassDef : public Definition QCString generatedFromFiles() const; const FileList &usedFiles() const; - QCString includeStatement() const; - const ArgumentList *typeConstraints() const; const ExampleSDict *exampleList() const; bool hasExamples() const; QCString getMemberListFileName() const; bool subGrouping() const; + //----------------------------------------------------------------------------------- // --- setters ---- //----------------------------------------------------------------------------------- @@ -432,6 +434,8 @@ class ClassDef : public Definition QPtrDict<void> *visitedClasses); void getTitleForMemberListType(MemberListType type, QCString &title,QCString &subtitle); + QCString includeStatement() const; + ClassDefImpl *m_impl; @@ -528,11 +532,11 @@ class BaseClassList : public QList<BaseClassDef> { public: ~BaseClassList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const BaseClassDef *item1,const BaseClassDef *item2) const { - ClassDef *c1=((BaseClassDef *)item1)->classDef; - ClassDef *c2=((BaseClassDef *)item2)->classDef; - if (c1==0 || c2==0) + const ClassDef *c1=item1->classDef; + const ClassDef *c2=item2->classDef; + if (c1==0 || c2==0) return FALSE; else return qstricmp(c1->name(),c2->name()); diff --git a/src/classlist.cpp b/src/classlist.cpp index f19c374..5751356 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -33,30 +33,25 @@ ClassList::~ClassList() { } -static int compItems(void *item1,void *item2) +static int compItems(const ClassDef *c1,const ClassDef *c2) { - ClassDef *c1=(ClassDef *)item1; - ClassDef *c2=(ClassDef *)item2; static bool b = Config_getBool("SORT_BY_SCOPE_NAME"); - //printf("compItems: %d %s<->%s\n",b,c1->name().data(),c2->name().data()); if (b) { - return qstricmp(c1->name(), - c2->name()); + return qstricmp(c1->name(), c2->name()); } else { - return qstricmp(c1->className(), - c2->className()); + return qstricmp(c1->className(), c2->className()); } } -int ClassList::compareItems(QCollection::Item item1, QCollection::Item item2) +int ClassList::compareValues(const ClassDef *item1, const ClassDef *item2) const { return compItems(item1,item2); } -int ClassSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int ClassSDict::compareValues(const ClassDef *item1, const ClassDef *item2) const { return compItems(item1,item2); } diff --git a/src/classlist.h b/src/classlist.h index adc781c..3f15b3e 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -28,12 +28,13 @@ class Definition; /** A list of ClassDef objects. */ class ClassList : public QList<ClassDef> -{ +{ public: ClassList(); ~ClassList(); - - int compareItems(QCollection::Item item1,QCollection::Item item2); + + private: + int compareValues(const ClassDef *item1,const ClassDef *item2) const; }; /** An iterator for ClassDef objects in a ClassList. */ @@ -57,11 +58,12 @@ class ClassSDict : public SDict<ClassDef> public: ClassSDict(int size=17) : SDict<ClassDef>(size) {} ~ClassSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); - void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, + void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, const char *header=0,bool localNames=FALSE); - void writeDocumentation(OutputList &ol,Definition *container=0); - bool declVisible(const ClassDef::CompoundType *filter=0) const; + void writeDocumentation(OutputList &ol,Definition *container=0); + bool declVisible(const ClassDef::CompoundType *filter=0) const; + private: + int compareValues(const ClassDef *item1,const ClassDef *item2) const; }; class GenericsCollection : public QIntDict<ClassDef> diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index c728be3..45469f2 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -63,6 +63,7 @@ CommandMap cmdMap[] = { "internal", CMD_INTERNAL }, { "invariant", CMD_INVARIANT }, { "javalink", CMD_JAVALINK }, + { "latexinclude", CMD_LATEXINCLUDE }, { "latexonly", CMD_LATEXONLY }, { "li", CMD_LI }, { "line", CMD_LINE }, @@ -135,6 +136,8 @@ CommandMap cmdMap[] = { "parblock", CMD_PARBLOCK }, { "endparblock", CMD_ENDPARBLOCK }, { "diafile", CMD_DIAFILE }, + { "--", CMD_NDASH }, + { "---", CMD_MDASH }, { 0, 0 }, }; diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 0017c02..d89e368 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -124,7 +124,10 @@ enum CommandType CMD_ENDINTERNAL = 94, CMD_PARBLOCK = 95, CMD_ENDPARBLOCK = 96, - CMD_DIAFILE = 97 + CMD_DIAFILE = 97, + CMD_LATEXINCLUDE = 98, + CMD_NDASH = 99, + CMD_MDASH = 100 }; enum HtmlTagType @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -111,6 +111,7 @@ static int g_lastSkipCppContext; static int g_lastVerbStringContext; static int g_memCallContext; static int g_lastCContext; +static int g_skipInlineInitContext; static bool g_insideObjC; static bool g_insideJava; @@ -299,21 +300,18 @@ ClassDef *VariableContext::findVariable(const QCString &name) { if (name.isEmpty()) return 0; ClassDef *result = 0; - //QListIterator<Scope> sli(m_scopes); + QListIterator<Scope> sli(m_scopes); Scope *scope; QCString key = name; // search from inner to outer scope - scope = m_scopes.last(); - //for (sli.toLast();(scope=sli.current());--sli) - while (scope) + for (sli.toLast();(scope=sli.current());--sli) { result = scope->find(key); - if (result) + if (result) { DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); return result; } - scope = m_scopes.prev(); } // nothing found -> also try the global scope result=m_globalScope.find(name); @@ -671,9 +669,10 @@ static void setParameterList(MemberDef *md) { g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; ArgumentList *al = md->argumentList(); - if (al==0) return; - Argument *a = al->first(); - while (a) + if (al==0) return; + ArgumentListIterator it(*al); + Argument *a; + for (;(a=it.current());++it) { g_parmName = a->name.copy(); g_parmType = a->type.copy(); @@ -684,7 +683,6 @@ static void setParameterList(MemberDef *md) g_parmType.stripPrefix("const "); g_parmType=g_parmType.stripWhiteSpace(); g_theVarContext.addVariable(g_parmType,g_parmName); - a = al->next(); } } @@ -803,13 +801,14 @@ static MemberDef *setCallContextForVar(const QCString &name) } else if (mn->count()>1) // global defined more than once { - MemberDef *md=mn->first(); - while (md) + MemberNameIterator it(*mn); + MemberDef *md; + for (;(md=it.current());++it) { //printf("mn=%p md=%p md->getBodyDef()=%p g_sourceFileDef=%p\n", // mn,md, // md->getBodyDef(),g_sourceFileDef); - + // in case there are multiple members we could link to, we // only link to members if defined in the same file or // defined as external. @@ -821,7 +820,6 @@ static MemberDef *setCallContextForVar(const QCString &name) //printf("returning member %s in source file %s\n",md->name().data(),g_sourceFileDef->name().data()); return md; } - md=mn->next(); } return 0; } @@ -1801,6 +1799,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" %x OldStyleArgs %x UsingName %x RawString +%x InlineInit %% @@ -2545,7 +2544,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_name+=yytext; BEGIN( FuncCall ); } -<FuncCall,Body,MemberCall,MemberCall2,SkipInits>{RAWBEGIN} { +<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} { QCString text=yytext; int i=text.find('R'); g_code->codify(text.left(i+1)); @@ -2557,14 +2556,14 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_delimiter=g_delimiter.left(g_delimiter.length()-1); BEGIN( RawString ); } -<FuncCall,Body,MemberCall,MemberCall2,SkipInits>\" { +<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\" { startFontClass("stringliteral"); g_code->codify(yytext); g_lastStringContext=YY_START; g_inForEachExpression = FALSE; BEGIN( SkipString ); } -<FuncCall,Body,MemberCall,MemberCall2,SkipInits>\' { +<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' { startFontClass("stringliteral"); g_code->codify(yytext); g_lastStringContext=YY_START; @@ -2918,6 +2917,35 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_theVarContext.addVariable(g_parmType,g_parmName); g_parmType.resize(0);g_parmName.resize(0); } +<MemberCall2,FuncCall>"{" { + if (g_bracketCount>0) + { + g_code->codify(yytext); + g_skipInlineInitContext=YY_START; + g_curlyCount=0; + BEGIN(InlineInit); + } + else + { + REJECT; + } + } +<InlineInit>"{" { g_curlyCount++; + g_code->codify(yytext); + } +<InlineInit>"}" { + g_code->codify(yytext); + if (--g_curlyCount<=0) + { + BEGIN(g_skipInlineInitContext); + } + } +<InlineInit>\n { + codifyLines(yytext); + } +<InlineInit>. { + g_code->codify(yytext); + } <MemberCall2,FuncCall>"(" { g_parmType.resize(0);g_parmName.resize(0); g_code->codify(yytext); @@ -3254,8 +3282,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } } <SkipCPP>\n/.*\n { - codifyLines(yytext); endFontClass(); + codifyLines(yytext); BEGIN( g_lastSkipCppContext ) ; } <*>\n{B}*"//@"[{}].*\n { // remove one-line group marker diff --git a/src/commentcnv.h b/src/commentcnv.h index 1c1fcb9..6255a73 100644 --- a/src/commentcnv.h +++ b/src/commentcnv.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -16,7 +16,7 @@ */ #ifndef _COMMENTCNV_H -#define _COMMNETCNV_H +#define _COMMENTCNV_H class BufStr; diff --git a/src/commentcnv.l b/src/commentcnv.l index d59ef51..4cc9da9 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -52,6 +52,13 @@ struct CondCtx bool skip; }; +struct CommentCtx +{ + CommentCtx(int line) + : lineNr(line) {} + int lineNr; +}; + static BufStr * g_inBuf; static BufStr * g_outBuf; static int g_inBufPos; @@ -64,6 +71,7 @@ static QCString g_fileName; static int g_lineNr; static int g_condCtx; static QStack<CondCtx> g_condStack; +static QStack<CommentCtx> g_commentStack; static QCString g_blockName; static int g_lastCommentContext; static bool g_inSpecialComment; @@ -256,8 +264,10 @@ void replaceComment(int offset); { g_pythonDocString = TRUE; g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ copyToOutput(yytext,(int)yyleng); BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } } <Scan>![><!]/.*\n { @@ -269,7 +279,9 @@ void replaceComment(int offset); { copyToOutput(yytext,(int)yyleng); g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } } <Scan>[Cc\*][><!]/.*\n { @@ -284,7 +296,9 @@ void replaceComment(int offset); { copyToOutput(yytext,(int)yyleng); g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } else { @@ -378,8 +392,10 @@ void replaceComment(int offset); <Scan>"/*"[*!]? { /* start of a C comment */ g_specialComment=(int)yyleng==3; g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ copyToOutput(yytext,(int)yyleng); BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } <Scan>"#"("#")? { if (g_lang!=SrcLangExt_Python) @@ -390,7 +406,9 @@ void replaceComment(int offset); { copyToOutput(yytext,(int)yyleng); g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } } <Scan>"--!" { @@ -402,7 +420,9 @@ void replaceComment(int offset); { copyToOutput(yytext,(int)yyleng); g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } } <Scan>![><!] { @@ -414,7 +434,9 @@ void replaceComment(int offset); { copyToOutput(yytext,(int)yyleng); g_nestingCount=0; + g_commentStack.clear(); /* to be on the save side */ BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } } <CComment>"{@code"/[ \t\n] { @@ -606,6 +628,7 @@ void replaceComment(int offset); } <CComment>"/"+"*" { /* nested C comment */ g_nestingCount++; + g_commentStack.push(new CommentCtx(g_lineNr)); copyToOutput(yytext,(int)yyleng); } <CComment>"*"+"/" { /* end of C comment */ @@ -615,14 +638,15 @@ void replaceComment(int offset); } else { + copyToOutput(yytext,(int)yyleng); if (g_nestingCount<=0) { - copyToOutput(yytext,(int)yyleng); BEGIN(Scan); } else { g_nestingCount--; + delete g_commentStack.pop(); } } } @@ -731,7 +755,7 @@ void replaceComment(int offset); <CComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command copyToOutput(yytext,(int)yyleng); } -<CComment,ReadLine>[\\@]"cond"[ \t]+ { // conditional section +<CComment,ReadLine>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section g_condCtx = YY_START; BEGIN(CondLine); } @@ -951,6 +975,8 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) g_lineNr = 1; g_condStack.clear(); g_condStack.setAutoDelete(TRUE); + g_commentStack.clear(); + g_commentStack.setAutoDelete(TRUE); printlex(yy_flex_debug, TRUE, __FILE__, fileName); isFixedForm = FALSE; @@ -963,6 +989,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) { g_nestingCount=0; BEGIN(CComment); + g_commentStack.push(new CommentCtx(g_lineNr)); } else { @@ -977,6 +1004,23 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) warn(g_fileName,ctx->lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); } + if (g_nestingCount>0 || (YY_START==CComment && g_lang!=SrcLangExt_Markdown)) + { + QCString tmp= "(probable line reference: "; + bool first = TRUE; + while (!g_commentStack.isEmpty()) + { + CommentCtx *ctx = g_commentStack.pop(); + if (!first) tmp += ", "; + tmp += QCString().setNum(ctx->lineNr); + first = FALSE; + delete ctx; + } + tmp += ")"; + warn(g_fileName,g_lineNr,"Reached end of file while still inside a (nested) comment. " + "Nesting level %d %s",g_nestingCount+1,tmp.data()); // add one for "normal" expected end of comment + } + g_commentStack.clear(); if (Debug::isFlagSet(Debug::CommentCnv)) { g_outBuf->at(g_outBuf->curPos())='\0'; diff --git a/src/commentscan.h b/src/commentscan.h index e296b89..ce28ea2 100644 --- a/src/commentscan.h +++ b/src/commentscan.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/commentscan.l b/src/commentscan.l index 0d08e5c..bd20bf0 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1,6 +1,6 @@ /***************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -234,6 +234,7 @@ static DocCmdMap docCmdMap[] = { "include", 0, TRUE }, { "includelineno", 0, TRUE }, { "invariant", 0, TRUE }, + { "latexinclude", 0, FALSE }, { "li", 0, TRUE }, { "line", 0, TRUE }, { "note", 0, TRUE }, @@ -553,7 +554,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, item->text += " <p>"; if (Doxygen::markdownSupport) { - item->text += processMarkdown(yyFileName,current,outputXRef); + item->text += processMarkdown(yyFileName,yyLineNr,current,outputXRef); } else { @@ -575,7 +576,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, ASSERT(item!=0); if (Doxygen::markdownSupport) { - item->text = processMarkdown(yyFileName,current,outputXRef); + item->text = processMarkdown(yyFileName,yyLineNr,current,outputXRef); } else { @@ -593,11 +594,26 @@ static void addXRefItem(const char *listName,const char *itemTitle, { docEntry->doc += cmdString; } - SectionInfo *si=new SectionInfo(listName,anchorLabel, - g_sectionTitle,SectionInfo::Anchor, - g_sectionLevel); - Doxygen::sectionDict->append(anchorLabel,si); - docEntry->anchors->append(si); + SectionInfo *si = Doxygen::sectionDict->find(anchorLabel); + if (si) + { + if (si->lineNr != -1) + { + warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel,si->fileName.data(),si->lineNr); + } + else + { + warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel,si->fileName.data()); + } + } + else + { + si=new SectionInfo(listName,yyLineNr,anchorLabel, + g_sectionTitle,SectionInfo::Anchor, + g_sectionLevel); + Doxygen::sectionDict->append(anchorLabel,si); + docEntry->anchors->append(si); + } } outputXRef.resize(0); } @@ -643,18 +659,32 @@ static SectionInfo::SectionType sectionLevelToType(int level) static void addSection() { - // create a new section element - g_sectionTitle+=yytext; - g_sectionTitle=g_sectionTitle.stripWhiteSpace(); - SectionInfo *si = new SectionInfo(yyFileName,g_sectionLabel, + SectionInfo *si = Doxygen::sectionDict->find(g_sectionLabel); + if (si) + { + if (si->lineNr != -1) + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",g_sectionLabel.data(),si->fileName.data(),si->lineNr); + } + else + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",g_sectionLabel.data(),si->fileName.data()); + } + } + else + { + // create a new section element + g_sectionTitle+=yytext; + g_sectionTitle=g_sectionTitle.stripWhiteSpace(); + si = new SectionInfo(yyFileName,yyLineNr,g_sectionLabel, g_sectionTitle,sectionLevelToType(g_sectionLevel),g_sectionLevel); - // add section to this entry - current->anchors->append(si); - - // add section to the global dictionary - Doxygen::sectionDict->append(g_sectionLabel,si); + // add section to this entry + current->anchors->append(si); + // add section to the global dictionary + Doxygen::sectionDict->append(g_sectionLabel,si); + } } //----------------------------------------------------------------------------- @@ -850,7 +880,7 @@ DCMD1 ("arg"|"attention"|"author"|"cite"|"code") DCMD2 ("date"|"dot"|"msc"|"dotfile"|"example") DCMD3 ("htmlinclude"|"htmlonly"|"image"|"include") DCMD4 ("includelineno"|"internal"|"invariant") -DCMD5 ("latexonly"|"li"|"line"|"manonly"|"name") +DCMD5 ("latexinclude"|"latexonly"|"li"|"line"|"manonly"|"name") DCMD6 ("note"|"par"|"paragraph"|"param"|"post") DCMD7 ("pre"|"remarks"|(("relate"[sd])("also")?)) DCMD8 ("remarks"|("return"[s]?)|"retval"|"sa"|"section") @@ -1170,6 +1200,12 @@ RCSTAG "$"{ID}":"[^\n$]+"$" <Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{B}*/\n { // horizontal line (dashed) addOutput(yytext); } +<Comment>{CMD}"---" { // escaped mdash + addOutput(yytext); + } +<Comment>{CMD}"--" { // escaped mdash + addOutput(yytext); + } <Comment>"---" { // mdash addOutput(insidePre || Doxygen::markdownSupport ? yytext : "—"); } @@ -1701,9 +1737,24 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle arguments of the anchor command ------- */ <AnchorLabel>{LABELID} { // found argument - SectionInfo *si = new SectionInfo(yyFileName,yytext,0,SectionInfo::Anchor,0); - Doxygen::sectionDict->append(yytext,si); - current->anchors->append(si); + SectionInfo *si = Doxygen::sectionDict->find(yytext); + if (si) + { + if (si->lineNr != -1) + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",yytext,si->fileName.data(),si->lineNr); + } + else + { + warn(yyFileName,yyLineNr,"multiple use of section label '%s', (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); + } addOutput(yytext); BEGIN( Comment ); } @@ -1765,7 +1816,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle arguments of if/ifnot commands ------- */ -<GuardParam>"(" { +<GuardParam>{B}*"(" { g_guardExpr=yytext; g_roundCount=1; BEGIN(GuardExpr); @@ -1791,7 +1842,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" unput(*yytext); BEGIN(GuardParam); } -<GuardParam>[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot guard +<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot guard handleGuard(yytext); } <GuardParam>{DOCNL} { // end of argument @@ -1842,8 +1893,14 @@ RCSTAG "$"{ID}":"[^\n$]+"$" } else { - delete guards.pop(); - BEGIN( GuardParamEnd ); + GuardedSection *s = guards.pop(); + bool parentVisible = s->parentVisible(); + delete s; + if (parentVisible) + { + enabledSectionFound=TRUE; + BEGIN( GuardParamEnd ); + } } } <SkipGuardedSection>{CMD}"else"/{NW} { @@ -2403,6 +2460,11 @@ static bool handleParBlock(const QCString &) warn(yyFileName,yyLineNr, "found \\parblock command while already in a parblock!"); } + if (!g_spaceBeforeCmd.isEmpty()) + { + addOutput(g_spaceBeforeCmd); + g_spaceBeforeCmd.resize(0); + } addOutput("@parblock "); g_insideParBlock = TRUE; return FALSE; @@ -2865,9 +2927,9 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, if (Doxygen::markdownSupport) { - current->brief = processMarkdown(fileName,current,current->brief); - current->doc = processMarkdown(fileName,current,current->doc); - current->inbodyDocs = processMarkdown(fileName,current,current->inbodyDocs); + current->brief = processMarkdown(fileName,lineNr,current,current->brief); + current->doc = processMarkdown(fileName,lineNr,current,current->doc); + current->inbodyDocs = processMarkdown(fileName,lineNr,current,current->inbodyDocs); } Debug::print(Debug::CommentScan,0, @@ -3079,7 +3141,7 @@ static void groupAddDocs(Entry *e,const char *fileName) static void handleGuard(const QCString &expr) { CondParser prs; - bool sectionEnabled=prs.parse(yyFileName,yyLineNr,expr); + bool sectionEnabled=prs.parse(yyFileName,yyLineNr,expr.stripWhiteSpace()); bool parentEnabled = TRUE; if (!guards.isEmpty()) parentEnabled = guards.top()->isEnabled(); if (parentEnabled) diff --git a/src/compound.xsd b/src/compound.xsd index c1eb0ab..2521a2e 100644 --- a/src/compound.xsd +++ b/src/compound.xsd @@ -390,94 +390,7 @@ <xsd:element name="anchor" type="docAnchorType" /> <xsd:element name="formula" type="docFormulaType" /> <xsd:element name="ref" type="docRefTextType" /> - <xsd:element name="copy" type="docEmptyType" /> - <xsd:element name="trademark" type="docEmptyType" /> - <xsd:element name="registered" type="docEmptyType" /> - <xsd:element name="lsquo" type="docEmptyType" /> - <xsd:element name="rsquo" type="docEmptyType" /> - <xsd:element name="ldquo" type="docEmptyType" /> - <xsd:element name="rdquo" type="docEmptyType" /> - <xsd:element name="ndash" type="docEmptyType" /> - <xsd:element name="mdash" type="docEmptyType" /> - <xsd:element name="umlaut" type="docCharType" /> - <xsd:element name="acute" type="docCharType" /> - <xsd:element name="grave" type="docCharType" /> - <xsd:element name="circ" type="docCharType" /> - <xsd:element name="slash" type="docCharType" /> - <xsd:element name="tilde" type="docCharType" /> - <xsd:element name="cedil" type="docCharType" /> - <xsd:element name="ring" type="docCharType" /> - <xsd:element name="szlig" type="docEmptyType" /> - <xsd:element name="nonbreakablespace" type="docEmptyType" /> - <xsd:element name="aelig" type="docEmptyType" /> - <xsd:element name="AElig" type="docEmptyType" /> - <xsd:element name="Gamma" type="docEmptyType" /> - <xsd:element name="Delta" type="docEmptyType" /> - <xsd:element name="Theta" type="docEmptyType" /> - <xsd:element name="Lambda" type="docEmptyType" /> - <xsd:element name="Xi" type="docEmptyType" /> - <xsd:element name="Pi" type="docEmptyType" /> - <xsd:element name="Sigma" type="docEmptyType" /> - <xsd:element name="Upsilon" type="docEmptyType" /> - <xsd:element name="Phi" type="docEmptyType" /> - <xsd:element name="Psi" type="docEmptyType" /> - <xsd:element name="Omega" type="docEmptyType" /> - <xsd:element name="alpha" type="docEmptyType" /> - <xsd:element name="beta" type="docEmptyType" /> - <xsd:element name="gamma" type="docEmptyType" /> - <xsd:element name="delta" type="docEmptyType" /> - <xsd:element name="epsilon" type="docEmptyType" /> - <xsd:element name="zeta" type="docEmptyType" /> - <xsd:element name="eta" type="docEmptyType" /> - <xsd:element name="theta" type="docEmptyType" /> - <xsd:element name="iota" type="docEmptyType" /> - <xsd:element name="kappa" type="docEmptyType" /> - <xsd:element name="lambda" type="docEmptyType" /> - <xsd:element name="mu" type="docEmptyType" /> - <xsd:element name="nu" type="docEmptyType" /> - <xsd:element name="xi" type="docEmptyType" /> - <xsd:element name="pi" type="docEmptyType" /> - <xsd:element name="rho" type="docEmptyType" /> - <xsd:element name="sigma" type="docEmptyType" /> - <xsd:element name="tau" type="docEmptyType" /> - <xsd:element name="upsilon" type="docEmptyType" /> - <xsd:element name="phi" type="docEmptyType" /> - <xsd:element name="chi" type="docEmptyType" /> - <xsd:element name="psi" type="docEmptyType" /> - <xsd:element name="omega" type="docEmptyType" /> - <xsd:element name="sigmaf" type="docEmptyType" /> - <xsd:element name="sect" type="docEmptyType" /> - <xsd:element name="deg" type="docEmptyType" /> - <xsd:element name="prime" type="docEmptyType" /> - <xsd:element name="Prime" type="docEmptyType" /> - <xsd:element name="infin" type="docEmptyType" /> - <xsd:element name="empty" type="docEmptyType" /> - <xsd:element name="plusmn" type="docEmptyType" /> - <xsd:element name="times" type="docEmptyType" /> - <xsd:element name="minus" type="docEmptyType" /> - <xsd:element name="sdot" type="docEmptyType" /> - <xsd:element name="part" type="docEmptyType" /> - <xsd:element name="nabla" type="docEmptyType" /> - <xsd:element name="radic" type="docEmptyType" /> - <xsd:element name="perp" type="docEmptyType" /> - <xsd:element name="sum" type="docEmptyType" /> - <xsd:element name="int" type="docEmptyType" /> - <xsd:element name="prod" type="docEmptyType" /> - <xsd:element name="sim" type="docEmptyType" /> - <xsd:element name="asymp" type="docEmptyType" /> - <xsd:element name="ne" type="docEmptyType" /> - <xsd:element name="equiv" type="docEmptyType" /> - <xsd:element name="prop" type="docEmptyType" /> - <xsd:element name="le" type="docEmptyType" /> - <xsd:element name="ge" type="docEmptyType" /> - <xsd:element name="larr" type="docEmptyType" /> - <xsd:element name="rarr" type="docEmptyType" /> - <xsd:element name="isin" type="docEmptyType" /> - <xsd:element name="notin" type="docEmptyType" /> - <xsd:element name="lceil" type="docEmptyType" /> - <xsd:element name="rceil" type="docEmptyType" /> - <xsd:element name="lfloor" type="docEmptyType" /> - <xsd:element name="rfloor" type="docEmptyType" /> + <!-- Automatically insert here the HTML entities --> </xsd:choice> </xsd:group> @@ -560,7 +473,6 @@ <xsd:element name="title" type="docTitleType" minOccurs="0" /> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" /> - <xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/> </xsd:sequence> </xsd:sequence> <xsd:attribute name="kind" type="DoxSimpleSectKind" /> @@ -717,10 +629,6 @@ </xsd:sequence> </xsd:complexType> - <xsd:complexType name="docCharType"> - <xsd:attribute name="char" type="DoxCharRange"/> - </xsd:complexType> - <xsd:complexType name="docEmptyType"/> <!-- Simple types --> diff --git a/src/condparser.cpp b/src/condparser.cpp index c99a232..67da1e3 100644 --- a/src/condparser.cpp +++ b/src/condparser.cpp @@ -1,5 +1,5 @@ /** - * Copyright (C) 1997-2013 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 diff --git a/src/condparser.h b/src/condparser.h index a4dfee8..0310f36 100644 --- a/src/condparser.h +++ b/src/condparser.h @@ -2,7 +2,7 @@ #define CONDPARSER_H /** - * Copyright (C) 1997-2013 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 diff --git a/src/config.h b/src/config.h index 3dcf8de..505e4d1 100644 --- a/src/config.h +++ b/src/config.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -165,7 +165,7 @@ class ConfigEnum : public ConfigOption class ConfigString : public ConfigOption { public: - enum WidgetType { String, File, Dir }; + enum WidgetType { String, File, Dir, Image }; ConfigString(const char *name,const char *doc) : ConfigOption(O_String) { @@ -493,13 +493,14 @@ class Config * \returns TRUE if successful, or FALSE if the string could not be * parsed. */ - bool parseString(const char *fn,const char *str); + //bool parseString(const char *fn,const char *str); + bool parseString(const char *fn,const char *str,bool upd = FALSE); /*! Parse a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be * opened or read. */ - bool parse(const char *fn); + bool parse(const char *fn,bool upd = FALSE); /*! Called from the constructor, will add doxygen's default options * to the configuration object diff --git a/src/config.l b/src/config.l index 05df386..133bc11 100644 --- a/src/config.l +++ b/src/config.l @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -435,6 +435,7 @@ static QCString includeName; static QStrList includePathList; static QStack<ConfigFileState> includeStack; static int includeDepth; +static bool config_upd = FALSE; static QCString tabSizeString; static QCString maxInitLinesString; @@ -672,15 +673,31 @@ static void readIncludeFile(const char *incName) BEGIN(GetString); break; case ConfigOption::O_Obsolete: - config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n" - "To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + if (config_upd) + { + config_err("Warning: Tag `%s' at line %d of file `%s' has become obsolete.\n" + " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + } + else + { + config_err("Warning: Tag `%s' at line %d of file `%s' has become obsolete.\n" + " To avoid this warning please remove this line from your configuration " + "file or upgrade it using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + } BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: - config_err("Warning: Tag `%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n" - "To avoid this warning please remove this line from your configuration " - "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + if (config_upd) + { + config_err("Warning: Tag `%s' at line %d of file `%s' belongs to an option that was not enabled at compile time.\n" + " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + } + else + { + config_err("Warning: Tag `%s' at line %d of file `%s' belongs to an option that was not enabled at compile time.\n" + " To avoid this warning please remove this line from your configuration " + "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + } BEGIN(SkipInvalid); break; } @@ -847,11 +864,11 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) { t << convertToComment(m_header,""); } - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->writeTemplate(t,sl,upd); - option = m_options->next(); } /* print last lines of user comment that were at the end of the file */ if (m_userComment) @@ -863,11 +880,11 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) void Config::convertStrToVal() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->convertStrToVal(); - option = m_options->next(); } } @@ -1003,11 +1020,11 @@ void ConfigEnum::substEnvVars() void Config::substituteEnvironmentVars() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->substEnvVars(); - option = m_options->next(); } } @@ -1573,20 +1590,43 @@ void Config::check() } checkFileName("GENERATE_TAGFILE"); + +#if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES. + // So this and other regressions should be analysed and fixed before this can be enabled + // disable any boolean options that depend on disabled options + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (it.toFirst();(option=it.current());++it) + { + QCString depName = option->dependsOn(); // option has a dependency + if (!depName.isEmpty()) + { + ConfigOption * dep = Config::instance()->get(depName); + if (dep->kind()==ConfigOption::O_Bool && + Config_getBool(depName)==FALSE) // dependent option is disabled + { + if (option->kind()==ConfigOption::O_Bool) + { + printf("disabling option %s\n",option->name().data()); + Config_getBool(option->name())=FALSE; // also disable this option + } + } + } + } +#endif } void Config::init() { - ConfigOption *option = m_options->first(); - while (option) + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) { option->init(); - option = m_options->next(); } // sanity check if all depends relations are valid - option = m_options->first(); - while (option) + for (it.toFirst();(option=it.current());++it) { QCString depName = option->dependsOn(); if (!depName.isEmpty()) @@ -1599,7 +1639,6 @@ void Config::init() exit(1); } } - option = m_options->next(); } } @@ -1668,7 +1707,7 @@ static QCString configFileToString(const char *name) return ""; } -bool Config::parseString(const char *fn,const char *str) +bool Config::parseString(const char *fn,const char *str,bool update) { config = Config::instance(); inputString = str; @@ -1680,17 +1719,19 @@ bool Config::parseString(const char *fn,const char *str) includeDepth = 0; configYYrestart( configYYin ); BEGIN( Start ); + config_upd = update; configYYlex(); + config_upd = FALSE; inputString = 0; return TRUE; } -bool Config::parse(const char *fn) +bool Config::parse(const char *fn,bool update) { int retval; encoding = "UTF-8"; printlex(yy_flex_debug, TRUE, __FILE__, fn); - retval = parseString(fn,configFileToString(fn)); + retval = parseString(fn,configFileToString(fn), update); printlex(yy_flex_debug, FALSE, __FILE__, fn); return retval; } diff --git a/src/config.xml b/src/config.xml index eff8cff..c832112 100644 --- a/src/config.xml +++ b/src/config.xml @@ -6,7 +6,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -247,7 +247,7 @@ Go to the <a href="commands.html">next</a> section or return to the </docs> </option> - <option type='string' id='PROJECT_LOGO' format='file' defval=''> + <option type='string' id='PROJECT_LOGO' format='image' defval=''> <docs> <![CDATA[ With the \c PROJECT_LOGO tag one can specify an logo or icon that is @@ -279,6 +279,16 @@ Go to the <a href="commands.html">next</a> section or return to the ]]> </docs> </option> + <option type='bool' id='ALLOW_UNICODE_NAMES' defval='0'> + <docs> +<![CDATA[ + If the \c ALLOW_UNICODE_NAMES tag is set to \c YES, + doxygen will allow non-ASCII characters to appear in the names of generated files. + If set to \c NO, non-ASCII characters will be escaped, for example _xE3_x81_x84 + will be used for Unicode U+3044. +]]> + </docs> + </option> <option type='enum' id='OUTPUT_LANGUAGE' defval='English'> <docs> <![CDATA[ @@ -578,7 +588,10 @@ Go to the <a href="commands.html">next</a> section or return to the Doxygen has a built-in mapping, but you can override or extend it using this tag. The format is <code>ext=language</code>, where \c ext is a file extension, and language is one of the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, - Objective-C, Python, Fortran, VHDL. + Objective-C, Python, Fortran (fixed format Fortran: FortranFixed, + free formatted Fortran: FortranFree, unknown formatted Fortran: Fortran. In + the later case the parser tries to guess whether the code is fixed or free + formatted code, this is the default for Fortran type files), VHDL. For instance to make doxygen treat <code>.inc</code> files as Fortran files (default is PHP), and <code>.f</code> files as C (default is Fortran), @@ -1553,7 +1566,7 @@ to disable this feature. <docs> <![CDATA[ If the \c CLANG_ASSISTED_PARSING tag is set to \c YES, then doxygen will use the - <a href="http://clang.llvm.org/">clang parser</a> for more acurate parsing + <a href="http://clang.llvm.org/">clang parser</a> for more accurate parsing at the cost of reduced performance. This can be particularly helpful with template rich C++ code for which doxygen's built-in parser lacks the necessary type information. @@ -2016,7 +2029,8 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. <![CDATA[ The \c BINARY_TOC flag controls whether a binary table of contents is generated (\c YES) or a - normal table of contents (\c NO) in the `.chm` file. + normal table of contents (\c NO) in the `.chm` file. Furthermore it enables + the `Previous` and `Next` buttons. ]]> </docs> </option> @@ -2328,7 +2342,7 @@ MATHJAX_CODEFILE = disableRenderer.js When the \c SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a web server instead of a web client using Javascript. -There are two flavours of web server based searching depending on the +There are two flavors of web server based searching depending on the \ref cfg_external_search "EXTERNAL_SEARCH" setting. When disabled, doxygen will generate a PHP script for searching and an index file used by the script. When \ref cfg_external_search "EXTERNAL_SEARCH" is @@ -2679,6 +2693,15 @@ EXTRA_PACKAGES=times ]]> </docs> </option> + <option type='string' id='MAN_SUBDIR' format='string' defval='' depends='GENERATE_MAN'> + <docs> +<![CDATA[ + The \c MAN_SUBDIR tag determines the name of the directory created within \c MAN_OUTPUT + in which the man pages are placed. If defaults to man followed by \c MAN_EXTENSION + with the initial . removed. +]]> + </docs> + </option> <option type='bool' id='MAN_LINKS' defval='0' depends='GENERATE_MAN'> <docs> <![CDATA[ @@ -2709,24 +2732,6 @@ EXTRA_PACKAGES=times ]]> </docs> </option> - <option type='string' id='XML_SCHEMA' format='string' defval='' depends='GENERATE_XML'> - <docs> -<![CDATA[ - The \c XML_SCHEMA tag can be used to specify a XML schema, - which can be used by a validating XML parser to check the - syntax of the XML files. -]]> - </docs> - </option> - <option type='string' id='XML_DTD' format='string' defval='' depends='GENERATE_XML'> - <docs> -<![CDATA[ - The \c XML_DTD tag can be used to specify a XML DTD, - which can be used by a validating XML parser to check the - syntax of the XML files. -]]> - </docs> - </option> <option type='bool' id='XML_PROGRAMLISTING' defval='1' depends='GENERATE_XML'> <docs> <![CDATA[ @@ -2921,7 +2926,7 @@ put in front of it. <docs> <![CDATA[ If the \c SKIP_FUNCTION_MACROS tag is set to \c YES then - doxygen's preprocessor will remove all refrences to function-like macros that are alone + doxygen's preprocessor will remove all references to function-like macros that are alone on a line, have an all uppercase name, and do not end with a semicolon. Such function macros are typically used for boiler-plate code, and will confuse the parser if not removed. @@ -2949,7 +2954,7 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs. See the section \ref external for more information about the use of tag files. \note - Each tag file must have an unique name + Each tag file must have a unique name (where the name does \e NOT include the path). If a tag file is not located in the directory in which doxygen is run, you must also specify the path to the tagfile here. @@ -3362,5 +3367,7 @@ remove the intermediate dot files that are used to generate the various graphs. <option type='obsolete' id='SHOW_DIRECTORIES'/> <option type='obsolete' id='HTML_ALIGN_MEMBERS'/> <option type='obsolete' id='SYMBOL_CACHE_SIZE'/> + <option type='obsolete' id='XML_SCHEMA'/> + <option type='obsolete' id='XML_DTD'/> </group> </doxygenconfig> diff --git a/src/configgen.py b/src/configgen.py index 4aed8bf..8ec0caa 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -1,7 +1,7 @@ #!/usr/bin/python # python script to generate configoptions.cpp and config.doc from config.xml # -# Copyright (C) 1997-2013 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 @@ -201,6 +201,19 @@ def prepCDocs(node): else: if abspath == '1': doc += "<br/>The file has to be specified with full path." + elif file =='image': + abspath = node.getAttribute('abspath') + if defval != '': + if abspath != '1': + doc += "<br/>The default image is: <code>%s</code>." % ( + defval) + else: + doc += "<br/>%s: %s%s%s." % ( + "The default image (with absolute path) is", + "<code>",defval,"</code>") + else: + if abspath == '1': + doc += "<br/>The image has to be specified with full path." else: # format == 'string': if defval != '': doc += "<br/>The default value is: <code>%s</code>." % ( @@ -262,6 +275,8 @@ def parseOption(node): print " cs->setDefaultValue(\"%s\");" % (defval) if format == 'file': print " cs->setWidgetType(ConfigString::File);" + elif format == 'image': + print " cs->setWidgetType(ConfigString::Image);" elif format == 'dir': print " cs->setWidgetType(ConfigString::Dir);" if depends != '': @@ -453,6 +468,21 @@ def parseOptionDoc(node, first): if abspath == '1': print "" print "The file has to be specified with full path." + elif file =='image': + abspath = node.getAttribute('abspath') + if defval != '': + print "" + if abspath != '1': + print "The default image is: <code>%s</code>." % ( + defval) + else: + print "%s: %s%s%s." % ( + "The default image (with absolute path) is", + "<code>",defval,"</code>") + else: + if abspath == '1': + print "" + print "The image has to be specified with full path." else: # format == 'string': if defval != '': print "" diff --git a/src/configoptions.h b/src/configoptions.h index 8b4fc22..be8ecf6 100644 --- a/src/configoptions.h +++ b/src/configoptions.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/constexp.h b/src/constexp.h index 1828b0b..27ca039 100644 --- a/src/constexp.h +++ b/src/constexp.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/constexp.l b/src/constexp.l index b333c72..bb4f842 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/constexp.y b/src/constexp.y index 421e26e..1475c1c 100644 --- a/src/constexp.y +++ b/src/constexp.y @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/context.cpp b/src/context.cpp index e573dde..2d46c86 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -27,6 +27,8 @@ // 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); + struct ContextGlobals { enum OutputFormat @@ -65,12 +67,37 @@ template<class T> class ScopedPtr void reset(T *p=0) { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } } }; +/** @brief Reference counting smart pointer */ +template<class T> class SharedPtr +{ + private: + T *m_ptr; + SharedPtr(const SharedPtr &); + SharedPtr &operator=(const SharedPtr &p); + void operator==(const SharedPtr &) const; + void operator!=(const SharedPtr &) const; + + public: + typedef T Type; + explicit SharedPtr(T *p=0) : m_ptr(p) { if (m_ptr) m_ptr->addRef(); } + ~SharedPtr() { if (m_ptr) m_ptr->release(); }; + T &operator*() const { return *m_ptr; } + T *operator->() const { return m_ptr; } + T *get() const { return m_ptr; } + operator bool() const { return m_ptr!=0; } + void reset(T *p=0) + { + if (p) p->addRef(); + if (m_ptr) m_ptr->release(); + m_ptr = p; + } +}; + /** @brief Template List iterator support */ -template<class T> class GenericConstIterator : public TemplateListIntf::ConstIterator { public: - GenericConstIterator(const QList<T> &list) + GenericConstIterator(const QList<TemplateVariant> &list) : m_it(list) { } virtual ~GenericConstIterator() {} void toFirst() @@ -93,7 +120,7 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator { if (m_it.current()) { - v = m_it.current(); + v = *m_it.current(); return TRUE; } else @@ -103,17 +130,16 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator } } private: - QListIterator<T> m_it; + QListIterator<TemplateVariant> m_it; }; //------------------------------------------------------------------------ /** @brief standard template list implementation */ -template<class T> class GenericNodeListContext : public TemplateListIntf { public: - GenericNodeListContext() + GenericNodeListContext() : m_refCount(0) { m_children.setAutoDelete(TRUE); } @@ -128,31 +154,45 @@ class GenericNodeListContext : public TemplateListIntf TemplateVariant result; if (index>=0 && index<count()) { - result = m_children.at(index); + result = *m_children.at(index); } return result; } TemplateListIntf::ConstIterator *createIterator() const { - return new GenericConstIterator<T>(m_children); + return new GenericConstIterator(m_children); } - void append(T *ctn) + void append(const TemplateVariant &ctn) { - m_children.append(ctn); + m_children.append(new TemplateVariant(ctn)); } bool isEmpty() const { return m_children.isEmpty(); } + int addRef() + { + return ++m_refCount; + } + int release() + { + int count = --m_refCount; + if (count<=0) + { + delete this; + } + return count; + } private: - mutable QList<T> m_children; + mutable QList<TemplateVariant> m_children; + int m_refCount; }; //------------------------------------------------------------------------ /** @brief Helper class to map a property name to a handler member function */ -class PropertyMapper +class PropertyMapper { private: struct PropertyFuncIntf @@ -224,29 +264,34 @@ class PropertyMapper class ConfigContext::Private { public: - Private() { cachedLists.setAutoDelete(TRUE); } + Private() { m_cachedLists.setAutoDelete(TRUE); } + ~Private() { } TemplateVariant fetchList(const QCString &name,const QStrList *list) { - TemplateList *tlist = cachedLists.find(name); - if (tlist==0) + TemplateVariant *v = m_cachedLists.find(name); + if (v==0) { - tlist = new TemplateList; - cachedLists.insert(name,tlist); + TemplateList *tlist = TemplateList::alloc(); + m_cachedLists.insert(name,new TemplateVariant(tlist)); QStrListIterator li(*list); char *s; for (li.toFirst();(s=li.current());++li) { tlist->append(s); } + return tlist; + } + else + { + return *v; } - return tlist; } private: - QDict<TemplateList> cachedLists; + QDict<TemplateVariant> m_cachedLists; }; //%% } -ConfigContext::ConfigContext() +ConfigContext::ConfigContext() : RefCountedContext("ConfigContext") { p = new Private; } @@ -310,7 +355,7 @@ class DoxygenContext::Private : public PropertyMapper }; //%% } -DoxygenContext::DoxygenContext() +DoxygenContext::DoxygenContext() : RefCountedContext("DoxygenContext") { p = new Private; } @@ -453,6 +498,18 @@ class TranslateContext::Private : public PropertyMapper } return TemplateVariant(); } + TemplateVariant handleIncludeDependencyGraph(const QValueList<TemplateVariant> &args) const + { + if (args.count()==1) + { + return theTranslator->trInclDepGraph(args[0].toString()); + } + else + { + err("tr.includeDependencyGraph should take one string argument, got %d\n",args.count()); + } + return TemplateVariant(); + } @@ -483,11 +540,17 @@ class TranslateContext::Private : public PropertyMapper TemplateVariant classes() const { return theTranslator->trClasses(); + // TODO: VHDL: trVhdlType(VhdlDocGen::ENTITY,FALSE) + // TODO: Fortran: trDataTypes() } TemplateVariant classList() const { return theTranslator->trCompoundList(); } + TemplateVariant classListDescription() const + { + return theTranslator->trCompoundListDescription(); + } TemplateVariant classIndex() const { return theTranslator->trCompoundIndex(); @@ -669,6 +732,47 @@ class TranslateContext::Private : public PropertyMapper { return theTranslator->trAdditionalInheritedMembers(); } + TemplateVariant includeDependencyGraph() const + { + return TemplateVariant::Delegate::fromMethod<Private,&Private::handleIncludeDependencyGraph>(this); + } + TemplateVariant includedByDependencyGraph() const + { + return theTranslator->trInclByDepGraph(); + } + TemplateVariant gotoSourceCode() const + { + return theTranslator->trGotoSourceCode(); + } + TemplateVariant gotoDocumentation() const + { + return theTranslator->trGotoDocumentation(); + } + TemplateVariant constantgroups() const + { + return theTranslator->trConstantGroups(); + } + TemplateVariant classDocumentation() const + { + return theTranslator->trClassDocumentation(); + } + TemplateVariant compoundMembers() const + { + return theTranslator->trCompoundMembers(); + } + TemplateVariant detailLevel() const + { + return theTranslator->trDetailLevel(); + } + TemplateVariant fileListDescription() const + { + bool extractAll = Config_getBool("EXTRACT_ALL"); + return theTranslator->trFileListDescription(extractAll); + } + TemplateVariant directories() const + { + return theTranslator->trDirectories(); + } Private() { //%% string generatedBy @@ -683,6 +787,8 @@ class TranslateContext::Private : public PropertyMapper 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 @@ -761,6 +867,26 @@ class TranslateContext::Private : public PropertyMapper 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 directories + addProperty("directories", this,&Private::directories); m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); @@ -773,7 +899,7 @@ class TranslateContext::Private : public PropertyMapper }; //%% } -TranslateContext::TranslateContext() +TranslateContext::TranslateContext() : RefCountedContext("TranslateContext") { p = new Private; } @@ -823,6 +949,31 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q return TemplateVariant(s.data(),TRUE); } +static TemplateVariant parseCode(FileDef *fd,const QCString &relPath) +{ + static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES"); + ParserInterface *pIntf = Doxygen::parserManager->getParser(fd->getDefFileExtension()); + 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 + ); + return TemplateVariant(s.data(),TRUE); +} + //------------------------------------------------------------------------ //%% struct Symbol: shared info for all symbols @@ -864,29 +1015,33 @@ class DefinitionContext : public PropertyMapper //%% 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_sourceDef.append(&m_lineLink); - m_sourceDef.append(&m_fileLink); - m_lineLink.set("text",m_def->getStartBodyLine()); - m_lineLink.set("isLinkable",TRUE); - m_lineLink.set("fileName",m_def->getSourceFileBase()); - m_lineLink.set("anchor",m_def->getSourceAnchor()); + 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_fileLink.set("text",m_def->name()); + m_cache.fileLink->set("text",m_def->name()); } else if (m_def->getBodyDef()) { - m_fileLink.set("text",m_def->getBodyDef()->name()); + m_cache.fileLink->set("text",m_def->getBodyDef()->name()); } else { - m_fileLink.set("text",name()); + m_cache.fileLink->set("text",name()); } - m_fileLink.set("isLinkable",TRUE); - m_fileLink.set("fileName",m_def->getSourceFileBase()); - m_fileLink.set("anchor",QCString()); + 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()); } } TemplateVariant fileName() const @@ -997,9 +1152,9 @@ class DefinitionContext : public PropertyMapper } TemplateVariant sourceDef() const { - if (m_sourceDef.count()==2) + if (m_cache.sourceDef->count()==2) { - return &m_sourceDef; + return m_cache.sourceDef.get(); } else { @@ -1018,16 +1173,21 @@ class DefinitionContext : public PropertyMapper { fillPath(((const FileDef*)def)->getDirDef(),list); } - NavPathElemContext *elem = new NavPathElemContext(def); - list->append(elem); - m_cache.navPathElems.append(elem); + list->append(NavPathElemContext::alloc(def)); } TemplateVariant navigationPath() const { if (!m_cache.navPath) { - TemplateList *list = new TemplateList; - fillPath(m_def,list); + TemplateList *list = TemplateList::alloc(); + if (m_def->getOuterScope() && m_def->getOuterScope()!=Doxygen::globalScope) + { + fillPath(m_def->getOuterScope(),list); + } + else if (m_def->definitionType()==Definition::TypeFile && ((const FileDef *)m_def)->getDirDef()) + { + fillPath(((const FileDef *)m_def)->getDirDef(),list); + } m_cache.navPath.reset(list); } return m_cache.navPath.get(); @@ -1037,17 +1197,16 @@ class DefinitionContext : public PropertyMapper Definition *m_def; struct Cachable { - Cachable() { navPathElems.setAutoDelete(TRUE); } + Cachable() { } ScopedPtr<TemplateVariant> details; ScopedPtr<TemplateVariant> brief; ScopedPtr<TemplateVariant> inbodyDocs; - ScopedPtr<TemplateList> navPath; - QList<NavPathElemContext> navPathElems; + SharedPtr<TemplateList> navPath; + SharedPtr<TemplateList> sourceDef; + SharedPtr<TemplateStruct> fileLink; + SharedPtr<TemplateStruct> lineLink; }; mutable Cachable m_cache; - TemplateList m_sourceDef; - TemplateStruct m_fileLink; - TemplateStruct m_lineLink; }; //%% } @@ -1058,9 +1217,8 @@ class DefinitionContext : public PropertyMapper class IncludeInfoContext::Private : public PropertyMapper { public: - Private(IncludeInfo *info,SrcLangExt lang) : + Private(const IncludeInfo *info,SrcLangExt lang) : m_info(info), - m_fileContext(info && info->fileDef ? info->fileDef : 0), m_lang(lang) { if (m_info) @@ -1082,9 +1240,13 @@ class IncludeInfoContext::Private : public PropertyMapper } TemplateVariant file() const { - if (m_info->fileDef) + if (!m_fileContext && m_info && m_info->fileDef) { - return &m_fileContext; + m_fileContext.reset(FileContext::alloc(m_info->fileDef)); + } + if (m_fileContext) + { + return m_fileContext.get(); } else { @@ -1096,12 +1258,12 @@ class IncludeInfoContext::Private : public PropertyMapper return m_info->includeName; } private: - IncludeInfo *m_info; - FileContext m_fileContext; + const IncludeInfo *m_info; + mutable SharedPtr<FileContext> m_fileContext; SrcLangExt m_lang; }; -IncludeInfoContext::IncludeInfoContext(IncludeInfo *info,SrcLangExt lang) +IncludeInfoContext::IncludeInfoContext(const IncludeInfo *info,SrcLangExt lang) : RefCountedContext("IncludeContext") { p = new Private(info,lang); } @@ -1119,14 +1281,59 @@ TemplateVariant IncludeInfoContext::get(const char *n) const //------------------------------------------------------------------------ +//%% list IncludeInfoList[Class] : list of nested classes +class IncludeInfoListContext::Private : public GenericNodeListContext +{ + public: + Private(const QList<IncludeInfo> &list,SrcLangExt lang) + { + QListIterator<IncludeInfo> li(list); + IncludeInfo *ii; + for (li.toFirst();(ii=li.current());++li) + { + if (!ii->indirect) + { + append(IncludeInfoContext::alloc(ii,lang)); + } + } + } +}; + +IncludeInfoListContext::IncludeInfoListContext(const QList<IncludeInfo> &list,SrcLangExt lang) : RefCountedContext("IncludeListContext") +{ + p = new Private(list,lang); +} + +IncludeInfoListContext::~IncludeInfoListContext() +{ + delete p; +} + +// TemplateListIntf +int IncludeInfoListContext::count() const +{ + return p->count(); +} + +TemplateVariant IncludeInfoListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *IncludeInfoListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + //%% struct Class(Symbol): class information //%% { class ClassContext::Private : public DefinitionContext<ClassContext::Private> { public: - Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd) , - m_classDef(cd), m_usedFiles(cd), - m_includeInfo(cd ? cd->includeInfo() : 0, cd ? cd->getLanguage() : SrcLangExt_Unknown) + Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd), + m_classDef(cd) { addProperty("title", this,&Private::title); addProperty("highlight", this,&Private::highlight); @@ -1139,7 +1346,6 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> addProperty("hasCollaborationDiagram", this,&Private::hasCollaborationDiagram); addProperty("collaborationDiagram", this,&Private::collaborationDiagram); addProperty("includeInfo", this,&Private::includeInfo); - addProperty("includeStatement", this,&Private::includeStatement); addProperty("inherits", this,&Private::inherits); addProperty("inheritedBy", this,&Private::inheritedBy); addProperty("unoIDLServices", this,&Private::unoIDLServices); @@ -1182,7 +1388,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> addProperty("detailedVariables", this,&Private::detailedVariables); addProperty("detailedProperties", this,&Private::detailedProperties); addProperty("detailedEvents", this,&Private::detailedEvents); - addProperty("nestedClasses", this,&Private::nestedClasses); + addProperty("classes", this,&Private::classes); addProperty("compoundType", this,&Private::compoundType); addProperty("templateDecls", this,&Private::templateDecls); addProperty("typeConstraints", this,&Private::typeConstraints); @@ -1215,7 +1421,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant usedFiles() const { - return TemplateVariant(&m_usedFiles); + if (!m_cache.usedFiles) + { + m_cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef)); + } + return m_cache.usedFiles.get(); } DotClassGraph *getClassGraph() const { @@ -1317,24 +1527,24 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> TemplateVariant includeInfo() const { - if (m_classDef->includeInfo()) + if (!m_cache.includeInfo && m_classDef->includeInfo()) + { + m_cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage())); + } + if (m_cache.includeInfo) { - return TemplateVariant(&m_includeInfo); + return m_cache.includeInfo.get(); } else { return TemplateVariant(FALSE); } } - TemplateVariant includeStatement() const - { - return m_classDef->includeStatement(); - } TemplateVariant inherits() const { if (!m_cache.inheritsList) { - m_cache.inheritsList.reset(new InheritanceListContext(m_classDef->baseClasses(),TRUE)); + m_cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE)); } return m_cache.inheritsList.get(); } @@ -1342,11 +1552,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (!m_cache.inheritedByList) { - m_cache.inheritedByList.reset(new InheritanceListContext(m_classDef->subClasses(),FALSE)); + m_cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE)); } return m_cache.inheritedByList.get(); } - TemplateVariant getMemberList(ScopedPtr<MemberListInfoContext> &list, + TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const { if (!list) @@ -1354,7 +1564,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> MemberList *ml = m_classDef->getMemberList(type); if (ml) { - list.reset(new MemberListInfoContext(m_classDef,relPathAsString(),ml,title,detailed)); + list.reset(MemberListInfoContext::alloc(m_classDef,relPathAsString(),ml,title,detailed)); } } if (list) @@ -1530,34 +1740,26 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE); } - TemplateVariant nestedClasses() const + TemplateVariant classes() const { - static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); - static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES"); - static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES"); - if (!m_cache.nestedClasses) + if (!m_cache.classes) { - NestedClassListContext *classList = new NestedClassListContext; + NestedClassListContext *classList = NestedClassListContext::alloc(); if (m_classDef->getClassSDict()) { ClassSDict::Iterator sdi(*m_classDef->getClassSDict()); ClassDef *cd; for (sdi.toFirst();(cd=sdi.current());++sdi) { - bool linkable = cd->isLinkable(); - if (cd->name().find('@')==-1 && !cd->isExtension() && - (cd->protection()!=::Private || extractPrivate) && - (linkable || - (!hideUndocClasses && (!cd->isLocal() || extractLocalClasses))) - ) + if (cd->visibleInParentsDeclList()) { classList->append(cd); } } } - m_cache.nestedClasses.reset(classList); + m_cache.classes.reset(classList); } - return m_cache.nestedClasses.get(); + return m_cache.classes.get(); } TemplateVariant compoundType() const { @@ -1575,10 +1777,9 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ClassDef *cd=(ClassDef *)d; if (cd->templateArguments()) { - ArgumentListContext *al = new ArgumentListContext(cd->templateArguments(),cd,relPathAsString()); + ArgumentListContext *al = ArgumentListContext::alloc(cd->templateArguments(),cd,relPathAsString()); // since a TemplateVariant does take ownership of the object, we add it // a separate list just to be able to delete it and avoid a memory leak - m_cache.templateArgList.append(al); tl->append(al); } } @@ -1591,8 +1792,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> Example *ex; for (it.toFirst();(ex=it.current());++it) { - TemplateStruct *s = new TemplateStruct; - m_cache.exampleList.append(s); + TemplateStruct *s = TemplateStruct::alloc(); s->set("text",ex->name); s->set("isLinkable",TRUE); s->set("anchor",ex->anchor); @@ -1605,7 +1805,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (!m_cache.templateDecls) { - TemplateList *tl = new TemplateList; + TemplateList *tl = TemplateList::alloc(); addTemplateDecls(m_classDef,tl); m_cache.templateDecls.reset(tl); } @@ -1615,11 +1815,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (!m_cache.typeConstraints && m_classDef->typeConstraints()) { - m_cache.typeConstraints.reset(new ArgumentListContext(m_classDef->typeConstraints(),m_classDef,relPathAsString())); + m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString())); } else { - m_cache.typeConstraints.reset(new ArgumentListContext); + m_cache.typeConstraints.reset(ArgumentListContext::alloc()); } return m_cache.typeConstraints.get(); } @@ -1627,7 +1827,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (!m_cache.examples) { - TemplateList *exampleList = new TemplateList; + TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); m_cache.examples.reset(exampleList); } @@ -1682,20 +1882,23 @@ 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(new MemberListContext(&m_cache.allMembers)); + m_cache.members.reset(MemberListContext::alloc(&m_cache.allMembers)); } return m_cache.members.get(); } TemplateVariant allMembersList() const { - if (!m_cache.allMembersList && m_classDef->memberNameInfoSDict()) + if (!m_cache.allMembersList) { - AllMembersListContext *ml = new AllMembersListContext(m_classDef->memberNameInfoSDict()); - m_cache.allMembersList.reset(ml); - } - else - { - m_cache.allMembersList.reset(new AllMembersListContext); + if (m_classDef->memberNameInfoSDict()) + { + AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoSDict()); + m_cache.allMembersList.reset(ml); + } + else + { + m_cache.allMembersList.reset(AllMembersListContext::alloc()); + } } return m_cache.allMembersList.get(); } @@ -1709,11 +1912,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (m_classDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(new MemberGroupListContext(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); + m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); } else { - m_cache.memberGroups.reset(new MemberGroupListContext); + m_cache.memberGroups.reset(MemberGroupListContext::alloc()); } } return m_cache.memberGroups.get(); @@ -1722,7 +1925,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (!m_cache.additionalInheritedMembers) { - InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext; + InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); ctx->addMemberList(m_classDef,MemberListType_pubTypes,theTranslator->trPublicTypes()); ctx->addMemberList(m_classDef,MemberListType_services,theTranslator->trServices()); ctx->addMemberList(m_classDef,MemberListType_interfaces,theTranslator->trInterfaces()); @@ -1763,78 +1966,72 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> private: ClassDef *m_classDef; - UsedFilesContext m_usedFiles; - IncludeInfoContext m_includeInfo; struct Cachable { - Cachable() : inheritanceNodes(-1) - { - templateArgList.setAutoDelete(TRUE); - exampleList.setAutoDelete(TRUE); - allMembers.setAutoDelete(TRUE); - } - ScopedPtr<InheritanceListContext> inheritsList; - ScopedPtr<InheritanceListContext> inheritedByList; + Cachable() : inheritanceNodes(-1) { } + SharedPtr<IncludeInfoContext> includeInfo; + SharedPtr<InheritanceListContext> inheritsList; + SharedPtr<InheritanceListContext> inheritedByList; ScopedPtr<DotClassGraph> classGraph; ScopedPtr<DotClassGraph> collaborationGraph; - ScopedPtr<NestedClassListContext> nestedClasses; - ScopedPtr<MemberListInfoContext> publicTypes; - ScopedPtr<MemberListInfoContext> publicMethods; - ScopedPtr<MemberListInfoContext> publicStaticMethods; - ScopedPtr<MemberListInfoContext> publicAttributes; - ScopedPtr<MemberListInfoContext> publicStaticAttributes; - ScopedPtr<MemberListInfoContext> publicSlots; - ScopedPtr<MemberListInfoContext> protectedTypes; - ScopedPtr<MemberListInfoContext> protectedMethods; - ScopedPtr<MemberListInfoContext> protectedStaticMethods; - ScopedPtr<MemberListInfoContext> protectedAttributes; - ScopedPtr<MemberListInfoContext> protectedStaticAttributes; - ScopedPtr<MemberListInfoContext> protectedSlots; - ScopedPtr<MemberListInfoContext> privateTypes; - ScopedPtr<MemberListInfoContext> privateMethods; - ScopedPtr<MemberListInfoContext> privateStaticMethods; - ScopedPtr<MemberListInfoContext> privateAttributes; - ScopedPtr<MemberListInfoContext> privateStaticAttributes; - ScopedPtr<MemberListInfoContext> privateSlots; - ScopedPtr<MemberListInfoContext> packageTypes; - ScopedPtr<MemberListInfoContext> packageMethods; - ScopedPtr<MemberListInfoContext> packageStaticMethods; - ScopedPtr<MemberListInfoContext> packageAttributes; - ScopedPtr<MemberListInfoContext> packageStaticAttributes; - ScopedPtr<MemberListInfoContext> unoIDLServices; - ScopedPtr<MemberListInfoContext> unoIDLInterfaces; - ScopedPtr<MemberListInfoContext> signals; - ScopedPtr<MemberListInfoContext> properties; - ScopedPtr<MemberListInfoContext> events; - ScopedPtr<MemberListInfoContext> friends; - ScopedPtr<MemberListInfoContext> related; - ScopedPtr<MemberListInfoContext> detailedTypedefs; - ScopedPtr<MemberListInfoContext> detailedEnums; - ScopedPtr<MemberListInfoContext> detailedServices; - ScopedPtr<MemberListInfoContext> detailedInterfaces; - ScopedPtr<MemberListInfoContext> detailedConstructors; - ScopedPtr<MemberListInfoContext> detailedMethods; - ScopedPtr<MemberListInfoContext> detailedRelated; - ScopedPtr<MemberListInfoContext> detailedVariables; - ScopedPtr<MemberListInfoContext> detailedProperties; - ScopedPtr<MemberListInfoContext> detailedEvents; - ScopedPtr<MemberGroupListContext> memberGroups; - ScopedPtr<AllMembersListContext> allMembersList; - ScopedPtr<ArgumentListContext> typeConstraints; - ScopedPtr<TemplateList> examples; - ScopedPtr<TemplateList> templateDecls; - ScopedPtr<InheritedMemberInfoListContext> additionalInheritedMembers; - ScopedPtr<MemberListContext> members; - QList<ArgumentListContext> templateArgList; - int inheritanceNodes; - QList<TemplateStruct> exampleList; - MemberList allMembers; + SharedPtr<NestedClassListContext> classes; + SharedPtr<MemberListInfoContext> publicTypes; + SharedPtr<MemberListInfoContext> publicMethods; + SharedPtr<MemberListInfoContext> publicStaticMethods; + SharedPtr<MemberListInfoContext> publicAttributes; + SharedPtr<MemberListInfoContext> publicStaticAttributes; + SharedPtr<MemberListInfoContext> publicSlots; + SharedPtr<MemberListInfoContext> protectedTypes; + SharedPtr<MemberListInfoContext> protectedMethods; + SharedPtr<MemberListInfoContext> protectedStaticMethods; + SharedPtr<MemberListInfoContext> protectedAttributes; + SharedPtr<MemberListInfoContext> protectedStaticAttributes; + SharedPtr<MemberListInfoContext> protectedSlots; + SharedPtr<MemberListInfoContext> privateTypes; + SharedPtr<MemberListInfoContext> privateMethods; + SharedPtr<MemberListInfoContext> privateStaticMethods; + SharedPtr<MemberListInfoContext> privateAttributes; + SharedPtr<MemberListInfoContext> privateStaticAttributes; + SharedPtr<MemberListInfoContext> privateSlots; + SharedPtr<MemberListInfoContext> packageTypes; + SharedPtr<MemberListInfoContext> packageMethods; + SharedPtr<MemberListInfoContext> packageStaticMethods; + SharedPtr<MemberListInfoContext> packageAttributes; + SharedPtr<MemberListInfoContext> packageStaticAttributes; + SharedPtr<MemberListInfoContext> unoIDLServices; + SharedPtr<MemberListInfoContext> unoIDLInterfaces; + SharedPtr<MemberListInfoContext> signals; + SharedPtr<MemberListInfoContext> properties; + SharedPtr<MemberListInfoContext> events; + SharedPtr<MemberListInfoContext> friends; + SharedPtr<MemberListInfoContext> related; + SharedPtr<MemberListInfoContext> detailedTypedefs; + SharedPtr<MemberListInfoContext> detailedEnums; + SharedPtr<MemberListInfoContext> detailedServices; + SharedPtr<MemberListInfoContext> detailedInterfaces; + SharedPtr<MemberListInfoContext> detailedConstructors; + SharedPtr<MemberListInfoContext> detailedMethods; + SharedPtr<MemberListInfoContext> detailedRelated; + SharedPtr<MemberListInfoContext> detailedVariables; + SharedPtr<MemberListInfoContext> detailedProperties; + SharedPtr<MemberListInfoContext> detailedEvents; + SharedPtr<MemberGroupListContext> memberGroups; + SharedPtr<AllMembersListContext> allMembersList; + SharedPtr<ArgumentListContext> typeConstraints; + SharedPtr<TemplateList> examples; + SharedPtr<TemplateList> templateDecls; + SharedPtr<InheritedMemberInfoListContext> additionalInheritedMembers; + SharedPtr<MemberListContext> members; + SharedPtr<UsedFilesContext> usedFiles; + SharedPtr<TemplateList> exampleList; + int inheritanceNodes; + MemberList allMembers; }; mutable Cachable m_cache; }; //%% } -ClassContext::ClassContext(ClassDef *cd) +ClassContext::ClassContext(ClassDef *cd) : RefCountedContext("ClassContext") { //printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():"<none>"); p = new Private(cd); @@ -1862,6 +2059,8 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri 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); } TemplateVariant title() const { @@ -1875,12 +2074,20 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri { return TemplateVariant(""); } + TemplateVariant compoundType() const + { + return m_namespaceDef->compoundTypeString(); + } + TemplateVariant hasDetails() const + { + return m_namespaceDef->hasDetailedDescription(); + } private: NamespaceDef *m_namespaceDef; }; //%% } -NamespaceContext::NamespaceContext(NamespaceDef *nd) +NamespaceContext::NamespaceContext(NamespaceDef *nd) : RefCountedContext("NamespaceContext") { p = new Private(nd); } @@ -1904,10 +2111,36 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> public: Private(FileDef *fd) : DefinitionContext<FileContext::Private>(fd) , m_fileDef(fd) { - addProperty("title",this,&Private::title); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subHighlight); - addProperty("versionInfo",this,&Private::versionInfo); + 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); } TemplateVariant title() const { @@ -1925,12 +2158,310 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> { return m_fileDef->getVersion(); } + TemplateVariant includeList() const + { + if (!m_cache.includeInfoList && m_fileDef->includeFileList()) + { + m_cache.includeInfoList.reset(IncludeInfoListContext::alloc( + *m_fileDef->includeFileList(),m_fileDef->getLanguage())); + } + if (m_cache.includeInfoList) + { + return m_cache.includeInfoList.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + DotInclDepGraph *getIncludeGraph() const + { + if (!m_cache.includeGraph) + { + m_cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE)); + } + return m_cache.includeGraph.get(); + } + TemplateVariant hasIncludeGraph() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + DotInclDepGraph *incGraph = getIncludeGraph(); + return (haveDot && !incGraph->isTooBig() && !incGraph->isTrivial()); + } + TemplateVariant includeGraph() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + QGString result; + if (haveDot) + { + DotInclDepGraph *cg = getIncludeGraph(); + FTextStream t(&result); + cg->writeGraph(t,BITMAP, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + g_globals.dynSectionId++; + return TemplateVariant(result.data(),TRUE); + } + DotInclDepGraph *getIncludedByGraph() const + { + if (!m_cache.includedByGraph) + { + m_cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE)); + } + return m_cache.includedByGraph.get(); + } + TemplateVariant hasIncludedByGraph() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + DotInclDepGraph *incGraph = getIncludedByGraph(); + return (haveDot && !incGraph->isTooBig() && !incGraph->isTrivial()); + } + TemplateVariant includedByGraph() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + QGString result; + if (haveDot) + { + DotInclDepGraph *cg = getIncludedByGraph(); + FTextStream t(&result); + cg->writeGraph(t,BITMAP, + g_globals.outputDir, + g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,g_globals.dynSectionId + ); + } + g_globals.dynSectionId++; + return TemplateVariant(result.data(),TRUE); + } + TemplateVariant hasDetails() const + { + return m_fileDef->hasDetailedDescription(); + } + TemplateVariant hasSourceFile() const + { + return m_fileDef->generateSourceFile(); + } + TemplateVariant sources() const + { + if (!m_cache.sources) + { + if (m_fileDef->generateSourceFile()) + { + m_cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString()))); + } + else + { + m_cache.sources.reset(new TemplateVariant("")); + } + } + return *m_cache.sources; + } + TemplateVariant version() const + { + return m_fileDef->fileVersion(); + } + TemplateVariant classes() const + { + if (!m_cache.classes) + { + NestedClassListContext *classList = NestedClassListContext::alloc(); + if (m_fileDef->getClassSDict()) + { + ClassSDict::Iterator sdi(*m_fileDef->getClassSDict()); + ClassDef *cd; + for (sdi.toFirst();(cd=sdi.current());++sdi) + { + if (cd->visibleInParentsDeclList()) + { + classList->append(cd); + } + } + } + m_cache.classes.reset(classList); + } + return m_cache.classes.get(); + } + TemplateVariant namespaces() const + { + if (!m_cache.namespaces) + { + NestedNamespaceListContext *namespaceList = NestedNamespaceListContext::alloc(); + if (m_fileDef->getNamespaceSDict()) + { + NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict()); + NamespaceDef *nd; + for (sdi.toFirst();(nd=sdi.current());++sdi) + { + if (nd->isLinkable() && !nd->isConstantGroup()) + { + namespaceList->append(nd); + } + } + } + m_cache.namespaces.reset(namespaceList); + } + return m_cache.namespaces.get(); + } + TemplateVariant constantgroups() const + { + if (!m_cache.constantgroups) + { + NestedNamespaceListContext *namespaceList = NestedNamespaceListContext::alloc(); + if (m_fileDef->getNamespaceSDict()) + { + NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict()); + NamespaceDef *nd; + for (sdi.toFirst();(nd=sdi.current());++sdi) + { + if (nd->isLinkable() && nd->isConstantGroup()) + { + namespaceList->append(nd); + } + } + } + m_cache.constantgroups.reset(namespaceList); + } + return m_cache.constantgroups.get(); + } + TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, + MemberListType type,const char *title,bool detailed=FALSE) const + { + if (!list) + { + MemberList *ml = m_fileDef->getMemberList(type); + if (ml) + { + list.reset(MemberListInfoContext::alloc(m_fileDef,relPathAsString(),ml,title,detailed)); + } + } + if (list) + { + return list.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant macros() const + { + return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines()); + } + TemplateVariant typedefs() const + { + return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + } + TemplateVariant enums() const + { + return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + } + TemplateVariant functions() const + { + // TODO: Fortran: trSubprograms() + // TODO: VHDL: VhdlDocGen::trFunctionAndProc() + return getMemberList(m_cache.functions,MemberListType_decFuncMembers,theTranslator->trFunctions()); + } + TemplateVariant variables() const + { + return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + } + TemplateVariant memberGroups() const + { + if (!m_cache.memberGroups) + { + if (m_fileDef->getMemberGroupSDict()) + { + m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); + } + else + { + m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + } + } + return m_cache.memberGroups.get(); + } + TemplateVariant detailedMacros() const + { + return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); + } + TemplateVariant detailedTypedefs() const + { + return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + } + TemplateVariant detailedEnums() const + { + return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + } + TemplateVariant detailedFunctions() const + { + // TODO: Fortran: trSubprogramDocumentation() + return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,theTranslator->trFunctionDocumentation()); + } + TemplateVariant detailedVariables() const + { + return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + } + TemplateVariant inlineClasses() const + { + if (!m_cache.inlineClasses) + { + NestedClassListContext *classList = NestedClassListContext::alloc(); + if (m_fileDef->getClassSDict()) + { + ClassSDict::Iterator sdi(*m_fileDef->getClassSDict()); + ClassDef *cd; + for (sdi.toFirst();(cd=sdi.current());++sdi) + { + if (cd->name().find('@')==-1 && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups()==0) + { + classList->append(cd); + } + } + } + m_cache.inlineClasses.reset(classList); + } + return m_cache.inlineClasses.get(); + } + TemplateVariant compoundType() const + { + return theTranslator->trFile(FALSE,TRUE); + } + private: FileDef *m_fileDef; + struct Cachable + { + SharedPtr<IncludeInfoListContext> includeInfoList; + ScopedPtr<DotInclDepGraph> includeGraph; + ScopedPtr<DotInclDepGraph> includedByGraph; + ScopedPtr<TemplateVariant> sources; + SharedPtr<NestedClassListContext> classes; + SharedPtr<NestedNamespaceListContext> namespaces; + SharedPtr<NestedNamespaceListContext> constantgroups; + SharedPtr<MemberListInfoContext> macros; + SharedPtr<MemberListInfoContext> typedefs; + SharedPtr<MemberListInfoContext> enums; + SharedPtr<MemberListInfoContext> functions; + SharedPtr<MemberListInfoContext> variables; + SharedPtr<MemberGroupListContext> memberGroups; + SharedPtr<MemberListInfoContext> detailedMacros; + SharedPtr<MemberListInfoContext> detailedTypedefs; + SharedPtr<MemberListInfoContext> detailedEnums; + SharedPtr<MemberListInfoContext> detailedFunctions; + SharedPtr<MemberListInfoContext> detailedVariables; + SharedPtr<NestedClassListContext> inlineClasses; + }; + mutable Cachable m_cache; }; //%% } -FileContext::FileContext(FileDef *fd) +FileContext::FileContext(FileDef *fd) : RefCountedContext("FileContext") { p = new Private(fd); } @@ -1954,10 +2485,14 @@ 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("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); } TemplateVariant title() const { @@ -1975,12 +2510,64 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> { return TemplateVariant(m_dirDef->shortName()); } + TemplateVariant dirs() const + { + if (!m_cache.dirs) + { + m_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); + } + } + return m_cache.dirs.get(); + } + TemplateVariant files() const + { + // FileList *list = m_dirDef->getFiles(); + if (!m_cache.files) + { + m_cache.files.reset(TemplateList::alloc()); + FileList *files = m_dirDef->getFiles(); + if (files) + { + QListIterator<FileDef> it(*files); + FileDef *fd; + for (it.toFirst();(fd=it.current());++it) + { + FileContext *fc = FileContext::alloc(fd); + m_cache.files->append(fc); + } + } + } + return m_cache.files.get(); + } + TemplateVariant hasDetails() const + { + return m_dirDef->hasDetailedDescription(); + } + TemplateVariant compoundType() const + { + return theTranslator->trDir(FALSE,TRUE); + } + private: DirDef *m_dirDef; + struct Cachable + { + Cachable() {} + SharedPtr<TemplateList> dirs; + SharedPtr<TemplateList> files; + }; + mutable Cachable m_cache; }; //%% } -DirContext::DirContext(DirDef *fd) +DirContext::DirContext(DirDef *fd) : RefCountedContext("DirContext") { p = new Private(fd); } @@ -1995,7 +2582,6 @@ TemplateVariant DirContext::get(const char *n) const return p->get(n); } - //------------------------------------------------------------------------ //%% struct Page(Symbol): page information @@ -2026,7 +2612,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> }; //%% } -PageContext::PageContext(PageDef *pd) +PageContext::PageContext(PageDef *pd) : RefCountedContext("PageContext") { p = new Private(pd); } @@ -2077,7 +2663,7 @@ class TextGeneratorHtml : public TextGeneratorIntf void writeBreak(int indent) const { - m_ts << "<br/>"; + m_ts << "<br />"; for (int i=0;i<indent;i++) { m_ts << " "; @@ -2160,21 +2746,70 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> public: Private(MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md) { - addProperty("declType", this,&Private::declType); - addProperty("declArgs", this,&Private::declArgs); + 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("isSettable", this,&Private::isSettable); + 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("isDefine", this,&Private::isDefine); - addProperty("isImplementation", this,&Private::isImplementation); - addProperty("isEvent", this,&Private::isEvent); - addProperty("isProperty", this,&Private::isProperty); - addProperty("isEnumeration", this,&Private::isEnumeration); - addProperty("isEnumValue", this,&Private::isEnumValue); 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("isRelated", this,&Private::isRelated); addProperty("hasDetails", this,&Private::hasDetails); addProperty("exception", this,&Private::exception); addProperty("bitfields", this,&Private::bitfields); @@ -2214,19 +2849,26 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> 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()); if (md && md->isProperty()) { - if (md->isGettable()) m_propertyAttrs.append("get"); - if (md->isSettable()) m_propertyAttrs.append("set"); + if (md->isGettable()) m_cache.propertyAttrs->append("get"); + if (md->isSettable()) m_cache.propertyAttrs->append("set"); } + m_cache.eventAttrs.reset(TemplateList::alloc()); if (md && md->isEvent()) { - if (md->isAddable()) m_eventAttrs.append("add"); - if (md->isRemovable()) m_eventAttrs.append("remove"); - if (md->isRaisable()) m_eventAttrs.append("raise"); + if (md->isAddable()) m_cache.eventAttrs->append("add"); + if (md->isRemovable()) m_cache.eventAttrs->append("remove"); + if (md->isRaisable()) m_cache.eventAttrs->append("raise"); } } + TemplateVariant fieldType() const + { + return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->fieldType()); + } TemplateVariant declType() const { return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); @@ -2259,10 +2901,202 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { return m_memberDef->isImplementation(); } + TemplateVariant isSignal() const + { + return m_memberDef->isSignal(); + } + TemplateVariant isSlot() const + { + return m_memberDef->isSlot(); + } + TemplateVariant isTypedef() const + { + return m_memberDef->isTypedef(); + } + TemplateVariant isFunction() const + { + return m_memberDef->isFunction(); + } + TemplateVariant isFunctionPtr() const + { + return m_memberDef->isFunctionPtr(); + } + TemplateVariant isFriend() const + { + return m_memberDef->isFriend(); + } + TemplateVariant isForeign() const + { + return m_memberDef->isForeign(); + } TemplateVariant isEvent() const { return m_memberDef->isEvent(); } + TemplateVariant isInline() const + { + return m_memberDef->isInline(); + } + TemplateVariant isExplicit() const + { + return m_memberDef->isExplicit(); + } + TemplateVariant isMutable() const + { + return m_memberDef->isMutable(); + } + TemplateVariant isGettable() const + { + return m_memberDef->isSettable(); + } + TemplateVariant isSettable() const + { + return m_memberDef->isSettable(); + } + TemplateVariant isReadable() const + { + return m_memberDef->isReadable(); + } + TemplateVariant isWritable() const + { + return m_memberDef->isWritable(); + } + TemplateVariant isAddable() const + { + return m_memberDef->isAddable(); + } + TemplateVariant isRemovable() const + { + return m_memberDef->isRemovable(); + } + TemplateVariant isRaisable() const + { + return m_memberDef->isRaisable(); + } + TemplateVariant isFinal() const + { + return m_memberDef->isFinal(); + } + TemplateVariant isAbstract() const + { + return m_memberDef->isAbstract(); + } + TemplateVariant isOverride() const + { + return m_memberDef->isOverride(); + } + TemplateVariant isInitonly() const + { + return m_memberDef->isInitonly(); + } + TemplateVariant isOptional() const + { + return m_memberDef->isOptional(); + } + TemplateVariant isRequired() const + { + return m_memberDef->isRequired(); + } + TemplateVariant isNonAtomic() const + { + return m_memberDef->isNonAtomic(); + } + TemplateVariant isCopy() const + { + return m_memberDef->isCopy(); + } + TemplateVariant isAssign() const + { + return m_memberDef->isAssign(); + } + TemplateVariant isRetain() const + { + return m_memberDef->isRetain(); + } + TemplateVariant isWeak() const + { + return m_memberDef->isWeak(); + } + TemplateVariant isStrong() const + { + return m_memberDef->isStrong(); + } + TemplateVariant isUnretained() const + { + return m_memberDef->isUnretained(); + } + TemplateVariant isNew() const + { + return m_memberDef->isNew(); + } + TemplateVariant isSealed() const + { + return m_memberDef->isSealed(); + } + TemplateVariant isExternal() const + { + return m_memberDef->isExternal(); + } + TemplateVariant isAlias() const + { + return m_memberDef->isAlias(); + } + TemplateVariant isDefault() const + { + return m_memberDef->isDefault(); + } + TemplateVariant isDelete() const + { + return m_memberDef->isDelete(); + } + TemplateVariant isNoExcept() const + { + return m_memberDef->isNoExcept(); + } + TemplateVariant isAttribute() const + { + return m_memberDef->isAttribute(); + } + TemplateVariant isUNOProperty() const + { + return m_memberDef->isUNOProperty(); + } + TemplateVariant isReadonly() const + { + return m_memberDef->isReadonly(); + } + TemplateVariant isBound() const + { + return m_memberDef->isBound(); + } + TemplateVariant isConstrained() const + { + return m_memberDef->isConstrained(); + } + TemplateVariant isTransient() const + { + return m_memberDef->isTransient(); + } + TemplateVariant isMaybeVoid() const + { + return m_memberDef->isMaybeVoid(); + } + TemplateVariant isMaybeDefault() const + { + return m_memberDef->isMaybeDefault(); + } + TemplateVariant isMaybeAmbiguous() const + { + return m_memberDef->isMaybeAmbiguous(); + } + TemplateVariant isPublished() const + { + return m_memberDef->isPublished(); + } + TemplateVariant isTemplateSpecialization() const + { + return m_memberDef->isTemplateSpecialization(); + } TemplateVariant isProperty() const { return m_memberDef->isProperty(); @@ -2271,6 +3105,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { return m_memberDef->isEnumValue(); } + TemplateVariant isVariable() const + { + return m_memberDef->isVariable(); + } TemplateVariant isEnumeration() const { return m_memberDef->isEnumerate(); @@ -2318,7 +3156,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ClassDef *cd = m_memberDef->getClassDefOfAnonymousType(); if (cd) { - m_cache.anonymousType.reset(new ClassContext(cd)); + m_cache.anonymousType.reset(ClassContext::alloc(cd)); } } if (m_cache.anonymousType) @@ -2337,7 +3175,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> MemberDef *md = m_memberDef->fromAnonymousMember(); if (md) { - m_cache.anonymousMember.reset(new MemberContext(md)); + m_cache.anonymousMember.reset(MemberContext::alloc(md)); } } if (m_cache.anonymousMember) @@ -2372,11 +3210,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> MemberList *ml = m_memberDef->enumFieldList(); if (ml) { - m_cache.enumValues.reset(new MemberListContext(ml)); + m_cache.enumValues.reset(MemberListContext::alloc(ml)); } else { - m_cache.enumValues.reset(new MemberListContext); + m_cache.enumValues.reset(MemberListContext::alloc()); } } return m_cache.enumValues.get(); @@ -2385,7 +3223,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.templateArgs && m_memberDef->templateArguments()) { - m_cache.templateArgs.reset(new ArgumentListContext(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); + m_cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); } if (m_cache.templateArgs) { @@ -2407,17 +3245,17 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant propertyAttrs() const { - return &m_propertyAttrs; + return m_cache.propertyAttrs.get(); } TemplateVariant eventAttrs() const { - return &m_eventAttrs; + return m_cache.eventAttrs.get(); } TemplateVariant getClass() const { if (!m_cache.classDef && m_memberDef->getClassDef()) { - m_cache.classDef.reset(new ClassContext(m_memberDef->getClassDef())); + m_cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef())); } if (m_cache.classDef) { @@ -2445,11 +3283,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ArgumentList *defArgList = getDefArgList(); if (defArgList && !m_memberDef->isProperty()) { - m_cache.arguments.reset(new ArgumentListContext(defArgList,m_memberDef,relPathAsString())); + m_cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString())); } else { - m_cache.arguments.reset(new ArgumentListContext); + m_cache.arguments.reset(ArgumentListContext::alloc()); } } return m_cache.arguments.get(); @@ -2496,8 +3334,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (tal->count()>0) { - ArgumentListContext *al = new ArgumentListContext(tal,m_memberDef,relPathAsString()); - m_cache.templateArgList.append(al); + ArgumentListContext *al = ArgumentListContext::alloc(tal,m_memberDef,relPathAsString()); tl->append(al); } } @@ -2515,17 +3352,15 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (tal->count()>0) { - ArgumentListContext *al = new ArgumentListContext(tal,m_memberDef,relPathAsString()); - m_cache.templateArgList.append(al); + ArgumentListContext *al = ArgumentListContext::alloc(tal,m_memberDef,relPathAsString()); tl->append(al); } } } if (m_memberDef->templateArguments()) // function template prefix { - ArgumentListContext *al = new ArgumentListContext( + ArgumentListContext *al = ArgumentListContext::alloc( m_memberDef->templateArguments(),m_memberDef,relPathAsString()); - m_cache.templateArgList.append(al); tl->append(al); } } @@ -2534,7 +3369,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.templateDecls) { - TemplateList *tl = new TemplateList; + TemplateList *tl = TemplateList::alloc(); addTemplateDecls(tl); m_cache.templateDecls.reset(tl); } @@ -2546,7 +3381,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { QStrList sl; m_memberDef->getLabels(sl,m_memberDef->getOuterScope()); - TemplateList *tl = new TemplateList; + TemplateList *tl = TemplateList::alloc(); if (sl.count()>0) { QStrListIterator it(sl); @@ -2593,14 +3428,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (!m_cache.implements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.implements.reset(new TemplateList); + m_cache.implements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { - MemberContext *mc = new MemberContext(md); - m_cache.implementsMember.reset(mc); + MemberContext *mc = MemberContext::alloc(md); m_cache.implements->append(mc); } } @@ -2612,14 +3446,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (!m_cache.reimplements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.reimplements.reset(new TemplateList); + m_cache.reimplements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { - MemberContext *mc = new MemberContext(md); - m_cache.reimplementsMember.reset(mc); + MemberContext *mc = MemberContext::alloc(md); m_cache.reimplements->append(mc); } } @@ -2631,7 +3464,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (!m_cache.implementedBy) { MemberList *ml = m_memberDef->reimplementedBy(); - m_cache.implementedBy.reset(new TemplateList); + m_cache.implementedBy.reset(TemplateList::alloc()); if (ml) { MemberListIterator mli(*ml); @@ -2642,7 +3475,6 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { MemberContext *mc = new MemberContext(md); - m_cache.implementedByMembers.append(mc); m_cache.implementedBy->append(mc); } } @@ -2654,7 +3486,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.reimplementedBy) { - m_cache.reimplementedBy.reset(new TemplateList); + m_cache.reimplementedBy.reset(TemplateList::alloc()); MemberList *ml = m_memberDef->reimplementedBy(); if (ml) { @@ -2666,7 +3498,6 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { MemberContext *mc = new MemberContext(md); - m_cache.reimplementedByMembers.append(mc); m_cache.reimplementedBy->append(mc); } } @@ -2682,8 +3513,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> Example *ex; for (it.toFirst();(ex=it.current());++it) { - TemplateStruct *s = new TemplateStruct; - m_cache.exampleList.append(s); + TemplateStruct *s = TemplateStruct::alloc(); s->set("text",ex->name); s->set("isLinkable",TRUE); s->set("anchor",ex->anchor); @@ -2696,7 +3526,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.examples) { - TemplateList *exampleList = new TemplateList; + TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); m_cache.examples.reset(exampleList); } @@ -2706,21 +3536,21 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.typeConstraints && m_memberDef->typeConstraints()) { - m_cache.typeConstraints.reset(new ArgumentListContext(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); + m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); } else { - m_cache.typeConstraints.reset(new ArgumentListContext); + m_cache.typeConstraints.reset(ArgumentListContext::alloc()); } return m_cache.typeConstraints.get(); } TemplateVariant functionQualifier() const { if (!m_memberDef->isObjCMethod() && - (m_memberDef->isFunction() || m_memberDef->isSlot() || + (m_memberDef->isFunction() || m_memberDef->isSlot() || m_memberDef->isPrototype() || m_memberDef->isSignal() ) - ) + ) { return "()"; } @@ -2733,7 +3563,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.sourceRefs) { - m_cache.sourceRefs.reset(new MemberListContext(m_memberDef->getReferencesMembers(),TRUE)); + m_cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); } return m_cache.sourceRefs.get(); } @@ -2741,7 +3571,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (!m_cache.sourceRefBys) { - m_cache.sourceRefBys.reset(new MemberListContext(m_memberDef->getReferencedByMembers(),TRUE)); + m_cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); } return m_cache.sourceRefBys.get(); } @@ -2862,48 +3692,39 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { Cachable() : initializerParsed(FALSE), sourceCodeParsed(FALSE) { - implementedByMembers.setAutoDelete(TRUE); - reimplementedByMembers.setAutoDelete(TRUE); - templateArgList.setAutoDelete(TRUE); - exampleList.setAutoDelete(TRUE); - } - ScopedPtr<ArgumentListContext> templateArgs; - ScopedPtr<ArgumentListContext> arguments; - ScopedPtr<MemberListContext> enumValues; - ScopedPtr<ClassContext> classDef; - ScopedPtr<ClassContext> anonymousType; - ScopedPtr<TemplateList> templateDecls; + } + SharedPtr<ArgumentListContext> templateArgs; + SharedPtr<ArgumentListContext> arguments; + SharedPtr<MemberListContext> enumValues; + SharedPtr<ClassContext> classDef; + SharedPtr<ClassContext> anonymousType; + SharedPtr<TemplateList> templateDecls; ScopedPtr<TemplateVariant> paramDocs; - ScopedPtr<TemplateList> implements; - ScopedPtr<MemberContext> implementsMember; - ScopedPtr<TemplateList> reimplements; - ScopedPtr<MemberContext> reimplementsMember; - ScopedPtr<TemplateList> implementedBy; - ScopedPtr<MemberListContext> sourceRefs; - ScopedPtr<MemberListContext> sourceRefBys; + SharedPtr<TemplateList> implements; + SharedPtr<TemplateList> reimplements; + SharedPtr<TemplateList> implementedBy; + SharedPtr<MemberListContext> sourceRefs; + SharedPtr<MemberListContext> sourceRefBys; ScopedPtr<DotCallGraph> callGraph; ScopedPtr<DotCallGraph> callerGraph; - ScopedPtr<MemberContext> anonymousMember; - QList<MemberContext> implementedByMembers; - ScopedPtr<TemplateList> reimplementedBy; - QList<MemberContext> reimplementedByMembers; - QList<ArgumentListContext> templateArgList; - ScopedPtr<TemplateList> labels; + SharedPtr<MemberContext> anonymousMember; + SharedPtr<TemplateList> reimplementedBy; + SharedPtr<TemplateList> labels; TemplateVariant initializer; bool initializerParsed; TemplateVariant sourceCode; bool sourceCodeParsed; - ScopedPtr<TemplateList> examples; - QList<TemplateStruct> exampleList; - ScopedPtr<ArgumentListContext> typeConstraints; + SharedPtr<TemplateList> examples; + SharedPtr<TemplateList> exampleList; + SharedPtr<ArgumentListContext> typeConstraints; + SharedPtr<TemplateList> propertyAttrs; + SharedPtr<TemplateList> eventAttrs; }; mutable Cachable m_cache; - TemplateList m_propertyAttrs; - TemplateList m_eventAttrs; }; //%% } -MemberContext::MemberContext(MemberDef *md) +MemberContext::MemberContext(MemberDef *md) : RefCountedContext("MemberContext") { p = new Private(md); } @@ -2949,7 +3770,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> }; //%% } -ModuleContext::ModuleContext(GroupDef *gd) +ModuleContext::ModuleContext(GroupDef *gd) : RefCountedContext("ModuleContext") { p = new Private(gd); } @@ -2967,11 +3788,11 @@ TemplateVariant ModuleContext::get(const char *n) const //------------------------------------------------------------------------ //%% list NestedClassList[Class] : list of nested classes -class NestedClassListContext::Private : public GenericNodeListContext<ClassContext> +class NestedClassListContext::Private : public GenericNodeListContext { }; -NestedClassListContext::NestedClassListContext() +NestedClassListContext::NestedClassListContext() : RefCountedContext("NestedClassListContext") { p = new Private; } @@ -3001,14 +3822,55 @@ void NestedClassListContext::append(ClassDef *cd) { if (cd) { - p->append(new ClassContext(cd)); + p->append(ClassContext::alloc(cd)); + } +} + +//------------------------------------------------------------------------ + +//%% list NestedClassList[Class] : list of nested namespaces +class NestedNamespaceListContext::Private : public GenericNodeListContext +{ +}; + +NestedNamespaceListContext::NestedNamespaceListContext() : RefCountedContext("NestedNamespaceListContext") +{ + p = new Private; +} + +NestedNamespaceListContext::~NestedNamespaceListContext() +{ + delete p; +} + +// TemplateListIntf +int NestedNamespaceListContext::count() const +{ + return p->count(); +} + +TemplateVariant NestedNamespaceListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *NestedNamespaceListContext::createIterator() const +{ + return p->createIterator(); +} + +void NestedNamespaceListContext::append(NamespaceDef *cd) +{ + if (cd) + { + p->append(NamespaceContext::alloc(cd)); } } //------------------------------------------------------------------------ //%% list ClassList[Class] : list of classes -class ClassListContext::Private : public GenericNodeListContext<ClassContext> +class ClassListContext::Private : public GenericNodeListContext { public: void addClasses(const ClassSDict &classSDict) @@ -3026,13 +3888,13 @@ class ClassListContext::Private : public GenericNodeListContext<ClassContext> } if (cd->isLinkableInProject() && cd->templateMaster()==0) { - append(new ClassContext(cd)); + append(ClassContext::alloc(cd)); } } } }; -ClassListContext::ClassListContext() +ClassListContext::ClassListContext() : RefCountedContext("ClassListContext") { p = new Private; p->addClasses(*Doxygen::classSDict); @@ -3067,7 +3929,7 @@ TemplateListIntf::ConstIterator *ClassListContext::createIterator() const class ClassInheritanceNodeContext::Private : public PropertyMapper { public: - Private(ClassDef *cd) : m_classContext(cd) + Private(ClassDef *cd) : m_classDef(cd) { //%% bool is_leaf_node: true if this node does not have any children addProperty("is_leaf_node",this,&Private::isLeafNode); @@ -3131,15 +3993,24 @@ class ClassInheritanceNodeContext::Private : public PropertyMapper } TemplateVariant getClass() const { - return TemplateVariant(&m_classContext); + if (!m_cache.classContext) + { + m_cache.classContext.reset(ClassContext::alloc(m_classDef)); + } + return m_cache.classContext.get(); } private: - GenericNodeListContext<ClassInheritanceNodeContext> m_children; - ClassContext m_classContext; + ClassDef *m_classDef; + GenericNodeListContext m_children; + struct Cachable + { + SharedPtr<ClassContext> classContext; + }; + mutable Cachable m_cache; }; //%% } -ClassInheritanceNodeContext::ClassInheritanceNodeContext(ClassDef *cd) +ClassInheritanceNodeContext::ClassInheritanceNodeContext(ClassDef *cd) : RefCountedContext("ClassInheritanceNodeContext") { p = new Private(cd); } @@ -3162,8 +4033,7 @@ void ClassInheritanceNodeContext::addChildren(const BaseClassList *bcl,bool hide //------------------------------------------------------------------------ //%% list ClassInheritance[ClassInheritanceNode]: list of classes -class ClassInheritanceContext::Private : public - GenericNodeListContext<ClassInheritanceNodeContext> +class ClassInheritanceContext::Private : public GenericNodeListContext { public: void addClasses(const ClassSDict &classSDict) @@ -3175,7 +4045,7 @@ class ClassInheritanceContext::Private : public bool b; if (cd->getLanguage()==SrcLangExt_VHDL) { - if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) + if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { continue; } @@ -3190,7 +4060,7 @@ class ClassInheritanceContext::Private : public if (cd->isVisibleInHierarchy()) // should it be visible { // new root level class - ClassInheritanceNodeContext *tnc = new ClassInheritanceNodeContext(cd); + ClassInheritanceNodeContext *tnc = ClassInheritanceNodeContext::alloc(cd); append(tnc); bool hasChildren = !cd->visited && classHasVisibleChildren(cd); if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren) @@ -3209,7 +4079,7 @@ class ClassInheritanceContext::Private : public } }; -ClassInheritanceContext::ClassInheritanceContext() +ClassInheritanceContext::ClassInheritanceContext() : RefCountedContext("ClassInheritanceContext") { p = new Private; initClassHierarchy(Doxygen::classSDict); @@ -3253,7 +4123,11 @@ class ClassHierarchyContext::Private : public PropertyMapper public: TemplateVariant tree() const { - return TemplateVariant(&m_classTree); + if (!m_cache.classTree) + { + m_cache.classTree.reset(ClassInheritanceContext::alloc()); + } + return m_cache.classTree.get(); } TemplateVariant fileName() const { @@ -3294,11 +4168,15 @@ class ClassHierarchyContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - ClassInheritanceContext m_classTree; + struct Cachable + { + SharedPtr<ClassInheritanceContext> classTree; + }; + mutable Cachable m_cache; }; //%% } -ClassHierarchyContext::ClassHierarchyContext() +ClassHierarchyContext::ClassHierarchyContext() : RefCountedContext("ClassHierarchyContext") { p = new Private; } @@ -3320,10 +4198,11 @@ TemplateVariant ClassHierarchyContext::get(const char *name) const class NestingNodeContext::Private : public PropertyMapper { public: - Private(Definition *d,bool addCls) : m_def(d), - m_classContext(m_def->definitionType()==Definition::TypeClass?(ClassDef*)d:0), - m_namespaceContext(m_def->definitionType()==Definition::TypeNamespace?(NamespaceDef*)d:0) + Private(const NestingNodeContext *parent,const NestingNodeContext *thisNode, + Definition *d,int index,int level,bool addCls) + : 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 @@ -3332,22 +4211,44 @@ class NestingNodeContext::Private : public PropertyMapper 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); + //%% 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); + addNamespaces(addCls); addClasses(); + addDirFiles(); } TemplateVariant isLeafNode() const { - return m_children.count()==0; + return m_children->count()==0; } TemplateVariant children() const { - return TemplateVariant(&m_children); + return m_children.get(); } TemplateVariant getClass() const { - if (m_def->definitionType()==Definition::TypeClass) + if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass) { - return TemplateVariant(&m_classContext); + m_cache.classContext.reset(ClassContext::alloc((ClassDef*)m_def)); + } + if (m_cache.classContext) + { + return m_cache.classContext.get(); } else { @@ -3356,21 +4257,104 @@ class NestingNodeContext::Private : public PropertyMapper } TemplateVariant getNamespace() const { - if (m_def->definitionType()==Definition::TypeNamespace) + if (!m_cache.namespaceContext && m_def->definitionType()==Definition::TypeNamespace) + { + m_cache.namespaceContext.reset(NamespaceContext::alloc((NamespaceDef*)m_def)); + } + if (m_cache.namespaceContext) + { + return m_cache.namespaceContext.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant getDir() const + { + if (!m_cache.dirContext && m_def->definitionType()==Definition::TypeDir) + { + m_cache.dirContext.reset(DirContext::alloc((DirDef*)m_def)); + } + if (m_cache.dirContext) { - return TemplateVariant(&m_namespaceContext); + return m_cache.dirContext.get(); } else { return TemplateVariant(FALSE); } } + TemplateVariant getFile() const + { + if (!m_cache.fileContext && m_def->definitionType()==Definition::TypeFile) + { + m_cache.fileContext.reset(FileContext::alloc((FileDef*)m_def)); + } + if (m_cache.fileContext) + { + return m_cache.fileContext.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant level() const + { + return m_level; + } + TemplateVariant id() const + { + QCString result; + if (m_parent) result=m_parent->id(); + result+=QCString().setNum(m_index)+"_"; + return result; + } + TemplateVariant name() const + { + return m_def->displayName(FALSE); + } + QCString relPathAsString() const + { + static bool createSubdirs = Config_getBool("CREATE_SUBDIRS"); + return createSubdirs ? QCString("../../") : QCString(""); + } + TemplateVariant brief() const + { + if (!m_cache.brief) + { + if (m_def->hasBriefDescription()) + { + m_cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), + "",m_def->briefDescription(),TRUE))); + } + else + { + m_cache.brief.reset(new TemplateVariant("")); + } + } + return *m_cache.brief; + } + TemplateVariant isLinkable() const + { + return m_def->isLinkable(); + } + TemplateVariant anchor() const + { + return m_def->anchor(); + } + TemplateVariant fileName() const + { + return m_def->getOutputFileBase(); + } + void addClasses() { ClassDef *cd = m_def->definitionType()==Definition::TypeClass ? (ClassDef*)m_def : 0; if (cd && cd->getClassSDict()) { - m_children.addClasses(*cd->getClassSDict(),FALSE); + m_children->addClasses(*cd->getClassSDict(),FALSE); } } void addNamespaces(bool addClasses) @@ -3378,24 +4362,47 @@ class NestingNodeContext::Private : public PropertyMapper NamespaceDef *nd = m_def->definitionType()==Definition::TypeNamespace ? (NamespaceDef*)m_def : 0; if (nd && nd->getNamespaceSDict()) { - m_children.addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses); + m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses); } if (addClasses && nd && nd->getClassSDict()) { - m_children.addClasses(*nd->getClassSDict(),FALSE); + m_children->addClasses(*nd->getClassSDict(),FALSE); + } + } + void addDirFiles() + { + DirDef *dd = m_def->definitionType()==Definition::TypeDir ? (DirDef*)m_def : 0; + if (dd) + { + m_children->addDirs(dd->subDirs()); + if (dd && dd->getFiles()) + { + m_children->addFiles(*dd->getFiles()); + } } } - Definition *m_def; private: - NestingContext m_children; - ClassContext m_classContext; - NamespaceContext m_namespaceContext; + const NestingNodeContext *m_parent; + Definition *m_def; + SharedPtr<NestingContext> m_children; + int m_level; + int m_index; + struct Cachable + { + SharedPtr<ClassContext> classContext; + SharedPtr<NamespaceContext> namespaceContext; + SharedPtr<DirContext> dirContext; + SharedPtr<FileContext> fileContext; + ScopedPtr<TemplateVariant> brief; + }; + mutable Cachable m_cache; }; //%% } -NestingNodeContext::NestingNodeContext(Definition *d,bool addClass) +NestingNodeContext::NestingNodeContext(const NestingNodeContext *parent, + Definition *d,int index,int level,bool addClass) : RefCountedContext("NestingNodeContext") { - p = new Private(d,addClass); + p = new Private(parent,this,d,index,level,addClass); } NestingNodeContext::~NestingNodeContext() @@ -3408,12 +4415,20 @@ TemplateVariant NestingNodeContext::get(const char *n) const return p->get(n); } +QCString NestingNodeContext::id() const +{ + return p->id().toString(); +} + //------------------------------------------------------------------------ //%% list Nesting[NestingNode]: namespace and class nesting relations -class NestingContext::Private : public GenericNodeListContext<NestingNodeContext> +class NestingContext::Private : public GenericNodeListContext { public: + Private(const NestingNodeContext *parent,int level) + : m_parent(parent), m_level(level), m_index(0) {} + void addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses) { NamespaceSDict::Iterator nli(nsDict); @@ -3427,8 +4442,9 @@ class NestingContext::Private : public GenericNodeListContext<NestingNodeContext bool isLinkable = nd->isLinkableInProject(); if (isLinkable || hasChildren) { - NestingNodeContext *nnc = new NestingNodeContext(nd,addClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses); append(nnc); + m_index++; } } } @@ -3455,17 +4471,73 @@ class NestingContext::Private : public GenericNodeListContext<NestingNodeContext { if (classVisibleInIndex(cd) && cd->templateMaster()==0) { - NestingNodeContext *nnc = new NestingNodeContext(cd,TRUE); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE); append(nnc); + m_index++; } } } } + void addDirs(const DirSDict &dirDict) + { + SDict<DirDef>::Iterator dli(dirDict); + DirDef *dd; + for (dli.toFirst();(dd=dli.current());++dli) + { + if (dd->getOuterScope()==Doxygen::globalScope) + { + append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE)); + m_index++; + } + } + } + void addDirs(const DirList &dirList) + { + QListIterator<DirDef> li(dirList); + DirDef *dd; + for (li.toFirst();(dd=li.current());++li) + { + append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE)); + m_index++; + } + } + void addFiles(const FileNameList &fnList) + { + FileNameListIterator fnli(fnList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) + { + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) + { + if (fd->getDirDef()==0) // top level file + { + append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE)); + m_index++; + } + } + } + } + void addFiles(const FileList &fList) + { + QListIterator<FileDef> li(fList); + FileDef *fd; + for (li.toFirst();(fd=li.current());++li) + { + append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE)); + m_index++; + } + } + private: + const NestingNodeContext *m_parent; + int m_level; + int m_index; }; -NestingContext::NestingContext() +NestingContext::NestingContext(const NestingNodeContext *parent,int level) : RefCountedContext("NestingContext") { - p = new Private; + p = new Private(parent,level); } NestingContext::~NestingContext() @@ -3499,16 +4571,129 @@ void NestingContext::addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bo p->addNamespaces(nsDict,rootOnly,addClasses); } +void NestingContext::addDirs(const DirSDict &dirs) +{ + p->addDirs(dirs); +} + +void NestingContext::addDirs(const DirList &dirs) +{ + p->addDirs(dirs); +} + +void NestingContext::addFiles(const FileNameList &files) +{ + p->addFiles(files); +} + +void NestingContext::addFiles(const FileList &files) +{ + p->addFiles(files); +} + + //------------------------------------------------------------------------ +static int computeMaxDepth(const TemplateListIntf *list) +{ + int maxDepth=0; + if (list) + { + TemplateListIntf::ConstIterator *it = list->createIterator(); + TemplateVariant v; + for (it->toFirst();it->current(v);it->toNext()) + { + const TemplateStructIntf *s = v.toStruct(); + TemplateVariant child = s->get("children"); + int d = computeMaxDepth(child.toList())+1; + if (d>maxDepth) maxDepth=d; + } + delete it; + } + return maxDepth; +} + +static int computeNumNodesAtLevel(const TemplateStructIntf *s,int level,int maxLevel) +{ + int num=0; + if (level<maxLevel) + { + num++; + TemplateVariant child = s->get("children"); + if (child.toList()) + { + TemplateListIntf::ConstIterator *it = child.toList()->createIterator(); + TemplateVariant v; + for (it->toFirst();it->current(v);it->toNext()) + { + num+=computeNumNodesAtLevel(v.toStruct(),level+1,maxLevel); + } + delete it; + } + } + return num; +} + +static int computePreferredDepth(const TemplateListIntf *list,int maxDepth) +{ + int preferredNumEntries = Config_getInt("HTML_INDEX_NUM_ENTRIES"); + int preferredDepth=1; + if (preferredNumEntries>0) + { + int depth = maxDepth; + for (int i=1;i<=depth;i++) + { + int num=0; + TemplateListIntf::ConstIterator *it = list->createIterator(); + TemplateVariant v; + for (it->toFirst();it->current(v);it->toNext()) + { + num+=computeNumNodesAtLevel(v.toStruct(),0,i); + } + delete it; + if (num<=preferredNumEntries) + { + preferredDepth=i; + } + else + { + break; + } + } + } + return preferredDepth; +} + + //%% struct ClassTree: Class nesting relations //%% { class ClassTreeContext::Private : public PropertyMapper { public: + Private() + { + m_classTree.reset(NestingContext::alloc(0,0)); + if (Doxygen::namespaceSDict) + { + m_classTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,TRUE); + } + if (Doxygen::classSDict) + { + 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); + } TemplateVariant tree() const { - return TemplateVariant(&m_classTree); + return m_classTree.get(); } TemplateVariant fileName() const { @@ -3543,30 +4728,39 @@ class ClassTreeContext::Private : public PropertyMapper return theTranslator->trClasses(); } } - Private() + TemplateVariant maxDepth() const { - if (Doxygen::namespaceSDict) + if (!m_cache.maxDepthComputed) { - m_classTree.addNamespaces(*Doxygen::namespaceSDict,TRUE,TRUE); + m_cache.maxDepth = computeMaxDepth(m_classTree.get()); + m_cache.maxDepthComputed=TRUE; } - if (Doxygen::classSDict) + return m_cache.maxDepth; + } + TemplateVariant preferredDepth() const + { + if (!m_cache.preferredDepthComputed) { - m_classTree.addClasses(*Doxygen::classSDict,TRUE); + m_cache.preferredDepth = computePreferredDepth(m_classTree.get(),maxDepth().toInt()); + m_cache.preferredDepthComputed=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); + return m_cache.preferredDepth; } private: - NestingContext m_classTree; + SharedPtr<NestingContext> m_classTree; + struct Cachable + { + Cachable() : maxDepthComputed(FALSE), preferredDepthComputed(FALSE) {} + int maxDepth; + bool maxDepthComputed; + int preferredDepth; + bool preferredDepthComputed; + }; + mutable Cachable m_cache; }; //%% } -ClassTreeContext::ClassTreeContext() +ClassTreeContext::ClassTreeContext() : RefCountedContext("ClassTreeContext") { p = new Private; } @@ -3584,7 +4778,7 @@ TemplateVariant ClassTreeContext::get(const char *name) const //------------------------------------------------------------------------ //%% list NamespaceList[Namespace] : list of namespaces -class NamespaceListContext::Private : public GenericNodeListContext<NamespaceContext> +class NamespaceListContext::Private : public GenericNodeListContext { public: void addNamespaces(const NamespaceSDict &nsDict) @@ -3595,13 +4789,13 @@ class NamespaceListContext::Private : public GenericNodeListContext<NamespaceCon { if (nd->isLinkableInProject()) { - append(new NamespaceContext(nd)); + append(NamespaceContext::alloc(nd)); } } } }; -NamespaceListContext::NamespaceListContext() +NamespaceListContext::NamespaceListContext() : RefCountedContext("NamespaceListContext") { p = new Private; p->addNamespaces(*Doxygen::namespaceSDict); @@ -3675,9 +4869,10 @@ class NamespaceTreeContext::Private : public PropertyMapper } Private() { + m_namespaceTree.reset(NestingContext::alloc(0,0)); if (Doxygen::namespaceSDict) { - m_namespaceTree.addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE); + m_namespaceTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE); } //%% Nesting tree addProperty("tree",this,&Private::tree); @@ -3688,11 +4883,11 @@ class NamespaceTreeContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - NestingContext m_namespaceTree; + SharedPtr<NestingContext> m_namespaceTree; }; //%% } -NamespaceTreeContext::NamespaceTreeContext() +NamespaceTreeContext::NamespaceTreeContext() : RefCountedContext("NamespaceTreeContext") { p = new Private; } @@ -3710,7 +4905,7 @@ TemplateVariant NamespaceTreeContext::get(const char *name) const //------------------------------------------------------------------------ //%% list FileList[File] : list of files -class FileListContext::Private : public GenericNodeListContext<FileContext> +class FileListContext::Private : public GenericNodeListContext { public: void addFiles(const FileNameList &fnList) @@ -3729,14 +4924,14 @@ class FileListContext::Private : public GenericNodeListContext<FileContext> bool nameOk = !fd->isDocumentationFile(); if (nameOk && (doc || src) && !fd->isReference()) { - append(new FileContext(fd)); + append(FileContext::alloc(fd)); } } } } }; -FileListContext::FileListContext() +FileListContext::FileListContext() : RefCountedContext("FileListContext") { p = new Private; if (Doxygen::inputNameList) p->addFiles(*Doxygen::inputNameList); @@ -3765,246 +4960,100 @@ TemplateListIntf::ConstIterator *FileListContext::createIterator() const //------------------------------------------------------------------------ -//%% list UsedFiles[File] : list of files -class UsedFilesContext::Private : public GenericNodeListContext<FileContext> +//%% list DirList[Dir] : list of files +class DirListContext::Private : public GenericNodeListContext { public: - void addFile(FileDef *fd) + Private() { - append(new FileContext(fd)); + DirDef *dir; + DirSDict::Iterator sdi(*Doxygen::directories); + for (sdi.toFirst();(dir=sdi.current());++sdi) + { + append(DirContext::alloc(dir)); + } } }; -UsedFilesContext::UsedFilesContext(ClassDef *cd) +DirListContext::DirListContext() : RefCountedContext("DirListContext") { p = new Private; - if (cd) - { - QListIterator<FileDef> li(cd->usedFiles()); - FileDef *fd; - for (li.toFirst();(fd=li.current());++li) - { - p->addFile(fd); - } - } } -UsedFilesContext::~UsedFilesContext() +DirListContext::~DirListContext() { delete p; } // TemplateListIntf -int UsedFilesContext::count() const +int DirListContext::count() const { return p->count(); } -TemplateVariant UsedFilesContext::at(int index) const +TemplateVariant DirListContext::at(int index) const { return p->at(index); } -TemplateListIntf::ConstIterator *UsedFilesContext::createIterator() const +TemplateListIntf::ConstIterator *DirListContext::createIterator() const { return p->createIterator(); } -void UsedFilesContext::addFile(FileDef *fd) -{ - p->addFile(fd); -} //------------------------------------------------------------------------ - -//%% struct DirFileNode: node is a directory hierarchy -//%% { -class DirFileNodeContext::Private : public PropertyMapper +//%% list UsedFiles[File] : list of files +class UsedFilesContext::Private : public GenericNodeListContext { public: - Private(Definition *d) : m_def(d), - m_dirContext (m_def->definitionType()==Definition::TypeDir ? (DirDef*)d : 0), - m_fileContext(m_def->definitionType()==Definition::TypeFile ? (FileDef*)d : 0) - { - //%% bool is_leaf_node: true if this node does not have any children - addProperty("is_leaf_node",this,&Private::isLeafNode); - //%% DirFile children: list of nested classes/namespaces - addProperty("children",this,&Private::children); - //%% [optional] Dir dir: directory info (if this node represents a directory) - addProperty("dir",this,&Private::getDir); - //%% [optional] File file: file info (if this node represents a file) - addProperty("file",this,&Private::getFile); - addDirFiles(); - } - TemplateVariant isLeafNode() const - { - return m_children.count()==0; - } - TemplateVariant children() const - { - return TemplateVariant(&m_children); - } - TemplateVariant getDir() const - { - if (m_def->definitionType()==Definition::TypeDir) - { - return TemplateVariant(&m_dirContext); - } - else - { - return TemplateVariant(FALSE); - } - } - TemplateVariant getFile() const - { - if (m_def->definitionType()==Definition::TypeFile) - { - return TemplateVariant(&m_fileContext); - } - else - { - return TemplateVariant(FALSE); - } - } - void addDirFiles() + void addFile(FileDef *fd) { - DirDef *dd = m_def->definitionType()==Definition::TypeDir ? (DirDef*)m_def : 0; - if (dd) - { - m_children.addDirs(dd->subDirs()); - if (dd && dd->getFiles()) - { - m_children.addFiles(*dd->getFiles()); - } - } + append(FileContext::alloc(fd)); } - private: - Definition *m_def; - DirFileContext m_children; - DirContext m_dirContext; - FileContext m_fileContext; }; -//%% } - -DirFileNodeContext::DirFileNodeContext(Definition *d) -{ - p = new Private(d); -} - -DirFileNodeContext::~DirFileNodeContext() -{ - delete p; -} - -TemplateVariant DirFileNodeContext::get(const char *n) const -{ - return p->get(n); -} - -//------------------------------------------------------------------------ - -//%% list DirFile[DirFileNode]: list of directories and/or files -class DirFileContext::Private : public GenericNodeListContext<DirFileNodeContext> +UsedFilesContext::UsedFilesContext(ClassDef *cd) : RefCountedContext("UsedFilesContext") { - public: - void addDirs(const DirSDict &dirDict) - { - SDict<DirDef>::Iterator dli(dirDict); - DirDef *dd; - for (dli.toFirst();(dd=dli.current());++dli) - { - if (dd->getOuterScope()==Doxygen::globalScope) - { - append(new DirFileNodeContext(dd)); - } - } - } - void addDirs(const DirList &dirList) - { - QListIterator<DirDef> li(dirList); - DirDef *dd; - for (li.toFirst();(dd=li.current());++li) - { - append(new DirFileNodeContext(dd)); - } - } - void addFiles(const FileNameList &fnList) - { - FileNameListIterator fnli(fnList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) - { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) - { - if (fd->getDirDef()==0) // top level file - { - append(new DirFileNodeContext(fd)); - } - } - } - } - void addFiles(const FileList &fList) + p = new Private; + if (cd) + { + QListIterator<FileDef> li(cd->usedFiles()); + FileDef *fd; + for (li.toFirst();(fd=li.current());++li) { - QListIterator<FileDef> li(fList); - FileDef *fd; - for (li.toFirst();(fd=li.current());++li) - { - append(new DirFileNodeContext(fd)); - } + p->addFile(fd); } -}; - -DirFileContext::DirFileContext() -{ - p = new Private; + } } -DirFileContext::~DirFileContext() +UsedFilesContext::~UsedFilesContext() { delete p; } // TemplateListIntf -int DirFileContext::count() const +int UsedFilesContext::count() const { return p->count(); } -TemplateVariant DirFileContext::at(int index) const +TemplateVariant UsedFilesContext::at(int index) const { return p->at(index); } -TemplateListIntf::ConstIterator *DirFileContext::createIterator() const +TemplateListIntf::ConstIterator *UsedFilesContext::createIterator() const { return p->createIterator(); } -void DirFileContext::addDirs(const DirSDict &dirs) -{ - p->addDirs(dirs); -} - -void DirFileContext::addDirs(const DirList &dirs) -{ - p->addDirs(dirs); -} - -void DirFileContext::addFiles(const FileNameList &files) -{ - p->addFiles(files); -} - -void DirFileContext::addFiles(const FileList &files) +void UsedFilesContext::addFile(FileDef *fd) { - p->addFiles(files); + p->addFile(fd); } - //------------------------------------------------------------------------ //%% struct FileTree: tree of directories and files @@ -4012,6 +5061,28 @@ void DirFileContext::addFiles(const FileList &files) class FileTreeContext::Private : public PropertyMapper { public: + Private() + { + // Add dirs tree + m_dirFileTree.reset(NestingContext::alloc(0,0)); + if (Doxygen::directories) + { + m_dirFileTree->addDirs(*Doxygen::directories); + } + if (Doxygen::inputNameList) + { + 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); + } TemplateVariant tree() const { return TemplateVariant(&m_dirFileTree); @@ -4036,31 +5107,39 @@ class FileTreeContext::Private : public PropertyMapper { return theTranslator->trFileList(); } - Private() + TemplateVariant maxDepth() const { - // Add dirs tree - if (Doxygen::directories) + if (!m_cache.maxDepthComputed) { - m_dirFileTree.addDirs(*Doxygen::directories); + m_cache.maxDepth = computeMaxDepth(m_dirFileTree.get()); + m_cache.maxDepthComputed=TRUE; } - if (Doxygen::inputNameList) + return m_cache.maxDepth; + } + TemplateVariant preferredDepth() const + { + if (!m_cache.preferredDepthComputed) { - m_dirFileTree.addFiles(*Doxygen::inputNameList); + m_cache.preferredDepth = computePreferredDepth(m_dirFileTree.get(),maxDepth().toInt()); + m_cache.preferredDepthComputed=TRUE; } - //%% 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); + return m_cache.preferredDepth; } private: - DirFileContext m_dirFileTree; + SharedPtr<NestingContext> m_dirFileTree; + struct Cachable + { + Cachable() : maxDepthComputed(FALSE), preferredDepthComputed(FALSE) {} + int maxDepth; + bool maxDepthComputed; + int preferredDepth; + bool preferredDepthComputed; + }; + mutable Cachable m_cache; }; //%% } -FileTreeContext::FileTreeContext() +FileTreeContext::FileTreeContext() : RefCountedContext("FileTreeContext") { p = new Private; } @@ -4082,8 +5161,10 @@ TemplateVariant FileTreeContext::get(const char *name) const class PageNodeContext::Private : public PropertyMapper { public: - Private(PageDef *pd) : m_pageDef(pd), m_pageContext(pd) + Private(PageDef *pd) : m_pageDef(pd) { + m_children.reset(PageNodeListContext::alloc()); + m_pageContext.reset(PageContext::alloc(pd)); //%% bool is_leaf_node: true if this node does not have any children addProperty("is_leaf_node",this,&Private::isLeafNode); //%% PageList children: list of nested classes/namespaces @@ -4094,31 +5175,31 @@ class PageNodeContext::Private : public PropertyMapper } TemplateVariant isLeafNode() const { - return m_children.count()==0; + return m_children->count()==0; } TemplateVariant children() const { - return TemplateVariant(&m_children); + return m_children.get(); } TemplateVariant getPage() const { - return TemplateVariant(&m_pageContext); + return m_pageContext.get(); } void addPages() { if (m_pageDef->getSubPages()) { - m_children.addPages(*m_pageDef->getSubPages(),FALSE); + m_children->addPages(*m_pageDef->getSubPages(),FALSE); } } private: - PageDef *m_pageDef; - PageNodeListContext m_children; - PageContext m_pageContext; + PageDef *m_pageDef; + SharedPtr<PageNodeListContext> m_children; + SharedPtr<PageContext> m_pageContext; }; //%% } -PageNodeContext::PageNodeContext(PageDef *pd) +PageNodeContext::PageNodeContext(PageDef *pd) : RefCountedContext("PageNodeContext") { p = new Private(pd); } @@ -4136,7 +5217,7 @@ TemplateVariant PageNodeContext::get(const char *n) const //------------------------------------------------------------------------ //%% list PageList[PageNode]: list of directories and/or files -class PageNodeListContext::Private : public GenericNodeListContext<PageNodeContext> +class PageNodeListContext::Private : public GenericNodeListContext { public: void addPages(const PageSDict &pages,bool rootOnly) @@ -4149,13 +5230,13 @@ class PageNodeListContext::Private : public GenericNodeListContext<PageNodeConte pd->getOuterScope()==0 || pd->getOuterScope()->definitionType()!=Definition::TypePage) { - append(new PageNodeContext(pd)); + append(PageNodeContext::alloc(pd)); } } } }; -PageNodeListContext::PageNodeListContext() +PageNodeListContext::PageNodeListContext() : RefCountedContext("PageNodeListContext") { p = new Private; } @@ -4195,7 +5276,7 @@ class PageTreeContext::Private : public PropertyMapper public: TemplateVariant tree() const { - return TemplateVariant(&m_pageList); + return m_pageList.get(); } TemplateVariant fileName() const { @@ -4219,10 +5300,11 @@ class PageTreeContext::Private : public PropertyMapper } Private() { + m_pageList.reset(PageNodeListContext::alloc()); // Add pages if (Doxygen::pageSDict) { - m_pageList.addPages(*Doxygen::pageSDict,TRUE); + m_pageList->addPages(*Doxygen::pageSDict,TRUE); } //%% PageNodeList tree: @@ -4234,11 +5316,11 @@ class PageTreeContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - PageNodeListContext m_pageList; + SharedPtr<PageNodeListContext> m_pageList; }; //%% } -PageTreeContext::PageTreeContext() +PageTreeContext::PageTreeContext() : RefCountedContext("PageTreeContext") { p = new Private; } @@ -4262,7 +5344,7 @@ class PageListContext::Private : public PropertyMapper public: TemplateVariant items() const { - return TemplateVariant(&m_pageList); + return m_pageList.get(); } TemplateVariant fileName() const { @@ -4286,6 +5368,7 @@ class PageListContext::Private : public PropertyMapper } Private() { + m_pageList.reset(new GenericNodeListContext); // Add pages PageSDict::Iterator pdi(*Doxygen::pageSDict); PageDef *pd=0; @@ -4293,7 +5376,7 @@ class PageListContext::Private : public PropertyMapper { if (!pd->getGroupDef() && !pd->isReference()) { - m_pageList.append(new PageContext(pd)); + m_pageList->append(PageContext::alloc(pd)); } } @@ -4306,11 +5389,11 @@ class PageListContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - GenericNodeListContext<PageContext> m_pageList; + SharedPtr<GenericNodeListContext> m_pageList; }; //%% } -PageListContext::PageListContext() +PageListContext::PageListContext() : RefCountedContext("PageListContext") { p = new Private; } @@ -4333,8 +5416,10 @@ TemplateVariant PageListContext::get(const char *name) const class ModuleNodeContext::Private : public PropertyMapper { public: - Private(GroupDef *gd) : m_groupDef(gd), m_moduleContext(gd) + Private(GroupDef *gd) : m_groupDef(gd) { + m_children.reset(ModuleListContext::alloc()); + m_moduleContext.reset(ModuleContext::alloc(gd)); //%% bool is_leaf_node: true if this node does not have any children addProperty("is_leaf_node",this,&Private::isLeafNode); //%% ModuleList children: list of submodules @@ -4345,31 +5430,31 @@ class ModuleNodeContext::Private : public PropertyMapper } TemplateVariant isLeafNode() const { - return m_children.count()==0; + return m_children->count()==0; } TemplateVariant children() const { - return TemplateVariant(&m_children); + return m_children.get(); } TemplateVariant getModule() const { - return TemplateVariant(&m_moduleContext); + return m_moduleContext.get(); } void addModules() { if (m_groupDef->getSubGroups()) { - m_children.addModules(*m_groupDef->getSubGroups()); + m_children->addModules(*m_groupDef->getSubGroups()); } } private: - GroupDef *m_groupDef; - ModuleListContext m_children; - ModuleContext m_moduleContext; + GroupDef *m_groupDef; + SharedPtr<ModuleListContext> m_children; + SharedPtr<ModuleContext> m_moduleContext; }; //%% } -ModuleNodeContext::ModuleNodeContext(GroupDef *gd) +ModuleNodeContext::ModuleNodeContext(GroupDef *gd) : RefCountedContext("ModuleNodeContext") { p = new Private(gd); } @@ -4387,7 +5472,7 @@ TemplateVariant ModuleNodeContext::get(const char *n) const //------------------------------------------------------------------------ //%% list ModuleList[ModuleNode]: list of directories and/or files -class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeContext> +class ModuleListContext::Private : public GenericNodeListContext { public: void addModules(const GroupSDict &modules) @@ -4399,7 +5484,7 @@ class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeConte { if (!gd->isASubGroup() && gd->isVisible() && (!gd->isReference() || externalGroups)) { - append(new ModuleNodeContext(gd)); + append(ModuleNodeContext::alloc(gd)); } } } @@ -4409,12 +5494,12 @@ class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeConte GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { - append(new ModuleNodeContext(gd)); + append(ModuleNodeContext::alloc(gd)); } } }; -ModuleListContext::ModuleListContext() +ModuleListContext::ModuleListContext() : RefCountedContext("ModuleListContext") { p = new Private; } @@ -4484,10 +5569,11 @@ class ModuleTreeContext::Private : public PropertyMapper } Private() { + m_moduleList.reset(ModuleListContext::alloc()); // Add modules if (Doxygen::groupSDict) { - m_moduleList.addModules(*Doxygen::groupSDict); + m_moduleList->addModules(*Doxygen::groupSDict); } //%% ModuleList tree: @@ -4499,11 +5585,11 @@ class ModuleTreeContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - ModuleListContext m_moduleList; + SharedPtr<ModuleListContext> m_moduleList; }; //%% } -ModuleTreeContext::ModuleTreeContext() +ModuleTreeContext::ModuleTreeContext() : RefCountedContext("ModuleTreeContext") { p = new Private; } @@ -4570,7 +5656,7 @@ class NavPathElemContext::Private : public PropertyMapper }; //%% } -NavPathElemContext::NavPathElemContext(Definition *def) +NavPathElemContext::NavPathElemContext(Definition *def) : RefCountedContext("NavPathElemContext") { p = new Private(def); } @@ -4619,10 +5705,11 @@ class ExampleListContext::Private : public PropertyMapper } Private() { + m_pageList.reset(PageNodeListContext::alloc()); // Add pages if (Doxygen::exampleSDict) { - m_pageList.addPages(*Doxygen::exampleSDict,FALSE); + m_pageList->addPages(*Doxygen::exampleSDict,FALSE); } //%% PageNodeList items: @@ -4634,11 +5721,11 @@ class ExampleListContext::Private : public PropertyMapper addProperty("title",this,&Private::title); } private: - PageNodeListContext m_pageList; + SharedPtr<PageNodeListContext> m_pageList; }; //%% } -ExampleListContext::ExampleListContext() +ExampleListContext::ExampleListContext() : RefCountedContext("ExampleListContext") { p = new Private; } @@ -4661,26 +5748,31 @@ TemplateVariant ExampleListContext::get(const char *name) const class InheritanceNodeContext::Private : public PropertyMapper { public: - Private(ClassDef *cd,const QCString &name) : m_classContext(cd), m_name(name) + Private(ClassDef *cd,const QCString &name) : m_classDef(cd), m_name(name) { addProperty("class",this,&Private::getClass); addProperty("name",this,&Private::name); } TemplateVariant getClass() const { - return &m_classContext; + if (!m_classContext) + { + m_classContext.reset(ClassContext::alloc(m_classDef)); + } + return m_classContext.get(); } TemplateVariant name() const { return m_name; } private: - ClassContext m_classContext; + ClassDef *m_classDef; + mutable SharedPtr<ClassContext> m_classContext; QCString m_name; }; //%% } -InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) +InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) : RefCountedContext("InheritanceNodeContext") { p = new Private(cd,name); } @@ -4698,16 +5790,16 @@ TemplateVariant InheritanceNodeContext::get(const char *name) const //------------------------------------------------------------------------ //%% list InheritanceList[InheritanceNode] : list of inherited classes -class InheritanceListContext::Private : public GenericNodeListContext<InheritanceNodeContext> +class InheritanceListContext::Private : public GenericNodeListContext { public: void addClass(ClassDef *cd,const QCString &name) { - append(new InheritanceNodeContext(cd,name)); + append(InheritanceNodeContext::alloc(cd,name)); } }; -InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses) +InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses) : RefCountedContext("InheritanceListContext") { p = new Private; if (list) @@ -4757,21 +5849,21 @@ TemplateListIntf::ConstIterator *InheritanceListContext::createIterator() const //------------------------------------------------------------------------ //%% list MemberList[Member] : list of inherited classes -class MemberListContext::Private : public GenericNodeListContext<MemberContext> +class MemberListContext::Private : public GenericNodeListContext { public: void addMember(MemberDef *md) { - append(new MemberContext(md)); + append(MemberContext::alloc(md)); } }; -MemberListContext::MemberListContext() +MemberListContext::MemberListContext() : RefCountedContext("MemberListContext") { p = new Private; } -MemberListContext::MemberListContext(const MemberList *list) +MemberListContext::MemberListContext(const MemberList *list) : RefCountedContext("MemberListContext") { p = new Private; if (list) @@ -4791,7 +5883,7 @@ MemberListContext::MemberListContext(const MemberList *list) } } -MemberListContext::MemberListContext(MemberSDict *list,bool doSort) +MemberListContext::MemberListContext(MemberSDict *list,bool doSort) : RefCountedContext("MemberListContext") { p = new Private; if (list) @@ -4877,7 +5969,7 @@ class MemberInfoContext::Private : public PropertyMapper { if (!m_member && m_memberInfo->memberDef) { - m_member.reset(new MemberContext(m_memberInfo->memberDef)); + m_member.reset(MemberContext::alloc(m_memberInfo->memberDef)); } if (m_member) { @@ -4890,11 +5982,11 @@ class MemberInfoContext::Private : public PropertyMapper } private: const MemberInfo *m_memberInfo; - mutable ScopedPtr<MemberContext> m_member; + mutable SharedPtr<MemberContext> m_member; }; //%% } -MemberInfoContext::MemberInfoContext(const MemberInfo *mi) +MemberInfoContext::MemberInfoContext(const MemberInfo *mi) : RefCountedContext("MemberInfoContext") { p = new Private(mi); } @@ -4913,7 +6005,7 @@ TemplateVariant MemberInfoContext::get(const char *name) const //------------------------------------------------------------------------ //%% list AllMembersList[MemberList] : list of inherited classes -class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoContext> +class AllMembersListContext::Private : public GenericNodeListContext { public: Private(const MemberNameInfoSDict *ml) @@ -4939,7 +6031,7 @@ class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoC ) ) { - append(new MemberInfoContext(mi)); + append(MemberInfoContext::alloc(mi)); } } } @@ -4948,12 +6040,12 @@ class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoC } }; -AllMembersListContext::AllMembersListContext() +AllMembersListContext::AllMembersListContext() : RefCountedContext("AllMembersListContext") { p = new Private(0); } -AllMembersListContext::AllMembersListContext(const MemberNameInfoSDict *ml) +AllMembersListContext::AllMembersListContext(const MemberNameInfoSDict *ml) : RefCountedContext("AllMembersListContext") { p = new Private(ml); } @@ -4989,8 +6081,7 @@ class MemberGroupInfoContext::Private : public PropertyMapper Private(Definition *def,const QCString &relPath,const MemberGroup *mg) : m_def(def), m_relPath(relPath), - m_memberListContext(mg->members()), - m_memberGroups(def,relPath,0), m_memberGroup(mg) + m_memberGroup(mg) { addProperty("members", this,&Private::members); addProperty("title", this,&Private::groupTitle); @@ -5002,7 +6093,11 @@ class MemberGroupInfoContext::Private : public PropertyMapper } TemplateVariant members() const { - return &m_memberListContext; + if (!m_cache.memberListContext) + { + m_cache.memberListContext.reset(MemberListContext::alloc(m_memberGroup->members())); + } + return m_cache.memberListContext.get(); } TemplateVariant groupTitle() const { @@ -5018,26 +6113,30 @@ class MemberGroupInfoContext::Private : public PropertyMapper } TemplateVariant memberGroups() const { - return &m_memberGroups; + if (!m_cache.memberGroups) + { + m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_def,m_relPath,0)); + } + return m_cache.memberGroups.get(); } TemplateVariant docs() const { - if (!m_docs) + if (!m_cache.docs) { QCString docs = m_memberGroup->documentation(); if (!docs.isEmpty()) { - m_docs.reset(new TemplateVariant( + m_cache.docs.reset(new TemplateVariant( parseDoc(m_def,"[@name docs]",-1, // TODO store file & line m_relPath, m_memberGroup->documentation()+"\n",FALSE))); } else { - m_docs.reset(new TemplateVariant("")); + m_cache.docs.reset(new TemplateVariant("")); } } - return *m_docs; + return *m_cache.docs; } TemplateVariant inherited() const { @@ -5046,15 +6145,19 @@ class MemberGroupInfoContext::Private : public PropertyMapper private: Definition *m_def; QCString m_relPath; - MemberListContext m_memberListContext; - MemberGroupListContext m_memberGroups; const MemberGroup *m_memberGroup; - mutable ScopedPtr<TemplateVariant> m_docs; + struct Cachable + { + SharedPtr<MemberListContext> memberListContext; + SharedPtr<MemberGroupListContext> memberGroups; + ScopedPtr<TemplateVariant> docs; + }; + mutable Cachable m_cache; }; //%% } MemberGroupInfoContext::MemberGroupInfoContext(Definition *def, - const QCString &relPath,const MemberGroup *mg) + const QCString &relPath,const MemberGroup *mg) : RefCountedContext("MemberGroupInfoContext") { p = new Private(def,relPath,mg); } @@ -5072,21 +6175,21 @@ TemplateVariant MemberGroupInfoContext::get(const char *name) const //------------------------------------------------------------------------ //%% list MemberGroupList[MemberGroupInfo] : list of member groups -class MemberGroupListContext::Private : public GenericNodeListContext<MemberGroupInfoContext> +class MemberGroupListContext::Private : public GenericNodeListContext { public: void addMemberGroup(Definition *def,const QCString &relPath,const MemberGroup *mg) { - append(new MemberGroupInfoContext(def,relPath,mg)); + append(MemberGroupInfoContext::alloc(def,relPath,mg)); } }; -MemberGroupListContext::MemberGroupListContext() +MemberGroupListContext::MemberGroupListContext() : RefCountedContext("MemberGroupListContext") { p = new Private; } -MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list) +MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list) : RefCountedContext("MemberGroupListContext") { p = new Private; if (list) @@ -5100,7 +6203,7 @@ MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &r } } -MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping) +MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping) : RefCountedContext("MemberGroupListContext") { p = new Private; if (dict) @@ -5148,9 +6251,8 @@ class MemberListInfoContext::Private : public PropertyMapper public: Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) : m_def(def), - m_memberListContext(ml), - m_memberGroups(def,relPath,ml ? ml->getMemberGroupList() : 0), m_memberList(ml), + m_relPath(relPath), m_title(title), m_subtitle(subtitle) { @@ -5163,7 +6265,11 @@ class MemberListInfoContext::Private : public PropertyMapper } TemplateVariant members() const { - return &m_memberListContext; + if (!m_cache.memberListContext) + { + m_cache.memberListContext.reset(MemberListContext::alloc(m_memberList)); + } + return m_cache.memberListContext.get(); } TemplateVariant title() const { @@ -5179,20 +6285,24 @@ class MemberListInfoContext::Private : public PropertyMapper } TemplateVariant memberGroups() const { - return &m_memberGroups; + if (!m_cache.memberGroups) + { + m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_def,m_relPath,m_memberList->getMemberGroupList())); + } + return m_cache.memberGroups.get(); } TemplateVariant inherited() const { - if (!m_inherited && (m_memberList->listType()&MemberListType_detailedLists)==0 && + if (!m_cache.inherited && (m_memberList->listType()&MemberListType_detailedLists)==0 && m_def->definitionType()==Definition::TypeClass) { - InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext; + InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); ctx->addMemberList((ClassDef*)m_def,m_memberList->listType(),m_title,FALSE); - m_inherited.reset(ctx); + m_cache.inherited.reset(ctx); } - if (m_inherited) + if (m_cache.inherited) { - return m_inherited.get(); + return m_cache.inherited.get(); } else { @@ -5201,18 +6311,23 @@ class MemberListInfoContext::Private : public PropertyMapper } private: Definition *m_def; - MemberListContext m_memberListContext; - MemberGroupListContext m_memberGroups; const MemberList *m_memberList; + QCString m_relPath; QCString m_title; QCString m_subtitle; - mutable ScopedPtr<InheritedMemberInfoListContext> m_inherited; + struct Cachable + { + SharedPtr<MemberListContext> memberListContext; + SharedPtr<MemberGroupListContext> memberGroups; + SharedPtr<InheritedMemberInfoListContext> inherited; + }; + mutable Cachable m_cache; }; //%% } MemberListInfoContext::MemberListInfoContext( Definition *def,const QCString &relPath,const MemberList *ml, - const QCString &title,const QCString &subtitle) + const QCString &title,const QCString &subtitle) : RefCountedContext("MemberListInfoContext") { p = new Private(def,relPath,ml,title,subtitle); } @@ -5251,7 +6366,7 @@ class InheritedMemberInfoContext::Private : public PropertyMapper { if (!m_classCtx) { - m_classCtx.reset(new ClassContext(m_class)); + m_classCtx.reset(ClassContext::alloc(m_class)); } return m_classCtx.get(); } @@ -5263,7 +6378,7 @@ class InheritedMemberInfoContext::Private : public PropertyMapper { if (!m_memberListCtx) { - m_memberListCtx.reset(new MemberListContext(m_memberList)); + m_memberListCtx.reset(MemberListContext::alloc(m_memberList)); } return m_memberListCtx.get(); } @@ -5274,26 +6389,27 @@ class InheritedMemberInfoContext::Private : public PropertyMapper } TemplateVariant inheritedFrom() const { - if (m_inheritedFrom.count()==0) + if (!m_inheritedFrom) { - m_inheritedFrom.append(title()); - m_inheritedFrom.append(getClass()); + m_inheritedFrom.reset(TemplateList::alloc()); + m_inheritedFrom->append(title()); + m_inheritedFrom->append(getClass()); } - return &m_inheritedFrom; + return m_inheritedFrom.get(); } private: ClassDef * m_class; MemberList *m_memberList; QCString m_title; - mutable ScopedPtr<ClassContext> m_classCtx; - mutable ScopedPtr<MemberListContext> m_memberListCtx; - mutable TemplateList m_inheritedFrom; + mutable SharedPtr<ClassContext> m_classCtx; + mutable SharedPtr<MemberListContext> m_memberListCtx; + mutable SharedPtr<TemplateList> m_inheritedFrom; }; //%% } InheritedMemberInfoContext::InheritedMemberInfoContext(ClassDef *cd,MemberList *ml, - const QCString &title) + const QCString &title) : RefCountedContext("InheritedMemberInfoContext") { p = new Private(cd,ml,title); } @@ -5311,7 +6427,7 @@ TemplateVariant InheritedMemberInfoContext::get(const char *name) const //------------------------------------------------------------------------ //%% list InheritedMemberList[InheritedMemberInfo] : list of inherited classes -class InheritedMemberInfoListContext::Private : public GenericNodeListContext<InheritedMemberInfoContext> +class InheritedMemberInfoListContext::Private : public GenericNodeListContext { public: void addMemberList(ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList) @@ -5385,7 +6501,7 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext<In addMemberListIncludingGrouped(inheritedFrom,ml2,combinedList); addMemberGroupsOfClass(inheritedFrom,cd,lt,combinedList); if (lt2!=-1) addMemberGroupsOfClass(inheritedFrom,cd,(MemberListType)lt2,combinedList); - append(new InheritedMemberInfoContext(cd,combinedList,title)); + append(InheritedMemberInfoContext::alloc(cd,combinedList,title)); } } void findInheritedMembers(ClassDef *inheritedFrom,ClassDef *cd,MemberListType lt, @@ -5424,7 +6540,7 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext<In } }; -InheritedMemberInfoListContext::InheritedMemberInfoListContext() +InheritedMemberInfoListContext::InheritedMemberInfoListContext() : RefCountedContext("InheritedMemberInfoListContext") { p = new Private; } @@ -5433,7 +6549,7 @@ void InheritedMemberInfoListContext::addMemberList( ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList) { QPtrDict<void> visited(17); - bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE); + bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE)>0; bool show = (additionalList && !memberInSection) || // inherited member to show in the additional inherited members list (!additionalList && memberInSection); // inherited member to show in a member list of the class //printf("%s:%s show=%d\n",cd->name().data(),MemberList::listTypeAsString(lt).data(),show); @@ -5542,7 +6658,7 @@ class ArgumentContext::Private : public PropertyMapper }; //%% } -ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath) +ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath) : RefCountedContext("ArgumentContext") { p = new Private(al,def,relPath); } @@ -5560,22 +6676,22 @@ TemplateVariant ArgumentContext::get(const char *name) const //------------------------------------------------------------------------ //%% list ArgumentList[Argument] : list of inherited classes -class ArgumentListContext::Private : public GenericNodeListContext<ArgumentContext> +class ArgumentListContext::Private : public GenericNodeListContext { public: void addArgument(const Argument *arg,Definition *def,const QCString &relPath) { - append(new ArgumentContext(arg,def,relPath)); + append(ArgumentContext::alloc(arg,def,relPath)); } }; -ArgumentListContext::ArgumentListContext() +ArgumentListContext::ArgumentListContext() : RefCountedContext("ArgumentListContext") { p = new Private; } ArgumentListContext::ArgumentListContext(const ArgumentList *list, - Definition *def,const QCString &relPath) + Definition *def,const QCString &relPath) : RefCountedContext("ArgumentListContext") { p = new Private; if (list) @@ -5692,74 +6808,88 @@ class HtmlSpaceless : public TemplateSpacelessIntf //------------------------------------------------------------------------ +#if DEBUG_REF +int RefCountedContext::s_totalCount; +#endif + void generateOutputViaTemplate() { + { TemplateEngine e; TemplateContext *ctx = e.createContext(); if (ctx) { - DoxygenContext doxygen; - ConfigContext config; - TranslateContext tr; - ClassListContext classList; - ClassTreeContext classTree; - ClassHierarchyContext classHierarchy; - NamespaceListContext namespaceList; - NamespaceTreeContext namespaceTree; - FileListContext fileList; - FileTreeContext fileTree; - PageTreeContext pageTree; - PageListContext pageList; - ModuleTreeContext moduleTree; - ExampleListContext exampleList; + SharedPtr<DoxygenContext> doxygen (DoxygenContext::alloc()); + SharedPtr<ConfigContext> config (ConfigContext::alloc()); + SharedPtr<TranslateContext> tr (TranslateContext::alloc()); + SharedPtr<ClassListContext> classList (ClassListContext::alloc()); + SharedPtr<ClassTreeContext> classTree (ClassTreeContext::alloc()); + SharedPtr<ClassHierarchyContext> classHierarchy (ClassHierarchyContext::alloc()); + SharedPtr<NamespaceListContext> namespaceList (NamespaceListContext::alloc()); + SharedPtr<NamespaceTreeContext> namespaceTree (NamespaceTreeContext::alloc()); + SharedPtr<DirListContext> dirList (DirListContext::alloc()); + SharedPtr<FileListContext> fileList (FileListContext::alloc()); + SharedPtr<FileTreeContext> fileTree (FileTreeContext::alloc()); + SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc()); + SharedPtr<PageListContext> pageList (PageListContext::alloc()); + SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc()); + SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc()); //%% Doxygen doxygen: - ctx->set("doxygen",&doxygen); + ctx->set("doxygen",doxygen.get()); //%% Translator tr: - ctx->set("tr",&tr); + ctx->set("tr",tr.get()); //%% Config config: - ctx->set("config",&config); + ctx->set("config",config.get()); //%% ClassList classList: - ctx->set("classList",&classList); // not used for standard HTML + ctx->set("classList",classList.get()); // not used for standard HTML //%% ClassTree classTree: - ctx->set("classTree",&classTree); + ctx->set("classTree",classTree.get()); // classIndex //%% ClassHierarchy classHierarchy: - ctx->set("classHierarchy",&classHierarchy); + ctx->set("classHierarchy",classHierarchy.get()); //%% NamespaceList namespaceList: - ctx->set("namespaceList",&namespaceList); + ctx->set("namespaceList",namespaceList.get()); //%% NamespaceTree namespaceTree: - ctx->set("namespaceTree",&namespaceTree); + ctx->set("namespaceTree",namespaceTree.get()); //%% FileList fileList: - ctx->set("fileList",&fileList); + ctx->set("fileList",fileList.get()); //%% FileTree fileTree: - ctx->set("fileTree",&fileTree); + ctx->set("fileTree",fileTree.get()); //%% PageList pageList - ctx->set("pageList",&pageList); + ctx->set("pageList",pageList.get()); //%% PageTree pageTree - ctx->set("pageTree",&pageTree); + ctx->set("pageTree",pageTree.get()); //%% ModuleTree moduleTree - ctx->set("moduleTree",&moduleTree); + ctx->set("moduleTree",moduleTree.get()); //%% ExampleList exampleList - ctx->set("exampleList",&exampleList); + ctx->set("exampleList",exampleList.get()); + //%% DirList dirList + ctx->set("dirList",dirList.get()); // render HTML output - Template *tpl = e.loadByName("htmllayout.tpl"); + 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"); - HtmlEscaper esc; - ctx->setEscapeIntf(&esc); + 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 } + delete ctx; + } +#if DEBUG_REF + printf("==== total ref count %d\n",RefCountedContext::s_totalCount); +#endif } diff --git a/src/context.h b/src/context.h index f027749..18fa519 100644 --- a/src/context.h +++ b/src/context.h @@ -3,6 +3,8 @@ #include "types.h" #include "template.h" +#include <qlist.h> +#include <stdio.h> class Definition; class ClassDef; @@ -37,147 +39,266 @@ class MemberGroupList; //---------------------------------------------------- -class ConfigContext : public TemplateStructIntf +#define DEBUG_REF 0 + +/** @brief Helper class to support reference counting */ +#if DEBUG_REF +class RefCountedContext { public: - ConfigContext(); - ~ConfigContext(); + RefCountedContext(const char *className) : m_refCount(0) + { + m_className=className; + m_insideRelease = FALSE; + } + virtual ~RefCountedContext() + { + if (!m_insideRelease) abort(); + } + int addRef() + { + ++s_totalCount; + printf("%p:%s::addRef()=%d\n",this,m_className.data(),m_refCount); + return ++m_refCount; + } + int release() + { + --s_totalCount; + printf("%p:%s::release()=%d\n",this,m_className.data(),m_refCount-1); + int count = --m_refCount; + if (count<=0) + { + m_insideRelease=TRUE; + delete this; + } + return count; + } + private: + int m_refCount; + QCString m_className; + bool m_insideRelease; + public: + static int s_totalCount; +}; + +#else // release version + +class RefCountedContext +{ + public: + RefCountedContext(const char *) : m_refCount(0) {} + virtual ~RefCountedContext() {} + int addRef() { return ++m_refCount; } + int release() + { + int count = --m_refCount; + if (count<=0) + { + delete this; + } + return count; + } + private: + int m_refCount; +}; +#endif + + +//---------------------------------------------------- + +class ConfigContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static ConfigContext *alloc() { return new ConfigContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ConfigContext(); + ~ConfigContext(); class Private; Private *p; }; //---------------------------------------------------- -class DoxygenContext : public TemplateStructIntf +class DoxygenContext : public RefCountedContext, public TemplateStructIntf { public: - DoxygenContext(); - ~DoxygenContext(); + static DoxygenContext *alloc() { return new DoxygenContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + DoxygenContext(); + ~DoxygenContext(); class Private; Private *p; }; //---------------------------------------------------- -class TranslateContext : public TemplateStructIntf +class TranslateContext : public RefCountedContext, public TemplateStructIntf { public: - TranslateContext(); - ~TranslateContext(); + static TranslateContext *alloc() { return new TranslateContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + TranslateContext(); + ~TranslateContext(); class Private; Private *p; }; //---------------------------------------------------- -class UsedFilesContext : public TemplateListIntf +class UsedFilesContext : public RefCountedContext, public TemplateListIntf { public: - UsedFilesContext(ClassDef *cd); - ~UsedFilesContext(); + static UsedFilesContext *alloc(ClassDef *cd) { return new UsedFilesContext(cd); } // 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(); } void addFile(FileDef *fd); private: + UsedFilesContext(ClassDef *cd); + ~UsedFilesContext(); + class Private; Private *p; }; //---------------------------------------------------- -class IncludeInfoContext : public TemplateStructIntf +class IncludeInfoContext : public RefCountedContext, public TemplateStructIntf { public: - IncludeInfoContext(IncludeInfo *,SrcLangExt lang); - ~IncludeInfoContext(); + static IncludeInfoContext *alloc(const IncludeInfo *info,SrcLangExt lang) + { return new IncludeInfoContext(info,lang); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + IncludeInfoContext(const IncludeInfo *,SrcLangExt lang); + ~IncludeInfoContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassContext : public TemplateStructIntf +class IncludeInfoListContext : public RefCountedContext, public TemplateListIntf { public: - ClassContext(ClassDef *); - ~ClassContext(); + static IncludeInfoListContext *alloc(const QList<IncludeInfo> &list,SrcLangExt lang) + { return new IncludeInfoListContext(list,lang); } + + // 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: + IncludeInfoListContext(const QList<IncludeInfo> &list,SrcLangExt lang); + ~IncludeInfoListContext(); + class Private; + Private *p; +}; + + +//---------------------------------------------------- + +class ClassContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static ClassContext *alloc(ClassDef *cd) { return new ClassContext(cd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ClassContext(ClassDef *); + ~ClassContext(); class Private; Private *p; }; //---------------------------------------------------- -class NamespaceContext : public TemplateStructIntf +class NamespaceContext : public RefCountedContext, public TemplateStructIntf { public: - NamespaceContext(NamespaceDef *); - ~NamespaceContext(); + static NamespaceContext *alloc(NamespaceDef *nd) { return new NamespaceContext(nd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + NamespaceContext(NamespaceDef *); + ~NamespaceContext(); class Private; Private *p; }; //---------------------------------------------------- -class FileContext : public TemplateStructIntf +class FileContext : public RefCountedContext, public TemplateStructIntf { public: - FileContext(FileDef *); - ~FileContext(); + static FileContext *alloc(FileDef *fd) { return new FileContext(fd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + FileContext(FileDef *); + ~FileContext(); class Private; Private *p; }; //---------------------------------------------------- -class DirContext : public TemplateStructIntf +class DirContext : public RefCountedContext, public TemplateStructIntf { public: - DirContext(DirDef *); - ~DirContext(); + static DirContext *alloc(DirDef *dd) { return new DirContext(dd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + DirContext(DirDef *); + ~DirContext(); class Private; Private *p; }; @@ -185,32 +306,38 @@ class DirContext : public TemplateStructIntf //---------------------------------------------------- -class PageContext : public TemplateStructIntf +class PageContext : public RefCountedContext, public TemplateStructIntf { public: - PageContext(PageDef *); - ~PageContext(); + static PageContext *alloc(PageDef *pd) { return new PageContext(pd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + PageContext(PageDef *); + ~PageContext(); class Private; Private *p; }; //---------------------------------------------------- -class MemberContext : public TemplateStructIntf +class MemberContext : public RefCountedContext, public TemplateStructIntf { public: - MemberContext(MemberDef *); - ~MemberContext(); + static MemberContext *alloc(MemberDef *md) { return new MemberContext(md); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + MemberContext(MemberDef *); + ~MemberContext(); class Private; Private *p; }; @@ -218,414 +345,501 @@ class MemberContext : public TemplateStructIntf //---------------------------------------------------- -class ModuleContext : public TemplateStructIntf +class ModuleContext : public RefCountedContext, public TemplateStructIntf { public: - ModuleContext(GroupDef *); - ~ModuleContext(); + static ModuleContext *alloc(GroupDef *gd) { return new ModuleContext(gd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ModuleContext(GroupDef *); + ~ModuleContext(); class Private; Private *p; }; //---------------------------------------------------- -class NestedClassListContext : public TemplateListIntf +class NestedClassListContext : public RefCountedContext, public TemplateListIntf { public: + static NestedClassListContext *alloc() { return new NestedClassListContext; } + + // 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(); } + + void append(ClassDef *cd); + + private: NestedClassListContext(); ~NestedClassListContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class NestedNamespaceListContext : public RefCountedContext, public TemplateListIntf +{ + public: + static NestedNamespaceListContext *alloc() { return new NestedNamespaceListContext; } // 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(); } - void append(ClassDef *cd); + void append(NamespaceDef *cd); private: + NestedNamespaceListContext(); + ~NestedNamespaceListContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassListContext : public TemplateListIntf +class ClassListContext : public RefCountedContext, public TemplateListIntf { public: - ClassListContext(); - ~ClassListContext(); + static ClassListContext *alloc() { return new ClassListContext; } // 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: + ClassListContext(); + ~ClassListContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassInheritanceNodeContext : public TemplateStructIntf +class ClassInheritanceNodeContext : public RefCountedContext, public TemplateStructIntf { public: - ClassInheritanceNodeContext(ClassDef *); - ~ClassInheritanceNodeContext(); + static ClassInheritanceNodeContext *alloc(ClassDef *cd) + { return new ClassInheritanceNodeContext(cd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } void addChildren(const BaseClassList *bcl,bool hideSuper); + private: + ClassInheritanceNodeContext(ClassDef *); + ~ClassInheritanceNodeContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassInheritanceContext : public TemplateListIntf +class ClassInheritanceContext : public RefCountedContext, public TemplateListIntf { public: - ClassInheritanceContext(); - ~ClassInheritanceContext(); + static ClassInheritanceContext *alloc() { return new ClassInheritanceContext; } // 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: + ClassInheritanceContext(); + ~ClassInheritanceContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassHierarchyContext : public TemplateStructIntf +class ClassHierarchyContext : public RefCountedContext, public TemplateStructIntf { public: - ClassHierarchyContext(); - ~ClassHierarchyContext(); + static ClassHierarchyContext *alloc() { return new ClassHierarchyContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ClassHierarchyContext(); + ~ClassHierarchyContext(); class Private; Private *p; }; //---------------------------------------------------- -class NestingNodeContext : public TemplateStructIntf +class NestingNodeContext : public RefCountedContext, public TemplateStructIntf { public: - NestingNodeContext(Definition *,bool addClasses); - ~NestingNodeContext(); + static NestingNodeContext *alloc(const NestingNodeContext *parent,Definition *def, + int index,int level,bool addClasses) + { return new NestingNodeContext(parent,def,index,level,addClasses); } + + QCString id() const; // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + NestingNodeContext(const NestingNodeContext *parent, + Definition *,int index,int level,bool addClasses); + ~NestingNodeContext(); class Private; Private *p; }; //---------------------------------------------------- -class NestingContext : public TemplateListIntf +class NestingContext : public RefCountedContext, public TemplateListIntf { public: - NestingContext(); - ~NestingContext(); + static NestingContext *alloc(const NestingNodeContext *parent,int level) + { return new NestingContext(parent,level); } // 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(); } void addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses); void addClasses(const ClassSDict &clDict,bool rootOnly); + void addDirs(const DirSDict &); + void addDirs(const DirList &); + void addFiles(const FileNameList &); + void addFiles(const FileList &); + private: + NestingContext(const NestingNodeContext *parent,int level); + ~NestingContext(); class Private; Private *p; }; //---------------------------------------------------- -class ClassTreeContext : public TemplateStructIntf +class ClassTreeContext : public RefCountedContext, public TemplateStructIntf { public: - ClassTreeContext(); - ~ClassTreeContext(); + static ClassTreeContext *alloc() { return new ClassTreeContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ClassTreeContext(); + ~ClassTreeContext(); class Private; Private *p; }; //---------------------------------------------------- -class NamespaceListContext : public TemplateListIntf +class NamespaceListContext : public RefCountedContext, public TemplateListIntf { public: - NamespaceListContext(); - ~NamespaceListContext(); + static NamespaceListContext *alloc() { return new NamespaceListContext; } // 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: + NamespaceListContext(); + ~NamespaceListContext(); class Private; Private *p; }; //---------------------------------------------------- -class NamespaceTreeContext : public TemplateStructIntf -{ - public: - NamespaceTreeContext(); - ~NamespaceTreeContext(); - - // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; - - private: - class Private; - Private *p; -}; - -//---------------------------------------------------- - -class DirFileNodeContext : public TemplateStructIntf +class NamespaceTreeContext : public RefCountedContext, public TemplateStructIntf { public: - DirFileNodeContext(Definition *); - ~DirFileNodeContext(); + static NamespaceTreeContext *alloc() { return new NamespaceTreeContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + NamespaceTreeContext(); + ~NamespaceTreeContext(); class Private; Private *p; }; //---------------------------------------------------- -class DirFileContext : public TemplateListIntf +class DirListContext : public RefCountedContext, public TemplateListIntf { public: - DirFileContext(); - ~DirFileContext(); + static DirListContext *alloc() { return new DirListContext; } // 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(); } - void addDirs(const DirSDict &); - void addDirs(const DirList &); - void addFiles(const FileNameList &); - void addFiles(const FileList &); private: + DirListContext(); + ~DirListContext(); class Private; Private *p; }; //---------------------------------------------------- -class FileListContext : public TemplateListIntf +class FileListContext : public RefCountedContext, public TemplateListIntf { public: - FileListContext(); - ~FileListContext(); + static FileListContext *alloc() { return new FileListContext; } // 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: + FileListContext(); + ~FileListContext(); class Private; Private *p; }; //---------------------------------------------------- -class FileTreeContext : public TemplateStructIntf +class FileTreeContext : public RefCountedContext, public TemplateStructIntf { public: - FileTreeContext(); - ~FileTreeContext(); + static FileTreeContext *alloc() { return new FileTreeContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + FileTreeContext(); + ~FileTreeContext(); class Private; Private *p; }; //---------------------------------------------------- -class PageNodeContext : public TemplateStructIntf +class PageNodeContext : public RefCountedContext, public TemplateStructIntf { public: - PageNodeContext(PageDef *); - ~PageNodeContext(); + static PageNodeContext *alloc(PageDef *pd) { return new PageNodeContext(pd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + PageNodeContext(PageDef *); + ~PageNodeContext(); class Private; Private *p; }; //---------------------------------------------------- -class PageNodeListContext : public TemplateListIntf +class PageNodeListContext : public RefCountedContext, public TemplateListIntf { public: - PageNodeListContext(); - ~PageNodeListContext(); + static PageNodeListContext *alloc() { return new PageNodeListContext; } // 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(); } void addPages(const PageSDict &,bool rootOnly); + private: + PageNodeListContext(); + ~PageNodeListContext(); class Private; Private *p; }; //---------------------------------------------------- -class PageListContext : public TemplateStructIntf +class PageListContext : public RefCountedContext, public TemplateStructIntf { public: - PageListContext(); - ~PageListContext(); + static PageListContext *alloc() { return new PageListContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + PageListContext(); + ~PageListContext(); class Private; Private *p; }; //---------------------------------------------------- -class PageTreeContext : public TemplateStructIntf +class PageTreeContext : public RefCountedContext, public TemplateStructIntf { public: - PageTreeContext(); - ~PageTreeContext(); + static PageTreeContext *alloc() { return new PageTreeContext; } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + PageTreeContext(); + ~PageTreeContext(); class Private; Private *p; }; //---------------------------------------------------- -class ModuleNodeContext : public TemplateStructIntf +class ModuleNodeContext : public RefCountedContext, public TemplateStructIntf { public: - ModuleNodeContext(GroupDef *); - ~ModuleNodeContext(); + static ModuleNodeContext *alloc(GroupDef *gd) { return new ModuleNodeContext(gd); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ModuleNodeContext(GroupDef *); + ~ModuleNodeContext(); class Private; Private *p; }; //---------------------------------------------------- -class ModuleListContext : public TemplateListIntf +class ModuleListContext : public RefCountedContext, public TemplateListIntf { public: - ModuleListContext(); - ~ModuleListContext(); + static ModuleListContext *alloc() { return new ModuleListContext(); } // 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(); } void addModules(const GroupSDict &); void addModules(const GroupList &); + private: + ModuleListContext(); + ~ModuleListContext(); class Private; Private *p; }; //---------------------------------------------------- -class ModuleTreeContext : public TemplateStructIntf +class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf { public: - ModuleTreeContext(); - ~ModuleTreeContext(); + static ModuleTreeContext *alloc() { return new ModuleTreeContext(); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ModuleTreeContext(); + ~ModuleTreeContext(); class Private; Private *p; }; //---------------------------------------------------- -class ExampleListContext : public TemplateStructIntf +class ExampleListContext : public RefCountedContext, public TemplateStructIntf { public: - ExampleListContext(); - ~ExampleListContext(); + static ExampleListContext *alloc() { return new ExampleListContext(); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ExampleListContext(); + ~ExampleListContext(); class Private; Private *p; }; //---------------------------------------------------- -class NavPathElemContext : public TemplateStructIntf +class NavPathElemContext : public RefCountedContext, public TemplateStructIntf { public: - NavPathElemContext(Definition *def); - ~NavPathElemContext(); + static NavPathElemContext *alloc(Definition *def) { return new NavPathElemContext(def); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + NavPathElemContext(Definition *def); + ~NavPathElemContext(); class Private; Private *p; }; @@ -633,90 +847,118 @@ class NavPathElemContext : public TemplateStructIntf //---------------------------------------------------- -class InheritanceNodeContext : public TemplateStructIntf +class InheritanceNodeContext : public RefCountedContext, public TemplateStructIntf { public: - InheritanceNodeContext(ClassDef *cd,const QCString &name); - ~InheritanceNodeContext(); + static InheritanceNodeContext *alloc(ClassDef *cd,const QCString &name) + { return new InheritanceNodeContext(cd,name); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + InheritanceNodeContext(ClassDef *cd,const QCString &name); + ~InheritanceNodeContext(); class Private; Private *p; }; //---------------------------------------------------- -class InheritanceListContext : public TemplateListIntf +class InheritanceListContext : public RefCountedContext, public TemplateListIntf { public: - InheritanceListContext(const BaseClassList *list,bool baseClasses); - ~InheritanceListContext(); + static InheritanceListContext *alloc(const BaseClassList *list,bool baseClasses) + { return new InheritanceListContext(list,baseClasses); } // 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: + InheritanceListContext(const BaseClassList *list,bool baseClasses); + ~InheritanceListContext(); class Private; Private *p; }; //---------------------------------------------------- -class MemberListContext : public TemplateListIntf +class MemberListContext : public RefCountedContext, public TemplateListIntf { public: - MemberListContext(); - MemberListContext(const MemberList *ml); - MemberListContext(MemberSDict *ml,bool doSort); - ~MemberListContext(); + static MemberListContext *alloc() + { return new MemberListContext; } + static MemberListContext *alloc(const MemberList *ml) + { return new MemberListContext(ml); } + static MemberListContext *alloc(MemberSDict *ml,bool doSort) + { return new MemberListContext(ml,doSort); } // 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: + MemberListContext(); + MemberListContext(const MemberList *ml); + MemberListContext(MemberSDict *ml,bool doSort); + ~MemberListContext(); class Private; Private *p; }; //---------------------------------------------------- -class MemberGroupInfoContext : public TemplateStructIntf +class MemberGroupInfoContext : public RefCountedContext, public TemplateStructIntf { public: - MemberGroupInfoContext(Definition *def,const QCString &relPath,const MemberGroup *mg); - ~MemberGroupInfoContext(); + static MemberGroupInfoContext *alloc(Definition *def,const QCString &relPath,const MemberGroup *mg) + { return new MemberGroupInfoContext(def,relPath,mg); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + MemberGroupInfoContext(Definition *def,const QCString &relPath,const MemberGroup *mg); + ~MemberGroupInfoContext(); class Private; Private *p; }; //---------------------------------------------------- -class MemberGroupListContext : public TemplateListIntf +class MemberGroupListContext : public RefCountedContext, public TemplateListIntf { public: - MemberGroupListContext(); - MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list); - MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *mgDict,bool subGrouping); - ~MemberGroupListContext(); + static MemberGroupListContext *alloc() + { return new MemberGroupListContext; } + static MemberGroupListContext *alloc(Definition *def,const QCString &relPath,const MemberGroupList *list) + { return new MemberGroupListContext(def,relPath,list); } + static MemberGroupListContext *alloc(Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping) + { return new MemberGroupListContext(def,relPath,dict,subGrouping); } // 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: + MemberGroupListContext(); + MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list); + MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *mgDict,bool subGrouping); + ~MemberGroupListContext(); class Private; Private *p; }; @@ -724,123 +966,154 @@ class MemberGroupListContext : public TemplateListIntf //---------------------------------------------------- -class MemberListInfoContext : public TemplateStructIntf +class MemberListInfoContext : public RefCountedContext, public TemplateStructIntf { public: - MemberListInfoContext(Definition *def,const QCString &relPath, + static MemberListInfoContext *alloc(Definition *def,const QCString &relPath, const MemberList *ml,const QCString &title, - const QCString &subtitle=QCString()); - ~MemberListInfoContext(); + const QCString &subtitle=QCString()) + { return new MemberListInfoContext(def,relPath,ml,title,subtitle); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + MemberListInfoContext(Definition *def,const QCString &relPath, + const MemberList *ml,const QCString &title, + const QCString &subtitle=QCString()); + ~MemberListInfoContext(); class Private; Private *p; }; //---------------------------------------------------- -class MemberInfoContext : public TemplateStructIntf +class MemberInfoContext : public RefCountedContext, public TemplateStructIntf { public: - MemberInfoContext(const MemberInfo *mi); - ~MemberInfoContext(); + static MemberInfoContext *alloc(const MemberInfo *mi) { return new MemberInfoContext(mi); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + MemberInfoContext(const MemberInfo *mi); + ~MemberInfoContext(); class Private; Private *p; }; //---------------------------------------------------- -class InheritedMemberInfoContext : public TemplateStructIntf +class InheritedMemberInfoContext : public RefCountedContext, public TemplateStructIntf { public: - InheritedMemberInfoContext(ClassDef *cd,MemberList *ml,const QCString &title); - ~InheritedMemberInfoContext(); + static InheritedMemberInfoContext *alloc(ClassDef *cd,MemberList *ml,const QCString &title) + { return new InheritedMemberInfoContext(cd,ml,title); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + InheritedMemberInfoContext(ClassDef *cd,MemberList *ml,const QCString &title); + ~InheritedMemberInfoContext(); class Private; Private *p; }; //---------------------------------------------------- -class InheritedMemberInfoListContext : public TemplateListIntf +class InheritedMemberInfoListContext : public RefCountedContext, public TemplateListIntf { public: - InheritedMemberInfoListContext(); + static InheritedMemberInfoListContext *alloc() { return new InheritedMemberInfoListContext; } void addMemberList(ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList=TRUE); - ~InheritedMemberInfoListContext(); // 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: + InheritedMemberInfoListContext(); + ~InheritedMemberInfoListContext(); class Private; Private *p; }; //---------------------------------------------------- -class AllMembersListContext : public TemplateListIntf +class AllMembersListContext : public RefCountedContext, public TemplateListIntf { public: - AllMembersListContext(); - AllMembersListContext(const MemberNameInfoSDict *ml); - ~AllMembersListContext(); + static AllMembersListContext *alloc() + { return new AllMembersListContext; } + static AllMembersListContext *alloc(const MemberNameInfoSDict *ml) + { return new AllMembersListContext(ml); } // 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: + AllMembersListContext(); + AllMembersListContext(const MemberNameInfoSDict *ml); + ~AllMembersListContext(); class Private; Private *p; }; //---------------------------------------------------- -class ArgumentContext : public TemplateStructIntf +class ArgumentContext : public RefCountedContext, public TemplateStructIntf { public: - ArgumentContext(const Argument *arg,Definition *def,const QCString &relPath); - ~ArgumentContext(); + static ArgumentContext *alloc(const Argument *arg,Definition *def,const QCString &relPath) + { return new ArgumentContext(arg,def,relPath); } // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } private: + ArgumentContext(const Argument *arg,Definition *def,const QCString &relPath); + ~ArgumentContext(); class Private; Private *p; }; //---------------------------------------------------- -class ArgumentListContext : public TemplateListIntf +class ArgumentListContext : public RefCountedContext, public TemplateListIntf { public: - ArgumentListContext(); - ArgumentListContext(const ArgumentList *al,Definition *def,const QCString &relPath); - ~ArgumentListContext(); + static ArgumentListContext *alloc() { return new ArgumentListContext; } + static ArgumentListContext *alloc(const ArgumentList *al,Definition *def,const QCString &relPath) + { return new ArgumentListContext(al,def,relPath); } // 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: + ArgumentListContext(); + ArgumentListContext(const ArgumentList *al,Definition *def,const QCString &relPath); + ~ArgumentListContext(); class Private; Private *p; }; diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp index 7efb4f8..a99ec56 100644 --- a/src/cppvalue.cpp +++ b/src/cppvalue.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/cppvalue.h b/src/cppvalue.h index 3f3ac3a..67c5433 100644 --- a/src/cppvalue.h +++ b/src/cppvalue.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/dbusxmlscanner.cpp b/src/dbusxmlscanner.cpp index 8b8df0d..e841428 100644 --- a/src/dbusxmlscanner.cpp +++ b/src/dbusxmlscanner.cpp @@ -252,7 +252,7 @@ public: COND_DOC_ERROR(idx < 0, QString("Anonymous namespace found.")); m_namespaceStack.append(openNamespace(attributes.value(idx))); - openScopes(m_namespaceStack.last()); + openScopes(m_namespaceStack.getLast()); } if (EXTENSION("struct")) @@ -291,7 +291,7 @@ public: m_currentEntry->type = getType(attributes).utf8(); QString type(getDBusType(m_currentEntry->type)); - m_structStack.last()->type.append(type.utf8()); + m_structStack.getLast()->type.append(type.utf8()); } if (EXTENSION("enum") || EXTENSION("flagset")) @@ -348,9 +348,9 @@ public: // Clean up elements stack: // Since we made sure to get the elements in the proper order when // adding we do not need to do so again here. - COND_DOC_ERROR(m_elementStack.last()->element != qName.utf8(), + COND_DOC_ERROR(m_elementStack.getLast()->element != qName.utf8(), QString("Malformed XML: Unexpected closing element found."). - arg(m_elementStack.last()->element).utf8()); + arg(m_elementStack.getLast()->element).utf8()); m_elementStack.removeLast(); // Interface: @@ -389,7 +389,7 @@ public: if (EXTENSION("namespace")) { - Entry * current = m_namespaceStack.last(); + Entry * current = m_namespaceStack.getLast(); CONDITION(!current, "end of namespace without start."); m_namespaceStack.removeLast(); @@ -399,7 +399,7 @@ public: if (EXTENSION("struct")) { - StructData * data = m_structStack.last(); + StructData * data = m_structStack.getLast(); CONDITION(!data, "end of struct without start."); data->entry->endBodyLine = lineNumber(); @@ -418,7 +418,7 @@ public: if (EXTENSION("member")) { - StructData * data = m_structStack.last(); + StructData * data = m_structStack.getLast(); CONDITION(!data, "end of member outside struct."); data->entry->addSubEntry(m_currentEntry); } @@ -625,7 +625,7 @@ private: QCString scoped_name; if (!m_scopeStack.isEmpty()) { - scoped_name = m_scopeStack.last()->scope->name; + scoped_name = m_scopeStack.getLast()->scope->name; scoped_name.append("::"); } if (!type.isEmpty()) @@ -686,7 +686,7 @@ private: Entry * current_namespace = openNamespace(scope); if (!m_scopeStack.isEmpty()) - { m_scopeStack.last()->scope->addSubEntry(current_namespace); } + { m_scopeStack.getLast()->scope->addSubEntry(current_namespace); } m_scopeStack.append(new ScopeData(current_namespace, m_scopeCount)); } @@ -699,7 +699,7 @@ private: object->name = scoped_name; if (!m_scopeStack.isEmpty()) - { m_scopeStack.last()->scope->addSubEntry(object); } + { m_scopeStack.getLast()->scope->addSubEntry(object); } m_scopeStack.append(new ScopeData(object, m_scopeCount)); ++m_scopeCount; @@ -721,13 +721,13 @@ private: void closeScopes() { - const int current_scope_count(m_scopeStack.last()->count); + const int current_scope_count(m_scopeStack.getLast()->count); // Do not close the root scope. if (current_scope_count == 0) { return; } - while (current_scope_count == m_scopeStack.last()->count) + while (current_scope_count == m_scopeStack.getLast()->count) { m_scopeStack.removeLast(); } } diff --git a/src/debug.cpp b/src/debug.cpp index a5000ff..e27ce11 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/debug.h b/src/debug.h index e1affab..e17c03c 100644 --- a/src/debug.h +++ b/src/debug.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/declinfo.h b/src/declinfo.h index 3d8cb87..5f11a1c 100644 --- a/src/declinfo.h +++ b/src/declinfo.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/declinfo.l b/src/declinfo.l index 58ecb05..f238be3 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/defargs.h b/src/defargs.h index 1dbabdb..6ebfe1d 100644 --- a/src/defargs.h +++ b/src/defargs.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/defargs.l b/src/defargs.l index 5f64b66..164c100 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/defgen.cpp b/src/defgen.cpp index 4e0e5b8..358cd24 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/defgen.h b/src/defgen.h index 290a415..696fb5c 100644 --- a/src/defgen.h +++ b/src/defgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/define.cpp b/src/define.cpp index 76a64e1..75459c9 100644 --- a/src/define.cpp +++ b/src/define.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/define.h b/src/define.h index 843ecec..7971cc4 100644 --- a/src/define.h +++ b/src/define.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -54,9 +54,10 @@ class DefineList : public QList<Define> public: DefineList() : QList<Define>() {} ~DefineList() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const Define *d1,const Define *d2) const { - return qstricmp(((Define *)i1)->name,((Define *)i2)->name); + return qstricmp(d1->name,d2->name); } }; @@ -67,12 +68,12 @@ class DefineName : public QList<Define> DefineName(const char *n) : QList<Define>() { name=n; } ~DefineName() {} const char *nameString() const { return name; } - int compareItems(QCollection::Item i1,QCollection::Item i2) + + private: + int compareValues(const Define *d1,const Define *d2) const { - return qstricmp(((Define *)i1)->name,((Define *)i2)->name); + return qstricmp(d1->name,d2->name); } - - private: QCString name; }; @@ -82,10 +83,10 @@ class DefineNameList : public QList<DefineName> public: DefineNameList() : QList<DefineName>() {} ~DefineNameList() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const DefineName *n1,const DefineName *n2) const { - return qstricmp(((DefineName *)i1)->nameString(), - ((DefineName *)i2)->nameString()); + return qstricmp(n1->nameString(),n2->nameString()); } }; diff --git a/src/definition.cpp b/src/definition.cpp index 46147fc..c4b9f77 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -417,8 +417,9 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) { if (!anchorList) return; //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); - SectionInfo *si=anchorList->first(); - while (si) + QListIterator<SectionInfo> it(*anchorList); + SectionInfo *si; + for (;(si=it.current());++it) { //printf("Add section `%s' to definition `%s'\n", // si->label.data(),name().data()); @@ -429,7 +430,7 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) gsi = new SectionInfo(*si); Doxygen::sectionDict->append(si->label,gsi); } - if (m_impl->sectionDict==0) + if (m_impl->sectionDict==0) { m_impl->sectionDict = new SectionDict(17); } @@ -438,7 +439,6 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) m_impl->sectionDict->append(gsi->label,gsi); gsi->definition = this; } - si=anchorList->next(); } } diff --git a/src/definition.h b/src/definition.h index f444cc5..dfd9dad 100644 --- a/src/definition.h +++ b/src/definition.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -371,11 +371,9 @@ class DefinitionList : public QList<Definition>, public DefinitionIntf public: ~DefinitionList() {} DefType definitionType() const { return TypeSymbolList; } - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const Definition *item1,const Definition *item2) const { - return qstricmp(((Definition *)item1)->name(), - ((Definition *)item2)->name() - ); + return qstricmp(item1->name(),item2->name()); } }; diff --git a/src/dia.cpp b/src/dia.cpp index 1032564..955171c 100644 --- a/src/dia.cpp +++ b/src/dia.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/diagram.cpp b/src/diagram.cpp index 80d0646..e50baec 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -209,18 +209,17 @@ static uint virtToMask(Specifier p) // pre: dil is not empty static Protection getMinProtectionLevel(DiagramItemList *dil) { - DiagramItem *di=dil->first(); + QListIterator<DiagramItem> it(*dil); + DiagramItem *di=it.current(); Protection result=di->protection(); - di=dil->next(); - while (di) + for (++it;(di=it.current());++it) { Protection p=di->protection(); - if (p!=result) + if (p!=result) { if (result==Protected && p==Public) result=p; else if (result==Private) result=p; - } - di=dil->next(); + } } return result; } @@ -371,12 +370,12 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, if (bcl) { /* there are base/sub classes */ - BaseClassDef *bcd=bcl->first(); - while (bcd) + BaseClassListIterator it(*bcl); + BaseClassDef *bcd; + for (;(bcd=it.current());++it) { ClassDef *ccd=bcd->classDef; if (ccd && ccd->isVisibleInHierarchy() /*&& !ccd->visited*/) count++; - bcd=bcl->next(); } } if (count>0 && (prot!=Private || !doBases)) @@ -392,8 +391,9 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, row=diagram->at(level+1); } /* insert base classes in the next row */ - BaseClassDef *bcd=bcl->first(); - while (bcd) + BaseClassListIterator it(*bcl); + BaseClassDef *bcd; + for (;(bcd=it.current());++it) { ClassDef *ccd=bcd->classDef; if (ccd && ccd->isVisibleInHierarchy() /*&& !ccd->visited*/) @@ -402,7 +402,6 @@ void DiagramRow::insertClass(DiagramItem *parent,ClassDef *cd,bool doBases, doBases?bcd->virt:Normal, doBases?bcd->templSpecifiers.data():""); } - bcd=bcl->next(); } } } @@ -423,12 +422,12 @@ TreeDiagram::~TreeDiagram() void TreeDiagram::moveChildren(DiagramItem *root,int dx) { DiagramItemList *dil=root->getChildren(); - DiagramItem *di=dil->first(); - while (di) + QListIterator<DiagramItem> it(*dil); + DiagramItem *di; + for (;(di=it.current());++it) { di->move(dx,0); moveChildren(di,dx); - di=dil->next(); } } @@ -463,11 +462,11 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) } // recurse to children - DiagramItem *di=dil->first(); - while (di && !moved && !di->isInList()) + QListIterator<DiagramItem> it(*dil); + DiagramItem *di; + for (;(di=it.current()) && !moved && !di->isInList();++it) { moved = layoutTree(di,r+1); - di=dil->next(); } } return moved; @@ -475,47 +474,49 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) void TreeDiagram::computeLayout() { - DiagramRow *row=first(); - while (row && row->count()<maxTreeWidth) row=next(); + QListIterator<DiagramRow> it(*this); + DiagramRow *row; + for (;(row=it.current()) && row->count()<maxTreeWidth;++it) {} if (row) { //printf("computeLayout() list row at %d\n",row->number()); - DiagramItem *di=row->first(); + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; DiagramItem *opi=0; int delta=0; bool first=TRUE; - while (di) + for (;(di=rit.current());++rit) { DiagramItem *pi=di->parentItem(); if (pi==opi && !first) { delta-=gridWidth; } first = pi!=opi; opi=pi; - di->move(delta,0); // collapse all items in the same + di->move(delta,0); // collapse all items in the same // list (except the first) di->putInList(); - di=row->next(); } } // re-organize the diagram items DiagramItem *root=getFirst()->getFirst(); while (layoutTree(root,0)) { } - + // move first items of the lists if (row) { - DiagramItem *di=row->first(); - while (di) + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; + while ((di=rit.current())) { DiagramItem *pi=di->parentItem(); if (pi->getChildren()->count()>1) { di->move(gridWidth,0); - while (di && di->parentItem()==pi) di=row->next(); + while (di && di->parentItem()==pi) { ++rit; di=rit.current(); } } else { - di=row->next(); + ++rit; } } } @@ -525,24 +526,25 @@ uint TreeDiagram::computeRows() { //printf("TreeDiagram::computeRows()=%d\n",count()); int count=0; - DiagramRow *row=first(); - while (row && !row->getFirst()->isInList()) + QListIterator<DiagramRow> it(*this); + DiagramRow *row; + for (;(row=it.current()) && !row->getFirst()->isInList();++it) { count++; - row=next(); } //printf("count=%d row=%p\n",count,row); if (row) { int maxListLen=0; int curListLen=0; - DiagramItem *di=row->first(),*opi=0; - while (di) + DiagramItem *opi=0; + QListIterator<DiagramItem> rit(*row); + DiagramItem *di; + for (;(di=rit.current());++rit) { if (di->parentItem()!=opi) curListLen=1; else curListLen++; if (curListLen>maxListLen) maxListLen=curListLen; opi=di->parentItem(); - di=row->next(); } //printf("maxListLen=%d\n",maxListLen); count+=maxListLen; @@ -550,43 +552,22 @@ uint TreeDiagram::computeRows() return count; } -#if 0 -uint TreeDiagram::computeCols() -{ - uint count=0; - DiagramRow *row=first(); - while (row && !row->getFirst()->isInList()) - { - if (row->count()>count) count=row->count(); - row=next(); - } - if (row) - { - row=prev(); - uint cols=row->count(); - if (row->getLast()->getChildren()->count()>1) cols++; - if (cols>count) count=cols; - } - return count; -}; -#endif - void TreeDiagram::computeExtremes(uint *maxLabelLen,uint *maxXPos) { uint ml=0,mx=0; - DiagramRow *dr=first(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; bool done=FALSE; - while (dr && !done) + for (;(dr=it.current()) && !done;++it) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { if (di->isInList()) done=TRUE; if (maxXPos) mx=QMAX(mx,(uint)di->xPos()); if (maxLabelLen) ml=QMAX(ml,Image::stringLength(di->label())); - di=dr->next(); } - dr=next(); } if (maxLabelLen) *maxLabelLen=ml; if (maxXPos) *maxXPos=mx; @@ -599,20 +580,22 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, QCString relPath, bool generateMap) { - DiagramRow *dr=first(); - if (!doBase) dr=next(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; + if (!doBase) ++it; bool done=FALSE; bool firstRow = doBase; - while (dr && !done) + for (;(dr=it.current()) && !done;++it) { int x=0,y=0; float xf=0.0f,yf=0.0f; - DiagramItem *di=dr->first(); + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di = rit.current(); if (di->isInList()) // put boxes in a list { DiagramItem *opi=0; - if (doBase) di=dr->last(); - while (di) + if (doBase) rit.toLast(); else rit.toFirst(); + while ((di=rit.current())) { if (di->parentItem()==opi) { @@ -673,13 +656,13 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, writeVectorBox(t,di,xf,yf,di->getChildren()->count()>0); } - if (doBase) di=dr->prev(); else di=dr->next(); + if (doBase) --rit; else ++rit; } done=TRUE; } else // draw a tree of boxes { - while (di) + for (rit.toFirst();(di=rit.current());++rit) { if (bitmap) { @@ -714,11 +697,8 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, } writeVectorBox(t,di,xf,yf); } - - di=dr->next(); } } - dr=next(); firstRow=FALSE; } } @@ -728,16 +708,18 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, uint baseRows,uint superRows, uint cellWidth,uint cellHeight) { - DiagramRow *dr=first(); + QListIterator<DiagramRow> it(*this); + DiagramRow *dr; bool done=FALSE; - while (dr && !done) // for each row + for (;(dr=it.current()) && !done;++it) // for each row { - DiagramItem *di=dr->first(); + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di = rit.current(); if (di->isInList()) // row consists of list connectors { int x=0,y=0,ys=0; float xf=0.0f,yf=0.0f,ysf=0.0f; - while (di) + for (;(di=rit.current());++rit) { DiagramItem *pi=di->parentItem(); DiagramItemList *dil=pi->getChildren(); @@ -849,7 +831,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, yf -= 1.0f; } } - di=dr->next(); + ++rit; di=rit.current(); } // add last horizonal line and a vertical connection line if (bitmap) @@ -895,13 +877,12 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } } - di=dr->next(); } done=TRUE; // the tree is drawn now } else // normal tree connector { - while (di) + for (;(di=rit.current());++rit) { int x=0,y=0; DiagramItemList *dil = di->getChildren(); @@ -988,8 +969,8 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } /* write input line */ - DiagramItem *first = dil->first(); - DiagramItem *last = dil->last(); + DiagramItem *first = dil->getFirst(); + DiagramItem *last = dil->getLast(); if (first!=last && !first->isInList()) /* connect with all base classes */ { if (bitmap) @@ -1027,9 +1008,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } } } - di=dr->next(); } - dr=next(); } } } @@ -1053,8 +1032,8 @@ ClassDiagram::ClassDiagram(ClassDef *root) clearVisitFlags(); super = new TreeDiagram(root,FALSE); super->computeLayout(); - DiagramItem *baseItem = base->first()->first(); - DiagramItem *superItem = super->first()->first(); + DiagramItem *baseItem = base->getFirst()->getFirst(); + DiagramItem *superItem = super->getFirst()->getFirst(); int xbase = baseItem->xPos(); int xsuper = superItem->xPos(); if (xbase>xsuper) @@ -1307,35 +1286,34 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, t << "boxfont setfont\n"; t << "1 boundaspect scale\n"; - + bool done=FALSE; - DiagramRow *dr=base->first(); - while (dr && !done) + QListIterator<DiagramRow> bit(*base); + DiagramRow *dr; + for (;(dr=bit.current()) && !done;++bit) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { done=di->isInList(); t << "(" << di->label() << ") cw\n"; - di=dr->next(); } - dr=base->next(); } - dr=super->first(); - dr=super->next(); + QListIterator<DiagramRow> sit(*super); + ++sit; done=FALSE; - while (dr && !done) + for (;(dr=sit.current()) && !done;++sit) { - DiagramItem *di=dr->first(); - while (di) + QListIterator<DiagramItem> rit(*dr); + DiagramItem *di; + for (;(di=rit.current());++rit) { done=di->isInList(); t << "(" << di->label() << ") cw\n"; - di=dr->next(); } - dr=super->next(); } - + t << "/boxwidth boxwidth marginwidth 2 mul add def\n" << "/xspacing boxwidth distx add def\n" << "/yspacing boxheight disty add def\n" diff --git a/src/diagram.h b/src/diagram.h index 62cab2e..6ce83f3 100644 --- a/src/diagram.h +++ b/src/diagram.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 5df047a..284d1ee 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -150,6 +150,7 @@ void DirDef::writeDetailedDescription(OutputList &ol,const QCString &title) // ol.newParagraph(); // FIXME:PARA ol.enableAll(); ol.disableAllBut(OutputGenerator::Man); + ol.enable(OutputGenerator::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } @@ -224,8 +225,9 @@ void DirDef::writeSubDirList(OutputList &ol) ol.parseText(theTranslator->trDir(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - DirDef *dd=m_subdirs.first(); - while (dd) + QListIterator<DirDef> it(m_subdirs); + DirDef *dd; + for (;(dd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); @@ -250,7 +252,6 @@ void DirDef::writeSubDirList(OutputList &ol) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - dd=m_subdirs.next(); } ol.endMemberList(); @@ -266,8 +267,9 @@ void DirDef::writeFileList(OutputList &ol) ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - FileDef *fd=m_fileList->first(); - while (fd) + QListIterator<FileDef> it(*m_fileList); + FileDef *fd; + for (;(fd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); @@ -313,7 +315,6 @@ void DirDef::writeFileList(OutputList &ol) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - fd=m_fileList->next(); } ol.endMemberList(); } @@ -334,6 +335,12 @@ QCString DirDef::shortTitle() const return theTranslator->trDirReference(m_shortName); } +bool DirDef::hasDetailedDescription() const +{ + static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); + return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty(); +} + void DirDef::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); @@ -584,10 +591,8 @@ bool DirDef::depGraphIsTrivial() const //---------------------------------------------------------------------- -int FilePairDict::compareItems(QCollection::Item item1,QCollection::Item item2) +int FilePairDict::compareValues(const FilePair *left,const FilePair *right) const { - FilePair *left = (FilePair*)item1; - FilePair *right = (FilePair*)item2; int orderHi = qstricmp(left->source()->name(),right->source()->name()); int orderLo = qstricmp(left->destination()->name(),right->destination()->name()); return orderHi==0 ? orderLo : orderHi; diff --git a/src/dirdef.h b/src/dirdef.h index 8b11b2e..8f4fbc2 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -37,7 +37,7 @@ class DirDef; class DirList : public QList<DirDef> { public: - int compareItems(QCollection::Item item1,QCollection::Item item2); + int compareValues(const DirDef *item1,const DirDef *item2) const; }; /** A model of a directory symbol. */ @@ -67,6 +67,7 @@ class DirDef : public Definition bool isParentOf(DirDef *dir) const; bool depGraphIsTrivial() const; QCString shortTitle() const; + bool hasDetailedDescription() const; // generate output void writeDocumentation(OutputList &ol); @@ -122,7 +123,8 @@ class FilePairDict : public SDict<FilePair> { public: FilePairDict(int size) : SDict<FilePair>(size) {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const FilePair *item1,const FilePair *item2) const; }; /** Usage information of a directory. */ @@ -160,9 +162,9 @@ class DirRelation UsedDir *m_dst; }; -inline int DirList::compareItems(QCollection::Item item1,QCollection::Item item2) +inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const { - return qstricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName()); + return qstricmp(item1->shortName(),item2->shortName()); } /** A sorted dictionary of DirDef objects. */ @@ -170,9 +172,9 @@ class DirSDict : public SDict<DirDef> { public: DirSDict(int size) : SDict<DirDef>(size) {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const DirDef *item1,const DirDef *item2) const { - return qstricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName()); + return qstricmp(item1->shortName(),item2->shortName()); } }; diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 47d3b98..2011333 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -2,7 +2,7 @@ * * * -* Copyright (C) 1997-2012 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 @@ -56,18 +56,6 @@ //------------------ -static const char index_xsd[] = -#include "index.xsd.h" -; - -//------------------ -// -static const char compound_xsd[] = -#include "compound.xsd.h" -; - -//------------------ - class DocbookSectionMapper : public QIntDict<char> { public: diff --git a/src/docbookgen.h b/src/docbookgen.h index 344cb5b..0431cf2 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -2,7 +2,7 @@ * * * -* Copyright (C) 1997-2012 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 diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index aaea045..6867dce 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2012 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 @@ -33,6 +33,7 @@ #include "filedef.h" #include "msc.h" #include "dia.h" +#include "htmlentity.h" DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) @@ -73,109 +74,14 @@ void DocbookDocVisitor::visit(DocWhiteSpace *w) void DocbookDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->docbook(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Copy: m_t << "©"; break; - case DocSymbol::Tm: m_t << "™"; break; - case DocSymbol::Reg: m_t << "®"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << """; break; - case DocSymbol::Lsquo: m_t << "‘"; break; - case DocSymbol::Rsquo: m_t << "’"; break; - case DocSymbol::Ldquo: m_t << "“"; break; - case DocSymbol::Rdquo: m_t << "”"; break; - case DocSymbol::Ndash: m_t << "–"; break; - case DocSymbol::Mdash: m_t << "—"; break; - case DocSymbol::Uml: m_t << "¨"; break; - case DocSymbol::Acute: m_t << "´"; break; - case DocSymbol::Grave: m_t << "À"; break; - case DocSymbol::Circ: m_t << "ˆ"; break; - case DocSymbol::Tilde: m_t << "˜"; break; - case DocSymbol::Szlig: m_t << "ß"; break; - case DocSymbol::Cedil: m_t << "¸"; break; - case DocSymbol::Ring: m_t << "Å"; break; - case DocSymbol::Slash: m_t << "Ø"; break; - case DocSymbol::Nbsp: m_t << " "; break; - case DocSymbol::Aelig: m_t << "æ"; break; - case DocSymbol::AElig: m_t << "Æ"; break; - case DocSymbol::GrkGamma: m_t << "Γ"; break; - case DocSymbol::GrkDelta: m_t << "Δ"; break; - case DocSymbol::GrkTheta: m_t << "Θ"; break; - case DocSymbol::GrkLambda: m_t << "Λ"; break; - case DocSymbol::GrkXi: m_t << "Ξ"; break; - case DocSymbol::GrkPi: m_t << "Π"; break; - case DocSymbol::GrkSigma: m_t << "Σ"; break; - case DocSymbol::GrkUpsilon: m_t << "Υ"; break; - case DocSymbol::GrkPhi: m_t << "Φ"; break; - case DocSymbol::GrkPsi: m_t << "Ψ"; break; - case DocSymbol::GrkOmega: m_t << "Ω"; break; - case DocSymbol::Grkalpha: m_t << "α"; break; - case DocSymbol::Grkbeta: m_t << "β"; break; - case DocSymbol::Grkgamma: m_t << "γ"; break; - case DocSymbol::Grkdelta: m_t << "δ"; break; - case DocSymbol::Grkepsilon: m_t << "ε"; break; - case DocSymbol::Grkzeta: m_t << "ζ"; break; - case DocSymbol::Grketa: m_t << "η"; break; - case DocSymbol::Grktheta: m_t << "θ"; break; - case DocSymbol::Grkiota: m_t << "ι"; break; - case DocSymbol::Grkkappa: m_t << "κ"; break; - case DocSymbol::Grklambda: m_t << "λ"; break; - case DocSymbol::Grkmu: m_t << "μ"; break; - case DocSymbol::Grknu: m_t << "ν"; break; - case DocSymbol::Grkxi: m_t << "ξ"; break; - case DocSymbol::Grkpi: m_t << "π"; break; - case DocSymbol::Grkrho: m_t << "ρ"; break; - case DocSymbol::Grksigma: m_t << "σ"; break; - case DocSymbol::Grktau: m_t << "τ"; break; - case DocSymbol::Grkupsilon: m_t << "υ"; break; - case DocSymbol::Grkphi: m_t << "φ"; break; - case DocSymbol::Grkchi: m_t << "χ"; break; - case DocSymbol::Grkpsi: m_t << "ψ"; break; - case DocSymbol::Grkomega: m_t << "ω"; break; - case DocSymbol::Grkvarsigma: m_t << "ς"; break; - case DocSymbol::Section: m_t << "<simplesect/>"; break; - case DocSymbol::Degree: m_t << "°"; break; - case DocSymbol::Prime: m_t << "′"; break; - case DocSymbol::DoublePrime: m_t << "″"; break; - case DocSymbol::Infinity: m_t << "∞"; break; - case DocSymbol::EmptySet: m_t << "∅"; break; - case DocSymbol::PlusMinus: m_t << "±"; break; - case DocSymbol::Times: m_t << "×"; break; - case DocSymbol::Minus: m_t << "−"; break; - case DocSymbol::CenterDot: m_t << "⋅"; break; - case DocSymbol::Partial: m_t << "∂"; break; - case DocSymbol::Nabla: m_t << "∇"; break; - case DocSymbol::SquareRoot: m_t << "√"; break; - case DocSymbol::Perpendicular: m_t << "⊥"; break; - case DocSymbol::Sum: m_t << "∑"; break; - case DocSymbol::Integral: m_t << "∫"; break; - case DocSymbol::Product: m_t << "∏"; break; - case DocSymbol::Similar: m_t << "∼"; break; - case DocSymbol::Approx: m_t << "≈"; break; - case DocSymbol::NotEqual: m_t << "≠"; break; - case DocSymbol::Equivalent: m_t << "≡"; break; - case DocSymbol::Proportional: m_t << "∝"; break; - case DocSymbol::LessEqual: m_t << "≤"; break; - case DocSymbol::GreaterEqual: m_t << "≥"; break; - case DocSymbol::LeftArrow: m_t << "←"; break; - case DocSymbol::RightArrow: m_t << "→"; break; - case DocSymbol::SetIn: m_t << "∈"; break; - case DocSymbol::SetNotIn: m_t << "∉"; break; - case DocSymbol::LeftCeil: m_t << "⌈"; break; - case DocSymbol::RightCeil: m_t << "⌉"; break; - case DocSymbol::LeftFloor: m_t << "⌊"; break; - case DocSymbol::RightFloor: m_t << "⌋"; break; - default: - err("unknown symbol found\n"); + m_t << res; + } + else + { + err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } @@ -379,6 +285,8 @@ void DocbookDocVisitor::visit(DocInclude *inc) break; case DocInclude::HtmlInclude: break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: m_t << "<verbatim>"; filter(inc->text()); @@ -453,7 +361,7 @@ void DocbookDocVisitor::visit(DocIndexEntry *ie) void DocbookDocVisitor::visit(DocSimpleSectSep *) { - m_t << "<simplesect/>"; + m_t << "<simplesectsep/>"; } void DocbookDocVisitor::visit(DocCite *cite) diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index a03e04a..20d424e 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -2,7 +2,7 @@ * * * -* Copyright (C) 1997-2012 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 diff --git a/src/docparser.cpp b/src/docparser.cpp index 4a18b4e..e5e2895 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -53,6 +53,7 @@ #include "config.h" #include "growbuf.h" #include "markdown.h" +#include "htmlentity.h" // debug off #define DBG(x) do {} while(0) @@ -1244,34 +1245,43 @@ reparsetoken: switch (Mappers::cmdMapper->map(tokenName)) { case CMD_BSLASH: - children.append(new DocSymbol(parent,DocSymbol::BSlash)); + children.append(new DocSymbol(parent,DocSymbol::Sym_BSlash)); break; case CMD_AT: - children.append(new DocSymbol(parent,DocSymbol::At)); + children.append(new DocSymbol(parent,DocSymbol::Sym_At)); break; case CMD_LESS: - children.append(new DocSymbol(parent,DocSymbol::Less)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Less)); break; case CMD_GREATER: - children.append(new DocSymbol(parent,DocSymbol::Greater)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Greater)); break; case CMD_AMP: - children.append(new DocSymbol(parent,DocSymbol::Amp)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - children.append(new DocSymbol(parent,DocSymbol::Dollar)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - children.append(new DocSymbol(parent,DocSymbol::Hash)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Hash)); break; case CMD_DCOLON: - children.append(new DocSymbol(parent,DocSymbol::DoubleColon)); + children.append(new DocSymbol(parent,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - children.append(new DocSymbol(parent,DocSymbol::Percent)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Percent)); + break; + case CMD_NDASH: + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); + break; + case CMD_MDASH: + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Minus)); break; case CMD_QUOTE: - children.append(new DocSymbol(parent,DocSymbol::Quot)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Quot)); break; case CMD_EMPHASIS: { @@ -1319,7 +1329,7 @@ reparsetoken: { doctokenizerYYsetStateHtmlOnly(); tok = doctokenizerYYlex(); - children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_exampleName)); + children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_exampleName,g_token->name=="block")); if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -1488,11 +1498,10 @@ reparsetoken: break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(tokenName,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(tokenName); + if (s!=DocSymbol::Sym_Unknown) { - children.append(new DocSymbol(parent,s,letter)); + children.append(new DocSymbol(parent,s)); } else { @@ -1571,138 +1580,10 @@ static void handleImg(DocNode *parent,QList<DocNode> &children,const HtmlAttribL //--------------------------------------------------------------------------- -DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName,char *letter) -{ - int l=symName.length(); - DBG(("decodeSymbol(%s) l=%d\n",qPrint(symName),l)); - // TODO: replace this with a hash - if (symName=="©") return DocSymbol::Copy; - else if (symName=="™") return DocSymbol::Tm; - else if (symName=="&tm;") return DocSymbol::Tm; // alias for ™ - else if (symName=="®") return DocSymbol::Reg; - else if (symName=="<") return DocSymbol::Less; - else if (symName==">") return DocSymbol::Greater; - else if (symName=="&") return DocSymbol::Amp; - else if (symName=="'") return DocSymbol::Apos; - else if (symName==""") return DocSymbol::Quot; - else if (symName=="‘") return DocSymbol::Lsquo; - else if (symName=="’") return DocSymbol::Rsquo; - else if (symName=="“") return DocSymbol::Ldquo; - else if (symName=="”") return DocSymbol::Rdquo; - else if (symName=="–") return DocSymbol::Ndash; - else if (symName=="—") return DocSymbol::Mdash; - else if (symName=="ß") return DocSymbol::Szlig; - else if (symName==" ") return DocSymbol::Nbsp; - else if (symName=="Æ") return DocSymbol::AElig; - else if (symName=="æ") return DocSymbol::Aelig; - else if (symName=="Γ") return DocSymbol::GrkGamma; - else if (symName=="Δ") return DocSymbol::GrkDelta; - else if (symName=="Θ") return DocSymbol::GrkTheta; - else if (symName=="Λ") return DocSymbol::GrkLambda; - else if (symName=="Ξ") return DocSymbol::GrkXi; - else if (symName=="Π") return DocSymbol::GrkPi; - else if (symName=="Σ") return DocSymbol::GrkSigma; - else if (symName=="Υ") return DocSymbol::GrkUpsilon; - else if (symName=="Φ") return DocSymbol::GrkPhi; - else if (symName=="Ψ") return DocSymbol::GrkPsi; - else if (symName=="Ω") return DocSymbol::GrkOmega; - else if (symName=="α") return DocSymbol::Grkalpha; - else if (symName=="β") return DocSymbol::Grkbeta; - else if (symName=="γ") return DocSymbol::Grkgamma; - else if (symName=="δ") return DocSymbol::Grkdelta; - else if (symName=="ε") return DocSymbol::Grkepsilon; - else if (symName=="ζ") return DocSymbol::Grkzeta; - else if (symName=="η") return DocSymbol::Grketa; - else if (symName=="θ") return DocSymbol::Grktheta; - else if (symName=="ι") return DocSymbol::Grkiota; - else if (symName=="κ") return DocSymbol::Grkkappa; - else if (symName=="λ") return DocSymbol::Grklambda; - else if (symName=="μ") return DocSymbol::Grkmu; - else if (symName=="ν") return DocSymbol::Grknu; - else if (symName=="ξ") return DocSymbol::Grkxi; - else if (symName=="π") return DocSymbol::Grkpi; - else if (symName=="ρ") return DocSymbol::Grkrho; - else if (symName=="σ") return DocSymbol::Grksigma; - else if (symName=="τ") return DocSymbol::Grktau; - else if (symName=="υ") return DocSymbol::Grkupsilon; - else if (symName=="φ") return DocSymbol::Grkphi; - else if (symName=="χ") return DocSymbol::Grkchi; - else if (symName=="ψ") return DocSymbol::Grkpsi; - else if (symName=="ω") return DocSymbol::Grkomega; - else if (symName=="ς") return DocSymbol::Grkvarsigma; - else if (symName=="§") return DocSymbol::Section; - else if (symName=="°") return DocSymbol::Degree; - else if (symName=="′") return DocSymbol::Prime; - else if (symName=="″") return DocSymbol::DoublePrime; - else if (symName=="∞") return DocSymbol::Infinity; - else if (symName=="∅") return DocSymbol::EmptySet; - else if (symName=="±") return DocSymbol::PlusMinus; - else if (symName=="×") return DocSymbol::Times; - else if (symName=="−") return DocSymbol::Minus; - else if (symName=="⋅") return DocSymbol::CenterDot; - else if (symName=="∂") return DocSymbol::Partial; - else if (symName=="∇") return DocSymbol::Nabla; - else if (symName=="√") return DocSymbol::SquareRoot; - else if (symName=="⊥") return DocSymbol::Perpendicular; - else if (symName=="∑") return DocSymbol::Sum; - else if (symName=="∫") return DocSymbol::Integral; - else if (symName=="∏") return DocSymbol::Product; - else if (symName=="∼") return DocSymbol::Similar; - else if (symName=="≈") return DocSymbol::Approx; - else if (symName=="≠") return DocSymbol::NotEqual; - else if (symName=="≡") return DocSymbol::Equivalent; - else if (symName=="∝") return DocSymbol::Proportional; - else if (symName=="≤") return DocSymbol::LessEqual; - else if (symName=="≥") return DocSymbol::GreaterEqual; - else if (symName=="←") return DocSymbol::LeftArrow; - else if (symName=="→") return DocSymbol::RightArrow; - else if (symName=="∈") return DocSymbol::SetIn; - else if (symName=="∉") return DocSymbol::SetNotIn; - else if (symName=="⌈") return DocSymbol::LeftCeil; - else if (symName=="⌉") return DocSymbol::RightCeil; - else if (symName=="⌊") return DocSymbol::LeftFloor; - else if (symName=="⌋") return DocSymbol::RightFloor; - else if (l==6 && symName.right(4)=="uml;") - { - *letter=symName.at(1); - return DocSymbol::Uml; - } - else if (l==8 && symName.right(6)=="acute;") - { - *letter=symName.at(1); - return DocSymbol::Acute; - } - else if (l==8 && symName.right(6)=="grave;") - { - *letter=symName.at(1); - return DocSymbol::Grave; - } - else if (l==7 && symName.right(5)=="circ;") - { - *letter=symName.at(1); - return DocSymbol::Circ; - } - else if (l==8 && symName.right(6)=="tilde;") - { - *letter=symName.at(1); - return DocSymbol::Tilde; - } - else if (l==8 && symName.right(6)=="cedil;") - { - *letter=symName.at(1); - return DocSymbol::Cedil; - } - else if (l==7 && symName.right(5)=="ring;") - { - *letter=symName.at(1); - return DocSymbol::Ring; - } - else if (l==8 && symName.right(6)=="slash;") - { - *letter=symName.at(1); - return DocSymbol::Slash; - } - return DocSymbol::Unknown; +DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName) +{ + DBG(("decodeSymbol(%s)\n",qPrint(symName))); + return HtmlEntityMapper::instance()->name2sym(symName); } //--------------------------------------------------------------------------- @@ -1719,9 +1600,9 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=0; - if (!children.isEmpty() && children.last()->kind()==DocNode::Kind_Para) + if (!children.isEmpty() && children.getLast()->kind()==DocNode::Kind_Para) { // last child item was a paragraph - lastPar = (DocPara*)children.last(); + lastPar = (DocPara*)children.getLast(); isFirst=FALSE; } do @@ -1873,12 +1754,12 @@ DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) DocVerbatim::DocVerbatim(DocNode *parent,const QCString &context, const QCString &text, Type t,bool isExample, - const QCString &exampleFile,const QCString &lang) + const QCString &exampleFile,bool isBlock,const QCString &lang) : m_context(context), m_text(text), m_type(t), - m_isExample(isExample), m_exampleFile(exampleFile), - m_relPath(g_relPath), m_lang(lang) -{ - m_parent = parent; + m_isExample(isExample), m_exampleFile(exampleFile), + m_relPath(g_relPath), m_lang(lang), m_isBlock(isBlock) +{ + m_parent = parent; } @@ -1905,6 +1786,9 @@ void DocInclude::parse() case HtmlInclude: readTextFileByName(m_file,m_text); break; + case LatexInclude: + readTextFileByName(m_file,m_text); + break; case Snippet: readTextFileByName(m_file,m_text); // check here for the existence of the blockId inside the file, so we @@ -3369,26 +3253,25 @@ int DocIndexEntry::parse() break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); switch (s) { - case DocSymbol::BSlash: m_entry+='\\'; break; - case DocSymbol::At: m_entry+='@'; break; - case DocSymbol::Less: m_entry+='<'; break; - case DocSymbol::Greater: m_entry+='>'; break; - case DocSymbol::Amp: m_entry+='&'; break; - case DocSymbol::Dollar: m_entry+='$'; break; - case DocSymbol::Hash: m_entry+='#'; break; - case DocSymbol::Percent: m_entry+='%'; break; - case DocSymbol::Apos: m_entry+='\''; break; - case DocSymbol::Quot: m_entry+='"'; break; - case DocSymbol::Lsquo: m_entry+='`'; break; - case DocSymbol::Rsquo: m_entry+='\''; break; - case DocSymbol::Ldquo: m_entry+="``"; break; - case DocSymbol::Rdquo: m_entry+="''"; break; - case DocSymbol::Ndash: m_entry+="--"; break; - case DocSymbol::Mdash: m_entry+="---"; break; + case DocSymbol::Sym_BSlash: m_entry+='\\'; break; + case DocSymbol::Sym_At: m_entry+='@'; break; + case DocSymbol::Sym_Less: m_entry+='<'; break; + case DocSymbol::Sym_Greater: m_entry+='>'; break; + case DocSymbol::Sym_Amp: m_entry+='&'; break; + case DocSymbol::Sym_Dollar: m_entry+='$'; break; + case DocSymbol::Sym_Hash: m_entry+='#'; break; + case DocSymbol::Sym_Percent: m_entry+='%'; break; + case DocSymbol::Sym_apos: m_entry+='\''; break; + case DocSymbol::Sym_Quot: m_entry+='"'; break; + case DocSymbol::Sym_lsquo: m_entry+='`'; break; + case DocSymbol::Sym_rsquo: m_entry+='\''; break; + case DocSymbol::Sym_ldquo: m_entry+="``"; break; + case DocSymbol::Sym_rdquo: m_entry+="''"; break; + case DocSymbol::Sym_ndash: m_entry+="--"; break; + case DocSymbol::Sym_mdash: m_entry+="---"; break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected symbol found as argument of \\addindex"); break; @@ -3407,6 +3290,8 @@ int DocIndexEntry::parse() case CMD_HASH: m_entry+='#'; break; case CMD_DCOLON: m_entry+="::"; break; case CMD_PERCENT: m_entry+='%'; break; + case CMD_NDASH: m_entry+="--"; break; + case CMD_MDASH: m_entry+="---"; break; case CMD_QUOTE: m_entry+='"'; break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command %s found as argument of \\addindex", @@ -4654,8 +4539,8 @@ int DocSimpleSect::parse(bool userTitle,bool needsSeparator) } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_Para); - ((DocPara *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_Para); + ((DocPara *)m_children.getLast())->markLast(FALSE); } par->markLast(); if (needsSeparator) m_children.append(new DocSimpleSectSep(this)); @@ -4705,8 +4590,8 @@ int DocSimpleSect::parseXml() } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_Para); - ((DocPara *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_Para); + ((DocPara *)m_children.getLast())->markLast(FALSE); } par->markLast(); m_children.append(par); @@ -4730,14 +4615,14 @@ int DocSimpleSect::parseXml() void DocSimpleSect::appendLinkWord(const QCString &word) { DocPara *p; - if (m_children.isEmpty() || m_children.last()->kind()!=DocNode::Kind_Para) + if (m_children.isEmpty() || m_children.getLast()->kind()!=DocNode::Kind_Para) { p = new DocPara(this); m_children.append(p); } else { - p = (DocPara *)m_children.last(); + p = (DocPara *)m_children.getLast(); // Comma-seperate <seealso> links. p->injectToken(TK_WORD,","); @@ -4881,7 +4766,7 @@ int DocParamList::parseXml(const QCString ¶mName) } else { - m_paragraphs.last()->markLast(FALSE); + m_paragraphs.getLast()->markLast(FALSE); } par->markLast(); m_paragraphs.append(par); @@ -4932,8 +4817,8 @@ int DocParamSect::parse(const QCString &cmdName,bool xmlContext, Direction d) } else { - ASSERT(m_children.last()->kind()==DocNode::Kind_ParamList); - ((DocParamList *)m_children.last())->markLast(FALSE); + ASSERT(m_children.getLast()->kind()==DocNode::Kind_ParamList); + ((DocParamList *)m_children.getLast())->markLast(FALSE); pl->markLast(); } m_children.append(pl); @@ -4945,6 +4830,10 @@ int DocParamSect::parse(const QCString &cmdName,bool xmlContext, Direction d) { retval = pl->parse(cmdName); } + if (retval==RetVal_EndParBlock) + { + retval = RetVal_OK; + } DBG(("DocParamSect::parse() end retval=%d\n",retval)); DocNode *n=g_nodeStack.pop(); @@ -4959,12 +4848,12 @@ int DocPara::handleSimpleSection(DocSimpleSect::Type t, bool xmlContext) DocSimpleSect *ss=0; bool needsSeparator = FALSE; if (!m_children.isEmpty() && // previous element - m_children.last()->kind()==Kind_SimpleSect && // was a simple sect - ((DocSimpleSect *)m_children.last())->type()==t && // of same type + m_children.getLast()->kind()==Kind_SimpleSect && // was a simple sect + ((DocSimpleSect *)m_children.getLast())->type()==t && // of same type t!=DocSimpleSect::User) // but not user defined { // append to previous section - ss=(DocSimpleSect *)m_children.last(); + ss=(DocSimpleSect *)m_children.getLast(); needsSeparator = TRUE; } else // start new section @@ -4991,11 +4880,11 @@ int DocPara::handleParamSection(const QCString &cmdName, { DocParamSect *ps=0; if (!m_children.isEmpty() && // previous element - m_children.last()->kind()==Kind_ParamSect && // was a param sect - ((DocParamSect *)m_children.last())->type()==t) // of same type + m_children.getLast()->kind()==Kind_ParamSect && // was a param sect + ((DocParamSect *)m_children.getLast())->type()==t) // of same type { // append to previous section - ps=(DocParamSect *)m_children.last(); + ps=(DocParamSect *)m_children.getLast(); } else // start new section { @@ -5086,13 +4975,15 @@ void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type return; } DocIncOperator *op = new DocIncOperator(this,t,g_token->name,g_context,g_isExample,g_exampleName); - DocNode *n1 = m_children.last(); - DocNode *n2 = n1!=0 ? m_children.prev() : 0; + QListIterator<DocNode> it(m_children); + DocNode *n1 = it.toLast(); + --it; + DocNode *n2 = n1!=0 ? it.current() : 0; bool isFirst = n1==0 || // no last node - (n1->kind()!=DocNode::Kind_IncOperator && + (n1->kind()!=DocNode::Kind_IncOperator && n1->kind()!=DocNode::Kind_WhiteSpace ) || // last node is not operator or whitespace - (n1->kind()==DocNode::Kind_WhiteSpace && + (n1->kind()==DocNode::Kind_WhiteSpace && n2!=0 && n2->kind()!=DocNode::Kind_IncOperator ); // previous not is not operator op->markFirst(isFirst); @@ -5400,7 +5291,7 @@ int DocPara::handleStartCode() if (g_token->verb.at(i)=='\n') li=i+1; i++; } - m_children.append(new DocVerbatim(this,g_context,stripIndentation(g_token->verb.mid(li)),DocVerbatim::Code,g_isExample,g_exampleName,lang)); + m_children.append(new DocVerbatim(this,g_context,stripIndentation(g_token->verb.mid(li)),DocVerbatim::Code,g_isExample,g_exampleName,FALSE,lang)); if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"code section ended without end marker"); doctokenizerYYsetStatePara(); return retval; @@ -5464,37 +5355,46 @@ int DocPara::handleCommand(const QCString &cmdName) if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); break; case CMD_BSLASH: - m_children.append(new DocSymbol(this,DocSymbol::BSlash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_BSlash)); break; case CMD_AT: - m_children.append(new DocSymbol(this,DocSymbol::At)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_At)); break; case CMD_LESS: - m_children.append(new DocSymbol(this,DocSymbol::Less)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Less)); break; case CMD_GREATER: - m_children.append(new DocSymbol(this,DocSymbol::Greater)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Greater)); break; case CMD_AMP: - m_children.append(new DocSymbol(this,DocSymbol::Amp)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - m_children.append(new DocSymbol(this,DocSymbol::Dollar)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - m_children.append(new DocSymbol(this,DocSymbol::Hash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Hash)); break; case CMD_PIPE: - m_children.append(new DocSymbol(this,DocSymbol::Pipe)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Pipe)); break; case CMD_DCOLON: - m_children.append(new DocSymbol(this,DocSymbol::DoubleColon)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - m_children.append(new DocSymbol(this,DocSymbol::Percent)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent)); + break; + case CMD_NDASH: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + break; + case CMD_MDASH: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); break; case CMD_QUOTE: - m_children.append(new DocSymbol(this,DocSymbol::Quot)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; case CMD_SA: g_inSeeBlock=TRUE; @@ -5588,7 +5488,7 @@ int DocPara::handleCommand(const QCString &cmdName) { doctokenizerYYsetStateHtmlOnly(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_exampleName)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_exampleName,g_token->name=="block")); if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -5751,6 +5651,9 @@ int DocPara::handleCommand(const QCString &cmdName) case CMD_HTMLINCLUDE: handleInclude(cmdName,DocInclude::HtmlInclude); break; + case CMD_LATEXINCLUDE: + handleInclude(cmdName,DocInclude::LatexInclude); + break; case CMD_VERBINCLUDE: handleInclude(cmdName,DocInclude::VerbInclude); break; @@ -6468,7 +6371,7 @@ reparsetoken: // remove leading whitespace !m_children.isEmpty() && // and whitespace after certain constructs - (k=m_children.last()->kind())!=DocNode::Kind_HtmlDescList && + (k=m_children.getLast()->kind())!=DocNode::Kind_HtmlDescList && k!=DocNode::Kind_HtmlTable && k!=DocNode::Kind_HtmlList && k!=DocNode::Kind_SimpleSect && @@ -6685,11 +6588,10 @@ reparsetoken: break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); + if (s!=DocSymbol::Sym_Unknown) { - m_children.append(new DocSymbol(this,s,letter)); + m_children.append(new DocSymbol(this,s)); } else { @@ -6904,11 +6806,10 @@ void DocText::parse() break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); + if (s!=DocSymbol::Sym_Unknown) { - m_children.append(new DocSymbol(this,s,letter)); + m_children.append(new DocSymbol(this,s)); } else { @@ -6921,34 +6822,43 @@ void DocText::parse() switch (Mappers::cmdMapper->map(g_token->name)) { case CMD_BSLASH: - m_children.append(new DocSymbol(this,DocSymbol::BSlash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_BSlash)); break; case CMD_AT: - m_children.append(new DocSymbol(this,DocSymbol::At)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_At)); break; case CMD_LESS: - m_children.append(new DocSymbol(this,DocSymbol::Less)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Less)); break; case CMD_GREATER: - m_children.append(new DocSymbol(this,DocSymbol::Greater)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Greater)); break; case CMD_AMP: - m_children.append(new DocSymbol(this,DocSymbol::Amp)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - m_children.append(new DocSymbol(this,DocSymbol::Dollar)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - m_children.append(new DocSymbol(this,DocSymbol::Hash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Hash)); break; case CMD_DCOLON: - m_children.append(new DocSymbol(this,DocSymbol::DoubleColon)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - m_children.append(new DocSymbol(this,DocSymbol::Percent)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent)); + break; + case CMD_NDASH: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + break; + case CMD_MDASH: + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus)); break; case CMD_QUOTE: - m_children.append(new DocSymbol(this,DocSymbol::Quot)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command `%s' found", diff --git a/src/docparser.h b/src/docparser.h index 050c871..fb4f084 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -336,34 +336,84 @@ class DocStyleChange : public DocNode class DocSymbol : public DocNode { public: - enum SymType { Unknown=0, BSlash, At, Less, Greater, Amp, Dollar, Hash, - DoubleColon, Percent, Copy, Tm, Reg, Apos, Quot, Uml, Acute, - Grave, Circ, Tilde, Szlig, Cedil, Ring, Nbsp, Slash, - Lsquo, Rsquo, Ldquo, Rdquo, Ndash, Mdash, Aelig, AElig, - GrkGamma, GrkDelta, GrkTheta, GrkLambda, GrkXi, GrkPi, - GrkSigma, GrkUpsilon, GrkPhi, GrkPsi, GrkOmega, Grkalpha, - Grkbeta, Grkgamma, Grkdelta, Grkepsilon, Grkzeta, Grketa, - Grktheta, Grkiota, Grkkappa, Grklambda, Grkmu, Grknu, Grkxi, - Grkpi, Grkrho, Grksigma, Grktau, Grkupsilon, Grkphi, Grkchi, - Grkpsi, Grkomega, Grkvarsigma, Section, Degree, Prime, - DoublePrime, Infinity, EmptySet, PlusMinus, Times, Minus, - CenterDot, Partial, Nabla, SquareRoot, Perpendicular, Sum, - Integral, Product, Similar, Approx, NotEqual, Equivalent, - Proportional, LessEqual, GreaterEqual, LeftArrow, RightArrow, - SetIn, SetNotIn, LeftCeil, RightCeil, LeftFloor, RightFloor, - Pipe + enum SymType { Sym_Unknown = -1, + Sym_nbsp, Sym_iexcl, Sym_cent, Sym_pound, Sym_curren, + Sym_yen, Sym_brvbar, Sym_sect, Sym_uml, Sym_copy, + Sym_ordf, Sym_laquo, Sym_not, Sym_shy, Sym_reg, + Sym_macr, Sym_deg, Sym_plusmn, Sym_sup2, Sym_sup3, + Sym_acute, Sym_micro, Sym_para, Sym_middot, Sym_cedil, + Sym_sup1, Sym_ordm, Sym_raquo, Sym_frac14, Sym_frac12, + Sym_frac34, Sym_iquest, Sym_Agrave, Sym_Aacute, Sym_Acirc, + Sym_Atilde, Sym_Auml, Sym_Aring, Sym_AElig, Sym_Ccedil, + Sym_Egrave, Sym_Eacute, Sym_Ecirc, Sym_Euml, Sym_Igrave, + Sym_Iacute, Sym_Icirc, Sym_Iuml, Sym_ETH, Sym_Ntilde, + Sym_Ograve, Sym_Oacute, Sym_Ocirc, Sym_Otilde, Sym_Ouml, + Sym_times, Sym_Oslash, Sym_Ugrave, Sym_Uacute, Sym_Ucirc, + Sym_Uuml, Sym_Yacute, Sym_THORN, Sym_szlig, Sym_agrave, + Sym_aacute, Sym_acirc, Sym_atilde, Sym_auml, Sym_aring, + Sym_aelig, Sym_ccedil, Sym_egrave, Sym_eacute, Sym_ecirc, + Sym_euml, Sym_igrave, Sym_iacute, Sym_icirc, Sym_iuml, + Sym_eth, Sym_ntilde, Sym_ograve, Sym_oacute, Sym_ocirc, + Sym_otilde, Sym_ouml, Sym_divide, Sym_oslash, Sym_ugrave, + Sym_uacute, Sym_ucirc, Sym_uuml, Sym_yacute, Sym_thorn, + Sym_yuml, Sym_fnof, Sym_Alpha, Sym_Beta, Sym_Gamma, + Sym_Delta, Sym_Epsilon, Sym_Zeta, Sym_Eta, Sym_Theta, + Sym_Iota, Sym_Kappa, Sym_Lambda, Sym_Mu, Sym_Nu, + Sym_Xi, Sym_Omicron, Sym_Pi, Sym_Rho, Sym_Sigma, + Sym_Tau, Sym_Upsilon, Sym_Phi, Sym_Chi, Sym_Psi, + Sym_Omega, Sym_alpha, Sym_beta, Sym_gamma, Sym_delta, + Sym_epsilon, Sym_zeta, Sym_eta, Sym_theta, Sym_iota, + Sym_kappa, Sym_lambda, Sym_mu, Sym_nu, Sym_xi, + Sym_omicron, Sym_pi, Sym_rho, Sym_sigmaf, Sym_sigma, + Sym_tau, Sym_upsilon, Sym_phi, Sym_chi, Sym_psi, + Sym_omega, Sym_thetasym, Sym_upsih, Sym_piv, Sym_bull, + Sym_hellip, Sym_prime, Sym_Prime, Sym_oline, Sym_frasl, + Sym_weierp, Sym_image, Sym_real, Sym_trade, Sym_alefsym, + Sym_larr, Sym_uarr, Sym_rarr, Sym_darr, Sym_harr, + Sym_crarr, Sym_lArr, Sym_uArr, Sym_rArr, Sym_dArr, + Sym_hArr, Sym_forall, Sym_part, Sym_exist, Sym_empty, + Sym_nabla, Sym_isin, Sym_notin, Sym_ni, Sym_prod, + Sym_sum, Sym_minus, Sym_lowast, Sym_radic, Sym_prop, + Sym_infin, Sym_ang, Sym_and, Sym_or, Sym_cap, + Sym_cup, Sym_int, Sym_there4, Sym_sim, Sym_cong, + Sym_asymp, Sym_ne, Sym_equiv, Sym_le, Sym_ge, + Sym_sub, Sym_sup, Sym_nsub, Sym_sube, Sym_supe, + Sym_oplus, Sym_otimes, Sym_perp, Sym_sdot, Sym_lceil, + Sym_rceil, Sym_lfloor, Sym_rfloor, Sym_lang, Sym_rang, + Sym_loz, Sym_spades, Sym_clubs, Sym_hearts, Sym_diams, + Sym_quot, Sym_amp, Sym_lt, Sym_gt, Sym_OElig, + Sym_oelig, Sym_Scaron, Sym_scaron, Sym_Yuml, Sym_circ, + Sym_tilde, Sym_ensp, Sym_emsp, Sym_thinsp, Sym_zwnj, + Sym_zwj, Sym_lrm, Sym_rlm, Sym_ndash, Sym_mdash, + Sym_lsquo, Sym_rsquo, Sym_sbquo, Sym_ldquo, Sym_rdquo, + Sym_bdquo, Sym_dagger, Sym_Dagger, Sym_permil, Sym_lsaquo, + Sym_rsaquo, Sym_euro, + + /* doxygen extensions */ + Sym_tm, Sym_apos, + + /* 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 }; - DocSymbol(DocNode *parent,SymType s,char letter='\0') : - m_symbol(s), m_letter(letter) { m_parent = parent; } + enum PerlType { Perl_unknown = 0, Perl_string, Perl_char, Perl_symbol, Perl_umlaut, + Perl_acute, Perl_grave, Perl_circ, Perl_slash, Perl_tilde, + Perl_cedilla, Perl_ring + }; + typedef struct PerlSymb { + const char *symb; + const PerlType type; + }PerlSymb; + DocSymbol(DocNode *parent,SymType s) : + m_symbol(s) { m_parent = parent; } SymType symbol() const { return m_symbol; } - char letter() const { return m_letter; } Kind kind() const { return Kind_Symbol; } void accept(DocVisitor *v) { v->visit(this); } - static SymType decodeSymbol(const QCString &symName,char *letter); + static SymType decodeSymbol(const QCString &symName); private: SymType m_symbol; - char m_letter; }; /** Node representing some amount of white space */ @@ -386,7 +436,7 @@ class DocVerbatim : public DocNode enum Type { Code, HtmlOnly, ManOnly, LatexOnly, RtfOnly, XmlOnly, Verbatim, Dot, Msc, DocbookOnly }; DocVerbatim(DocNode *parent,const QCString &context, const QCString &text, Type t,bool isExample, - const QCString &exampleFile,const QCString &lang=QCString()); + const QCString &exampleFile,bool isBlock=FALSE,const QCString &lang=QCString()); Kind kind() const { return Kind_Verbatim; } Type type() const { return m_type; } QCString text() const { return m_text; } @@ -396,6 +446,7 @@ class DocVerbatim : public DocNode QCString exampleFile() const { return m_exampleFile; } QCString relPath() const { return m_relPath; } QCString language() const { return m_lang; } + bool isBlock() const { return m_isBlock; } private: QCString m_context; @@ -405,6 +456,7 @@ class DocVerbatim : public DocNode QCString m_exampleFile; QCString m_relPath; QCString m_lang; + bool m_isBlock; }; @@ -412,7 +464,7 @@ class DocVerbatim : public DocNode class DocInclude : public DocNode { public: - enum Type { Include, DontInclude, VerbInclude, HtmlInclude, IncWithLines, Snippet }; + enum Type { Include, DontInclude, VerbInclude, HtmlInclude, LatexInclude, IncWithLines, Snippet }; DocInclude(DocNode *parent,const QCString &file, const QCString context, Type t, bool isExample,const QCString exampleFile, diff --git a/src/docsets.cpp b/src/docsets.cpp index 2aa2918..52d24bb 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -72,7 +72,7 @@ void DocSets::initialize() "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n" "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n" "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n" - "XCODE_INSTALL=$(shell xcode-select -print-path)\n" + "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n" "\n" "all: docset\n" "\n" diff --git a/src/docsets.h b/src/docsets.h index c5f0dc7..eac5bfc 100644 --- a/src/docsets.h +++ b/src/docsets.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/doctokenizer.h b/src/doctokenizer.h index ca0490c..1db764e 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -3,7 +3,7 @@ * $Id: $ * * - * Copyright (C) 1997-2013 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 diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 5ba1a72..7ffbbb3 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -3,7 +3,7 @@ * $Id: $ * * - * Copyright (C) 1997-2013 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 @@ -350,7 +350,7 @@ HFILEMASK ("."{FILESCHAR}*{FILEECHAR}+)* 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}) +SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---") SPCMD2 {CMD}[\\@<>&$#%~".|] SPCMD3 {CMD}form#[0-9]+ SPCMD4 {CMD}"::" @@ -406,6 +406,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} %x St_CodeOpt %x St_XmlCode %x St_HtmlOnly +%x St_HtmlOnlyOption %x St_ManOnly %x St_LatexOnly %x St_RtfOnly @@ -627,8 +628,16 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} <St_Para>"$"{ID}":"[^\n$]+"$" { /* RCS tag */ QCString tagName(yytext+1); int index=tagName.find(':'); - g_token->name = tagName.left(index+1); - g_token->text = tagName.mid(index+2,tagName.length()-index-3); + g_token->name = tagName.left(index); + int text_begin = index+2; + int text_end = tagName.length()-1; + if (tagName[text_begin-1]==':') /* check for Subversion fixed-length keyword */ + { + ++text_begin; + if (tagName[text_end-1]=='#') + --text_end; + } + g_token->text = tagName.mid(text_begin,text_end-text_begin); return TK_RCSTAG; } <St_Para,St_HtmlOnly>"$("{ID}")" { /* environment variable */ @@ -759,6 +768,14 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} <St_Code,St_XmlCode>. { g_token->verb+=yytext; } +<St_HtmlOnlyOption>" [block]" { // the space is added in commentscan.l + g_token->name="block"; + BEGIN(St_HtmlOnly); + } +<St_HtmlOnlyOption>.|\n { + unput(*yytext); + BEGIN(St_HtmlOnly); + } <St_HtmlOnly>{CMD}"endhtmlonly" { return RetVal_OK; } @@ -1024,7 +1041,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} g_token->name = types+"#"+params.mid(i); return TK_WORD; } -<St_Param>[^ \t\n,]+ { +<St_Param>[^ \t\n,@\\]+ { g_token->name = yytext; if (g_token->name.at(yyleng-1)==':') { @@ -1247,7 +1264,8 @@ void doctokenizerYYsetStateXmlCode() void doctokenizerYYsetStateHtmlOnly() { g_token->verb=""; - BEGIN(St_HtmlOnly); + g_token->name=""; + BEGIN(St_HtmlOnlyOption); } void doctokenizerYYsetStateManOnly() diff --git a/src/docvisitor.h b/src/docvisitor.h index d12295c..a444b47 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/dot.cpp b/src/dot.cpp index 8d9ba3f..051a438 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -783,10 +783,11 @@ class DotNodeList : public QList<DotNode> public: DotNodeList() : QList<DotNode>() {} ~DotNodeList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { - return qstricmp(((DotNode *)item1)->m_label,((DotNode *)item2)->m_label); - } + private: + int compareValues(const DotNode *n1,const DotNode *n2) const + { + return qstricmp(n1->m_label,n2->m_label); + } }; //-------------------------------------------------------------------- @@ -1101,7 +1102,7 @@ bool DotFilePatcher::run() } else // error invalid map id! { - err("Found invalid bounding FIG id in file %s!\n",mapId,m_patchFile.data()); + err("Found invalid bounding FIG %d in file %s!\n",mapId,m_patchFile.data()); t << line; } } @@ -1223,7 +1224,7 @@ DotManager *DotManager::instance() return m_theInstance; } -DotManager::DotManager() : m_dotMaps(1007) +DotManager::DotManager() : m_dotMaps(1009) { m_dotRuns.setAutoDelete(TRUE); m_dotMaps.setAutoDelete(TRUE); @@ -2461,8 +2462,12 @@ void DotGfxHierarchyTable::addClassList(ClassSDict *cl) for (cli.toLast();(cd=cli.current());--cli) { //printf("Trying %s subClasses=%d\n",cd->name().data(),cd->subClasses()->count()); - if (cd->getLanguage()==SrcLangExt_VHDL && !(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) - continue; + if (cd->getLanguage()==SrcLangExt_VHDL && + (VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS + ) + { + continue; + } if (!hasVisibleRoot(cd->baseClasses()) && cd->isVisibleInHierarchy() ) // root node in the forest @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 41fca96..26eda84 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -220,7 +220,7 @@ class Statistics } void end() { - stats.last()->elapsed=((double)time.elapsed())/1000.0; + stats.getLast()->elapsed=((double)time.elapsed())/1000.0; } void print() { @@ -996,8 +996,9 @@ static Definition *findScope(Entry *root,int level=0) * 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. */ -static Definition *buildScopeFromQualifiedName(const QCString name,int level,SrcLangExt lang) +static Definition *buildScopeFromQualifiedName(const QCString name,int level,SrcLangExt lang,TagInfo *tagInfo) { + //printf("buildScopeFromQualifiedName(%s) level=%d\n",name.data(),level); int i=0; int p=0,l; Definition *prevScope=Doxygen::globalScope; @@ -1020,9 +1021,11 @@ static Definition *buildScopeFromQualifiedName(const QCString name,int level,Src else if (nd==0 && cd==0) // scope is not known! { // introduce bogus namespace - //printf("++ adding dummy namespace %s to %s\n",nsName.data(),prevScope->name().data()); + //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",nsName.data(),prevScope->name().data(),tagInfo); nd=new NamespaceDef( - "[generated]",1,1,fullScope); + "[generated]",1,1,fullScope, + tagInfo?tagInfo->tagName:QCString(), + tagInfo?tagInfo->fileName:QCString()); nd->setLanguage(lang); // add namespace to the list @@ -1109,7 +1112,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr // so use this instead. QCString fqn = QCString(ui.currentKey())+ scope.right(scope.length()-p); - resultScope = buildScopeFromQualifiedName(fqn,fqn.contains("::"),startScope->getLanguage()); + resultScope = buildScopeFromQualifiedName(fqn,fqn.contains("::"),startScope->getLanguage(),0); //printf("Creating scope from fqn=%s result %p\n",fqn.data(),resultScope); if (resultScope) { @@ -1295,22 +1298,23 @@ static void addClassToContext(EntryNav *rootNav) QCString tagName; QCString refFileName; - if (rootNav->tagInfo()) + TagInfo *tagInfo = rootNav->tagInfo(); + if (tagInfo) { - tagName = rootNav->tagInfo()->tagName; - refFileName = rootNav->tagInfo()->fileName; + tagName = tagInfo->tagName; + refFileName = tagInfo->fileName; int i; if ((i=fullName.find("::"))!=-1) // symbols imported via tag files may come without the parent scope, // so we artificially create it here { - buildScopeFromQualifiedName(fullName,fullName.contains("::"),root->lang); + buildScopeFromQualifiedName(fullName,fullName.contains("::"),root->lang,tagInfo); } } cd=new ClassDef(root->fileName,root->startLine,root->startColumn, fullName,sec,tagName,refFileName,TRUE,root->spec&Entry::Enum); - Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d\n", - fullName.data(),sec,root->tArgLists ? (int)root->tArgLists->count() : -1); + Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d tagInfo=%p\n", + fullName.data(),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); @@ -1443,7 +1447,7 @@ static void resolveClassNestingRelations() //printf("processing unresolved=%s, iteration=%d\n",cd->name().data(),iteration); /// create the scope artificially // anyway, so we can at least relate scopes properly. - Definition *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage()); + Definition *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage(),0); 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! @@ -1748,13 +1752,16 @@ static void buildNamespaceList(EntryNav *rootNav) { QCString tagName; QCString tagFileName; - if (rootNav->tagInfo()) + TagInfo *tagInfo = rootNav->tagInfo(); + if (tagInfo) { - tagName=rootNav->tagInfo()->tagName; - tagFileName=rootNav->tagInfo()->fileName; + tagName = tagInfo->tagName; + tagFileName = tagInfo->fileName; } - //printf("++ new namespace %s lang=%s\n",fullName.data(),langToString(root->lang).data()); - NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine,root->startColumn,fullName,tagName,tagFileName,root->type,root->spec&Entry::Published); + //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data()); + NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine, + root->startColumn,fullName,tagName,tagFileName, + root->type,root->spec&Entry::Published); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->addSectionsToDefinition(root->anchors); @@ -1786,7 +1793,7 @@ static void buildNamespaceList(EntryNav *rootNav) if (d==0) // we didn't find anything, create the scope artificially // anyway, so we can at least relate scopes properly. { - Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage()); + Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo); d->addInnerCompound(nd); nd->setOuterScope(d); // TODO: Due to the order in which the tag file is written @@ -2319,7 +2326,7 @@ static MemberDef *addVariableToClass( root->fileName,root->startLine,root->startColumn, root->type,name,root->args,root->exception, prot,Normal,root->stat,related, - mtype,root->tArgLists ? root->tArgLists->last() : 0,0); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0); md->setTagInfo(rootNav->tagInfo()); md->setMemberClass(cd); // also sets outer scope (i.e. getOuterScope()) //md->setDefFile(root->fileName); @@ -2556,7 +2563,7 @@ static MemberDef *addVariableToFile( root->fileName,root->startLine,root->startColumn, root->type,name,root->args,0, Public, Normal,root->stat,Member, - mtype,root->tArgLists ? root->tArgLists->last() : 0,0); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0); md->setTagInfo(rootNav->tagInfo()); md->setMemberSpecifiers(root->spec); md->setDocumentation(root->doc,root->docFile,root->docLine); @@ -3245,7 +3252,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, root->stat && root->relatesType != MemberOf, root->relates.isEmpty() ? Member : root->relatesType == MemberOf ? Foreign : Related, - mtype,root->tArgLists ? root->tArgLists->last() : 0,root->argList); + mtype,root->tArgLists ? root->tArgLists->getLast() : 0,root->argList); md->setTagInfo(rootNav->tagInfo()); md->setMemberClass(cd); md->setDocumentation(root->doc,root->docFile,root->docLine); @@ -3535,9 +3542,9 @@ static void buildFunctionList(EntryNav *rootNav) ) { GroupDef *gd=0; - if (root->groups->first()!=0) + if (root->groups->getFirst()!=0) { - gd = Doxygen::groupSDict->find(root->groups->first()->groupname.data()); + gd = Doxygen::groupSDict->find(root->groups->getFirst()->groupname.data()); } //printf("match!\n"); //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); @@ -3598,7 +3605,7 @@ static void buildFunctionList(EntryNav *rootNav) md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph); // merge ingroup specifiers - if (md->getGroupDef()==0 && root->groups->first()!=0) + if (md->getGroupDef()==0 && root->groups->getFirst()!=0) { addMemberToGroups(root,md); } @@ -3607,7 +3614,7 @@ static void buildFunctionList(EntryNav *rootNav) //printf("existing member is grouped, new member not\n"); root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); } - else if (md->getGroupDef()!=0 && root->groups->first()!=0) + else if (md->getGroupDef()!=0 && root->groups->getFirst()!=0) { //printf("both members are grouped\n"); } @@ -3629,7 +3636,7 @@ static void buildFunctionList(EntryNav *rootNav) // root->type.data(),rname.data(),root->args.data(),root->bodyLine); // new global function - ArgumentList *tArgList = root->tArgLists ? root->tArgLists->last() : 0; + ArgumentList *tArgList = root->tArgLists ? root->tArgLists->getLast() : 0; QCString name=removeRedundantWhiteSpace(rname); md=new MemberDef( root->fileName,root->startLine,root->startColumn, @@ -5039,8 +5046,9 @@ static void computeTemplateClassRelations() ArgumentList *templArgs = new ArgumentList; stringToArgumentList(templSpec,templArgs); QList<BaseInfo> *baseList=root->extends; - BaseInfo *bi=baseList->first(); - while (bi) // for each base class of the template + QListIterator<BaseInfo> it(*baseList); + BaseInfo *bi; + for (;(bi=it.current());++it) // for each base class of the template { // check if the base class is a template argument BaseInfo tbi(bi->name,bi->prot,bi->virt); @@ -5082,7 +5090,6 @@ static void computeTemplateClassRelations() } delete actualTemplateNames; } - bi=baseList->next(); } delete templArgs; } // class has no base classes @@ -5102,17 +5109,17 @@ static void computeMemberReferences() for (cli.toFirst();(cd=cli.current());++cli) { cd->computeAnchors(); - } - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + } + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { fd->computeAnchors(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; @@ -5143,8 +5150,8 @@ static void addListReferences() md->visited=FALSE; } } - MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); - for (fnli.toFirst();(mn=fnli.current());++fnli) + MemberNameSDict::Iterator fmnli(*Doxygen::functionNameSDict); + for (fmnli.toFirst();(mn=fmnli.current());++fmnli) { MemberNameIterator mni(*mn); MemberDef *md=0; @@ -5159,30 +5166,34 @@ static void addListReferences() for (cli.toFirst();(cd=cli.current());++cli) { cd->addListReferences(); - } - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + } + + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { fd->addListReferences(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd=0; for (nli.toFirst();(nd=nli.current());++nli) { nd->addListReferences(); } + GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (gli.toFirst();(gd=gli.current());++gli) { gd->addListReferences(); } + PageSDict::Iterator pdi(*Doxygen::pageSDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) @@ -5200,6 +5211,7 @@ static void addListReferences() name,pd->title(),0); } } + DirSDict::Iterator ddi(*Doxygen::directories); DirDef *dd = 0; for (ddi.toFirst();(dd=ddi.current());++ddi) @@ -5486,7 +5498,7 @@ static bool findGlobalMember(EntryNav *rootNav, { //printf("Comparing return types '%s'<->'%s'\n", // md->typeString(),type); - if (md->templateArguments()->count()!=root->tArgLists->last()->count() || + if (md->templateArguments()->count()!=root->tArgLists->getLast()->count() || qstrcmp(md->typeString(),type)!=0) { //printf(" ---> no matching\n"); @@ -5555,6 +5567,15 @@ static bool isSpecialization( return FALSE; } +static bool scopeIsTemplate(Definition *d) +{ + bool result=FALSE; + if (d && d->definitionType()==Definition::TypeClass) + { + result = ((ClassDef*)d)->templateArguments() || scopeIsTemplate(d->getOuterScope()); + } + return result; +} static QCString substituteTemplatesInString( const QList<ArgumentList> &srcTempArgLists, @@ -5579,10 +5600,12 @@ static QCString substituteTemplatesInString( { ArgumentListIterator tsali(*srclali.current()); ArgumentListIterator tdali(*dstlali.current()); + ArgumentListIterator *fali=0; Argument *tsa =0,*tda=0, *fa=0; if (funcTempArgList) { - fa=funcTempArgList->first(); + fali = new ArgumentListIterator(*funcTempArgList); + fa = fali->current(); } for (tsali.toFirst();(tsa=tsali.current()) && !found;++tsali) @@ -5615,11 +5638,13 @@ static QCString substituteTemplatesInString( found=TRUE; } } - if (tda) - ++tdali; - else if (fa) - fa=funcTempArgList->next(); + if (tda) + ++tdali; + else if (fali) + { ++(*fali); fa=fali->current(); } } + + delete fali; //printf(" srcList='%s' dstList='%s faList='%s'\n", // argListToString(srclali.current()).data(), // argListToString(dstlali.current()).data(), @@ -5643,8 +5668,9 @@ static void substituteTemplatesInArgList( ) { ArgumentListIterator sali(*src); + ArgumentListIterator dali(*dst); Argument *sa=0; - Argument *da=dst->first(); + Argument *da=dali.current(); for (sali.toFirst();(sa=sali.current());++sali) // for each member argument { @@ -5666,7 +5692,8 @@ static void substituteTemplatesInArgList( { da->type=dstType; da->type=dstArray; - da=dst->next(); + ++dali; + da=dali.current(); } } dst->constSpecifier = src->constSpecifier; @@ -5862,7 +5889,7 @@ static void findMember(EntryNav *rootNav, // this as a normal method of a template class. if (!(root->tArgLists && root->tArgLists->count()>0 && - root->tArgLists->first()->count()==0 + root->tArgLists->getFirst()->count()==0 ) ) { @@ -5906,10 +5933,10 @@ static void findMember(EntryNav *rootNav, ClassDef *cd=getClass(scopeName); if (cd) { - if (root->tArgLists) root->tArgLists->first(); if (funcSpec.isEmpty()) { - tempScopeName=cd->qualifiedNameWithTemplateParameters(root->tArgLists); + int argListIndex=0; + tempScopeName=cd->qualifiedNameWithTemplateParameters(root->tArgLists,&argListIndex); } else { @@ -5918,7 +5945,7 @@ static void findMember(EntryNav *rootNav, } //printf("scopeName=%s cd=%p root->tArgLists=%p result=%s\n", // scopeName.data(),cd,root->tArgLists,tempScopeName.data()); - + //printf("scopeName=`%s' className=`%s'\n",scopeName.data(),className.data()); // rebuild the function declaration (needed to get the scope right). if (!scopeName.isEmpty() && !isRelated && !isFriend && !Config_getBool("HIDE_SCOPE_NAMES")) @@ -6128,20 +6155,22 @@ static void findMember(EntryNav *rootNav, Debug::print(Debug::FindMembers,0, "5b. Comparing return types '%s'<->'%s' #args %d<->%d\n", md->typeString(),funcType.data(), - md->templateArguments()->count(),root->tArgLists->last()->count()); - if (md->templateArguments()->count()!=root->tArgLists->last()->count() || + md->templateArguments()->count(),root->tArgLists->getLast()->count()); + if (md->templateArguments()->count()!=root->tArgLists->getLast()->count() || qstrcmp(memType,funcType)) { //printf(" ---> no matching\n"); matching = FALSE; } } - bool classIsTemplate = md->getClassDef() && md->getClassDef()->templateArguments(); + bool rootIsUserDoc = (root->section&Entry::MEMBERDOC_SEC)!=0; + bool classIsTemplate = scopeIsTemplate(md->getClassDef()); bool mdIsTemplate = md->templateArguments()!=0; bool classOrMdIsTemplate = mdIsTemplate || classIsTemplate; bool rootIsTemplate = root->tArgLists!=0; //printf("classIsTemplate=%d mdIsTemplate=%d rootIsTemplate=%d\n",classIsTemplate,mdIsTemplate,rootIsTemplate); - if ((mdIsTemplate || rootIsTemplate) && // either md or root is a template + if (!rootIsUserDoc && // don't check out-of-line @fn references, see bug722457 + (mdIsTemplate || rootIsTemplate) && // either md or root is a template ((classOrMdIsTemplate && !rootIsTemplate) || (!classOrMdIsTemplate && rootIsTemplate)) ) { @@ -6467,11 +6496,12 @@ static void findMember(EntryNav *rootNav, MemberName *mn = Doxygen::functionNameSDict->find(funcName); if (mn) { - mdDefine = mn->first(); + MemberNameIterator mni(*mn); + mdDefine = mni.current(); while (mdDefine && !isDefine) { isDefine = isDefine || mdDefine->isDefine(); - if (!isDefine) mdDefine = mn->next(); + if (!isDefine) { ++mni; mdDefine=mni.current(); } } } } @@ -6485,8 +6515,9 @@ static void findMember(EntryNav *rootNav, } else { - MemberDef *rmd=mn->first(); - while (rmd && newMember) // see if we got another member with matching arguments + MemberNameIterator mni(*mn); + MemberDef *rmd; + while ((rmd=mni.current()) && newMember) // see if we got another member with matching arguments { ArgumentList *rmdAl = rmd->argumentList(); @@ -6495,7 +6526,7 @@ static void findMember(EntryNav *rootNav, !matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmdAl, cd,fd,root->argList, TRUE); - if (newMember) rmd=mn->next(); + if (newMember) ++mni; } if (!newMember && rmd) // member already exists as rmd -> add docs { @@ -6543,7 +6574,7 @@ static void findMember(EntryNav *rootNav, root->stat && !isMemberOf, isMemberOf ? Foreign : isRelated ? Related : Member, mtype, - (root->tArgLists ? root->tArgLists->last() : 0), + (root->tArgLists ? root->tArgLists->getLast() : 0), funcArgs.isEmpty() ? 0 : root->argList); if (isDefine && mdDefine) @@ -6579,8 +6610,9 @@ static void findMember(EntryNav *rootNav, MemberName *rmn=Doxygen::functionNameSDict->find(funcName); if (rmn) { - MemberDef *rmd=rmn->first(); - while (rmd && !found) // see if we got another member with matching arguments + MemberNameIterator rmni(*rmn); + MemberDef *rmd; + while ((rmd=rmni.current()) && !found) // see if we got another member with matching arguments { ArgumentList *rmdAl = rmd->argumentList(); // check for matching argument lists @@ -6592,7 +6624,7 @@ static void findMember(EntryNav *rootNav, { found=TRUE; } - if (!found) rmd=rmn->next(); + if (!found) ++rmni; } if (rmd) // member found -> copy line number info { @@ -7423,7 +7455,7 @@ static void findEnumDocumentation(EntryNav *rootNav) md->setRefItems(root->sli); GroupDef *gd=md->getGroupDef(); - if (gd==0 &&root->groups->first()!=0) // member not grouped but out-of-line documentation is + if (gd==0 &&root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -7457,7 +7489,7 @@ static void findEnumDocumentation(EntryNav *rootNav) md->setMemberGroupId(root->mGrpId); GroupDef *gd=md->getGroupDef(); - if (gd==0 && root->groups->first()!=0) // member not grouped but out-of-line documentation is + if (gd==0 && root->groups->getFirst()!=0) // member not grouped but out-of-line documentation is { addMemberToGroups(root,md); } @@ -7574,11 +7606,12 @@ static void computeMemberRelations() for ( ; (mn=mnli.current()) ; ++mnli ) // for each member name { MemberNameIterator mdi(*mn); + MemberNameIterator bmdi(*mn); MemberDef *md; + MemberDef *bmd; for ( ; (md=mdi.current()) ; ++mdi ) // for each member with a specific name { - MemberDef *bmd = mn->first(); // for each other member with the same name - while (bmd) + for ( bmdi.toFirst() ; (bmd=bmdi.current()); ++bmdi ) // for each other member with the same name { ClassDef *mcd = md->getClassDef(); if (mcd && mcd->baseClasses()) @@ -7625,10 +7658,9 @@ static void computeMemberRelations() } } } - bmd = mn->next(); } } - } + } } @@ -8132,16 +8164,16 @@ static void addMembersToMemberGroup() cd->addMembersToMemberGroup(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->addMembersToMemberGroup(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8171,16 +8203,16 @@ static void distributeMemberGroupDocumentation() cd->distributeMemberGroupDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->distributeMemberGroupDocumentation(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8210,16 +8242,16 @@ static void findSectionsInDocumentation() cd->findSectionsInDocumentation(); } // for each file - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (fni.toFirst();(fd=fni.current());++fni) { fd->findSectionsInDocumentation(); - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } // for each namespace NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); @@ -8380,17 +8412,16 @@ static void findDefineDocumentation(EntryNav *rootNav) MemberName *mn=Doxygen::functionNameSDict->find(root->name); if (mn) { + MemberNameIterator mni(*mn); + MemberDef *md; int count=0; - MemberDef *md=mn->first(); - while (md) + for (;(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) count++; - md=mn->next(); } if (count==1) { - md=mn->first(); - while (md) + for (mni.toFirst();(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) { @@ -8409,20 +8440,18 @@ static void findDefineDocumentation(EntryNav *rootNav) if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId); addMemberToGroups(root,md); } - md=mn->next(); } } - else if (count>1 && - (!root->doc.isEmpty() || - !root->brief.isEmpty() || + else if (count>1 && + (!root->doc.isEmpty() || + !root->brief.isEmpty() || root->bodyLine!=-1 ) - ) + ) // multiple defines don't know where to add docs // but maybe they are in different files together with their documentation { - md=mn->first(); - while (md) + for (mni.toFirst();(md=mni.current());++mni) { if (md->memberType()==MemberType_Define) { @@ -8456,7 +8485,6 @@ static void findDefineDocumentation(EntryNav *rootNav) addMemberToGroups(root,md); } } - md=mn->next(); } //warn("define %s found in the following files:\n",root->name.data()); //warn("Cannot determine where to add the documentation found " @@ -8615,15 +8643,30 @@ static void findMainPage(EntryNav *rootNav) Doxygen::mainPage->setShowToc(root->stat); addPageToContext(Doxygen::mainPage,rootNav); - // a page name is a label as well! - SectionInfo *si=new SectionInfo( - indexName, + SectionInfo *si = Doxygen::sectionDict->find(Doxygen::mainPage->name()); + if (si) + { + if (si->lineNr != -1) + { + warn(root->fileName,root->startLine,"multiple use of section label '%s', (first occurrence: %s, line %d)",Doxygen::mainPage->name().data(),si->fileName.data(),si->lineNr); + } + else + { + warn(root->fileName,root->startLine,"multiple use of section label '%s', (first occurrence: %s)",Doxygen::mainPage->name().data(),si->fileName.data()); + } + } + else + { + // a page name is a label as well! but should no be double either + si=new SectionInfo( + indexName, root->startLine, Doxygen::mainPage->name(), Doxygen::mainPage->title(), SectionInfo::Page, 0); // level 0 - Doxygen::sectionDict->append(indexName,si); - Doxygen::mainPage->addSectionsToDefinition(root->anchors); + Doxygen::sectionDict->append(indexName,si); + Doxygen::mainPage->addSectionsToDefinition(root->anchors); + } } else { @@ -9255,16 +9298,15 @@ static void parseFiles(Entry *root,EntryNav *rootNav) // create a dictionary with files to process QDict<void> g_filesToProcess(10007); - QCString *s=g_inputFiles.first(); - while (s) + StringListIterator it(g_inputFiles); + QCString *s; + for (;(s=it.current());++it) { g_filesToProcess.insert(*s,(void*)0x8); - s=g_inputFiles.next(); } - s=g_inputFiles.first(); // process source files (and their include dependencies) - while (s) + for (it.toFirst();(s=it.current());++it) { bool ambig; FileDef *fd=findFileDef(Doxygen::inputNameDict,s->data(),ambig); @@ -9298,11 +9340,9 @@ static void parseFiles(Entry *root,EntryNav *rootNav) parser->finishTranslationUnit(); g_processedFiles.insert(*s,(void*)0x8); } - s=g_inputFiles.next(); } // process remaining files - s=g_inputFiles.first(); - while (s) + for (it.toFirst();(s=it.current());++it) { if (!g_processedFiles.find(*s)) // not yet processed { @@ -9316,14 +9356,14 @@ static void parseFiles(Entry *root,EntryNav *rootNav) parser->finishTranslationUnit(); g_processedFiles.insert(*s,(void*)0x8); } - s=g_inputFiles.next(); } } else // normal pocessing #endif { - QCString *s=g_inputFiles.first(); - while (s) + StringListIterator it(g_inputFiles); + QCString *s; + for (;(s=it.current());++it) { bool ambig; QStrList filesInSameTu; @@ -9332,7 +9372,6 @@ static void parseFiles(Entry *root,EntryNav *rootNav) ParserInterface * parser = getParserForFile(s->data()); parser->startTranslationUnit(s->data()); parseFile(parser,root,rootNav,fd,s->data(),FALSE,filesInSameTu); - s=g_inputFiles.next(); } } } @@ -9800,7 +9839,7 @@ static void devUsage() static void usage(const char *name) { - msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2013\n\n",versionString); + msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2014\n\n",versionString); msg("You can use doxygen in a number of ways:\n\n"); msg("1) Use doxygen to generate a template configuration file:\n"); msg(" %s [-s] -g [configName]\n\n",name); @@ -9853,13 +9892,15 @@ void initDoxygen() initPreprocessor(); Doxygen::parserManager = new ParserManager; - Doxygen::parserManager->registerParser("c", new CLanguageScanner, TRUE); - Doxygen::parserManager->registerParser("python", new PythonLanguageScanner); - Doxygen::parserManager->registerParser("fortran", new FortranLanguageScanner); - Doxygen::parserManager->registerParser("vhdl", new VHDLLanguageScanner); - Doxygen::parserManager->registerParser("dbusxml", new DBusXMLScanner); - Doxygen::parserManager->registerParser("tcl", new TclLanguageScanner); - Doxygen::parserManager->registerParser("md", new MarkdownFileParser); + Doxygen::parserManager->registerParser("c", new CLanguageScanner, TRUE); + Doxygen::parserManager->registerParser("python", new PythonLanguageScanner); + Doxygen::parserManager->registerParser("fortran", new FortranLanguageScanner); + Doxygen::parserManager->registerParser("fortranfree", new FortranLanguageScannerFree); + Doxygen::parserManager->registerParser("fortranfixed", new FortranLanguageScannerFixed); + Doxygen::parserManager->registerParser("vhdl", new VHDLLanguageScanner); + Doxygen::parserManager->registerParser("dbusxml", new DBusXMLScanner); + Doxygen::parserManager->registerParser("tcl", new TclLanguageScanner); + Doxygen::parserManager->registerParser("md", new MarkdownFileParser); // register any additional parsers here... @@ -10327,7 +10368,7 @@ void readConfiguration(int argc, char **argv) } - if (!Config::instance()->parse(configName)) + if (!Config::instance()->parse(configName,updateConfig)) { err("could not open or read configuration file %s!\n",configName); cleanUpDoxygen(); diff --git a/src/doxygen.css b/src/doxygen.css index 3c981f3..2f4bf70 100644 --- a/src/doxygen.css +++ b/src/doxygen.css @@ -670,12 +670,12 @@ span.mlabel { /* @end */ -/* these are for tree view when not used as main index */ +/* these are for tree view inside a (index) page */ div.directory { margin: 10px 0px; - border-top: 1px solid #A8B8D9; - border-bottom: 1px solid #A8B8D9; + border-top: 1px solid ##AA; + border-bottom: 1px solid ##AA; width: 100%; } @@ -734,6 +734,80 @@ div.directory { color: ##50; } +.arrow { + color: ##AA; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: ##88; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + div.dynheader { margin-top: 8px; -webkit-touch-callout: none; diff --git a/src/doxygen.h b/src/doxygen.h index ff9c620..6f766c0 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -65,6 +65,7 @@ class SectionDict; struct MemberGroupInfo; typedef QList<QCString> StringList; +typedef QListIterator<QCString> StringListIterator; //typedef QDict<FileDef> FileDict; //typedef QDict<GroupDef> GroupDict; diff --git a/src/doxygen.pro.in b/src/doxygen.pro.in index d9589e7..8bca741 100644 --- a/src/doxygen.pro.in +++ b/src/doxygen.pro.in @@ -1,7 +1,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -28,6 +28,7 @@ win32-borland:TMAKE_LFLAGS += -L..\lib -L$(BCB)\lib\psdk win32:TMAKE_CXXFLAGS += -DQT_NODLL win32-g++:LIBS = -L../lib -ldoxygen -ldoxycfg -lqtools -lmd5 -liconv -lpthread %%SQLITE3_LIBS%% %%LIBCLANG_LIBS%% -Wl,--as-needed -lole32 win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti +DEPENDPATH += ../generated_src/doxygen INCLUDEPATH += ../qtools ../libmd5 . DESTDIR = ../bin TARGET = doxygen @@ -35,5 +36,5 @@ unix:TARGETDEPS = ../lib/libdoxygen.a ../lib/libdoxycfg.a win32:TARGETDEPS = ..\lib\doxygen.lib ..\lib\doxycfg.lib win32-g++:TARGETDEPS = ../lib/libdoxygen.a ../lib/libdoxycfg.a win32-mingw:TARGETDEPS = ../lib/libdoxygen.a ../lib/libdoxycfg.a -OBJECTS_DIR = ../objects +OBJECTS_DIR = ../objects/doxygen diff --git a/src/doxygen.sty b/src/doxygen.sty index 199abf8..072104b 100644 --- a/src/doxygen.sty +++ b/src/doxygen.sty @@ -450,6 +450,10 @@ \textbf{#1} (\textnormal{#2}\,\pageref{#3})% } +% Used by @addindex +\newcommand{\lcurly}{\{} +\newcommand{\rcurly}{\}} + % Used for syntax highlighting \definecolor{comment}{rgb}{0.5,0.0,0.0} \definecolor{keyword}{rgb}{0.0,0.5,0.0} diff --git a/src/dynsections.js b/src/dynsections.js index ed092c7..85e1836 100644 --- a/src/dynsections.js +++ b/src/dynsections.js @@ -24,19 +24,20 @@ function updateStripes() $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } + function toggleLevel(level) { - $('table.directory tr').each(function(){ + $('table.directory tr').each(function() { var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l<level+1) { - i.attr('src','ftv2folderopen.png'); - a.attr('src','ftv2mnode.png'); + i.removeClass('iconfopen iconfclosed').addClass('iconfopen'); + a.html('▼'); $(this).show(); } else if (l==level+1) { - i.attr('src','ftv2folderclosed.png'); - a.attr('src','ftv2pnode.png'); + i.removeClass('iconfclosed iconfopen').addClass('iconfclosed'); + a.html('►'); $(this).show(); } else { $(this).hide(); @@ -47,34 +48,33 @@ function toggleLevel(level) function toggleFolder(id) { - //The clicked row + // the clicked row var currentRow = $('#row_'+id); - var currentRowImages = currentRow.find("img"); - //All rows after the clicked row + // all rows after the clicked row var rows = currentRow.nextAll("tr"); - //Only match elements AFTER this one (can't hide elements before) - var childRows = rows.filter(function() { - var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub - return this.id.match(re); - }); + var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub - //First row is visible we are HIDING - if (childRows.filter(':first').is(':visible')===true) { - currentRowImages.filter("[id^=arr]").attr('src', 'ftv2pnode.png'); - currentRowImages.filter("[id^=img]").attr('src', 'ftv2folderclosed.png'); - rows.filter("[id^=row_"+id+"]").hide(); - } else { //We are SHOWING - //All sub images - var childImages = childRows.find("img"); - var childImg = childImages.filter("[id^=img]"); - var childArr = childImages.filter("[id^=arr]"); + // only match elements AFTER this one (can't hide elements before) + var childRows = rows.filter(function() { return this.id.match(re); }); - currentRow.find("[id^=arr]").attr('src', 'ftv2mnode.png'); //open row - currentRow.find("[id^=img]").attr('src', 'ftv2folderopen.png'); //open row - childImg.attr('src','ftv2folderclosed.png'); //children closed - childArr.attr('src','ftv2pnode.png'); //children closed + // first row is visible we are HIDING + if (childRows.filter(':first').is(':visible')===true) { + // replace down arrow by right arrow for current row + var currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + currentRowSpans.filter(".arrow").html('►'); + rows.filter("[id^=row_"+id+"]").hide(); // hide all children + } else { // we are SHOWING + // replace right arrow by down arrow for current row + var currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen"); + currentRowSpans.filter(".arrow").html('▼'); + // replace down arrows by right arrows for child rows + var childRowsSpans = childRows.find("span"); + childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + childRowsSpans.filter(".arrow").html('►'); childRows.show(); //show all children } updateStripes(); diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index 213b0fa..6680aeb 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/eclipsehelp.h b/src/eclipsehelp.h index c21c4ae..f0ab78e 100644 --- a/src/eclipsehelp.h +++ b/src/eclipsehelp.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/entry.cpp b/src/entry.cpp index 15263ab..ee3d0ae 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/entry.h b/src/entry.h index cecd095..a861906 100644 --- a/src/entry.h +++ b/src/entry.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/example.h b/src/example.h index 8a2b529..7c86554 100644 --- a/src/example.h +++ b/src/example.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -38,9 +38,10 @@ class ExampleSDict : public SDict<Example> public: ExampleSDict(int size=17) : SDict<Example>(size) {} ~ExampleSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const Example *item1,const Example *item2) const { - return qstricmp(((Example *)item1)->name,((Example *)item2)->name); + return qstricmp(item1->name,item2->name); } }; diff --git a/src/filedef.cpp b/src/filedef.cpp index e286284..5752e8c 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -170,12 +170,19 @@ void FileDef::findSectionsInDocumentation() } } +bool FileDef::hasDetailedDescription() const +{ + static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); + static bool sourceBrowser = Config_getBool("SOURCE_BROWSER"); + return ((!briefDescription().isEmpty() && repeatBrief) || + !documentation().stripWhiteSpace().isEmpty() || // avail empty section + (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) + ); +} + void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) { - if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || - !documentation().stripWhiteSpace().isEmpty() || // avail empty section - (Config_getBool("SOURCE_BROWSER") && getStartBodyLine()!=-1 && getBodyDef()) - ) + if (hasDetailedDescription()) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); @@ -203,6 +210,7 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) // ol.newParagraph(); // FIXME:PARA ol.enableAll(); ol.disableAllBut(OutputGenerator::Man); + ol.enable(OutputGenerator::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } @@ -379,7 +387,7 @@ void FileDef::writeIncludedByGraph(OutputList &ol) { warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); } - if (!incDepGraph.isTrivial()) + else if (!incDepGraph.isTrivial()) { ol.startTextBlock(); ol.disable(OutputGenerator::Man); @@ -772,7 +780,7 @@ void FileDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { - if (md->getFileDef()==this && md->getNamespaceDef()==0 && md->isLinkable()) + if (md->getFileDef()==this && md->getNamespaceDef()==0 && md->isLinkable() && !md->isEnumValue()) { ol.writeString(" <tr><td class=\"navtab\">"); if (md->isLinkableInProject()) @@ -830,9 +838,9 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) getDirDef()->writeNavigationPath(ol); ol.endQuickIndices(); } - startTitle(ol,getOutputFileBase()); + startTitle(ol,getSourceFileBase()); ol.parseText(name()); - endTitle(ol,getOutputFileBase(),title); + endTitle(ol,getSourceFileBase(),title); } else { @@ -1402,7 +1410,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) // add new branch to the root if (!root->children().isEmpty()) { - root->children().last()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(base); return newBranch; @@ -1422,7 +1430,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) Directory *newBranch = new Directory(root,baseName); if (!root->children().isEmpty()) { - root->children().last()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(newBranch); return newBranch; @@ -1437,7 +1445,7 @@ static void mergeFileDef(Directory *root,FileDef *fd) Directory *dirNode = findDirNode(root,filePath); if (!dirNode->children().isEmpty()) { - dirNode->children().last()->setLast(FALSE); + dirNode->children().getLast()->setLast(FALSE); } DirEntry *e=new DirEntry(dirNode,fd); dirNode->addChild(e); @@ -1715,25 +1723,24 @@ void FileDef::addMemberToList(MemberListType lt,MemberDef *md) void FileDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); } } MemberList *FileDef::getMemberList(MemberListType lt) const { - FileDef *that = (FileDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } @@ -1800,3 +1807,7 @@ QCString FileDef::title() const return theTranslator->trFileReference(name()); } +QCString FileDef::fileVersion() const +{ + return m_fileVersion; +} diff --git a/src/filedef.h b/src/filedef.h index d1d7496..a95cd77 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -133,6 +133,10 @@ class FileDef : public Definition ClassSDict *getClassSDict() const { return m_classSDict; } QCString title() const; + bool hasDetailedDescription() const; + QCString fileVersion() const; + + bool subGrouping() const { return m_subGrouping; } //--------------------------------- @@ -237,13 +241,11 @@ class FileList : public QList<FileDef> FileList(const char *path) : QList<FileDef>(), m_pathName(path) {} ~FileList() {} QCString path() const { return m_pathName; } - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const FileDef *md1,const FileDef *md2) const { - FileDef *md1 = (FileDef *)item1; - FileDef *md2 = (FileDef *)item2; return qstricmp(md1->name(),md2->name()); } - private: QCString m_pathName; }; @@ -252,10 +254,9 @@ class OutputNameList : public QList<FileList> public: OutputNameList() : QList<FileList>() {} ~OutputNameList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const FileList *fl1,const FileList *fl2) const { - FileList *fl1 = (FileList *)item1; - FileList *fl2 = (FileList *)item2; return qstricmp(fl1->path(),fl2->path()); } }; diff --git a/src/filename.cpp b/src/filename.cpp index da0dccc..35a1841 100644 --- a/src/filename.cpp +++ b/src/filename.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -34,18 +34,17 @@ FileName::~FileName() void FileName::generateDiskNames() { //QCString commonPrefix; - FileDef *fd=first(); + QListIterator<FileDef> it(*this); + FileDef *fd; int count=0; - while (fd) - { - if (!fd->isReference()) count++; - fd=next(); + for (;(fd=it.current());++it) + { + if (!fd->isReference()) count++; } if (count==1) { - fd=first(); // skip references - while (fd && fd->isReference()) fd=next(); + for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } // name if unique, so diskname is simply the name //printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data()); fd->m_diskName=name; @@ -57,12 +56,11 @@ void FileName::generateDiskNames() bool found=FALSE; while (!found) // search for the common prefix of all paths { - fd=first(); - while (fd && fd->isReference()) fd=next(); + for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } char c=fd->m_path.at(i); if (c=='/') j=i; // remember last position of dirname - fd=next(); - while (fd && !found) + ++it; + while ((fd=it.current()) && !found) { if (!fd->isReference()) { @@ -75,15 +73,14 @@ void FileName::generateDiskNames() } else if (fd->m_path[i]!=c) { - found=TRUE; + found=TRUE; } - } - fd=next(); + } + ++it; } i++; } - fd=first(); - while (fd) + for (it.toFirst();(fd=it.current());++it) { //printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data()); if (!fd->isReference()) @@ -93,15 +90,12 @@ void FileName::generateDiskNames() //printf("!!!!!!!! non unique disk name=%s for fd=%s\n",(prefix+name).data(),fd->diskname.data()); fd->m_diskName=prefix+name; } - fd=next(); } } } -int FileName::compareItems(QCollection::Item item1, QCollection::Item item2) +int FileName::compareValues(const FileDef *f1, const FileDef *f2) const { - FileName *f1=(FileName *)item1; - FileName *f2=(FileName *)item2; return qstricmp(f1->fileName(),f2->fileName()); } @@ -120,20 +114,16 @@ FileNameList::~FileNameList() void FileNameList::generateDiskNames() { - FileName *fn=first(); - while (fn) + FileNameListIterator it(*this); + FileName *fn; + for (;(fn=it.current());++it) { fn->generateDiskNames(); - fn=next(); } } -int FileNameList::compareItems(QCollection::Item item1, QCollection::Item item2) +int FileNameList::compareValues(const FileName *f1, const FileName *f2) const { - FileName *f1=(FileName *)item1; - FileName *f2=(FileName *)item2; - //printf("FileNameList::compareItems `%s'<->`%s'\n", - // f1->fileName(),f2->fileName()); return Config_getBool("FULL_PATH_NAMES") ? qstricmp(f1->fullName(),f2->fullName()) : qstricmp(f1->fileName(),f2->fileName()); diff --git a/src/filename.h b/src/filename.h index 1cd160c..ac7b164 100644 --- a/src/filename.h +++ b/src/filename.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -24,16 +24,16 @@ /** Class representing all files with a certain base name */ class FileName : public FileList -{ +{ public: FileName(const char *fn,const char *name); ~FileName(); const char *fileName() const { return name; } const char *fullName() const { return fName; } void generateDiskNames(); - int compareItems(QCollection::Item item1,QCollection::Item item2); private: + int compareValues(const FileDef *item1,const FileDef *item2) const; QCString name; QCString fName; }; @@ -52,7 +52,8 @@ class FileNameList : public QList<FileName> FileNameList(); ~FileNameList(); void generateDiskNames(); - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const FileName *item1,const FileName *item2) const; }; /** Iterator for FileName objects in a FileNameList. */ diff --git a/src/filestorage.h b/src/filestorage.h index a6ee5b4..0d72923 100644 --- a/src/filestorage.h +++ b/src/filestorage.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/formula.cpp b/src/formula.cpp index 0d3c4cd..9e835e1 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -1,7 +1,7 @@ /****************************************************************************** * * - * Copyright (C) 1997-2013 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 diff --git a/src/formula.h b/src/formula.h index 79821bf..47f7d4b 100644 --- a/src/formula.h +++ b/src/formula.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/fortrancode.h b/src/fortrancode.h index 3913ebb..b64ede7 100644 --- a/src/fortrancode.h +++ b/src/fortrancode.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -15,8 +15,10 @@ * */ -#ifndef CODE_H -#define CODE_H +#ifndef FORTRANCODE_H +#define FORTRANCODE_H + +#include "types.h" class CodeOutputInterface; class FileDef; @@ -28,7 +30,7 @@ void parseFortranCode(CodeOutputInterface &,const char *,const QCString &, bool ,const char *,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool showLineNumbers,Definition *searchCtx, - bool collectRefs); + bool collectRefs, FortranFormat format); void resetFortranCodeParserState(); void codeFreeScanner(); diff --git a/src/fortrancode.l b/src/fortrancode.l index 8ee825b..c31080b 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -154,12 +154,14 @@ static int bracketCount = 0; // simplified way to know if this is fixed form // duplicate in fortranscanner.l -static bool recognizeFixedForm(const char* contents) +static bool recognizeFixedForm(const char* contents, FortranFormat format) { int column=0; bool skipLine=FALSE; - for (int i=0;;i++) + if (format == FortranFormat_Fixed) return TRUE; + if (format == FortranFormat_Free) return FALSE; + for (int i=0;;i++) { column++; @@ -437,9 +439,11 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ // look in local variables - for (Scope *scope=scopeStack.last(); scope!=NULL; scope=scopeStack.prev()) + QListIterator<Scope> it(scopeStack); + Scope *scope; + for (it.toLast();(scope=it.current());--it) { - if(scope->localVars.find(memberName)) + if (scope->localVars.find(memberName)) return FALSE; } @@ -636,13 +640,13 @@ static void endScope() static void addUse(const QCString &moduleName) { if (!scopeStack.isEmpty()) - scopeStack.last()->useNames.append(moduleName); + scopeStack.getLast()->useNames.append(moduleName); } static void addLocalVar(const QCString &varName) { if (!scopeStack.isEmpty()) - scopeStack.last()->localVars.insert(varName, (void*)1); + scopeStack.getLast()->localVars.insert(varName, (void*)1); } //---------------------------------------------------------------------------- @@ -681,14 +685,14 @@ NUM_TYPE (complex|integer|logical|real) LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.) KIND {ARGS} 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_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|IMPURE|ELEMENTAL) ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC) /* Assume that attribute statements are almost the same as attributes. */ ATTR_STMT {ATTR_SPEC}|DIMENSION -FLOW (DO|SELECT|CASE|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT) +FLOW (DO|SELECT|CASE|SELECTCASE|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT) COMMANDS (FORMAT|CONTAINS|MODULE{BS_}PROCEDURE|WRITE|READ|ALLOCATE|ALLOCATED|ASSOCIATED|DEALLOCATE|SIZE|INQUIRE|OPEN|CLOSE|DATA|COMMON) IGNORE (CALL) PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|IMPURE|PURE|ELEMENTAL)? @@ -1106,7 +1110,7 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool,Definition *searchCtx, - bool collectXRefs) + bool collectXRefs, FortranFormat format) { //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd); @@ -1120,7 +1124,7 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri g_code = &od; g_inputString = s; g_inputPosition = 0; - g_isFixedForm = recognizeFixedForm((const char*)s); + g_isFixedForm = recognizeFixedForm((const char*)s,format); g_currentFontClass = 0; g_needsTermination = FALSE; g_searchCtx = searchCtx; diff --git a/src/fortranscanner.h b/src/fortranscanner.h index 41f7790..92a8669 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -27,6 +27,7 @@ class FortranLanguageScanner : public ParserInterface { public: + FortranLanguageScanner(FortranFormat format=FortranFormat_Unknown) : m_format(format) { } virtual ~FortranLanguageScanner() {} void startTranslationUnit(const char *) {} void finishTranslationUnit() {} @@ -53,6 +54,21 @@ class FortranLanguageScanner : public ParserInterface ); void resetCodeParserState(); void parsePrototype(const char *text); + + private: + FortranFormat m_format; +}; + +class FortranLanguageScannerFree : public FortranLanguageScanner +{ + public: + FortranLanguageScannerFree() : FortranLanguageScanner(FortranFormat_Free) { } +}; + +class FortranLanguageScannerFixed : public FortranLanguageScanner +{ + public: + FortranLanguageScannerFixed() : FortranLanguageScanner(FortranFormat_Fixed) { } }; #endif diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 4cdea23..f6616ad 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -187,7 +187,7 @@ static InterfaceType ifType = IF_NONE; static bool functionLine = FALSE; static char stringStartSymbol; // single or double quote -static bool parsingPrototype = FALSE; // see parsePrototype() +static bool parsingPrototype = FALSE; // see parsePrototype() //! Accumulated modifiers of current statement, eg variable declaration. static SymbolModifiers currentModifiers; @@ -255,7 +255,7 @@ NUM_TYPE (complex|integer|logical|real) LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.) KIND {ARGS} 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}?) +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 (ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE) @@ -567,7 +567,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* /*------- type definition -------------------------------------------------------------------------------*/ -<Start,ModuleBody>^{BS}type/[^a-z0-9] { +<Start,ModuleBody>^{BS}type/[^a-z0-9_] { if(YY_START == Start) { addModule(NULL); @@ -1313,11 +1313,14 @@ void truncatePrepass(int index) // simplified way to know if this is fixed form // duplicate in fortrancode.l -static bool recognizeFixedForm(const char* contents) +static bool recognizeFixedForm(const char* contents, FortranFormat format) { int column=0; bool skipLine=FALSE; + if (format == FortranFormat_Fixed) return TRUE; + if (format == FortranFormat_Free) return FALSE; + for(int i=0;;i++) { column++; @@ -2126,7 +2129,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) int lineNr = brief ? current->briefLine : current->docLine; while (parseCommentBlock( g_thisParser, - docBlockInBody ? subrCurrent.first() : current, + docBlockInBody ? subrCurrent.getFirst() : current, doc, // text yyFileName, // file lineNr, @@ -2153,7 +2156,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) { QCString loc_doc; Entry *tmp_entry = current; - current = subrCurrent.first(); // temporarily switch to the entry of the subroutine / function + current = subrCurrent.getFirst(); // temporarily switch to the entry of the subroutine / function // Still in the specification section so no inbodyDocs yet, but parameter documentation current->inbodyDocs = ""; @@ -2243,7 +2246,7 @@ level--; #endif -static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) +static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, FortranFormat format) { char *tmpBuf = NULL; initParser(); @@ -2263,7 +2266,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) inputFile.setName(fileName); if (inputFile.open(IO_ReadOnly)) { - isFixedForm = recognizeFixedForm(fileBuf); + isFixedForm = recognizeFixedForm(fileBuf,format); if (isFixedForm) { @@ -2342,7 +2345,7 @@ void FortranLanguageScanner::parseInput(const char *fileName, printlex(yy_flex_debug, TRUE, __FILE__, fileName); - ::parseMain(fileName,fileBuf,root); + ::parseMain(fileName,fileBuf,root,m_format); printlex(yy_flex_debug, FALSE, __FILE__, fileName); } @@ -2365,7 +2368,7 @@ void FortranLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, { ::parseFortranCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, - showLineNumbers,searchCtx,collectXRefs); + showLineNumbers,searchCtx,collectXRefs,m_format); } bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) diff --git a/src/ftextstream.cpp b/src/ftextstream.cpp index f72185f..3038af3 100644 --- a/src/ftextstream.cpp +++ b/src/ftextstream.cpp @@ -165,6 +165,7 @@ FTextStream::FTextStream( FILE *fh ) { m_dev = new QFile; ((QFile *)m_dev)->open( IO_WriteOnly, fh); + m_owndev = TRUE; } FTextStream::~FTextStream() diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 11d3b1d..4613a92 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -1,7 +1,7 @@ /****************************************************************************** * ftvhelp.cpp,v 1.0 2000/09/06 16:09:00 * - * Copyright (C) 1997-2013 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 @@ -234,6 +234,7 @@ static unsigned char doc_a_png[528] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#if 0 static unsigned char module_png[528] = { 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, @@ -338,6 +339,7 @@ static unsigned char letter_a_png[528] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#endif static unsigned char arrow_right_png[352] = @@ -507,6 +509,7 @@ struct FTVImageInfo //extern FTVImageInfo image_info[]; +#if 0 #define FTVIMG_blank 0 #define FTVIMG_doc 1 #define FTVIMG_folderclosed 2 @@ -553,6 +556,7 @@ static FTVImageInfo image_info[] = { "M", "ftv2mo.png", 0 /*ftv2vertline_png*/ /*,352*/,24,22 }, { 0, 0, 0 /*, 0*/, 0, 0 } }; +#endif static ColoredImgDataItem ftv_image_data[] = { @@ -560,9 +564,9 @@ static ColoredImgDataItem ftv_image_data[] = { "ftv2doc.png", 24, 22, doc_png, doc_a_png }, { "ftv2folderclosed.png", 24, 22, folderclosed_png, folderclosed_a_png }, { "ftv2folderopen.png", 24, 22, folderopen_png, folderopen_a_png }, - { "ftv2ns.png", 24, 22, namespace_png, letter_a_png }, - { "ftv2mo.png", 24, 22, module_png, letter_a_png }, - { "ftv2cl.png", 24, 22, class_png, letter_a_png }, +// { "ftv2ns.png", 24, 22, namespace_png, letter_a_png }, +// { "ftv2mo.png", 24, 22, module_png, letter_a_png }, +// { "ftv2cl.png", 24, 22, class_png, letter_a_png }, { "ftv2lastnode.png", 16, 22, blank_png, blank_png }, { "ftv2link.png", 24, 22, doc_png, doc_a_png }, { "ftv2mlastnode.png", 16, 22, arrow_down_png, arrow_down_a_png }, @@ -780,68 +784,27 @@ QCString FTVHelp::generateIndentLabel(FTVNode *n,int level) { result=generateIndentLabel(n->parent,level+1); } - result+=QCString().sprintf("%d_",n->index); + result+=QCString().setNum(n->index)+"_"; return result; } -void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,int level, bool opened) +void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,bool opened) { - if (n->parent) + int indent=0; + FTVNode *p = n->parent; + while (p) { indent++; p=p->parent; } + if (n->isDir) { - generateIndent(t,n->parent,level+1,opened); + QCString dir = opened ? "▼" : "►"; + t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\"> </span>" + << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" "; + t << "onclick=\"toggleFolder('" << generateIndentLabel(n,0) << "')\""; + t << ">" << dir + << "</span>"; } - // from the root up to node n do... - if (level==0) // item before a dir or document + else { - if (n->isLast) - { - if (n->isDir) - { - t << "<img id=\"arr_" << generateIndentLabel(n,0) - << "\" "; - if (opened) - t << FTV_IMGATTRIBS(mlastnode); - else - t << FTV_IMGATTRIBS(plastnode); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\"/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(lastnode) << "/>"; - } - } - else - { - if (n->isDir) - { - t << "<img id=\"arr_" << generateIndentLabel(n,0) - << "\" "; - if (opened) - t << FTV_IMGATTRIBS(mnode); - else - t << FTV_IMGATTRIBS(pnode); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\"/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(node) << "/>"; - } - } - } - else // item at another level - { - if (n->isLast) - { - t << "<img " << FTV_IMGATTRIBS(blank) << "/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(vertline) << "/>"; - } + t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\"> </span>"; } } @@ -912,7 +875,7 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in index++; t << "><td class=\"entry\">"; bool nodeOpened = level+1<maxLevel; - generateIndent(t,n,0,nodeOpened); + generateIndent(t,n,nodeOpened); if (n->isDir) { if (n->def && n->def->definitionType()==Definition::TypeGroup) @@ -925,29 +888,19 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { - t << "<img "; - t << FTV_IMGATTRIBS(ns); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { - t << "<img "; - t << FTV_IMGATTRIBS(cl); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">C</span></span>"; } else { - t << "<img "; - t << "id=\"img_" << generateIndentLabel(n,0) - << "\" "; - if (nodeOpened) - t << FTV_IMGATTRIBS(folderopen); - else - t << FTV_IMGATTRIBS(folderclosed); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\""; - t << "/>"; + t << "<span id=\"img_" << generateIndentLabel(n,0) + << "\" class=\"iconf" + << (nodeOpened?"open":"closed") + << "\" onclick=\"toggleFolder('" << generateIndentLabel(n,0) + << "')\"> </span>"; } generateLink(t,n); t << "</td><td class=\"desc\">"; @@ -983,21 +936,15 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { - t << "<img "; - t << FTV_IMGATTRIBS(ns); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { - t << "<img "; - t << FTV_IMGATTRIBS(cl); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">C</span></span>"; } else { - t << "<img "; - t << FTV_IMGATTRIBS(doc); - t << "/>"; + t << "<span class=\"icondoc\"></span>"; } if (srcRef) { @@ -1023,15 +970,16 @@ struct NavIndexEntry QCString path; }; -class NavIndexEntryList : public QList<NavIndexEntry> +class NavIndexEntryList : public QList<NavIndexEntry> { public: NavIndexEntryList() : QList<NavIndexEntry>() { setAutoDelete(TRUE); } ~NavIndexEntryList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const NavIndexEntry *item1,const NavIndexEntry *item2) const { // sort list based on url - return qstrcmp(((NavIndexEntry*)item1)->url,((NavIndexEntry*)item2)->url); + return qstrcmp(item1->url,item2->url); } }; diff --git a/src/ftvhelp.h b/src/ftvhelp.h index 9794d8b..bddb2f0 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -64,7 +64,7 @@ class FTVHelp : public IndexIntf //bool generateJSTree(FTextStream &tidx,FTextStream &t,const QList<FTVNode> &nl,int level,bool &first); //bool generateJSTreeTopLevel(FTextStream &tidx,FTextStream &t,const QList<FTVNode> &nl,int level,bool &first); QCString generateIndentLabel(FTVNode *n,int level); - void generateIndent(FTextStream &t,FTVNode *n,int level,bool opened); + void generateIndent(FTextStream &t,FTVNode *n,bool opened); void generateLink(FTextStream &t,FTVNode *n); //void generateJSLink(FTextStream &t,FTVNode *n); QList<FTVNode> *m_indentNodes; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 9426c24..85bfb8f 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -581,6 +581,7 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title) // ol.newParagraph(); // FIXME:PARA ol.enableAll(); ol.disableAllBut(OutputGenerator::Man); + ol.enable(OutputGenerator::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } @@ -659,8 +660,9 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - FileDef *fd=fileList->first(); - while (fd) + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); @@ -679,7 +681,6 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - fd=fileList->next(); } ol.endMemberList(); } @@ -697,11 +698,11 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) int count=0; if (groupList->count()>0) { - GroupDef *gd=groupList->first(); - while (gd) + QListIterator<GroupDef> it(*groupList); + GroupDef *gd; + for (;(gd=it.current());++it) { if (gd->isVisible()) count++; - gd=groupList->next(); } } if (count>0) @@ -714,8 +715,9 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) { groupList->sort(); } - GroupDef *gd=groupList->first(); - while (gd) + QListIterator<GroupDef> it(*groupList); + GroupDef *gd; + for (;(gd=it.current());++it) { if (gd->isVisible()) { @@ -738,7 +740,6 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) } ol.endMemberDeclaration(0,0); } - gd=groupList->next(); } ol.endMemberList(); } @@ -753,8 +754,9 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - DirDef *dd=dirList->first(); - while (dd) + QListIterator<DirDef> it(*dirList); + DirDef *dd; + for (;(dd=it.current());++it) { ol.startMemberDeclaration(); ol.startMemberItem(dd->getOutputFileBase(),0); @@ -773,7 +775,6 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); - dd=dirList->next(); } ol.endMemberList(); @@ -1133,7 +1134,7 @@ void GroupDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { - if (md->getGroupDef()==this && md->isLinkable()) + if (md->getGroupDef()==this && md->isLinkable() && !md->isEnumValue()) { ol.writeString(" <tr><td class=\"navtab\">"); if (md->isLinkableInProject()) @@ -1436,26 +1437,24 @@ void GroupDef::addMemberToList(MemberListType lt,MemberDef *md) void GroupDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); } } - MemberList *GroupDef::getMemberList(MemberListType lt) const { - GroupDef *that = (GroupDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (;(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } diff --git a/src/groupdef.h b/src/groupdef.h index bd53ff5..481bece 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -159,9 +159,10 @@ class GroupSDict : public SDict<GroupDef> public: GroupSDict(uint size) : SDict<GroupDef>(size) {} virtual ~GroupSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const GroupDef *item1,const GroupDef *item2) const { - return qstrcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); + return qstrcmp(item1->groupTitle(),item2->groupTitle()); } }; @@ -169,9 +170,9 @@ class GroupSDict : public SDict<GroupDef> class GroupList : public QList<GroupDef> { public: - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const GroupDef *item1,const GroupDef *item2) const { - return qstrcmp(((GroupDef*)item1)->groupTitle(),((GroupDef*)item2)->groupTitle()); + return qstrcmp(item1->groupTitle(),item2->groupTitle()); } }; diff --git a/src/htags.cpp b/src/htags.cpp index 5f0c71a..1e18ae1 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/htags.h b/src/htags.h index 474b098..5173b2b 100644 --- a/src/htags.h +++ b/src/htags.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/htmlattrib.h b/src/htmlattrib.h index 203fb48..e7fd204 100644 --- a/src/htmlattrib.h +++ b/src/htmlattrib.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -40,33 +40,31 @@ class HtmlAttribList : public QList<HtmlAttrib> { clear(); QList<HtmlAttrib>::operator=(l); return *this; } QCString find(const QCString name) const { - HtmlAttribList *that = (HtmlAttribList *)this; + QListIterator<HtmlAttrib> it(*this); QCString result; - HtmlAttrib *attr=that->first(); - while (attr) + HtmlAttrib *attr; + for (;(attr=it.current());++it) { if (attr->name==name) return attr->value; - attr=that->next(); } return result; } QCString toString() const { - HtmlAttribList *that = (HtmlAttribList *)this; + QListIterator<HtmlAttrib> it(*this); QCString result; - HtmlAttrib *attr=that->first(); - while (attr) + HtmlAttrib *attr; + for (;(attr=it.current());++it) { result+=" "+attr->name+"=\""+attr->value+"\""; - attr=that->next(); } return result; } private: - QCollection::Item newItem( QCollection::Item d ) - { return (QCollection::Item)new HtmlAttrib(*(HtmlAttrib *)d); } - void deleteItem(QCollection::Item d) - { delete (HtmlAttrib *)d; } + HtmlAttrib *newValue( HtmlAttrib *v ) const + { return new HtmlAttrib(*v); } + void deleteValue(HtmlAttrib *v) const + { delete v; } }; /*! @brief Html attribute list iterator */ diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 6ccbda4..c70f2c5 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -33,6 +33,7 @@ #include "vhdldocgen.h" #include "filedef.h" #include "memberdef.h" +#include "htmlentity.h" static const int NUM_HTML_LIST_TYPES = 4; static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"}; @@ -43,27 +44,30 @@ static QCString convertIndexWordToAnchor(const QString &word) QCString result; const char *str = word.data(); unsigned char c; - while ((c = *str++)) - { - if ((c >= 'a' && c <= 'z') || // ALPHA - (c >= 'A' && c <= 'A') || // ALPHA - (c >= '0' && c <= '9') || // DIGIT - c == '-' || - c == '.' || - c == '_' || - c == '~' - ) - { - result += c; - } - else + if (str) + { + while ((c = *str++)) { - char enc[4]; - enc[0] = '%'; - enc[1] = hex[(c & 0xf0) >> 4]; - enc[2] = hex[c & 0xf]; - enc[3] = 0; - result += enc; + if ((c >= 'a' && c <= 'z') || // ALPHA + (c >= 'A' && c <= 'A') || // ALPHA + (c >= '0' && c <= '9') || // DIGIT + c == '-' || + c == '.' || + c == '_' || + c == '~' + ) + { + result += c; + } + else + { + char enc[4]; + enc[0] = '%'; + enc[1] = hex[(c & 0xf0) >> 4]; + enc[2] = hex[c & 0xf]; + enc[3] = 0; + result += enc; + } } } return result; @@ -91,7 +95,6 @@ static bool mustBeOutsideParagraph(DocNode *n) case DocNode::Kind_Internal: /* <div> */ case DocNode::Kind_Include: - case DocNode::Kind_Verbatim: case DocNode::Kind_Image: case DocNode::Kind_SecRefList: /* <hr> */ @@ -106,6 +109,11 @@ static bool mustBeOutsideParagraph(DocNode *n) /* \parblock */ case DocNode::Kind_ParBlock: return TRUE; + case DocNode::Kind_Verbatim: + { + DocVerbatim *dv = (DocVerbatim*)n; + return dv->type()!=DocVerbatim::HtmlOnly || dv->isBlock(); + } case DocNode::Kind_StyleChange: return ((DocStyleChange*)n)->style()==DocStyleChange::Preformatted || ((DocStyleChange*)n)->style()==DocStyleChange::Div || @@ -182,110 +190,14 @@ void HtmlDocVisitor::visit(DocWhiteSpace *w) void HtmlDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) - { - case DocSymbol::BSlash: m_t << "\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "©"; break; - case DocSymbol::Tm: m_t << "™"; break; - case DocSymbol::Reg: m_t << "®"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "‘"; break; - case DocSymbol::Rsquo: m_t << "’"; break; - case DocSymbol::Ldquo: m_t << "“"; break; - case DocSymbol::Rdquo: m_t << "”"; break; - case DocSymbol::Ndash: m_t << "–"; break; - case DocSymbol::Mdash: m_t << "—"; break; - case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; - case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; - case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; - case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; - case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; - case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; - case DocSymbol::Szlig: m_t << "ß"; break; - case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; - case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; - case DocSymbol::Nbsp: m_t << " "; break; - case DocSymbol::AElig: m_t << "Æ"; break; - case DocSymbol::Aelig: m_t << "æ"; break; - case DocSymbol::GrkGamma: m_t << "Γ"; break; - case DocSymbol::GrkDelta: m_t << "Δ"; break; - case DocSymbol::GrkTheta: m_t << "Θ"; break; - case DocSymbol::GrkLambda: m_t << "Λ"; break; - case DocSymbol::GrkXi: m_t << "Ξ"; break; - case DocSymbol::GrkPi: m_t << "Π"; break; - case DocSymbol::GrkSigma: m_t << "Σ"; break; - case DocSymbol::GrkUpsilon: m_t << "Υ"; break; - case DocSymbol::GrkPhi: m_t << "Φ"; break; - case DocSymbol::GrkPsi: m_t << "Ψ"; break; - case DocSymbol::GrkOmega: m_t << "Ω"; break; - case DocSymbol::Grkalpha: m_t << "α"; break; - case DocSymbol::Grkbeta: m_t << "β"; break; - case DocSymbol::Grkgamma: m_t << "γ"; break; - case DocSymbol::Grkdelta: m_t << "δ"; break; - case DocSymbol::Grkepsilon: m_t << "ε"; break; - case DocSymbol::Grkzeta: m_t << "ζ"; break; - case DocSymbol::Grketa: m_t << "η"; break; - case DocSymbol::Grktheta: m_t << "θ"; break; - case DocSymbol::Grkiota: m_t << "ι"; break; - case DocSymbol::Grkkappa: m_t << "κ"; break; - case DocSymbol::Grklambda: m_t << "λ"; break; - case DocSymbol::Grkmu: m_t << "μ"; break; - case DocSymbol::Grknu: m_t << "ν"; break; - case DocSymbol::Grkxi: m_t << "ξ"; break; - case DocSymbol::Grkpi: m_t << "π"; break; - case DocSymbol::Grkrho: m_t << "ρ"; break; - case DocSymbol::Grksigma: m_t << "σ"; break; - case DocSymbol::Grktau: m_t << "τ"; break; - case DocSymbol::Grkupsilon: m_t << "υ"; break; - case DocSymbol::Grkphi: m_t << "φ"; break; - case DocSymbol::Grkchi: m_t << "χ"; break; - case DocSymbol::Grkpsi: m_t << "ψ"; break; - case DocSymbol::Grkomega: m_t << "ω"; break; - case DocSymbol::Grkvarsigma: m_t << "ς"; break; - case DocSymbol::Section: m_t << "§"; break; - case DocSymbol::Degree: m_t << "°"; break; - case DocSymbol::Prime: m_t << "′"; break; - case DocSymbol::DoublePrime: m_t << "″"; break; - case DocSymbol::Infinity: m_t << "∞"; break; - case DocSymbol::EmptySet: m_t << "∅"; break; - case DocSymbol::PlusMinus: m_t << "±"; break; - case DocSymbol::Times: m_t << "×"; break; - case DocSymbol::Minus: m_t << "−"; break; - case DocSymbol::CenterDot: m_t << "⋅"; break; - case DocSymbol::Partial: m_t << "∂"; break; - case DocSymbol::Nabla: m_t << "∇"; break; - case DocSymbol::SquareRoot: m_t << "√"; break; - case DocSymbol::Perpendicular: m_t << "⊥"; break; - case DocSymbol::Sum: m_t << "∑"; break; - case DocSymbol::Integral: m_t << "∫"; break; - case DocSymbol::Product: m_t << "∏"; break; - case DocSymbol::Similar: m_t << "∼"; break; - case DocSymbol::Approx: m_t << "≈"; break; - case DocSymbol::NotEqual: m_t << "≠"; break; - case DocSymbol::Equivalent: m_t << "≡"; break; - case DocSymbol::Proportional: m_t << "∝"; break; - case DocSymbol::LessEqual: m_t << "≤"; break; - case DocSymbol::GreaterEqual: m_t << "≥"; break; - case DocSymbol::LeftArrow: m_t << "←"; break; - case DocSymbol::RightArrow: m_t << "→"; break; - case DocSymbol::SetIn: m_t << "∈"; break; - case DocSymbol::SetNotIn: m_t << "∉"; break; - case DocSymbol::LeftCeil: m_t << "⌈"; break; - case DocSymbol::RightCeil: m_t << "⌉"; break; - case DocSymbol::LeftFloor: m_t << "⌊"; break; - case DocSymbol::RightFloor: m_t << "⌋"; break; - default: - err("unknown symbol found\n"); + const char *res = HtmlEntityMapper::instance()->html(s->symbol()); + if (res) + { + m_t << res; + } + else + { + err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } @@ -332,7 +244,7 @@ void HtmlDocVisitor::visit(DocURL *u) void HtmlDocVisitor::visit(DocLineBreak *) { if (m_hide) return; - m_t << "<br/>\n"; + m_t << "<br />\n"; } void HtmlDocVisitor::visit(DocHorRuler *hr) @@ -452,7 +364,9 @@ void HtmlDocVisitor::visit(DocVerbatim *s) forceStartParagraph(s); break; case DocVerbatim::HtmlOnly: + if (s->isBlock()) forceEndParagraph(s); m_t << s->text(); + if (s->isBlock()) forceStartParagraph(s); break; case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: @@ -585,6 +499,8 @@ void HtmlDocVisitor::visit(DocInclude *inc) case DocInclude::HtmlInclude: m_t << inc->text(); break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: forceEndParagraph(inc); m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">"; @@ -1873,7 +1789,7 @@ void HtmlDocVisitor::visitPre(DocVhdlFlow *vf) m_t << "</a>"; if (vf->hasCaption()) { - m_t << "<br/>"; + m_t << "<br />"; } } } @@ -2040,7 +1956,7 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName, } void HtmlDocVisitor::writeDiaFile(const QCString &fileName, - const QCString &, + const QCString &relPath, const QCString &) { QCString baseName=fileName; @@ -2057,7 +1973,7 @@ void HtmlDocVisitor::writeDiaFile(const QCString &fileName, QCString outDir = Config_getString("HTML_OUTPUT"); writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); - m_t << "<img src=\"" << outDir << '/' << baseName << ".png" << "\" />" << endl; + m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />" << endl; } /** Used for items found inside a paragraph, which due to XHTML restrictions @@ -2092,7 +2008,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) //printf("forceEnd first=%d last=%d\n",isFirst,isLast); if (isFirst && isLast) return; - m_t << "</p>" << endl; + m_t << "</p>"; } } diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index fd7c23a..ddefecd 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp new file mode 100644 index 0000000..c49491e --- /dev/null +++ b/src/htmlentity.cpp @@ -0,0 +1,500 @@ +/****************************************************************************** + * + * 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 + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#include "htmlentity.h" +#include "message.h" +#include "ftextstream.h" + +//! Number of doxygen commands mapped as if it were HTML entities +static const int g_numberHtmlMappedCmds = 11; + +//! @brief Structure defining all HTML4 entities, doxygen extensions and doxygen commands representing special symbols. +//! @details In case an entity does not exist a NULL is given for the entity. The first column contains the symbolic code +//! for the entity, see also doxparser.h The second column contains the name of the enitity (without the starting \& and +//! ending ;) +static struct htmlEntityInfo +{ + DocSymbol::SymType symb; + const char *item; + const char *UTF8; + const char *html; + const char *xml; + const char *docbook; + const char *latex; + const char *man; + const char *rtf; + DocSymbol::PerlSymb perl; +} g_htmlEntities[] = +{ +#undef SYM +// helper macro to force consistent entries for the symbol and item columns +#define SYM(s) DocSymbol::Sym_##s,"&"#s";" + // HTML4 entities + // symb+item UTF-8 html xml docbook latex man rtf perl + { SYM(nbsp), "\xc2\xa0", " ", "<nonbreakablespace/>", " ", "~", " ", "\\~", { " ", DocSymbol::Perl_char }}, + { SYM(iexcl), "\xc2\xa1", "¡", "<iexcl/>", "¡", "!`", NULL, "\\'A1", { NULL, DocSymbol::Perl_unknown }}, + { SYM(cent), "\xc2\xa2", "¢", "<cent/>", "¢", "\\textcent{}", NULL, "\\'A2", { NULL, DocSymbol::Perl_unknown }}, + { SYM(pound), "\xc2\xa3", "£", "<pound/>", "£", "{$\\pounds$}", NULL, "\\'A3", { NULL, DocSymbol::Perl_unknown }}, + { SYM(curren), "\xc2\xa4", "¤", "<curren/>", "¤", "\\textcurrency{}", NULL, "\\'A4", { NULL, DocSymbol::Perl_unknown }}, + { SYM(yen), "\xc2\xa5", "¥", "<yen/>", "¥", "{$\\yen$}", NULL, "\\'A5", { NULL, DocSymbol::Perl_unknown }}, + { SYM(brvbar), "\xc2\xa6", "¦", "<brvbar/>", "¦", "\\textbrokenbar{}", NULL, "\\'A6", { NULL, DocSymbol::Perl_unknown }}, + { SYM(sect), "\xc2\xa7", "§", "<sect/>", "<simplesect/>", "{$\\S$}", NULL, "\\'A7", { "sect", DocSymbol::Perl_symbol }}, + { SYM(uml), "\xc2\xa8", "¨", "<umlaut/>", "¨", "\\textasciidieresis{}", " \\*(4", "\\'A8", { " ", DocSymbol::Perl_umlaut }}, + { SYM(copy), "\xc2\xa9", "©", "<copy/>", "©", "\\copyright{}", "(C)", "\\'A9", { "copyright", DocSymbol::Perl_symbol }}, + { SYM(ordf), "\xc2\xaa", "ª", "<ordf/>", "ª", "\\textordfeminine{}", NULL, "\\'AA", { NULL, DocSymbol::Perl_unknown }}, + { SYM(laquo), "\xc2\xab", "«", "<laquo/>", "«", "\\guillemotleft{}", NULL, "\\'AB", { NULL, DocSymbol::Perl_unknown }}, + { SYM(not), "\xc2\xac", "¬", "<not/>", "¬", "\\textlnot", NULL, "\\'AC", { NULL, DocSymbol::Perl_unknown }}, + { SYM(shy), "\xc2\xad", "­", "<shy/>", "­", "{$\\-$}", NULL, "\\-", { NULL, DocSymbol::Perl_unknown }}, + { SYM(reg), "\xc2\xae", "®", "<registered/>", "®", "\\textregistered{}", "(R)", "\\'AE", { "registered", DocSymbol::Perl_symbol }}, + { SYM(macr), "\xc2\xaf", "¯", "<macr/>", "¯", "\\={}", NULL, "\\'AF", { NULL, DocSymbol::Perl_unknown }}, + { SYM(deg), "\xc2\xb0", "°", "<deg/>", "°", "\\textdegree", NULL, "\\'B0", { "deg", DocSymbol::Perl_symbol }}, + { SYM(plusmn), "\xc2\xb1", "±", "<plusmn/>", "±", "{$\\pm$}", NULL, "\\'B1", { "+/-", DocSymbol::Perl_string }}, + { SYM(sup2), "\xc2\xb2", "²", "<sup2/>", "²", "\\texttwosuperior{}", NULL, "\\'B2", { NULL, DocSymbol::Perl_unknown }}, + { SYM(sup3), "\xc2\xb3", "³", "<sup3/>", "³", "\\textthreesuperior{}", NULL, "\\'B3", { NULL, DocSymbol::Perl_unknown }}, + { SYM(acute), "\xc2\xb4", "´", "<acute/>", "´", "\\'{}", NULL, "\\'B4", { " ", DocSymbol::Perl_acute }}, + { SYM(micro), "\xc2\xb5", "µ", "<micro/>", "µ", "{$\\mu$}", NULL, "\\'B5", { NULL, DocSymbol::Perl_unknown }}, + { SYM(para), "\xc2\xb6", "¶", "<para/>", "¶", "{$\\P$}", NULL, "\\'B6", { NULL, DocSymbol::Perl_unknown }}, + { SYM(middot), "\xc2\xb7", "·", "<middot/>", "·", "\\textperiodcentered{}", NULL, "\\'B7", { NULL, DocSymbol::Perl_unknown }}, + { SYM(cedil), "\xc2\xb8", "¸", "<cedil/>", "¸", "\\c{}", " \\*,", "\\'B8", { " ", DocSymbol::Perl_cedilla }}, + { SYM(sup1), "\xc2\xb9", "¹", "<sup1/>", "¹", "\\textonesuperior{}", NULL, "\\'B9", { NULL, DocSymbol::Perl_unknown }}, + { SYM(ordm), "\xc2\xba", "º", "<ordm/>", "º", "\\textordmasculine{}", NULL, "\\'BA", { NULL, DocSymbol::Perl_unknown }}, + { SYM(raquo), "\xc2\xbb", "»", "<raquo/>", "»", "\\guillemotright{}", NULL, "\\'BB", { NULL, DocSymbol::Perl_unknown }}, + { SYM(frac14), "\xc2\xbc", "¼", "<frac14/>", "¼", "{$\\frac14$}", "1/4", "\\'BC", { NULL, DocSymbol::Perl_unknown }}, + { SYM(frac12), "\xc2\xbd", "½", "<frac12/>", "½", "{$\\frac12$}", "1/2", "\\'BD", { NULL, DocSymbol::Perl_unknown }}, + { SYM(frac34), "\xc2\xbe", "¾", "<frac34/>", "¾", "{$\\frac34$}", "3/4", "\\'BE", { NULL, DocSymbol::Perl_unknown }}, + { SYM(iquest), "\xc2\xbf", "¿", "<iquest/>", "¿", "?`", NULL, "\\'BF", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Agrave), "\xc3\x80", "À", "<Agrave/>", "À", "\\`{A}", "A\\*:", "\\'C0", { "A", DocSymbol::Perl_grave }}, + { SYM(Aacute), "\xc3\x81", "Á", "<Aacute/>", "Á", "\\'{A}", "A\\*(`", "\\'C1", { "A", DocSymbol::Perl_acute }}, + { SYM(Acirc), "\xc3\x82", "Â", "<Acirc/>", "Â", "\\^{A}", "A\\*^", "\\'C2", { "A", DocSymbol::Perl_circ }}, + { SYM(Atilde), "\xc3\x83", "Ã", "<Atilde/>", "Ã", "\\~{A}", "A\\*~", "\\'C3", { "A", DocSymbol::Perl_tilde }}, + { SYM(Auml), "\xc3\x84", "Ä", "<Aumlaut/>", "Ä", "\\\"{A}", "A\\*(4", "\\'C4", { "A", DocSymbol::Perl_umlaut }}, + { SYM(Aring), "\xc3\x85", "Å", "<Aring/>", "Å", "\\AA", "A\\*o", "\\'C5", { "A", DocSymbol::Perl_ring }}, + { SYM(AElig), "\xc3\x86", "Æ", "<AElig/>", "Æ", "{\\AE}", NULL, "\\'C6", { "AElig", DocSymbol::Perl_symbol }}, + { SYM(Ccedil), "\xc3\x87", "Ç", "<Ccedil/>", "Ç", "\\c{C}", "C\\*,", "\\'C7", { "C", DocSymbol::Perl_cedilla }}, + { SYM(Egrave), "\xc3\x88", "È", "<Egrave/>", "È", "\\`{E}", "E\\*:", "\\'C8", { "E", DocSymbol::Perl_grave }}, + { SYM(Eacute), "\xc3\x89", "É", "<Eacute/>", "É", "\\'{E}", "E\\*(`", "\\'C9", { "E", DocSymbol::Perl_acute }}, + { SYM(Ecirc), "\xc3\x8a", "Ê", "<Ecirc/>", "Ê", "\\^{E}", "E\\*^", "\\'CA", { "E", DocSymbol::Perl_circ }}, + { SYM(Euml), "\xc3\x8b", "Ë", "<Eumlaut/>", "Ë", "\\\"{E}", "E\\*(4", "\\'CB", { "E", DocSymbol::Perl_umlaut }}, + { SYM(Igrave), "\xc3\x8c", "Ì", "<Igrave/>", "Ì", "\\`{I}", "I\\*:", "\\'CC", { "I", DocSymbol::Perl_grave }}, + { SYM(Iacute), "\xc3\x8d", "Í", "<Iacute/>", "Í", "\\'{I}", "I\\*(`", "\\'CD", { "I", DocSymbol::Perl_acute }}, + { SYM(Icirc), "\xc3\x8e", "Î", "<Icirc/>", "Î", "\\^{I}", "I\\*^", "\\'CE", { "I", DocSymbol::Perl_circ }}, + { SYM(Iuml), "\xc3\x8f", "Ï", "<Iumlaut/>", "Ï", "\\\"{I}", "I\\*(4", "\\'CF", { "I", DocSymbol::Perl_umlaut }}, + { SYM(ETH), "\xc3\x90", "Ð", "<ETH/>", "Ð", "\\DH", NULL, "\\'D0", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Ntilde), "\xc3\x91", "Ñ", "<Ntilde/>", "Ñ", "\\~{N}", "N\\*~", "\\'D1", { "N", DocSymbol::Perl_tilde }}, + { SYM(Ograve), "\xc3\x92", "Ò", "<Ograve/>", "Ò", "\\`{O}", "O\\*:", "\\'D2", { "O", DocSymbol::Perl_grave }}, + { SYM(Oacute), "\xc3\x93", "Ó", "<Oacute/>", "Ó", "\\'{O}", "O\\*(`", "\\'D3", { "O", DocSymbol::Perl_acute }}, + { SYM(Ocirc), "\xc3\x94", "Ô", "<Ocirc/>", "Ô", "\\^{O}", "O\\*^", "\\'D4", { "O", DocSymbol::Perl_circ }}, + { SYM(Otilde), "\xc3\x95", "Õ", "<Otilde/>", "Õ", "\\~{O}", "O\\*~", "\\'D5", { "O", DocSymbol::Perl_tilde }}, + { SYM(Ouml), "\xc3\x96", "Ö", "<Oumlaut/>", "Ö", "\\\"{O}", "O\\*(4", "\\'D6", { "O", DocSymbol::Perl_umlaut }}, + { SYM(times), "\xc3\x97", "×", "<times/>", "×", "{$\\times$}", NULL, "\\'D7", { "*", DocSymbol::Perl_char }}, + { SYM(Oslash), "\xc3\x98", "Ø", "<Oslash/>", "Ø", "{\\O}", "O\x08/", "\\'D8", { "O", DocSymbol::Perl_slash }}, + { SYM(Ugrave), "\xc3\x99", "Ù", "<Ugrave/>", "Ù", "\\`{U}", "U\\*:", "\\'D9", { "U", DocSymbol::Perl_grave }}, + { SYM(Uacute), "\xc3\x9a", "Ú", "<Uacute/>", "Ú", "\\'{U}", "U\\*(`", "\\'DA", { "U", DocSymbol::Perl_acute }}, + { SYM(Ucirc), "\xc3\x9b", "Û", "<Ucirc/>", "Û", "\\^{U}", "U\\*^", "\\'DB", { "U", DocSymbol::Perl_circ }}, + { SYM(Uuml), "\xc3\x9c", "Ü", "<Uumlaut/>", "Ü", "\\\"{U}", "U\\*(4", "\\'DC", { "U", DocSymbol::Perl_umlaut }}, + { SYM(Yacute), "\xc3\x9d", "Ý", "<Yacute/>", "Ý", "\\'{Y}", "Y\\*(`", "\\'DD", { "Y", DocSymbol::Perl_acute }}, + { SYM(THORN), "\xc3\x9e", "Þ", "<THORN/>", "Þ", "\\TH", NULL, "\\'DE", { NULL, DocSymbol::Perl_unknown }}, + { SYM(szlig), "\xc3\x9f", "ß", "<szlig/>", "ß", "{\\ss}", "s\\*:", "\\'DF", { "szlig", DocSymbol::Perl_symbol }}, + { SYM(agrave), "\xc3\xa0", "à", "<agrave/>", "à", "\\`{a}", "a\\*:", "\\'E0", { "a", DocSymbol::Perl_grave }}, + { SYM(aacute), "\xc3\xa1", "á", "<aacute/>", "á", "\\'{a}", "a\\*(`", "\\'E1", { "a", DocSymbol::Perl_acute }}, + { SYM(acirc), "\xc3\xa2", "â", "<acirc/>", "â", "\\^{a}", "a\\*^", "\\'E2", { "a", DocSymbol::Perl_circ }}, + { SYM(atilde), "\xc3\xa3", "ã", "<atilde/>", "ã", "\\~{a}", "a\\*~", "\\'E3", { "a", DocSymbol::Perl_tilde }}, + { SYM(auml), "\xc3\xa4", "ä", "<aumlaut/>", "ä", "\\\"{a}", "a\\*(4", "\\'E4", { "a", DocSymbol::Perl_umlaut }}, + { SYM(aring), "\xc3\xa5", "å", "<aring/>", "å", "\\aa", "a\\*o", "\\'E5", { "a", DocSymbol::Perl_ring }}, + { SYM(aelig), "\xc3\xa6", "æ", "<aelig/>", "æ", "{\\ae}", NULL, "\\'E6", { "aelig", DocSymbol::Perl_symbol }}, + { SYM(ccedil), "\xc3\xa7", "ç", "<ccedil/>", "ç", "\\c{c}", "c\\*,", "\\'E7", { "c", DocSymbol::Perl_cedilla }}, + { SYM(egrave), "\xc3\xa8", "è", "<egrave/>", "è", "\\`{e}", "e\\*:", "\\'E8", { "e", DocSymbol::Perl_grave }}, + { SYM(eacute), "\xc3\xa9", "é", "<eacute/>", "é", "\\'{e}", "e\\*(`", "\\'E9", { "e", DocSymbol::Perl_acute }}, + { SYM(ecirc), "\xc3\xaa", "ê", "<ecirc/>", "ê", "\\^{e}", "e\\*^", "\\'EA", { "e", DocSymbol::Perl_circ }}, + { SYM(euml), "\xc3\xab", "ë", "<eumlaut/>", "ë", "\\\"{e}", "e\\*(4", "\\'EB", { "e", DocSymbol::Perl_umlaut }}, + { SYM(igrave), "\xc3\xac", "ì", "<igrave/>", "ì", "\\`{\\i}", "i\\*:", "\\'EC", { "i", DocSymbol::Perl_grave }}, + { SYM(iacute), "\xc3\xad", "í", "<iacute/>", "í", "\\'{\\i}", "i\\*(`", "\\'ED", { "i", DocSymbol::Perl_acute }}, + { SYM(icirc), "\xc3\xae", "î", "<icirc/>", "î", "\\^{\\i}", "i\\*^", "\\'EE", { "i", DocSymbol::Perl_circ }}, + { SYM(iuml), "\xc3\xaf", "ï", "<iumlaut/>", "ï", "\\\"{\\i}", "i\\*(4", "\\'EF", { "i", DocSymbol::Perl_umlaut }}, + { SYM(eth), "\xc3\xb0", "ð", "<eth/>", "ð", "\\dh", NULL, "\\'F0", { NULL, DocSymbol::Perl_unknown }}, + { SYM(ntilde), "\xc3\xb1", "ñ", "<ntilde/>", "ñ", "\\~{n}", "n\\*~", "\\'F1", { "n", DocSymbol::Perl_tilde }}, + { SYM(ograve), "\xc3\xb2", "ò", "<ograve/>", "ò", "\\`{o}", "o\\*:", "\\'F2", { "o", DocSymbol::Perl_grave }}, + { SYM(oacute), "\xc3\xb3", "ó", "<oacute/>", "ó", "\\'{o}", "o\\*(`", "\\'F3", { "o", DocSymbol::Perl_acute }}, + { SYM(ocirc), "\xc3\xb4", "ô", "<ocirc/>", "ô", "\\^{o}", "o\\*^", "\\'F4", { "o", DocSymbol::Perl_circ }}, + { SYM(otilde), "\xc3\xb5", "õ", "<otilde/>", "õ", "\\~{o}", "o\\*~", "\\'F5", { "o", DocSymbol::Perl_tilde }}, + { SYM(ouml), "\xc3\xb6", "ö", "<oumlaut/>", "ö", "\\\"{o}", "o\\*(4", "\\'F6", { "o", DocSymbol::Perl_umlaut }}, + { SYM(divide), "\xc3\xb7", "÷", "<divide/>", "÷", "{$\\div$}", NULL, "\\'F7", { NULL, DocSymbol::Perl_unknown }}, + { SYM(oslash), "\xc3\xb8", "ø", "<oslash/>", "ø", "{\\o}", "o\x08/", "\\'F8", { "o", DocSymbol::Perl_slash }}, + { SYM(ugrave), "\xc3\xb9", "ù", "<ugrave/>", "ù", "\\`{u}", "u\\*:", "\\'F9", { "u", DocSymbol::Perl_grave }}, + { SYM(uacute), "\xc3\xba", "ú", "<uacute/>", "ú", "\\'{u}", "u\\*(`", "\\'FA", { "u", DocSymbol::Perl_acute }}, + { SYM(ucirc), "\xc3\xbb", "û", "<ucirc/>", "û", "\\^{u}", "u\\*^", "\\'FB", { "u", DocSymbol::Perl_circ }}, + { SYM(uuml), "\xc3\xbc", "ü", "<uumlaut/>", "ü", "\\\"{u}", "u\\*(4", "\\'FC", { "u", DocSymbol::Perl_umlaut }}, + { SYM(yacute), "\xc3\xbd", "ý", "<yacute/>", "ý", "\\'{y}", "y\\*(`", "\\'FD", { "y", DocSymbol::Perl_acute }}, + { SYM(thorn), "\xc3\xbe", "þ", "<thorn/>", "þ", "\\th", NULL, "\\'FE", { NULL, DocSymbol::Perl_unknown }}, + { SYM(yuml), "\xc3\xbf", "ÿ", "<yumlaut/>", "ÿ", "\\\"{y}", "y\\*(4", "\\'FF", { "y", DocSymbol::Perl_umlaut }}, + { SYM(fnof), "\xc6\x92", "ƒ", "<fnof/>", "ƒ", "\\textflorin", NULL, "\\'83", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Alpha), "\xce\x91", "Α", "<Alpha/>", "Α", "A", NULL, "\\u0913?", { "A", DocSymbol::Perl_char }}, + { SYM(Beta), "\xce\x92", "Β", "<Beta/>", "Β", "B", NULL, "\\u0914?", { "B", DocSymbol::Perl_char }}, + { SYM(Gamma), "\xce\x93", "Γ", "<Gamma/>", "Γ", "{$\\Gamma$}", NULL, "\\u0915?", { "Gamma", DocSymbol::Perl_symbol }}, + { SYM(Delta), "\xce\x94", "Δ", "<Delta/>", "Δ", "{$\\Delta$}", NULL, "\\u0916?", { "Delta", DocSymbol::Perl_symbol }}, + { SYM(Epsilon), "\xce\x95", "Ε", "<Epsilon/>", "Ε", "E", NULL, "\\u0917?", { "E", DocSymbol::Perl_char }}, + { SYM(Zeta), "\xce\x96", "Ζ", "<Zeta/>", "Ζ", "Z", NULL, "\\u0918?", { "Z", DocSymbol::Perl_char }}, + { SYM(Eta), "\xce\x97", "Η", "<Eta/>", "Η", "H", NULL, "\\u0919?", { "H", DocSymbol::Perl_char }}, + { SYM(Theta), "\xce\x98", "Θ", "<Theta/>", "Θ", "{$\\Theta$}", NULL, "\\u0920?", { "Theta", DocSymbol::Perl_symbol }}, + { SYM(Iota), "\xce\x99", "Ι", "<Iota/>", "Ι", "I", NULL, "\\u0921?", { "I", DocSymbol::Perl_char }}, + { SYM(Kappa), "\xce\x9a", "Κ", "<Kappa/>", "Κ", "K", NULL, "\\u0922?", { "K", DocSymbol::Perl_char }}, + { SYM(Lambda), "\xce\x9b", "Λ", "<Lambda/>", "Λ", "{$\\Lambda$}", NULL, "\\u0923?", { "Lambda", DocSymbol::Perl_symbol }}, + { SYM(Mu), "\xce\x9c", "Μ", "<Mu/>", "Μ", "M", NULL, "\\u0924?", { "M", DocSymbol::Perl_char }}, + { SYM(Nu), "\xce\x9d", "Ν", "<Nu/>", "Ν", "N", NULL, "\\u0925?", { "N", DocSymbol::Perl_char }}, + { SYM(Xi), "\xce\x9e", "Ξ", "<Xi/>", "Ξ", "{$\\Xi$}", NULL, "\\u0926?", { "Xi", DocSymbol::Perl_symbol }}, + { SYM(Omicron), "\xce\x9f", "Ο", "<Omicron/>", "Ο", "O", NULL, "\\u0927?", { "O", DocSymbol::Perl_char }}, + { SYM(Pi), "\xce\xa0", "Π", "<Pi/>", "Π", "{$\\Pi$}", NULL, "\\u0928?", { "Pi", DocSymbol::Perl_symbol }}, + { SYM(Rho), "\xce\xa1", "Ρ", "<Rho/>", "Ρ", "P", NULL, "\\u0929?", { "P", DocSymbol::Perl_char }}, + { SYM(Sigma), "\xce\xa3", "Σ", "<Sigma/>", "Σ", "{$\\Sigma$}", NULL, "\\u0931?", { "Sigma", DocSymbol::Perl_symbol }}, + { SYM(Tau), "\xce\xa4", "Τ", "<Tau/>", "Τ", "T", NULL, "\\u0932?", { "T", DocSymbol::Perl_char }}, + { SYM(Upsilon), "\xce\xa5", "Υ", "<Upsilon/>", "Υ", "{$\\Upsilon$}", NULL, "\\u0933?", { "Upsilon", DocSymbol::Perl_symbol }}, + { SYM(Phi), "\xce\xa6", "Φ", "<Phi/>", "Φ", "{$\\Phi$}", NULL, "\\u0934?", { "Phi", DocSymbol::Perl_symbol }}, + { SYM(Chi), "\xce\xa7", "Χ", "<Chi/>", "Χ", "X", NULL, "\\u0935?", { "X", DocSymbol::Perl_char }}, + { SYM(Psi), "\xce\xa8", "Ψ", "<Psi/>", "Ψ", "{$\\Psi$}", NULL, "\\u0936?", { "Psi", DocSymbol::Perl_symbol }}, + { SYM(Omega), "\xce\xa9", "Ω", "<Omega/>", "Ω", "{$\\Omega$}", NULL, "\\u0937?", { "Omega", DocSymbol::Perl_symbol }}, + { SYM(alpha), "\xce\xb1", "α", "<alpha/>", "α", "{$\\alpha$}", NULL, "\\u0945?", { "alpha", DocSymbol::Perl_symbol }}, + { SYM(beta), "\xce\xb2", "β", "<beta/>", "β", "{$\\beta$}", NULL, "\\u0946?", { "beta", DocSymbol::Perl_symbol }}, + { SYM(gamma), "\xce\xb3", "γ", "<gamma/>", "γ", "{$\\gamma$}", NULL, "\\u0947?", { "gamma", DocSymbol::Perl_symbol }}, + { SYM(delta), "\xce\xb4", "δ", "<delta/>", "δ", "{$\\delta$}", NULL, "\\u0948?", { "delta", DocSymbol::Perl_symbol }}, + { SYM(epsilon), "\xce\xb5", "ε", "<epsilon/>", "ε", "{$\\varepsilon$}", NULL, "\\u0949?", { "epsilon", DocSymbol::Perl_symbol }}, + { SYM(zeta), "\xce\xb6", "ζ", "<zeta/>", "ζ", "{$\\zeta$}", NULL, "\\u0950?", { "zeta", DocSymbol::Perl_symbol }}, + { SYM(eta), "\xce\xb7", "η", "<eta/>", "η", "{$\\eta$}", NULL, "\\u0951?", { "eta", DocSymbol::Perl_symbol }}, + { SYM(theta), "\xce\xb8", "θ", "<theta/>", "θ", "{$\\theta$}", NULL, "\\u0952?", { "theta", DocSymbol::Perl_symbol }}, + { SYM(iota), "\xce\xb9", "ι", "<iota/>", "ι", "{$\\iota$}", NULL, "\\u0953?", { "iota", DocSymbol::Perl_symbol }}, + { SYM(kappa), "\xce\xba", "κ", "<kappa/>", "κ", "{$\\kappa$}", NULL, "\\u0954?", { "kappa", DocSymbol::Perl_symbol }}, + { SYM(lambda), "\xce\xbb", "λ", "<lambda/>", "λ", "{$\\lambda$}", NULL, "\\u0955?", { "lambda", DocSymbol::Perl_symbol }}, + { SYM(mu), "\xce\xbc", "μ", "<mu/>", "μ", "{$\\mu$}", NULL, "\\u0956?", { "mu", DocSymbol::Perl_symbol }}, + { SYM(nu), "\xce\xbd", "ν", "<nu/>", "ν", "{$\\nu$}", NULL, "\\u0957?", { "nu", DocSymbol::Perl_symbol }}, + { SYM(xi), "\xce\xbe", "ξ", "<xi/>", "ξ", "{$\\xi$}", NULL, "\\u0958?", { "xi", DocSymbol::Perl_symbol }}, + { SYM(omicron), "\xce\xbf", "ο", "<omicron/>", "ο", "{$\\omicron$}", NULL, "\\u0959?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(pi), "\xcf\x80", "π", "<pi/>", "π", "{$\\pi$}", NULL, "\\u0960?", { "pi", DocSymbol::Perl_symbol }}, + { SYM(rho), "\xcf\x81", "ρ", "<rho/>", "ρ", "{$\\rho$}", NULL, "\\u0961?", { "rho", DocSymbol::Perl_symbol }}, + { SYM(sigmaf), "\xcf\x82", "ς", "<sigmaf/>", "ς", "{$\\varsigma$}", NULL, "\\u0962?", { "sigma", DocSymbol::Perl_symbol }}, + { SYM(sigma), "\xcf\x83", "σ", "<sigma/>", "σ", "{$\\sigma$}", NULL, "\\u0963?", { "sigma", DocSymbol::Perl_symbol }}, + { SYM(tau), "\xcf\x84", "τ", "<tau/>", "τ", "{$\\tau$}", NULL, "\\u0964?", { "tau", DocSymbol::Perl_symbol }}, + { SYM(upsilon), "\xcf\x85", "υ", "<upsilon/>", "υ", "{$\\upsilon$}", NULL, "\\u0965?", { "upsilon", DocSymbol::Perl_symbol }}, + { SYM(phi), "\xcf\x86", "φ", "<phi/>", "φ", "{$\\varphi$}", NULL, "\\u0966?", { "phi", DocSymbol::Perl_symbol }}, + { SYM(chi), "\xcf\x87", "χ", "<chi/>", "χ", "{$\\chi$}", NULL, "\\u0967?", { "chi", DocSymbol::Perl_symbol }}, + { SYM(psi), "\xcf\x88", "ψ", "<psi/>", "ψ", "{$\\psi$}", NULL, "\\u0968?", { "psi", DocSymbol::Perl_symbol }}, + { SYM(omega), "\xcf\x89", "ω", "<omega/>", "ω", "{$\\omega$}", NULL, "\\u0969?", { "omega", DocSymbol::Perl_symbol }}, + { SYM(thetasym), "\xcf\x91", "ϑ", "<thetasym/>", "ϑ", "{$\\vartheta$}", NULL, "\\u977?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(upsih), "\xcf\x92", "ϒ", "<upsih/>", "ϒ", "{$\\Upsilon$}", NULL, "\\u978?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(piv), "\xcf\x96", "ϖ", "<piv/>", "ϖ", "{$\\varpi$}", NULL, "\\u982?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(bull), "\xe2\x80\xa2", "•", "<bull/>", "•", "\\textbullet{}", NULL, "\\'95", { NULL, DocSymbol::Perl_unknown }}, + { SYM(hellip), "\xe2\x80\xa6", "…", "<hellip/>", "…", "{$\\cdots$}", NULL, "\\'85", { NULL, DocSymbol::Perl_unknown }}, + { SYM(prime), "\xe2\x80\xb2", "′", "<prime/>", "′", "'", NULL, "\\u8242?", { "\\\'", DocSymbol::Perl_string }}, + { SYM(Prime), "\xe2\x80\xb3", "″", "<Prime/>", "″", "''", NULL, "\\u8243?", { "\"", DocSymbol::Perl_char }}, + { SYM(oline), "\xe2\x80\xbe", "‾", "<oline/>", "‾", "{$\\overline{\\,}$}", NULL, "\\u8254?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(frasl), "\xe2\x81\x84", "⁄", "<frasl/>", "⁄", "/", NULL, "\\u8260?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(weierp), "\xe2\x84\x98", "℘", "<weierp/>", "℘", "{$\\wp$}", NULL, "\\u8472?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(image), "\xe2\x84\x91", "ℑ", "<image/>", "ℑ", "{$\\Im$}", NULL, "\\u8465?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(real), "\xe2\x84\x9c", "ℜ", "<real/>", "ℜ", "{$\\Re$}", NULL, "\\u8476?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(trade), "\xe2\x84\xa2", "™", "<trademark/>", "™", "\\texttrademark{}", "(TM)", "\\'99", { "trademark", DocSymbol::Perl_symbol }}, + { SYM(alefsym), "\xe2\x85\xb5", "ℵ", "<alefsym/>", "ℵ", "{$\\aleph$}", NULL, "\\u8501?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(larr), "\xe2\x86\x90", "←", "<larr/>", "←", "{$\\leftarrow$}", NULL, "\\u8592?", { "<-", DocSymbol::Perl_string }}, + { SYM(uarr), "\xe2\x86\x91", "↑", "<uarr/>", "↑", "{$\\uparrow$}", NULL, "\\u8593?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(rarr), "\xe2\x86\x92", "→", "<rarr/>", "→", "{$\\rightarrow$}", NULL, "\\u8594?", { "->", DocSymbol::Perl_string }}, + { SYM(darr), "\xe2\x86\x93", "↓", "<darr/>", "↓", "{$\\downarrow$}", NULL, "\\u8595?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(harr), "\xe2\x86\x94", "↔", "<harr/>", "↔", "{$\\leftrightarrow$}", NULL, "\\u8596?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(crarr), "\xe2\x86\xb5", "↵", "<crarr/>", "↵", "{$\\hookleftarrow$}", NULL, "\\u8629?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(lArr), "\xe2\x87\x90", "⇐", "<lArr/>", "⇐", "{$\\Leftarrow$}", NULL, "\\u8656?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(uArr), "\xe2\x87\x91", "⇑", "<uArr/>", "⇑", "{$\\Uparrow$}", NULL, "\\u8657?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(rArr), "\xe2\x87\x92", "⇒", "<rArr/>", "⇒", "{$\\Rightarrow$}", NULL, "\\u8658?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(dArr), "\xe2\x87\x93", "⇓", "<dArr/>", "⇓", "{$\\Downarrow$}", NULL, "\\u8659?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(hArr), "\xe2\x87\x94", "⇔", "<hArr/>", "⇔", "{$\\Leftrightarrow$}", NULL, "\\u8660?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(forall), "\xe2\x88\x80", "∀", "<forall/>", "∀", "{$\\forall$}", NULL, "\\u8704?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(part), "\xe2\x88\x82", "∂", "<part/>", "∂", "{$\\partial$}", NULL, "\\u8706?", { "partial", DocSymbol::Perl_symbol }}, + { SYM(exist), "\xe2\x88\x83", "∃", "<exist/>", "∃", "{$\\exists$}", NULL, "\\u8707?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(empty), "\xe2\x88\x85", "∅", "<empty/>", "∅", "{$\\emptyset$}", NULL, "\\u8709?", { "empty", DocSymbol::Perl_symbol }}, + { SYM(nabla), "\xe2\x88\x87", "∇", "<nabla/>", "∇", "{$\\nabla$}", NULL, "\\u8711?", { "nabla", DocSymbol::Perl_symbol }}, + { SYM(isin), "\xe2\x88\x88", "∈", "<isin/>", "∈", "{$\\in$}", NULL, "\\u8712?", { "in", DocSymbol::Perl_symbol }}, + { SYM(notin), "\xe2\x88\x89", "∉", "<notin/>", "∉", "{$\\notin$}", NULL, "\\u8713?", { "notin", DocSymbol::Perl_symbol }}, + { SYM(ni), "\xe2\x88\x8b", "∋", "<ni/>", "∋", "{$\\ni$}", NULL, "\\u8715?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(prod), "\xe2\x88\x8f", "∏", "<prod/>", "∏", "{$\\prod$}", NULL, "\\u8719?", { "prod", DocSymbol::Perl_symbol }}, + { SYM(sum), "\xe2\x88\x91", "∑", "<sum/>", "∑", "{$\\sum$}", NULL, "\\u8721?", { "sum", DocSymbol::Perl_symbol }}, + { SYM(minus), "\xe2\x88\x92", "−", "<minus/>", "−", "-", NULL, "\\u8722?", { "-", DocSymbol::Perl_char }}, + { SYM(lowast), "\xe2\x88\x97", "∗", "<lowast/>", "∗", "{$\\ast$}", NULL, "\\u8727?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(radic), "\xe2\x88\x9a", "√", "<radic/>", "√", "{$\\surd$}", NULL, "\\u8730?", { "sqrt", DocSymbol::Perl_symbol }}, + { SYM(prop), "\xe2\x88\x9d", "∝", "<prop/>", "∝", "{$\\propto$}", NULL, "\\u8733?", { "propto", DocSymbol::Perl_symbol }}, + { SYM(infin), "\xe2\x88\x9e", "∞", "<infin/>", "∞", "{$\\infty$}", NULL, "\\u8734?", { "inf", DocSymbol::Perl_symbol }}, + { SYM(ang), "\xe2\x88\xa0", "∠", "<ang/>", "∠", "{$\\angle$}", NULL, "\\u8736?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(and), "\xe2\x88\xa7", "∧", "<and/>", "∧", "{$\\wedge$}", NULL, "\\u8743?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(or), "\xe2\x88\xa8", "∨", "<or/>", "∨", "{$\\vee$}", NULL, "\\u8744?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(cap), "\xe2\x88\xa9", "∩", "<cap/>", "∩", "{$\\cap$}", NULL, "\\u8745?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(cup), "\xe2\x88\xaa", "∪", "<cup/>", "∪", "{$\\cup$}", NULL, "\\u8746?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(int), "\xe2\x88\xab", "∫", "<int/>", "∫", "{$\\int$}", NULL, "\\u8747?", { "int", DocSymbol::Perl_symbol }}, + { SYM(there4), "\xe2\x88\xb4", "∴", "<there4/>", "∴", "{$\\therefore$}", NULL, "\\u8756?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(sim), "\xe2\x88\xbc", "∼", "<sim/>", "∼", "{$\\sim$}", NULL, "\\u8764?", { "~", DocSymbol::Perl_char }}, + { SYM(cong), "\xe2\x89\x85", "≅", "<cong/>", "≅", "{$\\cong$}", NULL, "\\u8773?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(asymp), "\xe2\x89\x88", "≈", "<asymp/>", "≈", "{$\\approx$}", NULL, "\\u8776?", { "approx", DocSymbol::Perl_symbol }}, + { SYM(ne), "\xe2\x89\xa0", "≠", "<ne/>", "≠", "{$\\ne$}", NULL, "\\u8800?", { "!=", DocSymbol::Perl_string }}, + { SYM(equiv), "\xe2\x89\xa1", "≡", "<equiv/>", "≡", "{$\\equiv$}", NULL, "\\u8801?", { "equiv", DocSymbol::Perl_symbol }}, + { SYM(le), "\xe2\x89\xa4", "≤", "<le/>", "≤", "{$\\le$}", NULL, "\\u8804?", { "<=", DocSymbol::Perl_string }}, + { SYM(ge), "\xe2\x89\xa5", "≥", "<ge/>", "≥", "{$\\ge$}", NULL, "\\u8805?", { ">=", DocSymbol::Perl_string }}, + { SYM(sub), "\xe2\x8a\x82", "⊂", "<sub/>", "⊂", "{$\\subset$}", NULL, "\\u8834?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(sup), "\xe2\x8a\x83", "⊃", "<sup/>", "⊃", "{$\\supset$}", NULL, "\\u8835?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(nsub), "\xe2\x8a\x84", "⊄", "<nsub/>", "⊄", "{$\\not\\subset$}", NULL, "\\u8836?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(sube), "\xe2\x8a\x86", "⊆", "<sube/>", "⊆", "{$\\subseteq$}", NULL, "\\u8838?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(supe), "\xe2\x8a\x87", "⊇", "<supe/>", "⊇", "{$\\supseteq$}", NULL, "\\u8839?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(oplus), "\xe2\x8a\x95", "⊕", "<oplus/>", "⊕", "{$\\oplus$}", NULL, "\\u8853?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(otimes), "\xe2\x8a\x97", "⊗", "<otimes/>", "⊗", "{$\\otimes$}", NULL, "\\u8855?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(perp), "\xe2\x8a\xa5", "⊥", "<perp/>", "⊥", "{$\\perp$}", NULL, "\\u8869?", { "perp", DocSymbol::Perl_symbol }}, + { SYM(sdot), "\xe2\x8b\x85", "⋅", "<sdot/>", "⋅", "{$\\cdot$}", NULL, "\\u8901?", { ".", DocSymbol::Perl_char }}, + { SYM(lceil), "\xe2\x8c\x88", "⌈", "<lceil/>", "⌈", "{$\\lceil$}", NULL, "\\u8968?", { "lceil", DocSymbol::Perl_symbol }}, + { SYM(rceil), "\xe2\x8c\x89", "⌉", "<rceil/>", "⌉", "{$\\rceil$}", NULL, "\\u8969?", { "rceil", DocSymbol::Perl_symbol }}, + { SYM(lfloor), "\xe2\x8c\x8a", "⌊", "<lfloor/>", "⌊", "{$\\lfloor$}", NULL, "\\u8970?", { "lfloor", DocSymbol::Perl_symbol }}, + { SYM(rfloor), "\xe2\x8c\x8b", "⌋", "<rfloor/>", "⌋", "{$\\rfloor$}", NULL, "\\u8971?", { "rfloor", DocSymbol::Perl_symbol }}, + { SYM(lang), "\xe2\x8c\xa9", "⟨", "<lang/>", "〈", "{$\\langle$}", NULL, "\\u9001?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(rang), "\xe2\x8c\xaa", "⟩", "<rang/>", "〉", "{$\\rangle$}", NULL, "\\u9002?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(loz), "\xe2\x97\x8a", "◊", "<loz/>", "◊", "{$\\lozenge$}", NULL, "\\u9674?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(spades), "\xe2\x99\xa0", "♠", "<spades/>", "♠", "{$\\spadesuit$}", NULL, "\\u9824?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(clubs), "\xe2\x99\xa3", "♣", "<clubs/>", "♣", "{$\\clubsuit$}", NULL, "\\u9827?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(hearts), "\xe2\x99\xa5", "♥", "<hearts/>", "♥", "{$\\heartsuit$}", NULL, "\\u9829?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(diams), "\xe2\x99\xa6", "♦", "<diams/>", "♦", "{$\\diamondsuit$}", NULL, "\\u9830?", { NULL, DocSymbol::Perl_unknown }}, + { SYM(quot), "\"", """, "\"", """, "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }}, + { SYM(amp), "&", "&", "&", "&", "\\&", "&", "&", { "&", DocSymbol::Perl_char }}, + { SYM(lt), "<", "<", "<", "<", "<", "<", "<", { "<", DocSymbol::Perl_char }}, + { SYM(gt), ">", ">", ">", ">", ">", ">", ">", { ">", DocSymbol::Perl_char }}, + { SYM(OElig), "\xc5\x92", "Œ", "<OElig/>", "Œ", "\\OE", NULL, "\\'8C", { NULL, DocSymbol::Perl_unknown }}, + { SYM(oelig), "\xc5\x93", "œ", "<oelig/>", "œ", "\\oe", NULL, "\\'9C", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Scaron), "\xc5\xa0", "Š", "<Scaron/>", "Š", "\\v{S}", NULL, "\\'8A", { NULL, DocSymbol::Perl_unknown }}, + { SYM(scaron), "\xc5\xa1", "š", "<scaron/>", "š", "\\v{s}", NULL, "\\'9A", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Yuml), "\xc5\xb8", "Ÿ", "<Yumlaut/>", "Ÿ", "\\\"{Y}", "Y\\*(4", "\\'9F", { "Y", DocSymbol::Perl_umlaut }}, + { SYM(circ), "\xcb\x86", "ˆ", "<circ/>", "ˆ", "{$\\circ$}", NULL, "\\'88", { " ", DocSymbol::Perl_circ }}, + { SYM(tilde), "\xcb\x9c", "˜", "<tilde/>", "˜", "\\~{}", "~", "\\'98", { " ", DocSymbol::Perl_tilde }}, + { SYM(ensp), "\xe2\x80\x82", " ", "<ensp/>", " ", "\\enskip{}", NULL, "{\\enspace}", { NULL, DocSymbol::Perl_unknown }}, + { SYM(emsp), "\xe2\x80\x83", " ", "<emsp/>", " ", "\\quad{}", NULL, "{\\emspace}", { NULL, DocSymbol::Perl_unknown }}, + { SYM(thinsp), "\xe2\x80\x89", " ", "<thinsp/>", " ", "\\,", NULL, "{\\qmspace}", { NULL, DocSymbol::Perl_unknown }}, + { SYM(zwnj), "\xe2\x80\x8c", "‌", "<zwnj/>", "‌", "{}", NULL, "\\zwnj", { NULL, DocSymbol::Perl_unknown }}, + { SYM(zwj), "\xe2\x80\x8d", "‍", "<zwj/>", "‍", "", NULL, "\\zwj", { NULL, DocSymbol::Perl_unknown }}, + { SYM(lrm), "\xe2\x80\x8e", "‎", "<lrm/>", "‎", "", NULL, "\\ltrmark", { NULL, DocSymbol::Perl_unknown }}, + { SYM(rlm), "\xe2\x80\x8f", "‏", "<rlm/>", "‏", "", NULL, "\\rtlmark", { NULL, DocSymbol::Perl_unknown }}, + { SYM(ndash), "\xe2\x80\x93", "–", "<ndash/>", "–", "--", "--", "\\'96", { "-", DocSymbol::Perl_char }}, + { SYM(mdash), "\xe2\x80\x94", "—", "<mdash/>", "—", "---", "---", "\\'97", { "--", DocSymbol::Perl_string }}, + { SYM(lsquo), "\xe2\x80\x98", "‘", "<lsquo/>", "‘", "`", "`", "\\'91", { "\\\'", DocSymbol::Perl_string }}, + { SYM(rsquo), "\xe2\x80\x99", "’", "<rsquo/>", "’", "'", "'", "\\'92", { "\\\'", DocSymbol::Perl_string }}, + { SYM(sbquo), "\xe2\x80\x9a", "‚", "<sbquo/>", "‚", "\\quotesinglbase{}", NULL, "\\'82", { NULL, DocSymbol::Perl_unknown }}, + { SYM(ldquo), "\xe2\x80\x9c", "“", "<ldquo/>", "“", "``", "``", "\\'93", { "\"", DocSymbol::Perl_char }}, + { SYM(rdquo), "\xe2\x80\x9d", "”", "<rdquo/>", "”", "''", "''", "\\'94", { "\"", DocSymbol::Perl_char }}, + { SYM(bdquo), "\xe2\x80\x9e", "„", "<bdquo/>", "„", "\\quotedblbase{}", NULL, "\\'84", { NULL, DocSymbol::Perl_unknown }}, + { SYM(dagger), "\xe2\x80\xa0", "†", "<dagger/>", "†", "{$\\dagger$}", NULL, "\\'86", { NULL, DocSymbol::Perl_unknown }}, + { SYM(Dagger), "\xe2\x80\xa1", "‡", "<Dagger/>", "‡", "{$\\ddagger$}", NULL, "\\'87", { NULL, DocSymbol::Perl_unknown }}, + { SYM(permil), "\xe2\x80\xb0", "‰", "<permil/>", "‰", "{$\\permil{}$}", NULL, "\\'89", { NULL, DocSymbol::Perl_unknown }}, + { SYM(lsaquo), "\xe2\x80\xb9", "‹", "<lsaquo/>", "‹", "\\guilsinglleft{}", NULL, "\\'8B", { NULL, DocSymbol::Perl_unknown }}, + { SYM(rsaquo), "\xe2\x80\xba", "›", "<rsaquo/>", "›", "\\guilsinglright{}", NULL, "\\'9B", { NULL, DocSymbol::Perl_unknown }}, + { SYM(euro), "\xe2\x82\xac", "€", "<euro/>", "€", "\\texteuro{}", NULL, "\\'80", { NULL, DocSymbol::Perl_unknown }}, + + // doxygen extension to the HTML4 table of HTML entities + { SYM(tm), "\xe2\x84\xa2", "™", "<trademark/>", "™", "\\texttrademark{}", "(TM)", "\\'99", { "trademark", DocSymbol::Perl_symbol }}, + { SYM(apos), "'", "'", "'", "'", "'", "'", "'", { "\\\'", DocSymbol::Perl_string }}, + + // doxygen commands represented as HTML entities + { SYM(BSlash), "\\", "\\", "\\", "\\", "\\textbackslash{}", "\\\\", "\\\\", { "\\\\", DocSymbol::Perl_string }}, + { SYM(At), "@", "@", "@", "@", "@", "@", "@", { "@", DocSymbol::Perl_char }}, + { SYM(Less), "<", "<", "<", "<", "<", "<", "<", { "<", DocSymbol::Perl_char }}, + { SYM(Greater), ">", ">", ">", ">", ">", ">", ">", { ">", DocSymbol::Perl_char }}, + { SYM(Amp), "&", "&", "&", "&", "\\&", "&", "&", { "&", DocSymbol::Perl_char }}, + { SYM(Dollar), "$", "$", "$", "$", "\\$", "$", "$", { "$", DocSymbol::Perl_char }}, + { SYM(Hash), "#;", "#", "#", "#", "\\#", "#", "#", { "#", DocSymbol::Perl_char }}, + { SYM(DoubleColon), "::", "::", "::", "::", "::", "::", "::", { "::", DocSymbol::Perl_string }}, + { SYM(Percent), "%", "%", "%", "%", "\\%", "%", "%", { "%", DocSymbol::Perl_char }}, + { SYM(Pipe), "|", "|", "|", "|", "$|$", "|", "|", { "|", DocSymbol::Perl_char }}, + { SYM(Quot), "\"", "\"", "\"", """, "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }}, + { SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }} +}; + +static const int g_numHtmlEntities = (int)(sizeof(g_htmlEntities)/ sizeof(*g_htmlEntities)); + +HtmlEntityMapper *HtmlEntityMapper::s_instance = 0; + +HtmlEntityMapper::HtmlEntityMapper() +{ + m_name2sym = new QDict<int>(1009); + m_name2sym->setAutoDelete(TRUE); + for (int i = 0; i < g_numHtmlEntities; i++) + { + m_name2sym->insert(g_htmlEntities[i].item,new int(g_htmlEntities[i].symb)); + } + validate(); +} + +HtmlEntityMapper::~HtmlEntityMapper() +{ + delete m_name2sym; +} + +/** Returns the one and only instance of the HTML entity mapper */ +HtmlEntityMapper *HtmlEntityMapper::instance() +{ + if (s_instance==0) + { + s_instance = new HtmlEntityMapper; + } + return s_instance; +} + +/** Deletes the one and only instance of the HTML entity mapper */ +void HtmlEntityMapper::deleteInstance() +{ + delete s_instance; + s_instance=0; +} + + +/*! @brief Access routine to the UTF8 code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @param useInPrintf If TRUE the result will be escaped such that it can be + * used in a printf string pattern + * @return the UTF8 code of the HTML entity, + * in case the UTF code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::utf8(DocSymbol::SymType symb,bool useInPrintf) const +{ + if (useInPrintf && symb==DocSymbol::Sym_Percent) + { + return "%%"; // escape for printf + } + else + { + return g_htmlEntities[symb].UTF8; + } +} + +/*! @brief Access routine to the html code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @param useInPrintf If TRUE the result will be escaped such that it can be + * used in a printf string pattern + * @return the html representation of the HTML entity, + * in case the html code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::html(DocSymbol::SymType symb,bool useInPrintf) const +{ + if (useInPrintf && symb==DocSymbol::Sym_Percent) + { + return "%%"; // escape for printf + } + else + { + return g_htmlEntities[symb].html; + } +} + +/*! @brief Access routine to the XML code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the XML code of the HTML entity, + * in case the XML code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::xml(DocSymbol::SymType symb) const +{ + return g_htmlEntities[symb].xml; +} + +/*! @brief Access routine to the docbook code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the docbook code of the HTML entity, + * in case the docbook code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::docbook(DocSymbol::SymType symb) const +{ + return g_htmlEntities[symb].docbook; +} + +/*! @brief Access routine to the LaTeX code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the LaTeX code of the HTML entity, + * in case the LaTeX code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::latex(DocSymbol::SymType symb) const +{ + return g_htmlEntities[symb].latex; +} + +/*! @brief Access routine to the man code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the man of the HTML entity, + * in case the man code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::man(DocSymbol::SymType symb) const +{ + return g_htmlEntities[symb].man; +} + +/*! @brief Access routine to the RTF code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the RTF of the HTML entity, + * in case the RTF code is unknown \c NULL is returned. + */ +const char *HtmlEntityMapper::rtf(DocSymbol::SymType symb) const +{ + return g_htmlEntities[symb].rtf; +} + +/*! @brief Access routine to the perl struct with the perl code of the HTML entity + * + * @param symb Code of the requested HTML entity + * @return the pointer to perl struct with the perl code of the HTML entity, + * in case the perl code does not exists the NULL pointer is entered in the + * \c symb field and in the `DocSymbol::Perl_unknown` in the \c type field. + */ +const DocSymbol::PerlSymb *HtmlEntityMapper::perl(DocSymbol::SymType symb) const +{ + return &g_htmlEntities[symb].perl; +} + +/*! + * @brief Give code of the requested HTML entity name + * @param symName HTML entity name without \c & and \c; + * @return the code for the requested HTML entity name, + * in case the requested HTML item does not exist `DocSymbol::Sym_unknown` is returned. + */ +DocSymbol::SymType HtmlEntityMapper::name2sym(const QCString &symName) const +{ + int *pSymb = m_name2sym->find(symName); + return pSymb ? ((DocSymbol::SymType)*pSymb) : DocSymbol::Sym_Unknown; +} + +void HtmlEntityMapper::writeXMLSchema(FTextStream &t) +{ + for (int i=0;i<g_numHtmlEntities - g_numberHtmlMappedCmds;i++) + { + QCString bareName = g_htmlEntities[i].xml; + if (!bareName.isEmpty() && bareName.at(0)=='<' && bareName.right(2)=="/>") + { + bareName = bareName.mid(1,bareName.length()-3); // strip < and /> + t << " <xsd:element name=\"" << bareName << "\" type=\"docEmptyType\" />\n"; + } + } +} + +/*! @brief Routine to check if the entries of the html_entities are numbered correctly + * @details in case of a mismatch a warning message is given. + */ +void HtmlEntityMapper::validate() +{ + for (int i = 0; i < g_numHtmlEntities; i++) + { + if (i != g_htmlEntities[i].symb) + { + warn_uncond("Internal inconsistency, htmlentries code %d (item=%s)\n",i,g_htmlEntities[i].item); + } + } +} diff --git a/src/htmlentity.h b/src/htmlentity.h new file mode 100644 index 0000000..d3b268c --- /dev/null +++ b/src/htmlentity.h @@ -0,0 +1,47 @@ +/****************************************************************************** + * + * 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 + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ +#ifndef HTMLENTITY_H +#define HTMLENTITY_H + +#include <qdict.h> +#include "docparser.h" + +class FTextStream; + +/** @brief Singleton helper class to map html entities to other formats */ +class HtmlEntityMapper +{ + public: + static HtmlEntityMapper *instance(); + static void deleteInstance(); + DocSymbol::SymType name2sym(const QCString &symName) const; + const char *utf8(DocSymbol::SymType symb,bool useInPrintf=FALSE) const; + const char *html(DocSymbol::SymType symb,bool useInPrintf=FALSE) const; + const char *xml(DocSymbol::SymType symb) const; + const char *docbook(DocSymbol::SymType symb) const; + const char *latex(DocSymbol::SymType symb) const; + const char *man(DocSymbol::SymType symb) const; + const char *rtf(DocSymbol::SymType symb) const; + const DocSymbol::PerlSymb *perl(DocSymbol::SymType symb) const; + void writeXMLSchema(FTextStream &t); + private: + void validate(); + HtmlEntityMapper(); + ~HtmlEntityMapper(); + static HtmlEntityMapper *s_instance; + QDict<int> *m_name2sym; +}; + +#endif diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 059d0e7..0d399d3 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -1683,7 +1683,7 @@ void HtmlGenerator::startFile(const char *name,const char *, Doxygen::indexList->addIndexFile(fileName); lastFile = fileName; - t << substituteHtmlKeywords(g_header,convertToHtml(title),relPath); + t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),relPath); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " << versionString << " -->" << endl; @@ -2181,25 +2181,11 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d, void HtmlGenerator::startMemberList() { DBG_HTML(t << "<!-- startMemberList -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - //} - //else - //{ - // t << "<ul>" << endl; - //} } void HtmlGenerator::endMemberList() { DBG_HTML(t << "<!-- endMemberList -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - //} - //else - //{ - // t << "</ul>" << endl; - //} } // anonymous type: @@ -2254,93 +2240,63 @@ void HtmlGenerator::endMemberTemplateParams(const char *anchor,const char *inher void HtmlGenerator::insertMemberAlign(bool templ) { DBG_HTML(t << "<!-- insertMemberAlign -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - QCString className = templ ? "memTemplItemRight" : "memItemRight"; - t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; - //} + QCString className = templ ? "memTemplItemRight" : "memItemRight"; + t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; } void HtmlGenerator::startMemberDescription(const char *anchor,const char *inheritId) { DBG_HTML(t << "<!-- startMemberDescription -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ if (m_emptySection) { t << "<table class=\"memberdecls\">" << endl; m_emptySection=FALSE; } - t << "<tr class=\"memdesc:" << anchor; - if (inheritId) - { - t << " inherit " << inheritId; - } - t << "\"><td class=\"mdescLeft\"> </td><td class=\"mdescRight\">"; - //} - //else - //{ - // t << "<dl class=\"el\"><dd class=\"mdescRight\">"; - //} + t << "<tr class=\"memdesc:" << anchor; + if (inheritId) + { + t << " inherit " << inheritId; + } + t << "\"><td class=\"mdescLeft\"> </td><td class=\"mdescRight\">"; } void HtmlGenerator::endMemberDescription() { DBG_HTML(t << "<!-- endMemberDescription -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - t << "<br/></td></tr>" << endl; - //} - //else - //{ - // t << "<br/></dl>"; - //} + t << "<br /></td></tr>" << endl; } void HtmlGenerator::startMemberSections() { DBG_HTML(t << "<!-- startMemberSections -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - m_emptySection=TRUE; // we postpone writing <table> until we actually - // write a row to prevent empty tables, which - // are not valid XHTML! - //} + m_emptySection=TRUE; // we postpone writing <table> until we actually + // write a row to prevent empty tables, which + // are not valid XHTML! } void HtmlGenerator::endMemberSections() { DBG_HTML(t << "<!-- endMemberSections -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - if (!m_emptySection) - { - t << "</table>" << endl; - } - //} + if (!m_emptySection) + { + t << "</table>" << endl; + } } void HtmlGenerator::startMemberHeader(const char *anchor) { DBG_HTML(t << "<!-- startMemberHeader -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - if (!m_emptySection) - { - t << "</table>"; - m_emptySection=TRUE; - } - if (m_emptySection) - { - t << "<table class=\"memberdecls\">" << endl; - m_emptySection=FALSE; - } - t << "<tr class=\"heading\"><td colspan=\"2\"><h2 class=\"groupheader\">"; - //} - //else - //{ - // startGroupHeader(FALSE); - //} + if (!m_emptySection) + { + t << "</table>"; + m_emptySection=TRUE; + } + if (m_emptySection) + { + t << "<table class=\"memberdecls\">" << endl; + m_emptySection=FALSE; + } + t << "<tr class=\"heading\"><td colspan=\"2\"><h2 class=\"groupheader\">"; if (anchor) { t << "<a name=\"" << anchor << "\"></a>" << endl; @@ -2350,28 +2306,19 @@ void HtmlGenerator::startMemberHeader(const char *anchor) void HtmlGenerator::endMemberHeader() { DBG_HTML(t << "<!-- endMemberHeader -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - //{ - t << "</h2></td></tr>" << endl; - //} - //else - //{ - // endGroupHeader(FALSE); - //} + t << "</h2></td></tr>" << endl; } void HtmlGenerator::startMemberSubtitle() { DBG_HTML(t << "<!-- startMemberSubtitle -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - t << "<tr><td class=\"ititle\" colspan=\"2\">"; + t << "<tr><td class=\"ititle\" colspan=\"2\">"; } void HtmlGenerator::endMemberSubtitle() { DBG_HTML(t << "<!-- endMemberSubtitle -->" << endl) - //if (Config_getBool("HTML_ALIGN_MEMBERS")) - t << "</td></tr>" << endl; + t << "</td></tr>" << endl; } void HtmlGenerator::startIndexList() @@ -3324,11 +3271,11 @@ void HtmlGenerator::lineBreak(const char *style) { if (style) { - t << "<br class=\"" << style << "\"/>" << endl; + t << "<br class=\"" << style << "\" />" << endl; } else { - t << "<br/>" << endl; + t << "<br />" << endl; } } diff --git a/src/htmlgen.h b/src/htmlgen.h index 366027d..7b63a6b 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -280,9 +280,9 @@ class HtmlGenerator : public OutputGenerator { t << "</table>" << endl; } void startDescTableTitle() //{ t << "<tr><td valign=\"top\"><em>"; } - { t << "<tr><td class=\"fieldname\"><em>"; } + { t << "<tr><td class=\"fieldname\">"; } void endDescTableTitle() - { t << "</em> </td>"; } + { t << " </td>"; } void startDescTableData() //{ t << "<td>" << endl; } { t << "<td class=\"fielddoc\">" << endl; } diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index 23d5194..c1e535d 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -35,6 +35,7 @@ #include "groupdef.h" #include "memberdef.h" #include "filedef.h" +#include "util.h" //---------------------------------------------------------------------------- @@ -54,9 +55,10 @@ class IndexFieldSDict : public SDict<IndexField> public: IndexFieldSDict() : SDict<IndexField>(17) {} ~IndexFieldSDict() {} - int compareItems(QCollection::Item item1, QCollection::Item item2) + private: + int compareValues(const IndexField *item1, const IndexField *item2) const { - return qstricmp(((IndexField *)item1)->name,((IndexField *)item2)->name); + return qstricmp(item1->name,item2->name); } }; @@ -493,9 +495,22 @@ void HtmlHelp::createProjectFile() // the font-size one is not normally settable by the HTML Help Workshop // utility but the way to set it is described here: // http://support.microsoft.com/?scid=kb%3Ben-us%3B240062&x=17&y=18 - t << "main=\"" << recode(Config_getString("PROJECT_NAME")) << "\",\"index.hhc\"," + // NOTE: the 0x70387e number in addition to the above the Next and Prev button + // are shown. They can only be shown in case of a binary toc. + // dee http://www.mif2go.com/xhtml/htmlhelp_0016_943addingtabsandtoolbarbuttonstohtmlhelp.htm#Rz108x95873 + // Value has been taken from htmlhelp.h file of the HTML Help Workshop + if (Config_getBool("BINARY_TOC")) + { + t << "main=\"" << recode(Config_getString("PROJECT_NAME")) << "\",\"index.hhc\"," + "\"index.hhk\",\"" << indexName << "\",\"" << + indexName << "\",,,,,0x23520,,0x70387e,,,,,,,,0" << endl << endl; + } + else + { + t << "main=\"" << recode(Config_getString("PROJECT_NAME")) << "\",\"index.hhc\"," "\"index.hhk\",\"" << indexName << "\",\"" << indexName << "\",,,,,0x23520,,0x10387e,,,,,,,,0" << endl << endl; + } t << "[FILES]" << endl; char *s = indexFiles.first(); @@ -618,14 +633,17 @@ void HtmlHelp::addContentsItem(bool isDir, Definition * /* def */) { // If we're using a binary toc then folders cannot have links. - if(Config_getBool("BINARY_TOC") && isDir) - { - file = 0; - anchor = 0; - } + // Tried this and I didn't see any problems, when not using + // the resetting of file and anchor the TOC works better + // (prev / next button) + //if(Config_getBool("BINARY_TOC") && isDir) + //{ + //file = 0; + //anchor = 0; + //} int i; for (i=0;i<dc;i++) cts << " "; cts << "<LI><OBJECT type=\"text/sitemap\">"; - cts << "<param name=\"Name\" value=\"" << recode(name) << "\">"; + cts << "<param name=\"Name\" value=\"" << convertToHtml(recode(name),TRUE) << "\">"; if (file) // made file optional param - KPW { if (file && (file[0]=='!' || file[0]=='^')) // special markers for user defined URLs @@ -691,6 +709,6 @@ void HtmlHelp::addIndexItem(Definition *context,MemberDef *md, void HtmlHelp::addImageFile(const char *fileName) { - imageFiles.append(fileName); + if (!imageFiles.contains(fileName)) imageFiles.append(fileName); } diff --git a/src/htmlhelp.h b/src/htmlhelp.h index 85e46e0..574cec9 100644 --- a/src/htmlhelp.h +++ b/src/htmlhelp.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/image.cpp b/src/image.cpp index 49485af..3283754 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/image.h b/src/image.h index d2311a1..ad11a64 100644 --- a/src/image.h +++ b/src/image.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/index.cpp b/src/index.cpp index ae96c80..2013a7c 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -122,10 +122,8 @@ class MemberIndexList : public QList<MemberDef> typedef MemberDef ElementType; MemberIndexList(uint letter) : QList<MemberDef>(), m_letter(letter) {} ~MemberIndexList() {} - int compareItems(QCollection::Item item1, QCollection::Item item2) + int compareValues(const MemberDef *md1, const MemberDef *md2) const { - MemberDef *md1=(MemberDef *)item1; - MemberDef *md2=(MemberDef *)item2; int result = qstricmp(md1->name(),md2->name()); if (result==0) { @@ -347,7 +345,7 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, (!md->isStatic() || extractStatic) ) { - if (md->getOuterScope()==def) + if (md->getOuterScope()==def || md->getOuterScope()==Doxygen::globalScope) { Doxygen::indexList->addContentsItem(isDir, md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex); @@ -368,15 +366,18 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, MemberDef *emd; for (emli.toFirst();(emd=emli.current());++emli) { - if (emd->getOuterScope()==def) + if (!hideUndocMembers || emd->hasDocumentation()) { - Doxygen::indexList->addContentsItem(FALSE, - emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); - } - else // inherited member - { - Doxygen::indexList->addContentsItem(FALSE, - emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); + if (emd->getOuterScope()==def || emd->getOuterScope()==Doxygen::globalScope) + { + Doxygen::indexList->addContentsItem(FALSE, + emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); + } + else // inherited member + { + Doxygen::indexList->addContentsItem(FALSE, + emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); + } } } if (!isAnonymous) @@ -400,9 +401,10 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, { if (cd->isLinkable() && (cd->partOfGroups()==0 || def->definitionType()==Definition::TypeGroup)) { + static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS"); bool isNestedClass = def->definitionType()==Definition::TypeClass; addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(FALSE),cd->anchor(), - addToIndex && isNestedClass, + addToIndex && (isNestedClass || (cd->isSimple() && inlineSimpleStructs)), preventSeparateIndex || cd->isEmbeddedInOuterScope()); } } @@ -628,9 +630,10 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv FileList *fileList=dd->getFiles(); int fileCount=0; if (fileList && fileList->count()>0) - { - FileDef *fd=fileList->first(); - while (fd) + { + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { //static bool allExternals = Config_getBool("ALLEXTERNALS"); //if ((allExternals && fd->isLinkable()) || fd->isLinkableInProject()) @@ -646,13 +649,11 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv { fileCount++; } - fd=fileList->next(); } if (fileCount>0) { startIndexHierarchy(ol,level+1); - fd=fileList->first(); - while (fd) + for (it.toFirst();(fd=it.current());++it) { bool doc,src; doc = fileVisibleInIndex(fd,src); @@ -678,7 +679,6 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv 0,FALSE,FALSE,fd); } } - fd=fileList->next(); } endIndexHierarchy(ol,level+1); } @@ -689,8 +689,9 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv // write files of this directory if (fileCount>0) { - FileDef *fd=fileList->first(); - while (fd) + QListIterator<FileDef> it(*fileList); + FileDef *fd; + for (;(fd=it.current());++it) { //static bool allExternals = Config_getBool("ALLEXTERNALS"); //if ((allExternals && fd->isLinkable()) || fd->isLinkableInProject()) @@ -706,7 +707,6 @@ static void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv FALSE, convertToHtml(fd->name(),TRUE), 0, fd->getSourceFileBase(), 0, FALSE, TRUE, fd); } - fd=fileList->next(); } } } @@ -811,7 +811,7 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT bool b; if (cd->getLanguage()==SrcLangExt_VHDL) { - if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) + if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { continue; } @@ -1085,6 +1085,82 @@ static void countFiles(int &htmlFiles,int &files) } } +static void writeSingleFileIndex(OutputList &ol,FileDef *fd) +{ + //printf("Found filedef %s\n",fd->name().data()); + bool doc = fd->isLinkableInProject(); + bool src = fd->generateSourceFile(); + bool nameOk = !fd->isDocumentationFile(); + if (nameOk && (doc || src) && !fd->isReference()) + { + QCString path; + if (Config_getBool("FULL_PATH_NAMES")) + { + path=stripFromPath(fd->getPath().copy()); + } + QCString fullName=fd->name(); + if (!path.isEmpty()) + { + if (path.at(path.length()-1)!='/') fullName.prepend("/"); + fullName.prepend(path); + } + + ol.startIndexKey(); + ol.docify(path); + if (doc) + { + ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); + //if (addToIndex) + //{ + // addMembersToIndex(fd,LayoutDocManager::File,fullName,QCString()); + //} + } + else + { + ol.startBold(); + ol.docify(fd->name()); + ol.endBold(); + //if (addToIndex) + //{ + // Doxygen::indexList->addContentsItem(FALSE,fullName,0,0,0); + //} + } + if (src) + { + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.docify(" "); + ol.startTextLink(fd->includeName(),0); + ol.docify("["); + ol.parseText(theTranslator->trCode()); + ol.docify("]"); + ol.endTextLink(); + ol.popGeneratorState(); + } + ol.endIndexKey(); + bool hasBrief = !fd->briefDescription().isEmpty(); + ol.startIndexValue(hasBrief); + if (hasBrief) + { + //ol.docify(" ("); + ol.generateDoc( + fd->briefFile(),fd->briefLine(), + fd,0, + fd->briefDescription(TRUE), + FALSE, // index words + FALSE, // isExample + 0, // example name + TRUE, // single line + TRUE // link from index + ); + //ol.docify(")"); + } + ol.endIndexValue(fd->getOutputFileBase(),hasBrief); + //ol.popGeneratorState(); + // -------------------------------------------------------- + } +} + //---------------------------------------------------------------------------- static void writeFileIndex(OutputList &ol) @@ -1131,135 +1207,67 @@ static void writeFileIndex(OutputList &ol) OutputNameDict outputNameDict(1009); OutputNameList outputNameList; outputNameList.setAutoDelete(TRUE); - + if (Config_getBool("FULL_PATH_NAMES")) { // re-sort input files in (dir,file) output order instead of (file,dir) input order - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { QCString path=fd->getPath(); if (path.isEmpty()) path="[external]"; FileList *fl = outputNameDict.find(path); if (fl) { - fl->inSort(fd); + fl->append(fd); //printf("+ inserting %s---%s\n",fd->getPath().data(),fd->name().data()); } else { //printf("o inserting %s---%s\n",fd->getPath().data(),fd->name().data()); fl = new FileList(path); - fl->inSort(fd); - outputNameList.inSort(fl); + fl->append(fd); + outputNameList.append(fl); outputNameDict.insert(path,fl); } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } - + ol.startIndexList(); - FileList *fl=0; if (Config_getBool("FULL_PATH_NAMES")) { - fl = outputNameList.first(); + outputNameList.sort(); + QListIterator<FileList> fnli(outputNameList); + FileList *fl; + for (fnli.toFirst();(fl=fnli.current());++fnli) + { + fl->sort(); + QListIterator<FileDef> it(*fl); + FileDef *fd; + for (;(fd=it.current());++it) + { + writeSingleFileIndex(ol,fd); + } + } } else { - fl = Doxygen::inputNameList->first(); - } - while (fl) - { - FileDef *fd=fl->first(); - while (fd) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - //printf("Found filedef %s\n",fd->name().data()); - bool doc = fd->isLinkableInProject(); - bool src = fd->generateSourceFile(); - bool nameOk = !fd->isDocumentationFile(); - if (nameOk && (doc || src) && - !fd->isReference()) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { - QCString path; - if (Config_getBool("FULL_PATH_NAMES")) - { - path=stripFromPath(fd->getPath().copy()); - } - QCString fullName=fd->name(); - if (!path.isEmpty()) - { - if (path.at(path.length()-1)!='/') fullName.prepend("/"); - fullName.prepend(path); - } - - ol.startIndexKey(); - ol.docify(path); - if (doc) - { - ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); - //if (addToIndex) - //{ - // addMembersToIndex(fd,LayoutDocManager::File,fullName,QCString()); - //} - } - else - { - ol.startBold(); - ol.docify(fd->name()); - ol.endBold(); - //if (addToIndex) - //{ - // Doxygen::indexList->addContentsItem(FALSE,fullName,0,0,0); - //} - } - if (src) - { - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - ol.docify(" "); - ol.startTextLink(fd->includeName(),0); - ol.docify("["); - ol.parseText(theTranslator->trCode()); - ol.docify("]"); - ol.endTextLink(); - ol.popGeneratorState(); - } - ol.endIndexKey(); - bool hasBrief = !fd->briefDescription().isEmpty(); - ol.startIndexValue(hasBrief); - if (hasBrief) - { - //ol.docify(" ("); - ol.generateDoc( - fd->briefFile(),fd->briefLine(), - fd,0, - fd->briefDescription(TRUE), - FALSE, // index words - FALSE, // isExample - 0, // example name - TRUE, // single line - TRUE // link from index - ); - //ol.docify(")"); - } - ol.endIndexValue(fd->getOutputFileBase(),hasBrief); - //ol.popGeneratorState(); - // -------------------------------------------------------- + writeSingleFileIndex(ol,fd); } - fd=fl->next(); - } - if (Config_getBool("FULL_PATH_NAMES")) - { - fl=outputNameList.next(); - } - else - { - fl=Doxygen::inputNameList->next(); } } ol.endIndexList(); @@ -1360,7 +1368,10 @@ void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool globalO ) ) { - addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(FALSE),cd->anchor(),cd->partOfGroups()==0); + addMembersToIndex(cd,LayoutDocManager::Class, + cd->displayName(FALSE), + cd->anchor(), + cd->partOfGroups()==0 && !cd->isSimple()); } if (count>0) { @@ -1402,7 +1413,7 @@ static void writeNamespaceTree(NamespaceSDict *nsDict,FTVHelp *ftv, } } - if (isLinkable || hasChildren) + if ((isLinkable && !showClasses) || hasChildren) { ftv->addContentsItem(hasChildren,nd->localName(),ref,file,0,FALSE,TRUE,nd); @@ -1672,17 +1683,14 @@ class PrefixIgnoreClassList : public ClassList public: typedef ClassDef ElementType; PrefixIgnoreClassList(uint letter) : m_letter(letter) {} - virtual int compareItems(QCollection::Item item1, QCollection::Item item2) + uint letter() const { return m_letter; } + private: + virtual int compareValue(const ClassDef *c1, const ClassDef *c2) const { - ClassDef *c1=(ClassDef *)item1; - ClassDef *c2=(ClassDef *)item2; - QCString n1 = c1->className(); QCString n2 = c2->className(); return qstricmp (n1.data()+getPrefixIndex(n1), n2.data()+getPrefixIndex(n2)); } - uint letter() const { return m_letter; } - private: uint m_letter; }; @@ -1734,12 +1742,6 @@ class UsedIndexLetters : public SIntDict<uint> { public: UsedIndexLetters() : SIntDict<uint>(257) { setAutoDelete(TRUE); } - int compareItems( QCollection::Item item1, QCollection::Item item2) - { - int *p1=(int *)item1; - int *p2=(int *)item2; - return *p1 - *p2; // subtracting is done by int not uint. - } void add(uint letter) { uint *v = find(letter); @@ -1748,6 +1750,11 @@ class UsedIndexLetters : public SIntDict<uint> append(letter,new uint(letter)); } } + private: + int compareValues( const uint *p1, const uint *p2) const + { + return (int)*p1 - (int)*p2; // subtracting is done by int not uint. + } }; // write an alphabetical index of all class with a header for each letter @@ -3095,7 +3102,7 @@ static void writePages(PageDef *pd,FTVHelp *ftv) if (pd->title().isEmpty()) pageTitle=pd->name(); else - pageTitle=pd->title(); + pageTitle=filterTitle(pd->title()); if (ftv) { @@ -3166,9 +3173,10 @@ static void writePageIndex(OutputList &ol) PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { - if (pd->getOuterScope()==0 || - pd->getOuterScope()->definitionType()!=Definition::TypePage - ) // not a sub page + if ((pd->getOuterScope()==0 || + pd->getOuterScope()->definitionType()!=Definition::TypePage) && // not a sub page + !pd->isReference() // not an external page + ) { writePages(pd,ftv); } diff --git a/src/index.h b/src/index.h index ae15f16..6805655 100644 --- a/src/index.h +++ b/src/index.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/lang_cfg.h b/src/lang_cfg.h deleted file mode 100644 index 769696c..0000000 --- a/src/lang_cfg.h +++ /dev/null @@ -1,42 +0,0 @@ -#define LANG_AM -#define LANG_AR -#define LANG_BR -#define LANG_CA -#define LANG_CN -#define LANG_CZ -#define LANG_DE -#define LANG_DK -#define LANG_EN -#define LANG_EO -#define LANG_ES -#define LANG_FA -#define LANG_FI -#define LANG_FR -#define LANG_GR -#define LANG_HR -#define LANG_HU -#define LANG_ID -#define LANG_IT -#define LANG_JE -#define LANG_JP -#define LANG_KE -#define LANG_KR -#define LANG_LT -#define LANG_LV -#define LANG_MK -#define LANG_NL -#define LANG_NO -#define LANG_PL -#define LANG_PT -#define LANG_RO -#define LANG_RU -#define LANG_SC -#define LANG_SI -#define LANG_SK -#define LANG_SR -#define LANG_SV -#define LANG_TR -#define LANG_TW -#define LANG_UA -#define LANG_VI -#define LANG_ZA diff --git a/src/language.cpp b/src/language.cpp index c993323..3b57de1 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -156,16 +156,6 @@ Translator *theTranslator=0; -static const char obsoleteMsg[] = - "---------\n" - "ERROR: The selected language is no longer supported!\n" - "If you want doxygen to produce output in this language \n" - "you are kindly requested to help bringing the documentation \n" - "up to date. Please read the development section of the manual \n" - "for more information or contact Petr Prikryl (Prikryl@skil.cz).\n" - "Thanks in advance!\n" - "---------\n"; - bool setTranslator(const char *langName) { if (L_EQUAL("english")) diff --git a/src/language.h b/src/language.h index 9550cb9..4780ab3 100644 --- a/src/language.h +++ b/src/language.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/languages.py b/src/languages.py index 0005e88..7ce382a 100755 --- a/src/languages.py +++ b/src/languages.py @@ -25,8 +25,8 @@ print """\ <CustomBuildRule Name="Languages" DisplayName="Settings" - CommandLine="python $(InputPath) [AllOptions] [AdditionalOptions] > $(InputDir)../src/$(InputName).h" - Outputs="$(InputDir)../src/$(InputName).h" + CommandLine="python $(InputPath) [AllOptions] [AdditionalOptions] > $(InpDir)/$(InputName).h" + Outputs="$(IntDir)/$(InputName).h" FileExtensions="*.py" AdditionalDependencies="" ExecutionDescription="Executing languages ..." diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 91064a3..eed36bc 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -31,20 +31,27 @@ #include "cite.h" #include "filedef.h" #include "config.h" +#include "htmlentity.h" static QCString escapeLabelName(const char *s) { QCString result; const char *p=s; char c; - while ((c=*p++)) + if (p) { - switch (c) + while ((c=*p++)) { - case '%': result+="\\%"; break; - case '|': result+="\\texttt{\"|}"; break; - case '!': result+="\"!"; break; - default: result+=c; + switch (c) + { + case '%': result+="\\%"; break; + case '|': result+="\\texttt{\"|}"; break; + case '!': result+="\"!"; break; + case '{': result+="\\lcurly{}"; break; + case '}': result+="\\rcurly{}"; break; + case '~': result+="````~"; break; // to get it a bit better in index together with other special characters + default: result+=c; + } } } return result; @@ -69,17 +76,22 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s) const char *p=s; char str[2]; str[1]=0; char c; - while ((c=*p++)) + if (p) { - switch (c) + while ((c=*p++)) { - case '!': m_t << "\"!"; break; - case '"': m_t << "\"\""; break; - case '@': m_t << "\"@"; break; - case '|': m_t << "\\texttt{\"|}"; break; - case '[': m_t << "["; break; - case ']': m_t << "]"; break; - default: str[0]=c; filter(str); break; + switch (c) + { + case '!': m_t << "\"!"; break; + case '"': m_t << "\"\""; break; + case '@': m_t << "\"@"; break; + case '|': m_t << "\\texttt{\"|}"; break; + case '[': m_t << "["; break; + case ']': m_t << "]"; break; + case '{': m_t << "\\lcurly{}"; break; + case '}': m_t << "\\rcurly{}"; break; + default: str[0]=c; filter(str); break; + } } } return result; @@ -130,135 +142,25 @@ void LatexDocVisitor::visit(DocWhiteSpace *w) void LatexDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) - { - case DocSymbol::BSlash: m_t << "\\textbackslash{}"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: if (m_insidePre) m_t << "<"; else m_t << "$<$"; - break; - case DocSymbol::Greater: if (m_insidePre) m_t << ">"; else m_t << "$>$"; break; - case DocSymbol::Amp: m_t << "\\&"; break; - case DocSymbol::Dollar: m_t << "\\$"; break; - case DocSymbol::Hash: m_t << "\\#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "\\%"; break; - case DocSymbol::Pipe: m_t << "$|$"; break; - case DocSymbol::Copy: m_t << "\\copyright{}"; break; - case DocSymbol::Tm: m_t << "\\texttrademark{}"; break; - case DocSymbol::Reg: m_t << "\\textregistered{}"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "`"; break; - case DocSymbol::Rsquo: m_t << "'"; break; - case DocSymbol::Ldquo: m_t << "``"; break; - case DocSymbol::Rdquo: m_t << "''"; break; - case DocSymbol::Ndash: m_t << "--"; break; - case DocSymbol::Mdash: m_t << "---"; break; - case DocSymbol::Uml: - if (s->letter()=='i') - m_t << "\\\"{\\i}"; - else - m_t << "\\\"{" << s->letter() << "}"; - break; - case DocSymbol::Acute: - if (s->letter()=='i') - m_t << "\\'{\\i}"; - else - m_t << "\\'{" << s->letter() << "}"; - break; - case DocSymbol::Grave: - if (s->letter()=='i') - m_t << "\\`{\\i}"; - else - m_t << "\\`{" << s->letter() << "}"; - break; - case DocSymbol::Circ: - if (s->letter()=='i') - m_t << "\\^{\\i}"; - else - m_t << "\\^{" << s->letter() << "}"; - break; - case DocSymbol::Slash: if (tolower(s->letter())=='o') - m_t << "{\\" << s->letter() << "}"; - else - m_t << s->letter(); - break; - case DocSymbol::Tilde: m_t << "\\~{" << s->letter() << "}"; break; - case DocSymbol::Szlig: m_t << "{\\ss}"; break; - case DocSymbol::Cedil: m_t << "\\c{" << s->letter() << "}"; break; - case DocSymbol::Ring: m_t << "\\" << s->letter() << s->letter(); break; - case DocSymbol::Nbsp: m_t << "~"; break; - case DocSymbol::AElig: m_t << "{\\AE}"; break; - case DocSymbol::Aelig: m_t << "{\\ae}"; break; - case DocSymbol::GrkGamma: m_t << "{$\\Gamma$}"; break; - case DocSymbol::GrkDelta: m_t << "{$\\Delta$}"; break; - case DocSymbol::GrkTheta: m_t << "{$\\Theta$}"; break; - case DocSymbol::GrkLambda: m_t << "{$\\Lambda$}"; break; - case DocSymbol::GrkXi: m_t << "{$\\Xi$}"; break; - case DocSymbol::GrkPi: m_t << "{$\\Pi$}"; break; - case DocSymbol::GrkSigma: m_t << "{$\\Sigma$}"; break; - case DocSymbol::GrkUpsilon: m_t << "{$\\Upsilon$}"; break; - case DocSymbol::GrkPhi: m_t << "{$\\Phi$}"; break; - case DocSymbol::GrkPsi: m_t << "{$\\Psi$}"; break; - case DocSymbol::GrkOmega: m_t << "{$\\Omega$}"; break; - case DocSymbol::Grkalpha: m_t << "{$\\alpha$}"; break; - case DocSymbol::Grkbeta: m_t << "{$\\beta$}"; break; - case DocSymbol::Grkgamma: m_t << "{$\\gamma$}"; break; - case DocSymbol::Grkdelta: m_t << "{$\\delta$}"; break; - case DocSymbol::Grkepsilon: m_t << "{$\\varepsilon$}"; break; - case DocSymbol::Grkzeta: m_t << "{$\\zeta$}"; break; - case DocSymbol::Grketa: m_t << "{$\\eta$}"; break; - case DocSymbol::Grktheta: m_t << "{$\\theta$}"; break; - case DocSymbol::Grkiota: m_t << "{$\\iota$}"; break; - case DocSymbol::Grkkappa: m_t << "{$\\kappa$}"; break; - case DocSymbol::Grklambda: m_t << "{$\\lambda$}"; break; - case DocSymbol::Grkmu: m_t << "{$\\mu$}"; break; - case DocSymbol::Grknu: m_t << "{$\\nu$}"; break; - case DocSymbol::Grkxi: m_t << "{$\\xi$}"; break; - case DocSymbol::Grkpi: m_t << "{$\\pi$}"; break; - case DocSymbol::Grkrho: m_t << "{$\\rho$}"; break; - case DocSymbol::Grksigma: m_t << "{$\\sigma$}"; break; - case DocSymbol::Grktau: m_t << "{$\\tau$}"; break; - case DocSymbol::Grkupsilon: m_t << "{$\\upsilon$}"; break; - case DocSymbol::Grkphi: m_t << "{$\\varphi$}"; break; - case DocSymbol::Grkchi: m_t << "{$\\chi$}"; break; - case DocSymbol::Grkpsi: m_t << "{$\\psi$}"; break; - case DocSymbol::Grkomega: m_t << "{$\\omega$}"; break; - case DocSymbol::Grkvarsigma: m_t << "{$\\varsigma$}"; break; - case DocSymbol::Section: m_t << "{$\\S$}"; break; - case DocSymbol::Degree: m_t << "\\textdegree"; break; - case DocSymbol::Prime: m_t << "'"; break; - case DocSymbol::DoublePrime: m_t << "''"; break; - case DocSymbol::Infinity: m_t << "{$\\infty$}"; break; - case DocSymbol::EmptySet: m_t << "{$\\emptyset$}"; break; - case DocSymbol::PlusMinus: m_t << "{$\\pm$}"; break; - case DocSymbol::Times: m_t << "{$\\times$}"; break; - case DocSymbol::Minus: m_t << "-"; break; - case DocSymbol::CenterDot: m_t << "{$\\cdot$}"; break; - case DocSymbol::Partial: m_t << "{$\\partial$}"; break; - case DocSymbol::Nabla: m_t << "{$\\nabla$}"; break; - case DocSymbol::SquareRoot: m_t << "{$\\surd$}"; break; - case DocSymbol::Perpendicular: m_t << "{$\\perp$}"; break; - case DocSymbol::Sum: m_t << "{$\\sum$}"; break; - case DocSymbol::Integral: m_t << "{$\\int$}"; break; - case DocSymbol::Product: m_t << "{$\\prod$}"; break; - case DocSymbol::Similar: m_t << "{$\\sim$}"; break; - case DocSymbol::Approx: m_t << "{$\\approx$}"; break; - case DocSymbol::NotEqual: m_t << "{$\\ne$}"; break; - case DocSymbol::Equivalent: m_t << "{$\\equiv$}"; break; - case DocSymbol::Proportional: m_t << "{$\\propto$}"; break; - case DocSymbol::LessEqual: m_t << "{$\\le$}"; break; - case DocSymbol::GreaterEqual: m_t << "{$\\ge$}"; break; - case DocSymbol::LeftArrow: m_t << "{$\\leftarrow$}"; break; - case DocSymbol::RightArrow: m_t << "{$\\rightarrow$}"; break; - case DocSymbol::SetIn: m_t << "{$\\in$}"; break; - case DocSymbol::SetNotIn: m_t << "{$\\notin$}"; break; - case DocSymbol::LeftCeil: m_t << "{$\\lceil$}"; break; - case DocSymbol::RightCeil: m_t << "{$\\rceil$}"; break; - case DocSymbol::LeftFloor: m_t << "{$\\lfloor$}"; break; - case DocSymbol::RightFloor: m_t << "{$\\rfloor$}"; break; - default: - err("unknown symbol found\n"); + const char *res = HtmlEntityMapper::instance()->latex(s->symbol()); + if (res) + { + if (((s->symbol() == DocSymbol::Sym_lt) || (s->symbol() == DocSymbol::Sym_Less))&& (!m_insidePre)) + { + m_t << "$<$"; + } + else if (((s->symbol() == DocSymbol::Sym_gt) || (s->symbol() == DocSymbol::Sym_Greater)) && (!m_insidePre)) + { + m_t << "$>$"; + } + else + { + m_t << res; + } + } + else + { + err("LaTeX: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } @@ -279,8 +181,7 @@ void LatexDocVisitor::visit(DocURL *u) void LatexDocVisitor::visit(DocLineBreak *) { if (m_hide) return; - if (m_insideTable) m_t << "\\newline\n"; - else m_t << "\\par\n"; + m_t << "~\\newline\n"; } void LatexDocVisitor::visit(DocHorRuler *) @@ -304,10 +205,10 @@ void LatexDocVisitor::visit(DocStyleChange *s) if (s->enable()) m_t << "{\\ttfamily "; else m_t << "}"; break; case DocStyleChange::Subscript: - if (s->enable()) m_t << "$_{\\mbox{"; else m_t << "}}$ "; + if (s->enable()) m_t << "\\textsubscript{"; else m_t << "}"; break; case DocStyleChange::Superscript: - if (s->enable()) m_t << "$^{\\mbox{"; else m_t << "}}$ "; + if (s->enable()) m_t << "\\textsuperscript{"; else m_t << "}"; break; case DocStyleChange::Center: if (s->enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} "; @@ -466,6 +367,9 @@ void LatexDocVisitor::visit(DocInclude *inc) break; case DocInclude::HtmlInclude: break; + case DocInclude::LatexInclude: + m_t << inc->text(); + break; case DocInclude::VerbInclude: m_t << "\n\\begin{DoxyVerbInclude}\n"; m_t << inc->text(); @@ -1573,13 +1477,13 @@ void LatexDocVisitor::visitPost(DocText *) void LatexDocVisitor::visitPre(DocHtmlBlockQuote *) { if (m_hide) return; - m_t << "\\begin{quotation}" << endl; + m_t << "\\begin{quote}" << endl; } void LatexDocVisitor::visitPost(DocHtmlBlockQuote *) { if (m_hide) return; - m_t << "\\end{quotation}" << endl; + m_t << "\\end{quote}" << endl; } void LatexDocVisitor::visitPre(DocVhdlFlow *) @@ -1646,8 +1550,8 @@ void LatexDocVisitor::endLink(const QCString &ref,const QCString &file,const QCS m_t << "{"; filter(theTranslator->trPageAbbreviation()); m_t << "}{" << file; - if (!anchor.isEmpty()) m_t << "_" << anchor; - m_t << "}"; + if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; + m_t << anchor << "}"; } } diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 4073b7f..d386569 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/latexgen.cpp b/src/latexgen.cpp index e473e79..90591c5 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -293,7 +293,10 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\\usepackage{makeidx}\n" "\\usepackage{multicol}\n" "\\usepackage{multirow}\n" + "\\usepackage{fixltx2e}\n" // for \textsubscript + "\\PassOptionsToPackage{warn}{textcomp}\n" "\\usepackage{textcomp}\n" + "\\usepackage[nointegrals]{wasysym}\n" "\\usepackage[table]{xcolor}\n" "\n"; @@ -323,6 +326,7 @@ static void writeDefaultHeaderPart1(FTextStream &t) " \\fontseries{bc}\\selectfont%\n" " \\color{darkgray}%\n" "}\n" + "\\newcommand{\\+}{\\discretionary{\\mbox{\\scriptsize$\\hookleftarrow$}}{}{}}\n" "\n"; // Define page & text layout @@ -464,7 +468,11 @@ 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"; + t << "\\hypersetup{pageanchor=false,\n" + << " bookmarks=true,\n" + << " bookmarksnumbered=true,\n" + << " pdfencoding=unicode\n" + << " }\n"; } t << "\\pagenumbering{roman}\n" "\\begin{titlepage}\n" @@ -592,6 +600,14 @@ 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"); @@ -608,9 +624,9 @@ void LatexGenerator::startIndexSection(IndexSections is) { QCString header = fileToString(latexHeader); t << substituteKeywords(header,0, - Config_getString("PROJECT_NAME"), - Config_getString("PROJECT_NUMBER"), - Config_getString("PROJECT_BRIEF")); + convertToLaTeX(Config_getString("PROJECT_NAME")), + convertToLaTeX(Config_getString("PROJECT_NUMBER")), + convertToLaTeX(Config_getString("PROJECT_BRIEF"))); } } break; @@ -726,11 +742,13 @@ void LatexGenerator::startIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -742,9 +760,7 @@ void LatexGenerator::startIndexSection(IndexSections is) break; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; @@ -919,11 +935,13 @@ void LatexGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -949,9 +967,7 @@ void LatexGenerator::endIndexSection(IndexSections is) } } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; @@ -1006,9 +1022,9 @@ void LatexGenerator::endIndexSection(IndexSections is) { QCString footer = fileToString(latexFooter); t << substituteKeywords(footer,0, - Config_getString("PROJECT_NAME"), - Config_getString("PROJECT_NUMBER"), - Config_getString("PROJECT_BRIEF")); + convertToLaTeX(Config_getString("PROJECT_NAME")), + convertToLaTeX(Config_getString("PROJECT_NUMBER")), + convertToLaTeX(Config_getString("PROJECT_BRIEF"))); } break; } @@ -1362,8 +1378,10 @@ void LatexGenerator::startMemberDoc(const char *clname, t << "}"; if (clname) { - t << "!" << clname << "@{"; - docify(clname); + t << "!"; + escapeLabelName(clname); + t << "@{"; + escapeMakeIndexChars(clname); t << "}"; } t << "}" << endl; @@ -2000,13 +2018,18 @@ void LatexGenerator::escapeLabelName(const char *s) { 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!='%') + while ((c=*p) && c!='|' && c!='!' && c!='%' && c!='{' && c!='}' && c!='~') { result[i++]=c; p++; @@ -2029,16 +2052,20 @@ void LatexGenerator::escapeMakeIndexChars(const char *s) { 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!=']') + while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|') { result[i++]=c; p++; diff --git a/src/latexgen.h b/src/latexgen.h index 8e29c01..f68612d 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/layout.cpp b/src/layout.cpp index bc00745..739a2a3 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/layout.h b/src/layout.h index 2506076..d50bc7c 100644 --- a/src/layout.h +++ b/src/layout.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/libdoxycfg.pro.in b/src/libdoxycfg.pro.in index 6a63828..ab7c36c 100644 --- a/src/libdoxycfg.pro.in +++ b/src/libdoxycfg.pro.in @@ -1,7 +1,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -17,11 +17,11 @@ TEMPLATE = libdoxycfg.t CONFIG = console warn_on staticlib $extraopts HEADERS = config.h configoptions.h portable.h -SOURCES = config.cpp configoptions.cpp portable.cpp portable_c.c +SOURCES = ../generated_src/doxygen/config.cpp ../generated_src/doxygen/configoptions.cpp portable.cpp portable_c.c win32:TMAKE_CXXFLAGS += -DQT_NODLL win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti -INCLUDEPATH += ../qtools -win32:INCLUDEPATH += . +DEPENDPATH += ../generated_src/doxygen +INCLUDEPATH += ../generated_src/doxygen . ../qtools DESTDIR = ../lib TARGET = doxycfg -OBJECTS_DIR = ../objects +OBJECTS_DIR = ../objects/doxygen diff --git a/src/libdoxycfg.t.in b/src/libdoxycfg.t.in index 3a2ce0a..89833f6 100644 --- a/src/libdoxycfg.t.in +++ b/src/libdoxycfg.t.in @@ -1,7 +1,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -45,9 +45,9 @@ sub GenerateDep { #################### -#$ GenerateDep("config.cpp","config.l"); - $(LEX) -PconfigYY -t config.l >config.cpp +#$ GenerateDep("../generated_src/doxygen/config.cpp","config.l"); + $(LEX) -PconfigYY -t config.l >../generated_src/doxygen/config.cpp -configoptions.cpp: config.xml configgen.py - $(PYTHON) configgen.py -cpp config.xml >configoptions.cpp +../generated_src/doxygen/configoptions.cpp: config.xml configgen.py + $(PYTHON) configgen.py -cpp config.xml >../generated_src/doxygen/configoptions.cpp diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index b230b2f..457db58 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -1,7 +1,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -17,7 +17,6 @@ TEMPLATE = libdoxygen.t CONFIG = console warn_on staticlib $extraopts HEADERS = arguments.h \ - bib2xhtml.pl.h \ bufstr.h \ cite.h \ clangparser.h \ @@ -27,7 +26,6 @@ HEADERS = arguments.h \ code.h \ commentcnv.h \ commentscan.h \ - compound.xsd.h \ condparser.h \ config.h \ context.h \ @@ -47,41 +45,27 @@ HEADERS = arguments.h \ docvisitor.h \ dot.h \ doxygen.h \ - doxygen.bst.h \ - doxygen.css.h \ - doxygen.sty.h \ eclipsehelp.h \ entry.h \ example.h \ filedef.h \ filename.h \ - footer.html.h \ formula.h \ ftextstream.h \ ftvhelp.h \ groupdef.h \ - header.html.h \ htags.h \ htmlattrib.h \ htmldocvisitor.h \ htmlgen.h \ htmlhelp.h \ + htmlentity.h \ image.h \ index.h \ - index.xsd.h \ - jquery_p1.js.h \ - jquery_p2.js.h \ - jquery_p3.js.h \ - jquery_ui.js.h \ - jquery_fx.js.h \ - jquery_pt.js.h \ - svgpan.js.h \ - dynsections.js.h \ language.h \ latexdocvisitor.h \ latexgen.h \ layout.h \ - layout_default.xml.h \ logos.h \ mandocvisitor.h \ mangen.h \ @@ -96,8 +80,6 @@ HEADERS = arguments.h \ msc.h \ dia.h \ namespacedef.h \ - navtree.css.h \ - navtree.js.h \ objcache.h \ outputgen.h \ outputlist.h \ @@ -114,17 +96,11 @@ HEADERS = arguments.h \ qhp.h \ qhpxmlwriter.h \ reflist.h \ - resize.js.h \ rtfdocvisitor.h \ rtfgen.h \ rtfstyle.h \ scanner.h \ searchindex.h \ - search.css.h \ - search.js.h \ - extsearch.js.h \ - search_functions.php.h \ - search_opensearch.php.h \ section.h \ sortdict.h \ store.h \ @@ -143,34 +119,26 @@ HEADERS = arguments.h \ xmldocvisitor.h \ xmlgen.h \ docbookvisitor.h \ - docbookgen.h + docbookgen.h \ SOURCES = arguments.cpp \ - constexp.cpp \ - ce_parse.cpp \ cite.cpp \ clangparser.cpp \ classdef.cpp \ classlist.cpp \ cmdmapper.cpp \ - code.cpp \ - commentcnv.cpp \ - commentscan.cpp \ condparser.cpp \ context.cpp \ cppvalue.cpp \ dbusxmlscanner.cpp \ debug.cpp \ defgen.cpp \ - declinfo.cpp \ - defargs.cpp \ define.cpp \ definition.cpp \ diagram.cpp \ dirdef.cpp \ docparser.cpp \ docsets.cpp \ - doctokenizer.cpp \ dot.cpp \ doxygen.cpp \ eclipsehelp.cpp \ @@ -180,13 +148,12 @@ SOURCES = arguments.cpp \ formula.cpp \ ftextstream.cpp \ ftvhelp.cpp \ - fortrancode.cpp \ - fortranscanner.cpp \ groupdef.cpp \ htags.cpp \ htmldocvisitor.cpp \ htmlgen.cpp \ htmlhelp.cpp \ + htmlentity.cpp \ image.cpp \ index.cpp \ language.cpp \ @@ -213,46 +180,53 @@ SOURCES = arguments.cpp \ outputlist.cpp \ pagedef.cpp \ perlmodgen.cpp \ - pre.cpp \ - pycode.cpp \ - pyscanner.cpp \ qhp.cpp \ qhpxmlwriter.cpp \ reflist.cpp \ rtfdocvisitor.cpp \ rtfgen.cpp \ rtfstyle.cpp \ - scanner.cpp \ searchindex.cpp \ store.cpp \ tagreader.cpp \ - tclscanner.cpp \ template.cpp \ textdocvisitor.cpp \ tooltip.cpp \ util.cpp \ - version.cpp \ - vhdlcode.cpp \ vhdldocgen.cpp \ - vhdlparser.cpp \ - vhdlscanner.cpp \ xmldocvisitor.cpp \ xmlgen.cpp \ docbookvisitor.cpp \ - docbookgen.cpp + docbookgen.cpp \ + ../generated_src/doxygen/ce_parse.cpp \ + ../generated_src/doxygen/constexp.cpp \ + ../generated_src/doxygen/vhdlcode.cpp \ + ../generated_src/doxygen/vhdlparser.cpp \ + ../generated_src/doxygen/vhdlscanner.cpp \ + ../generated_src/doxygen/code.cpp \ + ../generated_src/doxygen/commentcnv.cpp \ + ../generated_src/doxygen/commentscan.cpp \ + ../generated_src/doxygen/declinfo.cpp \ + ../generated_src/doxygen/defargs.cpp \ + ../generated_src/doxygen/doctokenizer.cpp \ + ../generated_src/doxygen/pre.cpp \ + ../generated_src/doxygen/pycode.cpp \ + ../generated_src/doxygen/pyscanner.cpp \ + ../generated_src/doxygen/scanner.cpp \ + ../generated_src/doxygen/tclscanner.cpp \ + ../generated_src/doxygen/fortrancode.cpp \ + ../generated_src/doxygen/fortranscanner.cpp \ + ../generated_src/doxygen/version.cpp -win32:TMAKE_CXXFLAGS += -DQT_NODLL +win32:TMAKE_CXXFLAGS += -DQT_NODLL win32-msvc:TMAKE_CXXFLAGS += -Zm200 win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -linux-g++:TMAKE_CXXFLAGS += -fno-exceptions -INCLUDEPATH += ../qtools -#INCLUDEPATH += ../libpng -INCLUDEPATH += ../libmd5 +linux-g++:TMAKE_CXXFLAGS += -fno-exceptions +INCLUDEPATH += ../generated_src/doxygen ../src ../qtools ../libmd5 INCLUDEPATH += %%SQLITE3_INC%% +DEPENDPATH += ../generated_src/doxygen win32:INCLUDEPATH += . -#win32-g++:INCLUDEPATH = ../qtools /usr/include/libpng12 ../libmd5 -win32-g++:INCLUDEPATH = ../qtools ../libmd5 DESTDIR = ../lib TARGET = doxygen -OBJECTS_DIR = ../objects +OBJECTS_DIR = ../objects/doxygen diff --git a/src/libdoxygen.t.in b/src/libdoxygen.t.in index f131f70..173f90b 100644 --- a/src/libdoxygen.t.in +++ b/src/libdoxygen.t.in @@ -1,7 +1,7 @@ # # # -# Copyright (C) 1997-2013 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 @@ -21,10 +21,12 @@ YACC = %%BISON%% PYTHON = %%PYTHON%% PERL = %%PERL%% INCBUFSIZE = $(PYTHON) increasebuffer.py +GENERATED_SRC = ../generated_src/doxygen +GENERATED_OBJ = ../objects/doxygen #${ sub GenerateDep { - my($obj,$src,$dep) = @_; + my($obj,$src,@deps) = @_; my(@objv,$srcv,$i,$s,$o,$d,$c); @objv = split(/\s+/,$obj); @srcv = split(/\s+/,$src); @@ -33,7 +35,9 @@ sub GenerateDep { $o = $objv[$i]; next if $s eq ""; $text .= $o . ": " . $s; - $text .= " ${linebreak}\n\t\t" . $dep if $dep ne ""; + foreach my $dep (@deps) { + $text .= " ${linebreak}\n\t\t" . $dep if $dep ne ""; + } if ( $moc_output{$s} ne "" ) { $text .= " ${linebreak}\n\t\t" . $moc_output{$s}; } @@ -49,170 +53,164 @@ sub GenerateLex { if ($caseOpt) { $text .= "-i "; } - $text .= "-P".$name."YY -t ".$name.".l | \$(INCBUFSIZE) >".$name.".cpp"; + $text .= "-P".$name."YY -t ".$name.".l | \$(INCBUFSIZE) > \$(GENERATED_SRC)/".$name.".cpp"; } #$} #################### -#$ GenerateDep("scanner.cpp","scanner.l"); +#$ GenerateDep("\$(GENERATED_SRC)/scanner.cpp","scanner.l"); #$ GenerateLex("scanner",0); -#$ GenerateDep("code.cpp","code.l"); +#$ GenerateDep("\$(GENERATED_SRC)/code.cpp","code.l"); #$ GenerateLex("code",0); -#$ GenerateDep("pyscanner.cpp","pyscanner.l"); +#$ GenerateDep("\$(GENERATED_SRC)/pyscanner.cpp","pyscanner.l"); #$ GenerateLex("pyscanner",0); -#$ GenerateDep("pycode.cpp","pycode.l"); +#$ GenerateDep("\$(GENERATED_SRC)/pycode.cpp","pycode.l"); #$ GenerateLex("pycode",0); -#$ GenerateDep("fortranscanner.cpp","fortranscanner.l"); +#$ GenerateDep("\$(GENERATED_SRC)/fortranscanner.cpp","fortranscanner.l"); #$ GenerateLex("fortranscanner",1); -#$ GenerateDep("fortrancode.cpp","fortrancode.l"); +#$ GenerateDep("\$(GENERATED_SRC)/fortrancode.cpp","fortrancode.l"); #$ GenerateLex("fortrancode",1); -#$ GenerateDep("vhdlcode.cpp","vhdlcode.l"); +#$ GenerateDep("\$(GENERATED_SRC)/vhdlcode.cpp","vhdlcode.l"); #$ GenerateLex("vhdlcode",1); -#$ GenerateDep("tclscanner.cpp","tclscanner.l"); +#$ GenerateDep("\$(GENERATED_SRC)/tclscanner.cpp","tclscanner.l"); #$ GenerateLex("tclscanner",1); -#$ GenerateDep("pre.cpp","pre.l"); +#$ GenerateDep("\$(GENERATED_SRC)/pre.cpp","pre.l"); #$ GenerateLex("pre",0); -#$ GenerateDep("declinfo.cpp","declinfo.l"); +#$ GenerateDep("\$(GENERATED_SRC)/declinfo.cpp","declinfo.l"); #$ GenerateLex("declinfo",0); -#$ GenerateDep("defargs.cpp","defargs.l"); +#$ GenerateDep("\$(GENERATED_SRC)/defargs.cpp","defargs.l"); #$ GenerateLex("defargs",0); -#$ GenerateDep("doctokenizer.cpp","doctokenizer.l"); +#$ GenerateDep("\$(GENERATED_SRC)/doctokenizer.cpp","doctokenizer.l"); #$ GenerateLex("doctokenizer",0); -#$ GenerateDep("commentcnv.cpp","commentcnv.l"); +#$ GenerateDep("\$(GENERATED_SRC)/commentcnv.cpp","commentcnv.l"); #$ GenerateLex("commentcnv",0); -#$ GenerateDep("commentscan.cpp","commentscan.l"); +#$ GenerateDep("\$(GENERATED_SRC)/commentscan.cpp","commentscan.l"); #$ GenerateLex("commentscan",0); -#$ GenerateDep("constexp.cpp","constexp.l","ce_parse.h"); +#$ GenerateDep("\$(GENERATED_SRC)/constexp.cpp","constexp.l","\$(GENERATED_SRC)/ce_parse.h"); #$ GenerateLex("constexp",0); -#$ GenerateDep("ce_parse.cpp","constexp.y"); - $(YACC) -l -p constexpYY constexp.y -o ce_parse.cpp +#$ GenerateDep("\$(GENERATED_SRC)/ce_parse.cpp","constexp.y"); + $(YACC) -l -p constexpYY constexp.y -o \$(GENERATED_SRC)/ce_parse.cpp -#$ GenerateDep("ce_parse.h","constexp.y"); - $(YACC) -l -d -p ce_parsexpYY constexp.y -o ce_parse.c - -rm ce_parse.c +#$ GenerateDep("\$(GENERATED_SRC)/ce_parse.h","constexp.y"); + $(YACC) -l -d -p ce_parsexpYY constexp.y -o \$(GENERATED_SRC)/ce_parse.c + -rm $(GENERATED_SRC)/ce_parse.c -#$ GenerateDep("vhdlscanner.cpp","vhdlscanner.l","vhdlparser.h"); +#$ GenerateDep("\$(GENERATED_SRC)/vhdlscanner.cpp","vhdlscanner.l","\$(GENERATED_SRC)/vhdlparser.h"); #$ GenerateLex("vhdlscanner",1); -#$ GenerateDep("vhdlparser.cpp","vhdlparser.y"); - $(YACC) -l -p vhdlscannerYY vhdlparser.y -o vhdlparser.cpp +#$ GenerateDep("\$(GENERATED_SRC)/vhdlparser.cpp","vhdlparser.y"); + $(YACC) -l -p vhdlscannerYY vhdlparser.y -o \$(GENERATED_SRC)/vhdlparser.cpp -#$ GenerateDep("vhdlparser.h","vhdlparser.y"); - $(YACC) -l -d -p vhdlscannerYY vhdlparser.y -o vhdlparser.c - -rm vhdlparser.c +#$ GenerateDep("\$(GENERATED_SRC)/vhdlparser.h","vhdlparser.y"); + $(YACC) -l -d -p vhdlscannerYY vhdlparser.y -o \$(GENERATED_SRC)/vhdlparser.c + -rm $(GENERATED_SRC)/vhdlparser.c -#$ GenerateDep("layout.cpp","layout_default.xml.h"); - TO_C_CMD=$(PYTHON) to_c_cmd.py < $< > $@ -cite.cpp: doxygen.bst.h bib2xhtml.pl.h +#$ GenerateDep("layout.cpp","\$(GENERATED_SRC)/layout_default.xml.h"); -ftvhelp.cpp: navtree.js.h resize.js.h navtree.css.h +#$ GenerateDep("cite.cpp","\$(GENERATED_SRC)/doxygen.bst.h","\$(GENERATED_SRC)/bib2xhtml.pl.h"); -htmlgen.cpp: header.html.h footer.html.h doxygen.css.h search_functions.php.h \ - search_opensearch.php.h search.css.h jquery_p1.js.h jquery_p2.js.h \ - jquery_p3.js.h jquery_ui.js.h jquery_fx.js.h jquery_pt.js.h \ - svgpan.js.h dynsections.js.h extsearch.js.h +#$ GenerateDep("ftvhelp.cpp","\$(GENERATED_SRC)/navtree.js.h","\$(GENERATED_SRC)/resize.js.h","\$(GENERATED_SRC)/navtree.css.h"); -layout.cpp: layout_default.xml.h +#$ GenerateDep("htmlgen.cpp","\$(GENERATED_SRC)/header.html.h","\$(GENERATED_SRC)/footer.html.h","\$(GENERATED_SRC)/doxygen.css.h","\$(GENERATED_SRC)/search_functions.php.h","\$(GENERATED_SRC)/search_opensearch.php.h","\$(GENERATED_SRC)/search.css.h","\$(GENERATED_SRC)/jquery_p1.js.h","\$(GENERATED_SRC)/jquery_p2.js.h","\$(GENERATED_SRC)/jquery_p3.js.h","\$(GENERATED_SRC)/jquery_ui.js.h","\$(GENERATED_SRC)/jquery_fx.js.h","\$(GENERATED_SRC)/jquery_pt.js.h","\$(GENERATED_SRC)/svgpan.js.h","\$(GENERATED_SRC)/dynsections.js.h","\$(GENERATED_SRC)/extsearch.js.h"); -xmlgen.cpp: index.xsd.h compound.xsd.h +#$ GenerateDep("xmlgen.cpp","\$(GENERATED_SRC)/index.xsd.h","\$(GENERATED_SRC)/compound.xsd.h"); -latexgen.cpp: doxygen.sty.h +#$ GenerateDep("latexgen.cpp","\$(GENERATED_SRC)/doxygen.sty.h"); -searchindex.cpp: search.js.h +#$ GenerateDep("searchindex.cpp","\$(GENERATED_SRC)/search.js.h"); -index.xsd.h: index.xsd +$(GENERATED_SRC)/index.xsd.h: index.xsd $(TO_C_CMD) -compound.xsd.h: compound.xsd +$(GENERATED_SRC)/compound.xsd.h: compound.xsd $(TO_C_CMD) -layout_default.xml.h: layout_default.xml +$(GENERATED_SRC)/layout_default.xml.h: layout_default.xml $(TO_C_CMD) -header.html.h: header.html +$(GENERATED_SRC)/header.html.h: header.html $(TO_C_CMD) -footer.html.h: footer.html +$(GENERATED_SRC)/footer.html.h: footer.html $(TO_C_CMD) -search_functions.php.h: search_functions.php +$(GENERATED_SRC)/search_functions.php.h: search_functions.php $(TO_C_CMD) -search_opensearch.php.h: search_opensearch.php +$(GENERATED_SRC)/search_opensearch.php.h: search_opensearch.php $(TO_C_CMD) -search.js.h: search.js +$(GENERATED_SRC)/search.js.h: search.js $(TO_C_CMD) -search.css.h: search.css +$(GENERATED_SRC)/search.css.h: search.css $(TO_C_CMD) -extsearch.js.h: extsearch.js +$(GENERATED_SRC)/extsearch.js.h: extsearch.js $(TO_C_CMD) -doxygen.css.h: doxygen.css +$(GENERATED_SRC)/doxygen.css.h: doxygen.css $(TO_C_CMD) -doxygen.sty.h: doxygen.sty +$(GENERATED_SRC)/doxygen.sty.h: doxygen.sty $(TO_C_CMD) - -navtree.js.h: navtree.js +$(GENERATED_SRC)/navtree.js.h: navtree.js $(TO_C_CMD) -resize.js.h: resize.js +$(GENERATED_SRC)/resize.js.h: resize.js $(TO_C_CMD) -jquery_p1.js.h: jquery_p1.js +$(GENERATED_SRC)/jquery_p1.js.h: jquery_p1.js $(TO_C_CMD) -jquery_p2.js.h: jquery_p2.js +$(GENERATED_SRC)/jquery_p2.js.h: jquery_p2.js $(TO_C_CMD) -jquery_p3.js.h: jquery_p3.js +$(GENERATED_SRC)/jquery_p3.js.h: jquery_p3.js $(TO_C_CMD) -jquery_ui.js.h: jquery_ui.js +$(GENERATED_SRC)/jquery_ui.js.h: jquery_ui.js $(TO_C_CMD) -jquery_fx.js.h: jquery_fx.js +$(GENERATED_SRC)/jquery_fx.js.h: jquery_fx.js $(TO_C_CMD) -jquery_pt.js.h: jquery_pt.js +$(GENERATED_SRC)/jquery_pt.js.h: jquery_pt.js $(TO_C_CMD) -navtree.css.h: navtree.css +$(GENERATED_SRC)/navtree.css.h: navtree.css $(TO_C_CMD) -svgpan.js.h: svgpan.js +$(GENERATED_SRC)/svgpan.js.h: svgpan.js $(TO_C_CMD) -dynsections.js.h: dynsections.js +$(GENERATED_SRC)/dynsections.js.h: dynsections.js $(TO_C_CMD) -doxygen.bst.h: doxygen.bst +$(GENERATED_SRC)/doxygen.bst.h: doxygen.bst $(TO_C_CMD) -bib2xhtml.pl.h: bib2xhtml.pl +$(GENERATED_SRC)/bib2xhtml.pl.h: bib2xhtml.pl $(TO_C_CMD) -version.cpp: ../configure - $(PYTHON) version.py +$(GENERATED_SRC)/version.cpp: ../configure + $(PYTHON) version.py $(GENERATED_SRC) diff --git a/src/lodepng.cpp b/src/lodepng.cpp index df8378e..b237d5a 100644 --- a/src/lodepng.cpp +++ b/src/lodepng.cpp @@ -1146,10 +1146,10 @@ static unsigned encodeLZ77_brute(uivector* out, const unsigned char* in, size_t } #endif +/* static const unsigned HASH_NUM_VALUES = 65536; static const unsigned HASH_NUM_CHARACTERS = 6; static const unsigned HASH_SHIFT = 2; -/* Good and fast values: HASH_NUM_VALUES=65536, HASH_NUM_CHARACTERS=6, HASH_SHIFT=2 making HASH_NUM_CHARACTERS larger (like 8), makes the file size larger but is a bit faster making HASH_NUM_CHARACTERS smaller (like 3), makes the file size smaller but is slower diff --git a/src/logos.cpp b/src/logos.cpp index 6aea996..9a9e5db 100644 --- a/src/logos.cpp +++ b/src/logos.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/logos.h b/src/logos.h index 13406e1..083d772 100644 --- a/src/logos.h +++ b/src/logos.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/main.cpp b/src/main.cpp index 09798ec..b64f700 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 729f3d4..5403324 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -29,6 +29,7 @@ #include "message.h" #include "parserintf.h" #include "filedef.h" +#include "htmlentity.h" ManDocVisitor::ManDocVisitor(FTextStream &t,CodeOutputInterface &ci, const char *langExt) @@ -75,42 +76,15 @@ void ManDocVisitor::visit(DocWhiteSpace *w) void ManDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->man(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "(C)"; break; - case DocSymbol::Tm: m_t << "(TM)"; break; - case DocSymbol::Reg: m_t << "(R)"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "`"; break; - case DocSymbol::Rsquo: m_t << "'"; break; - case DocSymbol::Ldquo: m_t << "``"; break; - case DocSymbol::Rdquo: m_t << "''"; break; - case DocSymbol::Ndash: m_t << "--"; break; - case DocSymbol::Mdash: m_t << "---"; break; - case DocSymbol::Uml: m_t << s->letter() << "\\*(4"; break; - case DocSymbol::Acute: m_t << s->letter() << "\\*(`"; break; - case DocSymbol::Grave: m_t << s->letter() << "\\*:"; break; - case DocSymbol::Circ: m_t << s->letter() << "\\*^"; break; - case DocSymbol::Slash: m_t << s->letter(); break; /* todo: implement this */ - case DocSymbol::Tilde: m_t << s->letter() << "\\*~"; break; - case DocSymbol::Szlig: m_t << "s\\*:"; break; - case DocSymbol::Cedil: m_t << s->letter() << "\\*,"; break; - case DocSymbol::Ring: m_t << s->letter() << "\\*o"; break; - case DocSymbol::Nbsp: m_t << " "; break; - default: - // unsupport symbol for man page :-( - break; + m_t << res; + } + else + { + // no error or warning to be supplied + // err("man: non supported HTML-entity found: &%s;\n",get_symbol_item(s->symbol())); } m_firstCol=FALSE; } @@ -288,6 +262,8 @@ void ManDocVisitor::visit(DocInclude *inc) break; case DocInclude::HtmlInclude: break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: if (!m_firstCol) m_t << endl; m_t << ".PP" << endl; diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h index 7012152..a5906d0 100644 --- a/src/mandocvisitor.h +++ b/src/mandocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/mangen.cpp b/src/mangen.cpp index a50ee73..cf6795b 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -64,9 +64,19 @@ static QCString getExtension() return ext; } +static QCString getSubdir() +{ + QCString dir = Config_getString("MAN_SUBDIR"); + if (dir.isEmpty()) + { + dir = "man" + getExtension(); + } + return dir; +} + ManGenerator::ManGenerator() : OutputGenerator() { - dir=Config_getString("MAN_OUTPUT")+"/man" + getExtension(); + dir=Config_getString("MAN_OUTPUT") + "/" + getSubdir(); firstCol=TRUE; paragraph=TRUE; col=0; @@ -106,10 +116,10 @@ void ManGenerator::init() err("Could not create output directory %s\n",manOutput.data()); exit(1); } - d.setPath(manOutput+"/man"+ext); - if (!d.exists() && !d.mkdir(manOutput+"/man"+ext)) + d.setPath(manOutput + "/" + getSubdir()); + if (!d.exists() && !d.mkdir(manOutput + "/" + getSubdir())) { - err("Could not create output directory %s/man%s\n",manOutput.data(),ext.data()); + err("Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); exit(1); } createSubDirs(d); @@ -445,7 +455,7 @@ void ManGenerator::startDoxyAnchor(const char *,const char *manName, FTextStream linkstream; linkstream.setDevice(&linkfile); //linkstream.setEncoding(QTextStream::UnicodeUTF8); - linkstream << ".so man" << getExtension() << "/" << buildFileName( manName ) << endl; + linkstream << ".so " << getSubdir() << "/" << buildFileName( manName ) << endl; } } linkfile.close(); diff --git a/src/mangen.h b/src/mangen.h index 7ac5ae1..98ef959 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/markdown.cpp b/src/markdown.cpp index ac824f4..291e1dc 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -48,6 +48,7 @@ #include "commentcnv.h" #include "config.h" #include "section.h" +#include "message.h" //----------- @@ -90,6 +91,7 @@ static QDict<LinkRef> g_linkRefs(257); static action_t g_actions[256]; static Entry *g_current; static QCString g_fileName; +static int g_lineNr; // In case a markdown page starts with a level1 header, that header is used // as a title of the page, in effect making it a level0 header, so the @@ -1002,6 +1004,16 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int if (c=='[' || c==']' || c=='*' || c=='+' || c=='-' || c=='!' || c=='(' || c==')' || c=='.' || c=='`' || c=='_') { + if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \--- + { + out.addStr(&data[1],3); + return 4; + } + else if (c=='-' && size>2 && data[2]=='-') // \-- + { + out.addStr(&data[1],2); + return 3; + } out.addStr(&data[1],1); return 2; } @@ -1133,8 +1145,8 @@ static int isLinkRef(const char *data,int size, while (i<size && data[i]==' ') i++; if (i<size && data[i]=='\n') { - i++; eol=i; + i++; while (i<size && data[i]==' ') i++; } if (i>=size) @@ -1152,6 +1164,7 @@ static int isLinkRef(const char *data,int size, int titleStart=i; // search for end of the line while (i<size && data[i]!='\n') i++; + eol = i; // search back to matching character int end=i-1; @@ -1166,8 +1179,7 @@ static int isLinkRef(const char *data,int size, //printf("end of isLinkRef: i=%d size=%d data[i]='%c' eol=%d\n", // i,size,data[i],eol); if (i>=size) return i; // end of buffer while ref id was found - else if (data[i]=='\n') return i+1; // end of line while ref id was found - else if (eol) return eol; // no optional title found + else if (eol) return eol; // end of line while ref id was found return 0; // invalid link ref } @@ -1467,7 +1479,7 @@ int findTableColumns(const char *data,int size,int &start,int &end,int &columns) eol=i+1; i--; while (i>0 && data[i]==' ') i--; - if (i>0 && data[i]=='|') i--,n++; // trailing | does not count + if (i>0 && data[i-1]!='\\' && data[i]=='|') i--,n++; // trailing or escaped | does not count end = i; // count columns between start and end @@ -1690,12 +1702,27 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) out.addStr(" "); out.addStr(header); out.addStr("\n"); - SectionInfo *si = new SectionInfo(g_fileName,id,header,type,level); - if (g_current) + SectionInfo *si = Doxygen::sectionDict->find(header); + if (si) { - g_current->anchors->append(si); + if (si->lineNr != -1) + { + warn(g_fileName,g_lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",header.data(),si->fileName.data(),si->lineNr); + } + else + { + warn(g_fileName,g_lineNr,"multiple use of section label '%s', (first occurrence: %s)",header.data(),si->fileName.data()); + } + } + else + { + si = new SectionInfo(g_fileName,g_lineNr,id,header,type,level); + if (g_current) + { + g_current->anchors->append(si); + } + Doxygen::sectionDict->append(header,si); } - Doxygen::sectionDict->append(header,si); } else { @@ -1725,7 +1752,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size) { // find end of this line end=i+1; - while (end<size && data[end-1]!='\n') end++; + while (end<=size && data[end-1]!='\n') end++; int j=i; int level=0; int indent=i; @@ -1753,7 +1780,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size) { for (l=level;l<curLevel;l++) { - out.addStr("\n</blockquote>\n"); + out.addStr("</blockquote>\n"); } } curLevel=level; @@ -1766,7 +1793,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size) // end of comment within blockquote => add end markers for (l=0;l<curLevel;l++) { - out.addStr("\n</blockquote>\n"); + out.addStr("</blockquote>\n"); } return i; } @@ -1781,7 +1808,7 @@ static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent) { // find end of this line end=i+1; - while (end<size && data[end-1]!='\n') end++; + while (end<=size && data[end-1]!='\n') end++; int j=i; int indent=0; while (j<end && data[j]==' ') j++,indent++; @@ -1828,7 +1855,7 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size, // find end of the line int nb=0; end=i+1; - while (end<size && data[end-1]!='\n') + while (end<=size && data[end-1]!='\n') { // while looking for the end of the line we might encounter a block // that needs to be passed unprocessed. @@ -1892,12 +1919,12 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size, } else if (nb==0 && data[end-1]=='`') { - while (end<size && data[end-1]=='`') end++,nb++; + while (end<=size && data[end-1]=='`') end++,nb++; } else if (nb>0 && data[end-1]=='`') { int enb=0; - while (end<size && data[end-1]=='`') end++,enb++; + while (end<=size && data[end-1]=='`') end++,enb++; if (enb==nb) nb=0; } else @@ -1908,12 +1935,29 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size, //printf("findEndOfLine pi=%d i=%d end=%d {%s}\n",pi,i,end,QCString(data+i).left(end-i).data()); } +static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, + int blockStart,int blockEnd) +{ + QCString lang = lng; + if (!lang.isEmpty() && lang.at(0)=='.') lang=lang.mid(1); + out.addStr("@code"); + if (!lang.isEmpty()) + { + out.addStr("{"+lang+"}"); + } + out.addStr(data+blockStart,blockEnd-blockStart); + out.addStr("\n"); + out.addStr("@endcode"); +} + static QCString processQuotations(const QCString &s,int refIndent) { GrowBuf out; const char *data = s.data(); int size = s.length(); int i=0,end=0,pi=-1; + int blockStart,blockEnd,blockOffset; + QCString lang; while (i<size) { findEndOfLine(out,data,size,pi,i,end); @@ -1921,7 +1965,15 @@ static QCString processQuotations(const QCString &s,int refIndent) if (pi!=-1) { - if (isBlockQuote(data+pi,i-pi,refIndent)) + if (isFencedCodeBlock(data+pi,size-pi,refIndent,lang,blockStart,blockEnd,blockOffset)) + { + writeFencedCodeBlock(out,data+pi,lang,blockStart,blockEnd); + i=pi+blockOffset; + pi=-1; + end=i+1; + continue; + } + else if (isBlockQuote(data+pi,i-pi,refIndent)) { i = pi+writeBlockQuote(out,data+pi,size-pi); pi=-1; @@ -1968,7 +2020,7 @@ static QCString processBlocks(const QCString &s,int indent) // get indent for the first line end = i+1; int sp=0; - while (end<size && data[end-1]!='\n') + while (end<=size && data[end-1]!='\n') { if (data[end-1]==' ') sp++; end++; @@ -2020,13 +2072,28 @@ static QCString processBlocks(const QCString &s,int indent) out.addStr(" "); out.addStr(header); out.addStr("\n\n"); - SectionInfo *si = new SectionInfo(g_fileName,id,header, - level==1 ? SectionInfo::Section : SectionInfo::Subsection,level); - if (g_current) + SectionInfo *si = Doxygen::sectionDict->find(header); + if (si) { - g_current->anchors->append(si); + if (si->lineNr != -1) + { + warn(g_fileName,g_lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",header.data(),si->fileName.data(),si->lineNr); + } + else + { + warn(g_fileName,g_lineNr,"multiple use of section label '%s', (first occurrence: %s)",header.data(),si->fileName.data()); + } + } + else + { + si = new SectionInfo(g_fileName,g_lineNr,id,header, + level==1 ? SectionInfo::Section : SectionInfo::Subsection,level); + if (g_current) + { + g_current->anchors->append(si); + } + Doxygen::sectionDict->append(header,si); } - Doxygen::sectionDict->append(header,si); } else { @@ -2057,15 +2124,7 @@ static QCString processBlocks(const QCString &s,int indent) { //printf("Found FencedCodeBlock lang='%s' start=%d end=%d code={%s}\n", // lang.data(),blockStart,blockEnd,QCString(data+pi+blockStart).left(blockEnd-blockStart).data()); - if (!lang.isEmpty() && lang.at(0)=='.') lang=lang.mid(1); - out.addStr("@code"); - if (!lang.isEmpty()) - { - out.addStr("{"+lang+"}"); - } - out.addStr(data+pi+blockStart,blockEnd-blockStart); - out.addStr("\n"); - out.addStr("@endcode"); + writeFencedCodeBlock(out,data+pi,lang,blockStart,blockEnd); i=pi+blockOffset; pi=-1; end=i+1; @@ -2101,7 +2160,7 @@ static QCString processBlocks(const QCString &s,int indent) { //printf("found link ref: id='%s' link='%s' title='%s'\n", // id.data(),link.data(),title.data()); - g_linkRefs.insert(id,new LinkRef(link,title)); + g_linkRefs.insert(id.lower(),new LinkRef(link,title)); } else { @@ -2152,7 +2211,6 @@ static QCString extractPageTitle(QCString &docs,QCString &id) { docs=docs.mid(end1); } - id = extractTitleId(title); //printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",title.data(),docs.data(),id.data()); return title; } @@ -2214,7 +2272,7 @@ static QCString detab(const QCString &s,int &refIndent) //--------------------------------------------------------------------------- -QCString processMarkdown(const QCString &fileName,Entry *e,const QCString &input) +QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,const QCString &input) { static bool init=FALSE; if (!init) @@ -2237,6 +2295,7 @@ QCString processMarkdown(const QCString &fileName,Entry *e,const QCString &input g_linkRefs.clear(); g_current = e; g_fileName = fileName; + g_lineNr = lineNr; static GrowBuf out; if (input.isEmpty()) return input; out.clear(); @@ -2279,14 +2338,7 @@ void MarkdownFileParser::parseInput(const char *fileName, current->fileName = fileName; current->docFile = fileName; current->docLine = 1; - int len = qstrlen(fileBuf); - BufStr input(len); - BufStr output(len); - input.addArray(fileBuf,qstrlen(fileBuf)); - input.addChar('\0'); - convertCppComments(&input,&output,fileName); - output.addChar('\0'); - QCString docs = output.data(); + QCString docs = fileBuf; QCString id; QCString title=extractPageTitle(docs,id).stripWhiteSpace(); QCString titleFn = QFileInfo(fileName).baseName().utf8(); diff --git a/src/markdown.h b/src/markdown.h index d3a845e..5e35259 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -22,7 +22,7 @@ class Entry; /** processes string \a s and converts markdown into doxygen/html commands. */ -QCString processMarkdown(const QCString &fileName,Entry *e,const QCString &s); +QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,const QCString &s); QCString markdownFileNameToId(const QCString &fileName); class MarkdownFileParser : public ParserInterface diff --git a/src/marshal.cpp b/src/marshal.cpp index a6b3e75..04f426d 100644 --- a/src/marshal.cpp +++ b/src/marshal.cpp @@ -139,6 +139,7 @@ void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors) marshalQCString(s,si->ref); marshalInt(s,(int)si->type); marshalQCString(s,si->fileName); + marshalInt(s,si->lineNr); marshalInt(s,si->level); } } @@ -546,8 +547,9 @@ QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s) QCString ref = unmarshalQCString(s); SectionInfo::SectionType type = (SectionInfo::SectionType)unmarshalInt(s); QCString fileName = unmarshalQCString(s); + int lineNr = unmarshalInt(s); int level = unmarshalInt(s); - result->append(new SectionInfo(fileName,label,title,type,level,ref)); + result->append(new SectionInfo(fileName,lineNr,label,title,type,level,ref)); } return result; } diff --git a/src/marshal.h b/src/marshal.h index 977a89b..0c61276 100644 --- a/src/marshal.h +++ b/src/marshal.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 4d7ea9f..a1b23e8 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -133,13 +133,14 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, if (md->getLanguage()==SrcLangExt_Tcl) { if (defArgList->count()==0) return FALSE; - Argument *a=defArgList->first(); + ArgumentListIterator ali(*defArgList); + Argument *a; ol.endMemberDocName(); ol.startParameterList(FALSE); ol.startParameterType(TRUE,0); ol.endParameterType(); ol.startParameterName(FALSE); - while (a) + for (;(a=ali.current());++ali) { if (a->defval.isEmpty()) { @@ -149,7 +150,6 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, { ol.docify("?"+a->name+"? "); } - a=defArgList->next(); } ol.endParameterName(TRUE,FALSE,FALSE); return TRUE; @@ -181,7 +181,6 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.popGeneratorState(); //printf("===> name=%s isDefine=%d\n",md->name().data(),md->isDefine()); - Argument *a=defArgList->first(); QCString cName; if (cd) { @@ -208,6 +207,8 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, bool first=TRUE; bool paramTypeStarted=FALSE; bool isDefine = md->isDefine(); + ArgumentListIterator ali(*defArgList); + Argument *a=ali.current(); while (a) { if (isDefine || first) @@ -302,7 +303,8 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.endTypewriter(); } - a=defArgList->next(); + ++ali; + a=ali.current(); if (a) { if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments @@ -432,7 +434,8 @@ static void writeExceptionList(OutputList &ol, ClassDef *cd, MemberDef *md) static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) { ol.docify("template<"); - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a = ali.current(); while (a) { ol.docify(a->type); @@ -443,7 +446,8 @@ static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) ol.docify(" = "); ol.docify(a->defval); } - a=al->next(); + ++ali; + a=ali.current(); if (a) ol.docify(", "); } ol.docify("> "); @@ -975,7 +979,7 @@ QCString MemberDef::getOutputFileBase() const ); return "dummy"; } - else if (separateMemberPages) + else if (separateMemberPages && isDetailedSectionLinkable()) { if (getEnumScope()) // enum value, which is part of enum's documentation { @@ -1348,7 +1352,7 @@ bool MemberDef::isBriefSectionVisible() const bool visibleIfNotDefaultCDTor = !(cOrDTor && m_impl->defArgList && (m_impl->defArgList->isEmpty() || - m_impl->defArgList->first()->type == "void" + m_impl->defArgList->getFirst()->type == "void" ) && !hasDocs ); @@ -1414,6 +1418,7 @@ void MemberDef::writeDeclaration(OutputList &ol, if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd; _writeTagData(compoundType); + _addToSearchIndex(); QCString cname = d->name(); QCString cdname = d->displayName(); @@ -1568,7 +1573,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ); } bool htmlOn = ol.isEnabled(OutputGenerator::Html); - if (htmlOn && /*Config_getBool("HTML_ALIGN_MEMBERS") &&*/ !ltype.isEmpty()) + if (htmlOn && !ltype.isEmpty()) { ol.disable(OutputGenerator::Html); } @@ -1787,11 +1792,12 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.writeDoc(rootNode,getOuterScope()?getOuterScope():d,this); if (detailsVisible) { + static bool separateMemberPages = Config_getBool("SEPARATE_MEMBER_PAGES"); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); //ol.endEmphasis(); ol.docify(" "); - if (m_impl->group!=0 && gd==0) // forward link to the group + if (separateMemberPages || (m_impl->group!=0 && gd==0)) // forward link to the page or group { ol.startTextLink(getOutputFileBase(),anchor()); } @@ -1895,7 +1901,7 @@ bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages; bool fileFilter = getNamespaceDef()==0 || !inFile; - bool simpleFilter = !hideUndocMembers && inlineSimpleStructs && + bool simpleFilter = (hasBriefDescription() || !hideUndocMembers) && inlineSimpleStructs && getClassDef()!=0 && getClassDef()->isSimple(); bool visible = isDetailedSectionLinkable() && groupFilter && fileFilter && @@ -2286,8 +2292,9 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, //printf("** %s: enum values=%d\n",name().data(),fmdl!=0 ? fmdl->count() : 0); if (fmdl) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator it(*fmdl); + MemberDef *fmd; + for (;(fmd=it.current());++it) { //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable()); if (fmd->isLinkable()) @@ -2312,7 +2319,7 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, Doxygen::indexList->addIndexItem(container,fmd); //ol.writeListItem(); - ol.startDescTableTitle(); // this enables emphasis! + ol.startDescTableTitle(); ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name(),fmd->argsString()); first=FALSE; //ol.startEmphasis(); @@ -2349,7 +2356,6 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, } ol.endDescTableData(); } - fmd=fmdl->next(); } } if (!first) @@ -2696,6 +2702,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (sp!=-1) { ldef=ldef.left(sp+1)+ldef.mid(ep+2); + } else { + ldef=ldef.mid(ep+2); } } // strip keywords @@ -3036,6 +3044,18 @@ static Definition *getClassFromType(Definition *scope,const QCString &type,SrcLa } #endif +QCString MemberDef::fieldType() const +{ + QCString type = m_impl->accessorType; + if (type.isEmpty()) + { + type = m_impl->type; + } + + if (isTypedef()) type.prepend("typedef "); + return simplifyTypeForTable(type); +} + void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) { Definition *scope = getOuterScope(); @@ -3056,15 +3076,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) ol.startInlineMemberType(); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); - QCString type = m_impl->accessorType; - if (type.isEmpty()) - { - type = m_impl->type; - } - - if (isTypedef()) type.prepend("typedef "); - - QCString ts = simplifyTypeForTable(type); + QCString ts = fieldType(); if (cd) // cd points to an anonymous struct pointed to by this member // so we add a link to it from the type column. @@ -3599,7 +3611,6 @@ void MemberDef::_writeTagData(const DefType compoundType) } writeDocAnchorsToTagFile(); Doxygen::tagFile << " </member>" << endl; - _addToSearchIndex(); } m_impl->tagDataWritten |= typeMask; } @@ -3709,11 +3720,11 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, uint numVisibleEnumValues=0; if (fmdl) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator mli(*fmdl); + MemberDef *fmd; + for (mli.toFirst();(fmd=mli.current());++mli) { if (fmd->isBriefSectionVisible()) numVisibleEnumValues++; - fmd=fmdl->next(); } } if (numVisibleEnumValues==0 && !isBriefSectionVisible()) @@ -3729,6 +3740,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, if (isLinkableInProject() || hasDocumentedEnumValues()) { _writeTagData(compoundType); + _addToSearchIndex(); writeLink(typeDecl,cd,nd,fd,gd); } else @@ -3753,7 +3765,8 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, typeDecl.docify("{ "); if (fmdl) { - MemberDef *fmd=fmdl->first(); + MemberListIterator mli(*fmdl); + MemberDef *fmd=mli.current(); bool fmdVisible = fmd->isBriefSectionVisible(); while (fmd) { @@ -3776,6 +3789,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, if (fmd->hasDocumentation()) // enum value has docs { fmd->_writeTagData(compoundType); + fmd->_addToSearchIndex(); fmd->writeLink(typeDecl,cd,nd,fd,gd); } else // no docs for this enum value @@ -3793,7 +3807,8 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, } bool prevVisible = fmdVisible; - fmd=fmdl->next(); + ++mli; + fmd=mli.current(); if (fmd && (fmdVisible=fmd->isBriefSectionVisible())) { typeDecl.writeString(", "); @@ -3855,6 +3870,11 @@ void MemberDef::setAccessorType(ClassDef *cd,const char *t) m_impl->accessorType = t; } +ClassDef *MemberDef::accessorClass() const +{ + return m_impl->accessorClass; +} + void MemberDef::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); diff --git a/src/memberdef.h b/src/memberdef.h index 47912b8..3259102 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -81,6 +81,7 @@ class MemberDef : public Definition ClassDef *getClassDef() const; FileDef *getFileDef() const; NamespaceDef* getNamespaceDef() const; + ClassDef *accessorClass() const; // grabbing the property read/write accessor names const char *getReadAccessor() const; @@ -251,7 +252,7 @@ class MemberDef : public Definition // overrules QCString documentation() const; QCString briefDescription(bool abbr=FALSE) const; - + QCString fieldType() const; //----------------------------------------------------------------------------------- diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 2df4a89..84567e2 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -75,7 +75,7 @@ void MemberGroup::insertMember(MemberDef *md) // md->getSectionList(m_parent), // md,md->name().data()); - MemberDef *firstMd = memberList->first(); + MemberDef *firstMd = memberList->getFirst(); if (inSameSection && memberList->count()>0 && firstMd->getSectionList(m_parent)!=md->getSectionList(m_parent)) { @@ -215,8 +215,9 @@ int MemberGroup::countInheritableMembers(ClassDef *inheritedFrom) const void MemberGroup::distributeMemberGroupDocumentation() { //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",grpHeader.data()); - MemberDef *md=memberList->first(); - while (md) + MemberListIterator li(*memberList); + MemberDef *md; + for (li.toFirst();(md=li.current());++li) { //printf("checking md=%s\n",md->name().data()); // find the first member of the group with documentation @@ -228,16 +229,15 @@ void MemberGroup::distributeMemberGroupDocumentation() //printf("found it!\n"); break; } - md=memberList->next(); } if (md) // distribute docs of md to other members of the list { //printf("Member %s has documentation!\n",md->name().data()); - MemberDef *omd=memberList->first(); - while (omd) + MemberDef *omd; + for (li.toFirst();(omd=li.current());++li) { - if (md!=omd && omd->documentation().isEmpty() && - omd->briefDescription().isEmpty() && + if (md!=omd && omd->documentation().isEmpty() && + omd->briefDescription().isEmpty() && omd->inbodyDocumentation().isEmpty() ) { @@ -246,7 +246,6 @@ void MemberGroup::distributeMemberGroupDocumentation() omd->setDocumentation(md->documentation(),md->docFile(),md->docLine()); omd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine()); } - omd=memberList->next(); } } } diff --git a/src/membergroup.h b/src/membergroup.h index c5a2d0c..42e60c5 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -125,9 +125,10 @@ class MemberGroupSDict : public SIntDict<MemberGroup> public: MemberGroupSDict(int size=17) : SIntDict<MemberGroup>(size) {} ~MemberGroupSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const MemberGroup *item1,const MemberGroup *item2) const { - return ((MemberGroup *)item1)->groupId() - ((MemberGroup*)item2)->groupId(); + return item1->groupId() - item2->groupId(); } }; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 101293a..28ed37e 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -55,11 +55,9 @@ MemberList::~MemberList() delete memberGroupList; } -int MemberList::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberList::compareValues(const MemberDef *c1, const MemberDef *c2) const { static bool sortConstructorsFirst = Config_getBool("SORT_MEMBERS_CTORS_1ST"); - MemberDef *c1=(MemberDef *)item1; - MemberDef *c2=(MemberDef *)item2; if (sortConstructorsFirst) { int ord1 = c1->isConstructor() ? 2 : (c1->isDestructor() ? 1 : 0); int ord2 = c2->isConstructor() ? 2 : (c2->isDestructor() ? 1 : 0); @@ -381,9 +379,18 @@ void MemberList::writePlainDeclarations(OutputList &ol, } ol.startMemberDeclaration(); ol.startMemberItem(md->anchor(),0,inheritId); + bool detailsLinkable = md->isDetailedSectionLinkable(); + if (!detailsLinkable) + { + ol.startDoxyAnchor(md->getOutputFileBase(),0,md->anchor(),md->name(),QCString()); + } ol.writeString("enum "); ol.insertMemberAlign(); md->writeEnumDeclaration(ol,cd,nd,fd,gd,compoundType); + if (!detailsLinkable) + { + ol.endDoxyAnchor(md->getOutputFileBase(),md->anchor()); + } ol.endMemberItem(); if (!md->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { @@ -696,52 +703,53 @@ void MemberList::writeDocumentationPage(OutputList &ol, MemberDef *md; for ( ; (md=mli.current()) ; ++mli) { - QCString diskName=md->getOutputFileBase(); - QCString title=md->qualifiedName(); - startFile(ol,diskName,md->name(),title,HLI_None,!generateTreeView, - container->getOutputFileBase()); - if (!generateTreeView) + if (md->isDetailedSectionLinkable()) { - container->writeNavigationPath(ol); - ol.endQuickIndices(); - } - ol.startContents(); - + QCString diskName=md->getOutputFileBase(); + QCString title=md->qualifiedName(); + startFile(ol,diskName,md->name(),title,HLI_None,!generateTreeView,diskName); + if (!generateTreeView) + { + container->writeNavigationPath(ol); + ol.endQuickIndices(); + } + ol.startContents(); - if (generateTreeView) - { - md->writeDocumentation(this,ol,scopeName,container,m_inGroup); - ol.endContents(); - endFileWithNavPath(container,ol); - } - else - { - ol.writeString("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n" - " <tr>\n" - " <td valign=\"top\">\n"); + if (generateTreeView) + { + md->writeDocumentation(this,ol,scopeName,container,m_inGroup); + ol.endContents(); + endFileWithNavPath(container,ol); + } + else + { + ol.writeString("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n" + " <tr>\n" + " <td valign=\"top\">\n"); - container->writeQuickMemberLinks(ol,md); + container->writeQuickMemberLinks(ol,md); - ol.writeString(" </td>\n"); - ol.writeString(" <td valign=\"top\" class=\"mempage\">\n"); + ol.writeString(" </td>\n"); + ol.writeString(" <td valign=\"top\" class=\"mempage\">\n"); - md->writeDocumentation(this,ol,scopeName,container,m_inGroup); + md->writeDocumentation(this,ol,scopeName,container,m_inGroup); - ol.writeString(" </td>\n"); - ol.writeString(" </tr>\n"); - ol.writeString("</table>\n"); + ol.writeString(" </td>\n"); + ol.writeString(" </tr>\n"); + ol.writeString("</table>\n"); - endFile(ol); + endFile(ol); + } } - } - if (memberGroupList) - { - //printf("MemberList::writeDocumentation() -- member groups\n"); - MemberGroupListIterator mgli(*memberGroupList); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) + if (memberGroupList) { - mg->writeDocumentationPage(ol,scopeName,container); + //printf("MemberList::writeDocumentation() -- member groups\n"); + MemberGroupListIterator mgli(*memberGroupList); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + mg->writeDocumentationPage(ol,scopeName,container); + } } } } @@ -938,15 +946,9 @@ QCString MemberList::listTypeAsString(MemberListType type) //-------------------------------------------------------------------------- -int MemberSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberSDict::compareValues(const MemberDef *c1, const MemberDef *c2) const { - // NOTE: this function can be triggered from unmarshalMemberSDict - // so it may not result in called to MemberDef::makeResident(). - // As a result, the data returned by MemberDef::name() and - // MemberDef::getDefLine() will always be kept in memory. - MemberDef *c1=(MemberDef *)item1; - MemberDef *c2=(MemberDef *)item2; - //printf("MemberSDict::compareItems(%s,%s)\n",c1->name().data(),c2->name().data()); + //printf("MemberSDict::compareValues(%s,%s)\n",c1->name().data(),c2->name().data()); int cmp = qstricmp(c1->name(),c2->name()); if (cmp) { diff --git a/src/memberlist.h b/src/memberlist.h index 9dfa104..607eb01 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -40,7 +40,6 @@ class MemberList : public QList<MemberDef> bool insert(uint index,const MemberDef *md); void inSort(const MemberDef *md); void append(const MemberDef *md); - int compareItems(QCollection::Item item1,QCollection::Item item2); int varCount() const { ASSERT(m_numDecMembers!=-1); return m_varCnt; } int funcCount() const { ASSERT(m_numDecMembers!=-1); return m_funcCnt; } int enumCount() const { ASSERT(m_numDecMembers!=-1); return m_enumCnt; } @@ -82,6 +81,7 @@ class MemberList : public QList<MemberDef> void unmarshal(StorageIntf *s); private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; int m_varCnt; int m_funcCnt; int m_enumCnt; @@ -121,7 +121,8 @@ class MemberSDict : public SDict<MemberDef> public: MemberSDict(int size=17) : SDict<MemberDef>(size) {} virtual ~MemberSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; }; diff --git a/src/membername.cpp b/src/membername.cpp index 58eaf8c..a2f7296 100644 --- a/src/membername.cpp +++ b/src/membername.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -30,10 +30,8 @@ MemberName::~MemberName() { } -int MemberName::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberName::compareValues(const MemberDef *m1, const MemberDef *m2) const { - MemberDef *m1=(MemberDef *)item1; - MemberDef *m2=(MemberDef *)item2; ClassDef *c1=m1->getClassDef(); ClassDef *c2=m2->getClassDef(); FileDef *f1=m1->getFileDef(); @@ -52,10 +50,8 @@ MemberNameInfo::MemberNameInfo(const char *n) : QList<MemberInfo>() setAutoDelete(TRUE); } -int MemberNameInfo::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberNameInfo::compareValues(const MemberInfo *m1,const MemberInfo *m2) const { - MemberInfo *m1=(MemberInfo *)item1; - MemberInfo *m2=(MemberInfo *)item2; ClassDef *c1=m1->memberDef->getClassDef(); ClassDef *c2=m2->memberDef->getClassDef(); FileDef *f1=m1->memberDef->getFileDef(); @@ -72,12 +68,10 @@ MemberNameIterator::MemberNameIterator(const MemberName &mnlist) : { } -int MemberNameSDict::compareItems(QCollection::Item item1, QCollection::Item item2) +int MemberNameSDict::compareValues(const MemberName *n1,const MemberName *n2) const { - MemberName *n1=(MemberName *)item1; - MemberName *n2=(MemberName *)item2; return qstricmp(n1->memberName()+getPrefixIndex(n1->memberName()), - n2->memberName()+getPrefixIndex(n2->memberName()) - ); + n2->memberName()+getPrefixIndex(n2->memberName()) + ); } diff --git a/src/membername.h b/src/membername.h index 0004aea..7a2fdc5 100644 --- a/src/membername.h +++ b/src/membername.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -24,14 +24,14 @@ /** Class representing all MemberDef objects with the same name */ class MemberName : public QList<MemberDef> -{ +{ public: MemberName(const char *name); ~MemberName(); const char *memberName() const { return name; } - - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberDef *item1,const MemberDef *item2) const; QCString name; }; @@ -49,7 +49,8 @@ class MemberNameSDict : public SDict<MemberName> MemberNameSDict(int size) : SDict<MemberName>(size) {} ~MemberNameSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2); + private: + int compareValues(const MemberName *item1,const MemberName *item2) const; }; /** Data associated with a MemberDef in an inheritance relation. */ @@ -74,8 +75,8 @@ class MemberNameInfo : public QList<MemberInfo> MemberNameInfo(const char *name); ~MemberNameInfo() {} const char *memberName() const { return name; } - int compareItems(QCollection::Item item1,QCollection::Item item2); private: + int compareValues(const MemberInfo *item1,const MemberInfo *item2) const; QCString name; }; @@ -93,11 +94,10 @@ class MemberNameInfoSDict : public SDict<MemberNameInfo> public: MemberNameInfoSDict(int size) : SDict<MemberNameInfo>(size) {} ~MemberNameInfoSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { return qstricmp( - ((MemberNameInfo *)item1)->memberName(), - ((MemberNameInfo *)item2)->memberName() - ); + private: + int compareValues(const MemberNameInfo *item1,const MemberNameInfo *item2) const + { + return qstricmp(item1->memberName(), item2->memberName()); } }; diff --git a/src/message.cpp b/src/message.cpp index dd3549a..8e4ecbd 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -13,7 +13,6 @@ * */ -#include <stdarg.h> #include <stdio.h> #include <qdatetime.h> #include "config.h" @@ -22,6 +21,7 @@ #include "doxygen.h" #include "portable.h" #include "filedef.h" +#include "message.h" static QCString outputFormat; static const char *warning_str = "warning: "; @@ -110,7 +110,7 @@ void msg(const char *fmt, ...) va_list args; va_start(args, fmt); vfprintf(stdout, fmt, args); - va_end(args); + va_end(args); } } @@ -172,6 +172,11 @@ void warn(const char *file,int line,const char *fmt, ...) va_end(args); } +void va_warn(const char *file,int line,const char *fmt,va_list args) +{ + do_warn("WARNINGS", file, line, warning_str, fmt, args); +} + void warn_simple(const char *file,int line,const char *text) { if (!Config_getBool("WARNINGS")) return; // warning type disabled diff --git a/src/message.h b/src/message.h index b7bdfe4..481e8bf 100644 --- a/src/message.h +++ b/src/message.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -19,9 +19,11 @@ #define MESSAGE_H #include <stdio.h> +#include <stdarg.h> extern void msg(const char *fmt, ...); extern void warn(const char *file,int line,const char *fmt, ...); +extern void va_warn(const char *file,int line,const char *fmt, va_list args); extern void warn_simple(const char *file,int line,const char *text); extern void warn_undoc(const char *file,int line,const char *fmt, ...); extern void warn_doc_error(const char *file,int line,const char *fmt, ...); diff --git a/src/msc.cpp b/src/msc.cpp index 3592e76..ebbba0f 100644 --- a/src/msc.cpp +++ b/src/msc.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index d00d845..2aa5728 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -68,6 +68,10 @@ NamespaceDef::NamespaceDef(const char *df,int dl,int dc, { m_type = CONSTANT_GROUP; } + else if (type && !strcmp("library", type)) + { + m_type = LIBRARY; + } else { m_type = NAMESPACE; @@ -248,11 +252,17 @@ void NamespaceDef::computeAnchors() if (allMemberList) setAnchors(allMemberList); } +bool NamespaceDef::hasDetailedDescription() const +{ + static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); + return ((!briefDescription().isEmpty() && repeatBrief) || + !documentation().isEmpty()); +} + + void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title) { - if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || - !documentation().isEmpty() - ) + if (hasDetailedDescription()) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); @@ -280,6 +290,7 @@ void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title //ol.newParagraph(); // FIXME:PARA ol.enableAll(); ol.disableAllBut(OutputGenerator::Man); + ol.enable(OutputGenerator::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } @@ -293,7 +304,7 @@ void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title void NamespaceDef::writeBriefDescription(OutputList &ol) { - if (!briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) + if (hasBriefDescription()) { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),TRUE,FALSE,0,TRUE,FALSE); @@ -306,9 +317,7 @@ void NamespaceDef::writeBriefDescription(OutputList &ol) ol.writeString(" \n"); ol.enable(OutputGenerator::RTF); - if (Config_getBool("REPEAT_BRIEF") || - !documentation().isEmpty() - ) + if (hasDetailedDescription()) { ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(0,"details"); @@ -655,7 +664,7 @@ void NamespaceDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) co MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { - if (md->getNamespaceDef()==this && md->isLinkable()) + if (md->getNamespaceDef()==this && md->isLinkable() && !md->isEnumValue()) { ol.writeString(" <tr><td class=\"navtab\">"); if (md->isLinkableInProject()) @@ -916,29 +925,9 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title, continue; // will be output in another pass, see layout_default.xml ol.startMemberDeclaration(); ol.startMemberItem(nd->getOutputFileBase(),0); - if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp) - { - ol.docify("package "); - } - else if (lang==SrcLangExt_Fortran) - { - ol.docify("module "); - } - else if (lang==SrcLangExt_IDL) - { - if (nd->isModule()) - { - ol.docify("module "); - } - else if (nd->isConstantGroup()) - { - ol.docify("constants"); - } - else - { - err("Internal inconsistency: namespace in IDL not module or cg\n"); - } - } + QCString ct = nd->compoundTypeString(); + ol.docify(ct); + ol.docify(" "); ol.insertMemberAlign(); QCString name; if (localName) @@ -1007,11 +996,19 @@ void NamespaceDef::addMemberToList(MemberListType lt,MemberDef *md) void NamespaceDef::sortMemberLists() { - MemberList *ml = m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } - ml = m_memberLists.next(); + } + if (classSDict) + { + classSDict->sort(); + } + if (namespaceSDict) + { + namespaceSDict->sort(); } } @@ -1019,15 +1016,14 @@ void NamespaceDef::sortMemberLists() MemberList *NamespaceDef::getMemberList(MemberListType lt) const { - NamespaceDef *that = (NamespaceDef*)this; - MemberList *ml = that->m_memberLists.first(); - while (ml) + QListIterator<MemberList> mli(m_memberLists); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) { if (ml->listType()==lt) { return ml; } - ml = that->m_memberLists.next(); } return 0; } @@ -1103,3 +1099,37 @@ QCString NamespaceDef::title() const } return pageTitle; } + +QCString NamespaceDef::compoundTypeString() const +{ + SrcLangExt lang = getLanguage(); + if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp) + { + return "package"; + } + else if (lang==SrcLangExt_Fortran) + { + return "module"; + } + else if (lang==SrcLangExt_IDL) + { + if (isModule()) + { + return "module"; + } + else if (isConstantGroup()) + { + return "constants"; + } + else if (isLibrary()) + { + return "library"; + } + else + { + err("Internal inconsistency: namespace in IDL not module, library or constant group\n"); + } + } + return ""; +} + diff --git a/src/namespacedef.h b/src/namespacedef.h index 2037d23..4613480 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -68,9 +68,11 @@ class NamespaceDef : public Definition bool isConstantGroup() const { return CONSTANT_GROUP == m_type; } bool isModule() const { return MODULE == m_type; } + bool isLibrary() const { return LIBRARY == m_type; } bool isLinkableInProject() const; bool isLinkable() const; + bool hasDetailedDescription() const; void addMembersToMemberGroup(); void distributeMemberGroupDocumentation(); void findSectionsInDocumentation(); @@ -94,6 +96,7 @@ class NamespaceDef : public Definition NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } QCString title() const; + QCString compoundTypeString() const; bool visited; @@ -130,20 +133,18 @@ class NamespaceDef : public Definition ClassSDict *classSDict; NamespaceSDict *namespaceSDict; bool m_subGrouping; - enum { NAMESPACE, MODULE, CONSTANT_GROUP } m_type; + enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; bool m_isPublished; }; /** A list of NamespaceDef objects. */ class NamespaceList : public QList<NamespaceDef> -{ +{ public: ~NamespaceList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const NamespaceDef *nd1,const NamespaceDef *nd2) const { - return qstricmp(((NamespaceDef *)item1)->name(), - ((NamespaceDef *)item2)->name() - ); + return qstricmp(nd1->name(), nd2->name()); } }; @@ -169,15 +170,14 @@ class NamespaceSDict : public SDict<NamespaceDef> public: NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {} ~NamespaceSDict() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) - { - return qstricmp(((NamespaceDef *)item1)->name(), - ((NamespaceDef *)item2)->name() - ); - } void writeDeclaration(OutputList &ol,const char *title, bool isConstantGroup=false, bool localName=FALSE); bool declVisible() const; + private: + int compareValues(const NamespaceDef *item1,const NamespaceDef *item2) const + { + return qstricmp(item1->name(),item2->name()); + } }; diff --git a/src/navtree.js b/src/navtree.js index 1d739b2..3914be8 100644 --- a/src/navtree.js +++ b/src/navtree.js @@ -1,5 +1,3 @@ -var SYNCONMSG = 'click to disable panel synchronisation'; -var SYNCOFFMSG = 'click to enable panel synchronisation'; var navTreeSubIndices = new Array(); function getData(varName) @@ -22,6 +20,21 @@ function stripPath2(uri) return m ? uri.substring(i-6) : s; } +function hashValue() +{ + return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); +} + +function hashUrl() +{ + return '#'+hashValue(); +} + +function pathName() +{ + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); +} + function localStorageSupported() { try { @@ -44,7 +57,7 @@ function deleteLink() { if (localStorageSupported()) { window.localStorage.setItem('navpath',''); - } + } } function cachedLink() @@ -116,11 +129,13 @@ var animationInProgress = false; function gotoAnchor(anchor,aname,updateLocation) { var pos, docContent = $('#doc-content'); - if (anchor.parent().attr('class')=='memItemLeft' || - anchor.parent().attr('class')=='fieldtype' || - anchor.parent().is(':header')) + var ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || + ancParent.hasClass('fieldname') || + ancParent.hasClass('fieldtype') || + ancParent.is(':header')) { - pos = anchor.parent().position().top; + pos = ancParent.position().top; } else if (anchor.position()) { pos = anchor.position().top; } @@ -178,7 +193,7 @@ function newNode(o, po, text, link, childrenData, lastNode) a.className = stripPath(link.replace('#',':')); if (link.indexOf('#')!=-1) { var aname = '#'+link.split('#')[1]; - var srcPage = stripPath($(location).attr('pathname')); + var srcPage = stripPath(pathName()); var targetPage = stripPath(link.split('#')[0]); a.href = srcPage!=targetPage ? url : "javascript:void(0)"; a.onclick = function(){ @@ -272,14 +287,13 @@ function glowEffect(n,duration) function highlightAnchor() { - var aname = $(location).attr('hash'); + var aname = hashUrl(); var anchor = $(aname); if (anchor.parent().attr('class')=='memItemLeft'){ - var rows = $('.memberdecls tr[class$="'+ - window.location.hash.substring(1)+'"]'); + var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); glowEffect(rows.children(),300); // member without details - } else if (anchor.parents().slice(2).prop('tagName')=='TR') { - glowEffect(anchor.parents('div.memitem'),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldname'){ + glowEffect(anchor.parent().parent(),1000); // enum value } else if (anchor.parent().attr('class')=='fieldtype'){ glowEffect(anchor.parent().parent(),1000); // struct field } else if (anchor.parent().is(":header")) { @@ -294,7 +308,7 @@ function selectAndHighlight(hash,n) { var a; if (hash) { - var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1); + var link=stripPath(pathName())+':'+hash.substring(1); a=$('.item a[class$="'+link+'"]'); } if (a && a.length) { @@ -405,14 +419,13 @@ function navTo(o,root,hash,relpath) if (link) { var parts = link.split('#'); root = parts[0]; - if (parts.length>1) hash = '#'+parts[1]; + if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,''); else hash=''; } if (hash.match(/^#l\d+$/)) { var anchor=$('a[name='+hash.substring(1)+']'); glowEffect(anchor.parent(),1000); // line number hash=''; // strip line number anchors - //root=root.replace(/_source\./,'.'); // source link to doc link } var url=root+hash; var i=-1; @@ -446,7 +459,7 @@ function toggleSyncButton(relpath) if (navSync.hasClass('sync')) { navSync.removeClass('sync'); showSyncOff(navSync,relpath); - storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash')); + storeLink(stripPath2(pathName())+hashUrl()); } else { navSync.addClass('sync'); showSyncOn(navSync,relpath); @@ -486,7 +499,7 @@ function initNavTree(toroot,relpath) } $(window).load(function(){ - navTo(o,toroot,window.location.hash,relpath); + navTo(o,toroot,hashUrl(),relpath); showRoot(); }); @@ -494,21 +507,20 @@ function initNavTree(toroot,relpath) if (window.location.hash && window.location.hash.length>1){ var a; if ($(location).attr('hash')){ - var clslink=stripPath($(location).attr('pathname'))+':'+ - $(location).attr('hash').substring(1); - a=$('.item a[class$="'+clslink+'"]'); + var clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]'); } if (a==null || !$(a).parent().parent().hasClass('selected')){ $('.item').removeClass('selected'); $('.item').removeAttr('id'); } - var link=stripPath2($(location).attr('pathname')); - navTo(o,link,$(location).attr('hash'),relpath); + var link=stripPath2(pathName()); + navTo(o,link,hashUrl(),relpath); } else if (!animationInProgress) { $('#doc-content').scrollTop(0); $('.item').removeClass('selected'); $('.item').removeAttr('id'); - navTo(o,toroot,window.location.hash,relpath); + navTo(o,toroot,hashUrl(),relpath); } }) } diff --git a/src/objcache.cpp b/src/objcache.cpp index 3a538a3..a59c67b 100644 --- a/src/objcache.cpp +++ b/src/objcache.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/objcache.h b/src/objcache.h index d93c1f6..6e6e95d 100644 --- a/src/objcache.h +++ b/src/objcache.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/outputgen.cpp b/src/outputgen.cpp index 89686e0..ee9bc48 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/outputgen.h b/src/outputgen.h index 95c467d..aaf1ba7 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/outputlist.cpp b/src/outputlist.cpp index f5df477..59c3efb 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -33,100 +33,98 @@ OutputList::OutputList(bool) { //printf("OutputList::OutputList()\n"); - outputs = new QList<OutputGenerator>; - outputs->setAutoDelete(TRUE); + m_outputs.setAutoDelete(TRUE); } OutputList::~OutputList() { //printf("OutputList::~OutputList()\n"); - delete outputs; } void OutputList::add(const OutputGenerator *og) { - if (og) outputs->append(og); + if (og) m_outputs.append(og); } void OutputList::disableAllBut(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disableIfNot(o); - og=outputs->next(); } } void OutputList::enableAll() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->enable(); - og=outputs->next(); } } void OutputList::disableAll() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disable(); - og=outputs->next(); } } void OutputList::disable(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->disableIf(o); - og=outputs->next(); } } void OutputList::enable(OutputGenerator::OutputType o) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->enableIf(o); - og=outputs->next(); } } bool OutputList::isEnabled(OutputGenerator::OutputType o) { bool result=FALSE; - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { result=result || og->isEnabled(o); - og=outputs->next(); } return result; } void OutputList::pushGeneratorState() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->pushGeneratorState(); - og=outputs->next(); } } void OutputList::popGeneratorState() { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { og->popGeneratorState(); - og=outputs->next(); } } @@ -138,12 +136,12 @@ bool OutputList::generateDoc(const char *fileName,int startLine, { int count=0; if (docStr.isEmpty()) return TRUE; - - OutputGenerator *og=outputs->first(); - while (og) + + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) count++; - og=outputs->next(); } if (count==0) return TRUE; // no output formats enabled. @@ -163,13 +161,13 @@ bool OutputList::generateDoc(const char *fileName,int startLine, void OutputList::writeDoc(DocRoot *root,Definition *ctx,MemberDef *md) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { //printf("og->printDoc(extension=%s)\n", // ctx?ctx->getDefFileExtension().data():"<null>"); if (og->isEnabled()) og->writeDoc(root,ctx,md); - og=outputs->next(); } VhdlDocGen::setFlowMember(0); @@ -178,21 +176,19 @@ void OutputList::writeDoc(DocRoot *root,Definition *ctx,MemberDef *md) bool OutputList::parseText(const QCString &textStr) { int count=0; - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) count++; - og=outputs->next(); } if (count==0) return TRUE; // no output formats enabled. DocText *root = validatingParseText(textStr); - og=outputs->first(); - while (og) + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) og->writeDoc(root,0,0); - og=outputs->next(); } bool isEmpty = root->isEmpty(); @@ -211,11 +207,11 @@ bool OutputList::parseText(const QCString &textStr) // zero arguments void OutputList::forall(void (OutputGenerator::*func)()) { - OutputGenerator *og=outputs->first(); - while (og) + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (it.toFirst();(og=it.current());++it) { if (og->isEnabled()) (og->*func)(); - og=outputs->next(); } } @@ -223,98 +219,98 @@ void OutputList::forall(void (OutputGenerator::*func)()) #define FORALL1(a1,p1) \ void OutputList::forall(void (OutputGenerator::*func)(a1),a1) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1); \ - og=outputs->next(); \ } \ -} +} // two arguments #define FORALL2(a1,a2,p1,p2) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2),a1,a2) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2); \ - og=outputs->next(); \ } \ -} +} // three arguments #define FORALL3(a1,a2,a3,p1,p2,p3) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3),a1,a2,a3) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3); \ - og=outputs->next(); \ } \ -} +} // four arguments #define FORALL4(a1,a2,a3,a4,p1,p2,p3,p4) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4),a1,a2,a3,a4) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4); \ - og=outputs->next(); \ } \ -} +} // five arguments #define FORALL5(a1,a2,a3,a4,a5,p1,p2,p3,p4,p5) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5),a1,a2,a3,a4,a5) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5); \ - og=outputs->next(); \ } \ -} +} // six arguments #define FORALL6(a1,a2,a3,a4,a5,a6,p1,p2,p3,p4,p5,p6) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6),a1,a2,a3,a4,a5,a6) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6); \ - og=outputs->next(); \ } \ -} +} // seven arguments #define FORALL7(a1,a2,a3,a4,a5,a6,a7,p1,p2,p3,p4,p5,p6,p7) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7),a1,a2,a3,a4,a5,a6,a7) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7); \ - og=outputs->next(); \ } \ -} +} // eight arguments #define FORALL8(a1,a2,a3,a4,a5,a6,a7,a8,p1,p2,p3,p4,p5,p6,p7,p8) \ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7,a8),a1,a2,a3,a4,a5,a6,a7,a8) \ { \ - OutputGenerator *og=outputs->first(); \ - while (og) \ + QListIterator<OutputGenerator> it(m_outputs); \ + OutputGenerator *og; \ + for (it.toFirst();(og=it.current());++it) \ { \ if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7,p8); \ - og=outputs->next(); \ } \ -} +} // now instantiate only the ones we need. diff --git a/src/outputlist.h b/src/outputlist.h index a12d9f5..f578d64 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -58,7 +58,7 @@ class OutputList : public OutputDocInterface virtual ~OutputList(); void add(const OutputGenerator *); - uint count() const { return outputs->count(); } + uint count() const { return m_outputs.count(); } void disableAllBut(OutputGenerator::OutputType o); void enableAll(); @@ -483,28 +483,28 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::addWord,word,hiPriority); } void startPlainFile(const char *name) - { - OutputGenerator *og=outputs->first(); - while (og) + { + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (;(og=it.current());++it) { if (og->isEnabled()) (og->startPlainFile)(name); - og=outputs->next(); } } - void endPlainFile() - { - OutputGenerator *og=outputs->first(); - while (og) + void endPlainFile() + { + QListIterator<OutputGenerator> it(m_outputs); + OutputGenerator *og; + for (;(og=it.current());++it) { if (og->isEnabled()) (og->endPlainFile)(); - og=outputs->next(); } } private: void debug(); void clear(); - + void forall(void (OutputGenerator::*func)()); FORALLPROTO1(const char *); FORALLPROTO1(char); @@ -546,9 +546,9 @@ class OutputList : public OutputDocInterface FORALLPROTO5(const char *,const char *,const char *,const char *,bool); FORALLPROTO6(const char *,const char *,const char *,const char *,const char *,const char *); FORALLPROTO6(const char *,const DocLinkInfo &,const char *,const char *,const SourceLinkInfo &,const SourceLinkInfo &); - + OutputList(const OutputList &ol); - QList<OutputGenerator> *outputs; + QList<OutputGenerator> m_outputs; }; #endif diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 3c9e1b6..e75327c 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/pagedef.h b/src/pagedef.h index 141c03b..890829e 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -81,9 +81,10 @@ class PageSDict : public SDict<PageDef> public: PageSDict(int size) : SDict<PageDef>(size) {} virtual ~PageSDict() {} - int compareItems(QCollection::Item i1,QCollection::Item i2) + private: + int compareValues(const PageDef *i1,const PageDef *i2) const { - return qstricmp(((PageDef *)i1)->name(),((PageDef *)i2)->name()); + return qstricmp(i1->name(),i2->name()); } }; diff --git a/src/parserintf.h b/src/parserintf.h index d474d8f..c389597 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -184,8 +184,8 @@ class ParserManager */ ParserInterface *getParser(const char *extension) { - if (extension==0) return m_defaultParser; QCString ext = QCString(extension).lower(); + if (ext.isEmpty()) ext=".no_extension"; ParserInterface *intf = m_extensions.find(ext); if (intf==0 && ext.length()>4) { diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index 5537438..948836b 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 by Dimitri van Heesch. + * Copyright (C) 1997-2014 by Dimitri van Heesch. * Authors: Dimitri van Heesch, Miguel Lobo. * * Permission to use, copy, modify, and distribute this software and its @@ -41,6 +41,8 @@ #include "namespacedef.h" #include "membergroup.h" #include "section.h" +#include "util.h" +#include "htmlentity.h" #define PERLOUTPUT_MAX_INDENTATION 40 @@ -540,140 +542,71 @@ void PerlModDocVisitor::visit(DocWhiteSpace *) void PerlModDocVisitor::visit(DocSymbol *sy) { - char c = 0; - const char *s = 0; - const char *accent = 0; - const char *symbol = 0; - switch(sy->symbol()) + const DocSymbol::PerlSymb *res = HtmlEntityMapper::instance()->perl(sy->symbol()); + const char *accent=0; + if (res-> symb) { - case DocSymbol::At: c = '@'; break; - case DocSymbol::Less: c = '<'; break; - case DocSymbol::Greater: c = '>'; break; - case DocSymbol::Amp: c = '&'; break; - case DocSymbol::Dollar: c = '$'; break; - case DocSymbol::Hash: c = '#'; break; - case DocSymbol::DoubleColon: s = "::"; break; - case DocSymbol::Percent: c = '%'; break; - case DocSymbol::Pipe: c = '|'; break; - case DocSymbol::Quot: c = '"'; break; - case DocSymbol::Lsquo: s = "\\\'"; break; - case DocSymbol::Rsquo: s = "\\\'"; break; - case DocSymbol::Ldquo: c = '"'; break; - case DocSymbol::Rdquo: c = '"'; break; - case DocSymbol::Ndash: c = '-'; break; - case DocSymbol::Mdash: s = "--"; break; - case DocSymbol::Nbsp: c = ' '; break; - case DocSymbol::Uml: accent = "umlaut"; break; - case DocSymbol::Acute: accent = "acute"; break; - case DocSymbol::Grave: accent = "grave"; break; - case DocSymbol::Circ: accent = "circ"; break; - case DocSymbol::Slash: accent = "slash"; break; - case DocSymbol::Tilde: accent = "tilde"; break; - case DocSymbol::Cedil: accent = "cedilla"; break; - case DocSymbol::Ring: accent = "ring"; break; - case DocSymbol::BSlash: s = "\\\\"; break; - case DocSymbol::Copy: symbol = "copyright"; break; - case DocSymbol::Tm: symbol = "trademark"; break; - case DocSymbol::Reg: symbol = "registered"; break; - case DocSymbol::Szlig: symbol = "szlig"; break; - case DocSymbol::Apos: s = "\\\'"; break; - case DocSymbol::Aelig: symbol = "aelig"; break; - case DocSymbol::AElig: symbol = "AElig"; break; - case DocSymbol::GrkGamma: symbol = "Gamma"; break; - case DocSymbol::GrkDelta: symbol = "Delta"; break; - case DocSymbol::GrkTheta: symbol = "Theta"; break; - case DocSymbol::GrkLambda: symbol = "Lambda"; break; - case DocSymbol::GrkXi: symbol = "Xi"; break; - case DocSymbol::GrkPi: symbol = "Pi"; break; - case DocSymbol::GrkSigma: symbol = "Sigma"; break; - case DocSymbol::GrkUpsilon: symbol = "Upsilon"; break; - case DocSymbol::GrkPhi: symbol = "Phi"; break; - case DocSymbol::GrkPsi: symbol = "Psi"; break; - case DocSymbol::GrkOmega: symbol = "Omega"; break; - case DocSymbol::Grkalpha: symbol = "alpha"; break; - case DocSymbol::Grkbeta: symbol = "beta"; break; - case DocSymbol::Grkgamma: symbol = "gamma"; break; - case DocSymbol::Grkdelta: symbol = "delta"; break; - case DocSymbol::Grkepsilon: symbol = "epsilon"; break; - case DocSymbol::Grkzeta: symbol = "zeta"; break; - case DocSymbol::Grketa: symbol = "eta"; break; - case DocSymbol::Grktheta: symbol = "theta"; break; - case DocSymbol::Grkiota: symbol = "iota"; break; - case DocSymbol::Grkkappa: symbol = "kappa"; break; - case DocSymbol::Grklambda: symbol = "lambda"; break; - case DocSymbol::Grkmu: symbol = "mu"; break; - case DocSymbol::Grknu: symbol = "nu"; break; - case DocSymbol::Grkxi: symbol = "xi"; break; - case DocSymbol::Grkpi: symbol = "pi"; break; - case DocSymbol::Grkrho: symbol = "rho"; break; - case DocSymbol::Grksigma: symbol = "sigma"; break; - case DocSymbol::Grktau: symbol = "tau"; break; - case DocSymbol::Grkupsilon: symbol = "upsilon"; break; - case DocSymbol::Grkphi: symbol = "phi"; break; - case DocSymbol::Grkchi: symbol = "chi"; break; - case DocSymbol::Grkpsi: symbol = "psi"; break; - case DocSymbol::Grkomega: symbol = "omega"; break; - case DocSymbol::Grkvarsigma: symbol = "sigma"; break; - case DocSymbol::Section: symbol = "sect"; break; - case DocSymbol::Degree: symbol = "deg"; break; - case DocSymbol::Prime: s = "\\\'"; break; - case DocSymbol::DoublePrime: c = '"'; break; - case DocSymbol::Infinity: symbol = "inf"; break; - case DocSymbol::EmptySet: symbol = "empty"; break; - case DocSymbol::PlusMinus: s = "+/-"; break; - case DocSymbol::Times: c = '*'; break; - case DocSymbol::Minus: c = '-'; break; - case DocSymbol::CenterDot: c = '.'; break; - case DocSymbol::Partial: symbol = "partial"; break; - case DocSymbol::Nabla: symbol = "nabla"; break; - case DocSymbol::SquareRoot: symbol = "sqrt"; break; - case DocSymbol::Perpendicular: symbol = "perp"; break; - case DocSymbol::Sum: symbol = "sum"; break; - case DocSymbol::Integral: symbol = "int"; break; - case DocSymbol::Product: symbol = "prod"; break; - case DocSymbol::Similar: c = '~'; break; - case DocSymbol::Approx: symbol = "approx"; break; - case DocSymbol::NotEqual: s = "!="; break; - case DocSymbol::Equivalent: symbol = "equiv"; break; - case DocSymbol::Proportional: symbol = "propto"; break; - case DocSymbol::LessEqual: s = "<="; break; - case DocSymbol::GreaterEqual: s = ">="; break; - case DocSymbol::LeftArrow: s = "<-"; break; - case DocSymbol::RightArrow: s = "->"; break; - case DocSymbol::SetIn: symbol = "in"; break; - case DocSymbol::SetNotIn: symbol = "notin"; break; - case DocSymbol::LeftCeil: symbol = "lceil"; break; - case DocSymbol::RightCeil: symbol = "rceil"; break; - case DocSymbol::LeftFloor: symbol = "lfloor"; break; - case DocSymbol::RightFloor: symbol = "rfloor"; break; - case DocSymbol::Unknown: err("unknown symbol found\n"); - break; - } - if (c != 0) - { - enterText(); - m_output.add(c); - } - else if (s != 0) - { - enterText(); - m_output.add(s); - } - else if (symbol != 0) - { - leaveText(); - openItem("symbol"); - m_output.addFieldQuotedString("symbol", symbol); - closeItem(); - } - else if (accent != 0) + switch (res->type) + { + case DocSymbol::Perl_string: + enterText(); + m_output.add(res->symb); + break; + case DocSymbol::Perl_char: + enterText(); + m_output.add(res->symb[0]); + break; + case DocSymbol::Perl_symbol: + leaveText(); + openItem("symbol"); + m_output.addFieldQuotedString("symbol", res->symb); + closeItem(); + break; + default: + switch(res->type) + { + case DocSymbol::Perl_umlaut: + accent = "umlaut"; + break; + case DocSymbol::Perl_acute: + accent = "acute"; + break; + case DocSymbol::Perl_grave: + accent = "grave"; + break; + case DocSymbol::Perl_circ: + accent = "circ"; + break; + case DocSymbol::Perl_slash: + accent = "slash"; + break; + case DocSymbol::Perl_tilde: + accent = "tilde"; + break; + case DocSymbol::Perl_cedilla: + accent = "cedilla"; + break; + case DocSymbol::Perl_ring: + accent = "ring"; + break; + default: + break; + } + leaveText(); + if (accent) + { + openItem("accent"); + m_output + .addFieldQuotedString("accent", accent) + .addFieldQuotedChar("letter", res->symb[0]); + closeItem(); + } + break; + } + } + else { - leaveText(); - openItem("accent"); - m_output - .addFieldQuotedString("accent", accent) - .addFieldQuotedChar("letter", sy->letter()); - closeItem(); + err("perl: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(sy->symbol(),TRUE)); } } @@ -771,6 +704,7 @@ void PerlModDocVisitor::visit(DocInclude *inc) return; case DocInclude::DontInclude: return; case DocInclude::HtmlInclude: type = "htmlonly"; break; + case DocInclude::LatexInclude: type = "latexonly"; break; case DocInclude::VerbInclude: type = "preformatted"; break; case DocInclude::Snippet: return; } @@ -2098,7 +2032,7 @@ void PerlModGenerator::generatePerlModForGroup(GroupDef *gd) { m_output.openList("files"); QListIterator<FileDef> fli(*fl); - FileDef *fd = fl->first(); + FileDef *fd; for (fli.toFirst();(fd=fli.current());++fli) m_output.openHash() .addFieldQuotedString("name", fd->name()) @@ -2192,7 +2126,7 @@ void PerlModGenerator::generatePerlModForPage(PageDef *pd) SectionInfo *si = Doxygen::sectionDict->find(pd->name()); if (si) - m_output.addFieldQuotedString("title", si->title); + m_output.addFieldQuotedString("title4", filterTitle(si->title)); addPerlModDocBlock(m_output,"detailed",pd->docFile(),pd->docLine(),0,0,pd->documentation()); m_output.closeHash(); diff --git a/src/perlmodgen.h b/src/perlmodgen.h index 7f593b2..f908959 100644 --- a/src/perlmodgen.h +++ b/src/perlmodgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 37929fc..0381c93 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -21,6 +21,7 @@ #include <qglobal.h> #include "docvisitor.h" +#include "htmlentity.h" /*! Concrete visitor implementation for pretty printing */ class PrintDocVisitor : public DocVisitor @@ -56,106 +57,14 @@ class PrintDocVisitor : public DocVisitor void visit(DocSymbol *s) { indent_leaf(); - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->utf8(s->symbol(),TRUE); + if (res) { - case DocSymbol::BSlash: printf("\\"); break; - case DocSymbol::At: printf("@"); break; - case DocSymbol::Less: printf("<"); break; - case DocSymbol::Greater: printf(">"); break; - case DocSymbol::Amp: printf("&"); break; - case DocSymbol::Dollar: printf("$"); break; - case DocSymbol::Hash: printf("#"); break; - case DocSymbol::Percent: printf("%%"); break; - case DocSymbol::Pipe: printf("|"); break; - case DocSymbol::Copy: printf("©"); break; - case DocSymbol::Apos: printf("'"); break; - case DocSymbol::Quot: printf("\""); break; - case DocSymbol::Lsquo: printf("‘"); break; - case DocSymbol::Rsquo: printf("’"); break; - case DocSymbol::Ldquo: printf("“"); break; - case DocSymbol::Rdquo: printf("”"); break; - case DocSymbol::Ndash: printf("–"); break; - case DocSymbol::Mdash: printf("—"); break; - case DocSymbol::Uml: printf("&%cuml;",s->letter()); break; - case DocSymbol::Acute: printf("&%cacute;",s->letter()); break; - case DocSymbol::Grave: printf("&%cgrave;",s->letter()); break; - case DocSymbol::Circ: printf("&%ccirc;",s->letter()); break; - case DocSymbol::Tilde: printf("&%ctilde;",s->letter()); break; - case DocSymbol::Szlig: printf("ß"); break; - case DocSymbol::Cedil: printf("&%ccedul;",s->letter()); break; - case DocSymbol::Ring: printf("&%cring;",s->letter()); break; - case DocSymbol::Nbsp: printf(" "); break; - case DocSymbol::Aelig: printf("æ"); break; - case DocSymbol::AElig: printf("Æ"); break; - case DocSymbol::GrkGamma: printf("Γ"); break; - case DocSymbol::GrkDelta: printf("Δ"); break; - case DocSymbol::GrkTheta: printf("Θ"); break; - case DocSymbol::GrkLambda: printf("Λ"); break; - case DocSymbol::GrkXi: printf("Ξ"); break; - case DocSymbol::GrkPi: printf("Π"); break; - case DocSymbol::GrkSigma: printf("Σ"); break; - case DocSymbol::GrkUpsilon: printf("Υ"); break; - case DocSymbol::GrkPhi: printf("Φ"); break; - case DocSymbol::GrkPsi: printf("Ψ"); break; - case DocSymbol::GrkOmega: printf("Ω"); break; - case DocSymbol::Grkalpha: printf("α"); break; - case DocSymbol::Grkbeta: printf("β"); break; - case DocSymbol::Grkgamma: printf("γ"); break; - case DocSymbol::Grkdelta: printf("δ"); break; - case DocSymbol::Grkepsilon: printf("ε"); break; - case DocSymbol::Grkzeta: printf("ζ"); break; - case DocSymbol::Grketa: printf("η"); break; - case DocSymbol::Grktheta: printf("θ"); break; - case DocSymbol::Grkiota: printf("ι"); break; - case DocSymbol::Grkkappa: printf("κ"); break; - case DocSymbol::Grklambda: printf("λ"); break; - case DocSymbol::Grkmu: printf("μ"); break; - case DocSymbol::Grknu: printf("ν"); break; - case DocSymbol::Grkxi: printf("ξ"); break; - case DocSymbol::Grkpi: printf("π"); break; - case DocSymbol::Grkrho: printf("ρ"); break; - case DocSymbol::Grksigma: printf("σ"); break; - case DocSymbol::Grktau: printf("τ"); break; - case DocSymbol::Grkupsilon: printf("υ"); break; - case DocSymbol::Grkphi: printf("φ"); break; - case DocSymbol::Grkchi: printf("χ"); break; - case DocSymbol::Grkpsi: printf("ψ"); break; - case DocSymbol::Grkomega: printf("ω"); break; - case DocSymbol::Grkvarsigma: printf("ς"); break; - case DocSymbol::Section: printf("§"); break; - case DocSymbol::Degree: printf("°"); break; - case DocSymbol::Prime: printf("′"); break; - case DocSymbol::DoublePrime: printf("″"); break; - case DocSymbol::Infinity: printf("∞"); break; - case DocSymbol::EmptySet: printf("∅"); break; - case DocSymbol::PlusMinus: printf("±"); break; - case DocSymbol::Times: printf("×"); break; - case DocSymbol::Minus: printf("−"); break; - case DocSymbol::CenterDot: printf("⋅"); break; - case DocSymbol::Partial: printf("∂"); break; - case DocSymbol::Nabla: printf("∇"); break; - case DocSymbol::SquareRoot: printf("√"); break; - case DocSymbol::Perpendicular: printf("⊥"); break; - case DocSymbol::Sum: printf("∑"); break; - case DocSymbol::Integral: printf("∫"); break; - case DocSymbol::Product: printf("∏"); break; - case DocSymbol::Similar: printf("∼"); break; - case DocSymbol::Approx: printf("≈"); break; - case DocSymbol::NotEqual: printf("≠"); break; - case DocSymbol::Equivalent: printf("≡"); break; - case DocSymbol::Proportional: printf("∝"); break; - case DocSymbol::LessEqual: printf("≤"); break; - case DocSymbol::GreaterEqual: printf("≥"); break; - case DocSymbol::LeftArrow: printf("←"); break; - case DocSymbol::RightArrow: printf("→"); break; - case DocSymbol::SetIn: printf("∈"); break; - case DocSymbol::SetNotIn: printf("∉"); break; - case DocSymbol::LeftCeil: printf("⌈"); break; - case DocSymbol::RightCeil: printf("⌉"); break; - case DocSymbol::LeftFloor: printf("⌊"); break; - case DocSymbol::RightFloor: printf("⌋"); break; - default: - printf("unknown symbol found\n"); + printf("%s",res); + } + else + { + printf("print: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } void visit(DocURL *u) @@ -256,6 +165,7 @@ class PrintDocVisitor : public DocVisitor case DocInclude::IncWithLines: printf("incwithlines"); break; case DocInclude::DontInclude: printf("dontinclude"); break; case DocInclude::HtmlInclude: printf("htmlinclude"); break; + case DocInclude::LatexInclude: printf("latexinclude"); break; case DocInclude::VerbInclude: printf("verbinclude"); break; case DocInclude::Snippet: printf("snippet"); break; } diff --git a/src/pycode.h b/src/pycode.h index 6382975..9b0dacb 100644 --- a/src/pycode.h +++ b/src/pycode.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/pycode.l b/src/pycode.l index 8512711..585b587 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/pyscanner.h b/src/pyscanner.h index 4b99706..e4e974f 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/pyscanner.l b/src/pyscanner.l index 671d330..c67875e 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -645,6 +645,8 @@ STARTDOCSYMS "##" } <FromMod>{ + "." { // python3 style imports + } {IDENTIFIER}({B}"."{B}{IDENTIFIER})* { // from package import g_packageName=yytext; } @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/reflist.cpp b/src/reflist.cpp index 70bd9ba..ee6ac91 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/reflist.h b/src/reflist.h index 3124582..97b1420 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -44,10 +44,9 @@ class SortedRefItems : public SDict<RefItem> public: SortedRefItems(int size=17) : SDict<RefItem>(size) {} virtual ~SortedRefItems() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const RefItem *r1,const RefItem *r2) const { - RefItem *r1 = (RefItem*)item1; - RefItem *r2 = (RefItem*)item2; return qstricmp(r1->title,r2->title); } }; diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 7c2fef8..67faf98 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -32,6 +32,7 @@ #include "dia.h" #include "filedef.h" #include "config.h" +#include "htmlentity.h" //#define DBG_RTF(x) m_t << x #define DBG_RTF(x) do {} while(0) @@ -121,198 +122,14 @@ void RTFDocVisitor::visit(DocSymbol *s) { if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visit(DocSymbol)}\n"); - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->rtf(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "(C)"; break; - case DocSymbol::Tm: m_t << "(TM)"; break; - case DocSymbol::Reg: m_t << "(R)"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "`"; break; - case DocSymbol::Rsquo: m_t << "'"; break; - case DocSymbol::Ldquo: m_t << "\""; break; - case DocSymbol::Rdquo: m_t << "\""; break; - case DocSymbol::Ndash: m_t << "-"; break; - case DocSymbol::Mdash: m_t << "--"; break; - case DocSymbol::Uml: switch(s->letter()) - { - case 'A' : m_t << '\304'; break; - case 'E' : m_t << '\313'; break; - case 'I' : m_t << '\317'; break; - case 'O' : m_t << '\326'; break; - case 'U' : m_t << '\334'; break; - case 'Y' : m_t << 'Y'; break; - case 'a' : m_t << '\344'; break; - case 'e' : m_t << '\353'; break; - case 'i' : m_t << '\357'; break; - case 'o' : m_t << '\366'; break; - case 'u' : m_t << '\374'; break; - case 'y' : m_t << '\377'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Acute: switch(s->letter()) - { - case 'A' : m_t << '\301'; break; - case 'E' : m_t << '\311'; break; - case 'I' : m_t << '\315'; break; - case 'O' : m_t << '\323'; break; - case 'U' : m_t << '\332'; break; - case 'Y' : m_t << '\335'; break; - case 'a' : m_t << '\341'; break; - case 'e' : m_t << '\351'; break; - case 'i' : m_t << '\355'; break; - case 'o' : m_t << '\363'; break; - case 'u' : m_t << '\372'; break; - case 'y' : m_t << '\375'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Grave: switch(s->letter()) - { - case 'A' : m_t << '\300'; break; - case 'E' : m_t << '\310'; break; - case 'I' : m_t << '\314'; break; - case 'O' : m_t << '\322'; break; - case 'U' : m_t << '\331'; break; - case 'a' : m_t << '\340'; break; - case 'e' : m_t << '\350'; break; - case 'i' : m_t << '\354'; break; - case 'o' : m_t << '\362'; break; - case 'u' : m_t << '\371'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Circ: switch(s->letter()) - { - case 'A' : m_t << '\302'; break; - case 'E' : m_t << '\312'; break; - case 'I' : m_t << '\316'; break; - case 'O' : m_t << '\324'; break; - case 'U' : m_t << '\333'; break; - case 'a' : m_t << '\342'; break; - case 'e' : m_t << '\352'; break; - case 'i' : m_t << '\356'; break; - case 'o' : m_t << '\364'; break; - case 'u' : m_t << '\373'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Tilde: switch(s->letter()) - { - case 'A' : m_t << '\303'; break; - case 'N' : m_t << '\321'; break; - case 'O' : m_t << '\325'; break; - case 'a' : m_t << '\343'; break; - case 'n' : m_t << '\361'; break; - case 'o' : m_t << '\365'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Cedil: switch(s->letter()) - { - case 'C' : m_t << '\307'; break; - case 'c' : m_t << '\347'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Slash: switch(s->letter()) - { - case 'O' : m_t << '\330'; break; - case 'o' : m_t << '\370'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Ring: switch(s->letter()) - { - case 'A' : m_t << '\305'; break; - case 'a' : m_t << '\345'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Szlig: m_t << "\337"; break; - case DocSymbol::Nbsp: m_t << "\\~ "; break; - case DocSymbol::Aelig: m_t << "\346"; break; - case DocSymbol::AElig: m_t << "\306"; break; - case DocSymbol::GrkGamma: m_t << "Gamma "; break; - case DocSymbol::GrkDelta: m_t << "Delta "; break; - case DocSymbol::GrkTheta: m_t << "Theta "; break; - case DocSymbol::GrkLambda: m_t << "Lambda "; break; - case DocSymbol::GrkXi: m_t << "Xi "; break; - case DocSymbol::GrkPi: m_t << "Pi "; break; - case DocSymbol::GrkSigma: m_t << "Sigma "; break; - case DocSymbol::GrkUpsilon: m_t << "Upsilon "; break; - case DocSymbol::GrkPhi: m_t << "Phi "; break; - case DocSymbol::GrkPsi: m_t << "Psi "; break; - case DocSymbol::GrkOmega: m_t << "Omega "; break; - case DocSymbol::Grkalpha: m_t << "alpha "; break; - case DocSymbol::Grkbeta: m_t << "beta "; break; - case DocSymbol::Grkgamma: m_t << "gamma "; break; - case DocSymbol::Grkdelta: m_t << "delta "; break; - case DocSymbol::Grkepsilon: m_t << "epsilon "; break; - case DocSymbol::Grkzeta: m_t << "zeta "; break; - case DocSymbol::Grketa: m_t << "eta "; break; - case DocSymbol::Grktheta: m_t << "theta "; break; - case DocSymbol::Grkiota: m_t << "iota "; break; - case DocSymbol::Grkkappa: m_t << "kappa "; break; - case DocSymbol::Grklambda: m_t << "lambda "; break; - case DocSymbol::Grkmu: m_t << "mu "; break; - case DocSymbol::Grknu: m_t << "nu "; break; - case DocSymbol::Grkxi: m_t << "xi "; break; - case DocSymbol::Grkpi: m_t << "pi "; break; - case DocSymbol::Grkrho: m_t << "rho "; break; - case DocSymbol::Grksigma: m_t << "sigma "; break; - case DocSymbol::Grktau: m_t << "tau "; break; - case DocSymbol::Grkupsilon: m_t << "upsilon "; break; - case DocSymbol::Grkphi: m_t << "phi "; break; - case DocSymbol::Grkchi: m_t << "chi "; break; - case DocSymbol::Grkpsi: m_t << "psi "; break; - case DocSymbol::Grkomega: m_t << "omega "; break; - case DocSymbol::Grkvarsigma: m_t << "sigma "; break; - case DocSymbol::Section: m_t << "\247"; break; - case DocSymbol::Degree: m_t << "\260"; break; - case DocSymbol::Prime: m_t << "'"; break; - case DocSymbol::DoublePrime: m_t << "\""; break; - case DocSymbol::Infinity: m_t << "inf "; break; - case DocSymbol::EmptySet: m_t << "empty "; break; - case DocSymbol::PlusMinus: m_t << "\261"; break; - case DocSymbol::Times: m_t << "\327"; break; - case DocSymbol::Minus: m_t << "-"; break; - case DocSymbol::CenterDot: m_t << "."; break; - case DocSymbol::Partial: m_t << "partial "; break; - case DocSymbol::Nabla: m_t << "nabla "; break; - case DocSymbol::SquareRoot: m_t << "sqrt "; break; - case DocSymbol::Perpendicular: m_t << "perp "; break; - case DocSymbol::Sum: m_t << "sum "; break; - case DocSymbol::Integral: m_t << "int "; break; - case DocSymbol::Product: m_t << "prod "; break; - case DocSymbol::Similar: m_t << "~"; break; - case DocSymbol::Approx: m_t << "approx "; break; - case DocSymbol::NotEqual: m_t << "!="; break; - case DocSymbol::Equivalent: m_t << "equiv "; break; - case DocSymbol::Proportional: m_t << "propto "; break; - case DocSymbol::LessEqual: m_t << "<="; break; - case DocSymbol::GreaterEqual: m_t << ">="; break; - case DocSymbol::LeftArrow: m_t << "<-"; break; - case DocSymbol::RightArrow: m_t << "->"; break; - case DocSymbol::SetIn: m_t << "in "; break; - case DocSymbol::SetNotIn: m_t << "notin "; break; - case DocSymbol::LeftCeil: m_t << "lceil "; break; - case DocSymbol::RightCeil: m_t << "rceil "; break; - case DocSymbol::LeftFloor: m_t << "lfloor "; break; - case DocSymbol::RightFloor: m_t << "rfloor "; break; - default: - err("unknown symbol found\n"); + m_t << res; + } + else + { + err("RTF: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } m_lastIsPara=FALSE; } @@ -565,6 +382,8 @@ void RTFDocVisitor::visit(DocInclude *inc) break; case DocInclude::HtmlInclude: break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: m_t << "{" << endl; m_t << "\\par" << endl; diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 9572b73..efc9d21 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index d8c34ee..8699c4e 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 by Parker Waechter & Dimitri van Heesch. + * Copyright (C) 1997-2014 by Parker Waechter & Dimitri van Heesch. * * Style sheet additions by Alexander Bartolich * @@ -492,11 +492,13 @@ void RTFGenerator::startIndexSection(IndexSections is) { //File Documentation bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -507,9 +509,7 @@ void RTFGenerator::startIndexSection(IndexSections is) break; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; @@ -792,13 +792,15 @@ void RTFGenerator::endIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=TRUE; - FileName *fn=Doxygen::inputNameList->first(); t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl; - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - while (fd) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { if (fd->isLinkableInProject()) { @@ -819,9 +821,7 @@ void RTFGenerator::endIndexSection(IndexSections is) t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } - fd=fn->next(); } - fn=Doxygen::inputNameList->next(); } } break; diff --git a/src/rtfgen.h b/src/rtfgen.h index 6206311..7b31673 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 by Parker Waechter & Dimitri van Heesch. + * Copyright (C) 1997-2014 by Parker Waechter & 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 diff --git a/src/rtfstyle.cpp b/src/rtfstyle.cpp index 2bede42..f44951a 100644 --- a/src/rtfstyle.cpp +++ b/src/rtfstyle.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/rtfstyle.h b/src/rtfstyle.h index 52488f1..4f0a03f 100644 --- a/src/rtfstyle.h +++ b/src/rtfstyle.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/scanner.h b/src/scanner.h index 767fea0..8c8c3d9 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/scanner.l b/src/scanner.l index bbe90a3..a7ac841 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -5023,6 +5023,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) tempEntry = current; // temporarily switch to the previous entry current = previous; + previous = 0; docBlockContext = SkipCurlyEndDoc; docBlockInBody = FALSE; @@ -5062,7 +5063,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <SkipCurlyEndDoc>"}" { //addToBody("}"); - current = tempEntry; + if (tempEntry) // we can only switch back to current if no new item was created + { + current = tempEntry; + tempEntry = 0; + } BEGIN( lastCurlyContext ); } <SkipCurly>\" { @@ -5115,6 +5120,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lastCContext = YY_START; BEGIN(SkipCxxComment); } +<SkipInits>"(" { + roundCount=0; + lastSkipRoundContext=YY_START; + BEGIN(SkipRound); + } <SkipInits>\" { lastStringContext=YY_START; BEGIN( SkipString ); @@ -5510,7 +5520,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( CopyArgComment ); } <CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block - current->typeConstr->last()->docs = fullArgString; + current->typeConstr->getLast()->docs = fullArgString; } <CSConstraintType>"{" { // end of type constraint reached // parse documentation of the constraints @@ -5528,24 +5538,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <CSConstraintName>{ID} { // parameter name - current->typeConstr->last()->name=yytext; + current->typeConstr->getLast()->name=yytext; } <CSConstraintType>"where" { // another constraint for a different param current->typeConstr->append(new Argument); BEGIN( CSConstraintName ); } <CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? { - if (current->typeConstr->last()->type.isEmpty()) + if (current->typeConstr->getLast()->type.isEmpty()) // first type constraint for this parameter { - current->typeConstr->last()->type=yytext; + current->typeConstr->getLast()->type=yytext; } else // new type constraint for same parameter { - QCString name = current->typeConstr->last()->name; + QCString name = current->typeConstr->getLast()->name; current->typeConstr->append(new Argument); - current->typeConstr->last()->name=name; - current->typeConstr->last()->type=yytext; + current->typeConstr->getLast()->name=name; + current->typeConstr->getLast()->type=yytext; } } <CSConstraintName,CSConstraintType>\n { @@ -5766,7 +5776,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) specName = ¤t->name; BEGIN ( Specialization ); } -<Bases>"<" { +<Bases>{BN}*"<" { + lineCount(); sharpCount=1; roundCount=0; lastSkipSharpContext = YY_START; @@ -6194,7 +6205,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) g_nestedComment=FALSE; BEGIN(DocCopyBlock); } -<DocBlock>"<"{PRE}">" { +<DocBlock>{B}*"<"{PRE}">" { docBlock+=yytext; docBlockName="<pre>"; g_fencedSize=0; @@ -6210,6 +6221,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <DocBlock>"~~~"[~]* { docBlock+=yytext; + docBlockName="~~~"; g_fencedSize=yyleng; g_nestedComment=FALSE; BEGIN(DocCopyBlock); @@ -6293,6 +6305,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) REJECT; } } +<DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516) + if (docBlockName=="code") + { + QCString indent; + indent.fill(' ',computeIndent(yytext,-1)); + docBlock+=indent+"*"; + } + else + { + REJECT; + } + } <DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one * if (docBlockName=="code") { @@ -6497,7 +6521,14 @@ static void startCommentBlock(bool brief) static void newEntry() { - current_root->addSubEntry(current); + if (tempEntry==0) // if temp entry is not 0, it holds current, + // and current is actually replaced by previous which was + // already added to current_root, so we should not add it again + // (see bug723314) + { + current_root->addSubEntry(current); + } + tempEntry = 0; previous = current; current = new Entry ; initEntry(); diff --git a/src/searchindex.cpp b/src/searchindex.cpp index f023e4d..a550eb1 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -632,16 +632,14 @@ class SearchIndexList : public SDict< SearchDefinitionList > } l->append(d); } - int compareItems(QCollection::Item item1, QCollection::Item item2) + uint letter() const { return m_letter; } + private: + int compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const { - QList<Definition> *md1=(QList<Definition> *)item1; - QList<Definition> *md2=(QList<Definition> *)item2; - QCString n1 = md1->first()->localName(); - QCString n2 = md2->first()->localName(); + QCString n1 = md1->getFirst()->localName(); + QCString n2 = md2->getFirst()->localName(); return qstricmp(n1.data(),n2.data()); } - uint letter() const { return m_letter; } - private: uint m_letter; }; @@ -1029,7 +1027,7 @@ void writeJavascriptSearchIndex() " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl; t << "<html><head><title></title>" << endl; t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl; - t << "<meta name=\"generator\" content=\"Doxygen " << versionString << "\">" << endl; + t << "<meta name=\"generator\" content=\"Doxygen " << versionString << "\"/>" << endl; t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl; t << "<script type=\"text/javascript\" src=\"" << baseName << ".js\"></script>" << endl; t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl; @@ -1077,7 +1075,7 @@ void writeJavascriptSearchIndex() int itemCount=0; for (li.toFirst();(dl=li.current());++li) { - Definition *d = dl->first(); + Definition *d = dl->getFirst(); QCString id = d->localName(); if (!firstEntry) diff --git a/src/searchindex.h b/src/searchindex.h index 2ce80e8..872c0d3 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/section.h b/src/section.h index 486656d..a1f859e 100644 --- a/src/section.h +++ b/src/section.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -33,25 +33,32 @@ struct SectionInfo Paragraph = 4, Anchor = 5 }; - SectionInfo(const char *f,const char *l,const char *t, + SectionInfo(const char *f,const int lin,const char *l,const char *t, SectionType st,int lev,const char *r=0) : - label(l), title(t), type(st), ref(r), definition(0), - fileName(f), generated(FALSE), level(lev) - { + label(l), title(t), type(st), ref(r), definition(0), + fileName(f), lineNr(lin), generated(FALSE), level(lev) + { } SectionInfo(const SectionInfo &s) { - label=s.label.copy(); title=s.title.copy(); ref=s.ref.copy(); - type =s.type; definition=s.definition; - fileName=s.fileName.copy(); generated=s.generated; + label=s.label.copy(); + title=s.title.copy(); + type =s.type; + ref=s.ref.copy(); + definition=s.definition; + fileName=s.fileName.copy(); + lineNr=s.lineNr; + generated=s.generated; + level=s.level; } ~SectionInfo() {} - QCString label; + QCString label; QCString title; SectionType type; QCString ref; Definition *definition; QCString fileName; + int lineNr; bool generated; int level; }; diff --git a/src/settings.h b/src/settings.h deleted file mode 100644 index a9fd128..0000000 --- a/src/settings.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SETTINGS_H -#define SETTINGS_H - -#define USE_SQLITE3 0 -#define USE_LIBCLANG 0 - -#define IS_SUPPORTED(x) \ - ((USE_SQLITE3 && strcmp("USE_SQLITE3",(x))==0) || \ - (USE_LIBCLANG && strcmp("USE_LIBCLANG",(x))==0) || \ - 0) - -#endif diff --git a/src/settings.py b/src/settings.py index af24e7b..a9dfa13 100755 --- a/src/settings.py +++ b/src/settings.py @@ -1,11 +1,12 @@ # import sys +import os f_sqlite3 = sys.argv[1] f_libclang = sys.argv[2] -f1 = open('../src/settings.h','w') +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") diff --git a/src/sortdict.h b/src/sortdict.h index e111075..f79a335 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -73,7 +73,7 @@ const uint SDict_primes[] = template<class T> class SDict; template<class T> class SIntDict; -/** internal wrapper class that redirects compareItems() to the +/** internal wrapper class that redirects compareValues() to the * dictionary */ template<class T> @@ -82,9 +82,9 @@ class SList : public QList<T> public: SList(SDict<T> *owner) : m_owner(owner) {} virtual ~SList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + int compareValues(const T *item1,const T *item2) const { - return m_owner->compareItems(item1,item2); + return m_owner->compareValues(item1,item2); } private: SDict<T> *m_owner; @@ -264,7 +264,7 @@ class SDict * Overload this to properly sort items. * \sa inSort() */ - virtual int compareItems(QCollection::Item item1,QCollection::Item item2) + virtual int compareValues(const T *item1,const T *item2) const { return item1!=item2; } @@ -421,7 +421,7 @@ class SDict }; }; -/** internal wrapper class that redirects compareItems() to the +/** internal wrapper class that redirects compareValues() to the * dictionary */ template<class T> @@ -430,11 +430,11 @@ class SIntList : public QList<T> public: SIntList(SIntDict<T> *owner) : m_owner(owner) {} virtual ~SIntList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const T *item1,const T *item2) const { - return m_owner->compareItems(item1,item2); + return m_owner->compareValues(item1,item2); } - private: SIntDict<T> *m_owner; }; @@ -573,7 +573,7 @@ class SIntDict * Overload this to properly sort items. * \sa inSort() */ - virtual int compareItems(QCollection::Item item1,QCollection::Item item2) + virtual int compareValues(const T *item1,const T *item2) const { return item1!=item2; } diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index a59a3d0..42a0307 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2012 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 @@ -45,143 +45,59 @@ //#define DBG_CTX(x) printf x #define DBG_CTX(x) do { } while(0) -static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def); - -////////////////////////////////////////////////////// -const char *i_q_includes="INSERT OR REPLACE INTO includes " - "( local, id_src, dst ) " - "VALUES " - "(:local,:id_src,:dst )" ; -const char *c_q_includes="SELECT count(*) FROM includes WHERE local=:local and id_src=:id_src and dst=:dst"; -static sqlite3_stmt *c_s_includes=0; -static sqlite3_stmt *i_s_includes=0; -////////////////////////////////////////////////////// -const char *i_q_innerclass="INSERT OR REPLACE INTO innerclass " - "( refid, prot, name )" - "VALUES " - "(:refid,:prot,:name )"; -static sqlite3_stmt *i_s_innerclass=0; -////////////////////////////////////////////////////// -const char *i_q_files="INSERT OR REPLACE INTO files " - "( name )" - "VALUES " - "(:name )"; -const char *id_q_files="SELECT id FROM files WHERE name=:name"; -static sqlite3_stmt *id_s_files=0; -static sqlite3_stmt *i_s_files=0; -////////////////////////////////////////////////////// -const char *i_q_xrefs="INSERT OR REPLACE INTO xrefs " - "( src, dst, id_file, line, column )" - "VALUES " - "(:src,:dst,:id_file,:line,:column )"; -static sqlite3_stmt *i_s_xrefs=0; -////////////////////////////////////////////////////// -const char *i_q_memberdef="INSERT OR REPLACE INTO memberdef " - "( refid, prot, static, const, explicit, inline, final, sealed, new, optional, required, virt, mutable, initonly, readable, writable, gettable, settable, accessor, addable, removable, raisable, name, type, definition, argsstring, scope, initializer, kind, id_bfile, bline, bcolumn, id_file, line, column)" - "VALUES " - "(:refid,:prot,:static,:const,:explicit,:inline,:final,:sealed,:new,:optional,:required,:virt,:mutable,:initonly,:readable,:writable,:gettable,:settable,:accessor,:addable,:removable,:raisable,:name,:type,:definition,:argsstring,:scope,:initializer,:kind,:id_bfile,:bline,:bcolumn,:id_file,:line,:column)"; -const char *id_q_memberdef="SELECT id FROM memberdef WHERE refid=:refid and id is not null"; -static sqlite3_stmt *id_s_memberdef=0; -static sqlite3_stmt *i_s_memberdef=0; -////////////////////////////////////////////////////// -const char *i_q_compounddef="INSERT OR REPLACE INTO compounddef " - "( name, kind, prot, refid, id_file, line, column ) " - "VALUES " - "(:name,:kind,:prot,:refid,:id_file,:line,:column )"; -static sqlite3_stmt *i_s_compounddef=0; -////////////////////////////////////////////////////// -const char *i_q_basecompoundref="INSERT OR REPLACE INTO basecompoundref " - "( base, derived, refid, prot, virt ) " - "VALUES " - "(:base,:derived,:refid,:prot,:virt )" ; -static sqlite3_stmt *i_s_basecompoundref=0; -////////////////////////////////////////////////////// -const char *i_q_derivedcompoundref="INSERT OR REPLACE INTO derivedcompoundref " - "( refid, prot, virt, base, derived ) " - "VALUES " - "(:refid,:prot,:virt,:base,:derived )" ; -static sqlite3_stmt *i_s_derivedcompoundref=0; -////////////////////////////////////////////////////// - -const char * schema_queries[][2] = -{ - { - "compounddef", - "CREATE TABLE IF NOT EXISTS compounddef (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," - "name TEXT NOT NULL," - "kind TEXT NOT NULL," - "prot INTEGER NOT NULL," - "refid TEXT NOT NULL," - "id_file INTEGER NOT NULL," - "line INTEGER NOT NULL," - "column INTEGER NOT NULL)" - }, - { - "basecompoundref", - "CREATE TABLE IF NOT EXISTS basecompoundref (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " - "base TEXT NOT NULL," - "derived TEXT NOT NULL," - "refid TEXT NOT NULL," - "prot INTEGER NOT NULL," - "virt INTEGER NOT NULL)" - }, - { - "derivedcompoundref", - "CREATE TABLE IF NOT EXISTS derivedcompoundref (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " - "base TEXT NOT NULL," - "derived TEXT NOT NULL," - "refid TEXT NOT NULL," - "prot INTEGER NOT NULL," - "virt INTEGER NOT NULL)" - }, - { - "includes", +const char * schema_queries[][2] = { + { "includes", "CREATE TABLE IF NOT EXISTS includes (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " "local INTEGER NOT NULL," "id_src INTEGER NOT NULL," - "dst TEXT NOT NULL)" + "id_dst INTEGER NOT NULL);" + "CREATE UNIQUE INDEX idx_includes ON includes " + "(local, id_src, id_dst);" }, - { - "innerclass", + { "innerclass", "CREATE TABLE IF NOT EXISTS innerclass (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " "refid TEXT NOT NULL," "prot INTEGER NOT NULL," "name TEXT NOT NULL)" }, - { - "files", + { "files", "CREATE TABLE IF NOT EXISTS files (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " - "name TEXT NOT NULL)" + "name TEXT PRIMARY KEY NOT NULL);" }, - { - "xrefs", + { "refids", + "CREATE TABLE IF NOT EXISTS refids (" + "refid TEXT PRIMARY KEY NOT NULL);" + }, + { "xrefs", "CREATE TABLE IF NOT EXISTS xrefs (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " - "src TEXT NOT NULL, " - "dst TEXT NOT NULL, " - "id_file INTEGER NOT NULL, " - "line INTEGER, " - "column INTEGER)" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "refid_src INTEGER NOT NULL, " + "refid_dst INTEGER NOT NULL, " + "id_file INTEGER NOT NULL, " + "line INTEGER NOT NULL, " + "column INTEGER NOT NULL);" + "CREATE UNIQUE INDEX idx_xrefs ON xrefs " + "(refid_src, refid_dst, id_file, line, column);" }, - { - "memberdef", + { "memberdef", "CREATE TABLE IF NOT EXISTS memberdef (" - "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "id_file INTEGER NOT NULL," + "line INTEGER NOT NULL," + "column INTEGER NOT NULL," + "refid TEXT NOT NULL," "name TEXT NOT NULL," "definition TEXT," "type TEXT," "argsstring TEXT," "scope TEXT," "initializer TEXT," - "prot INTEGER NOT NULL," - "static INTEGER NOT NULL," + "prot INTEGER," "const INTEGER," + "virt INTEGER," + "static INTEGER NOT NULL," "explicit INTEGER," "inline INTEGER," "final INTEGER," @@ -189,7 +105,6 @@ const char * schema_queries[][2] = "new INTEGER," "optional INTEGER," "required INTEGER," - "virt INTEGER," "mutable INTEGER," "initonly INTEGER," "readable INTEGER," @@ -201,14 +116,177 @@ const char * schema_queries[][2] = "removable INTEGER," "raisable INTEGER," "kind INTEGER," + "id_bodyfile INTEGER," + "bodystart INTEGER," + "bodyend INTEGER," + "detaileddescription TEXT," + "briefdescription TEXT," + "inbodydescription TEXT" + ")" + }, + { "compounddef", + "CREATE TABLE IF NOT EXISTS compounddef (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "name TEXT NOT NULL," + "kind TEXT NOT NULL," + "prot INTEGER NOT NULL," "refid TEXT NOT NULL," - "id_bfile INTEGER," - "bline INTEGER," - "bcolumn INTEGER," "id_file INTEGER NOT NULL," "line INTEGER NOT NULL," "column INTEGER NOT NULL)" }, + { "basecompoundref", + "CREATE TABLE IF NOT EXISTS basecompoundref (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "base TEXT NOT NULL," + "derived TEXT NOT NULL," + "refid TEXT NOT NULL," + "prot INTEGER NOT NULL," + "virt INTEGER NOT NULL)" + }, + { "derivedcompoundref", + "CREATE TABLE IF NOT EXISTS derivedcompoundref (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " + "base TEXT NOT NULL," + "derived TEXT NOT NULL," + "refid TEXT NOT NULL," + "prot INTEGER NOT NULL," + "virt INTEGER NOT NULL)" + }, + { "params", + "CREATE TABLE IF NOT EXISTS params (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "attributes TEXT," + "type TEXT," + "declname TEXT," + "defnname TEXT," + "array TEXT," + "defval TEXT," + "briefdescription TEXT)" + }, + { "memberdef_params", + "CREATE TABLE IF NOT EXISTS memberdef_params (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "id_memberdef INTEGER NOT NULL," + "id_param INTEGER NOT NULL)" + }, + { "innernamespaces", + "CREATE TABLE IF NOT EXISTS innernamespaces (" + "rowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "refid TEXT NOT NULL," + "name TEXT NOT NULL)" + } +}; + +////////////////////////////////////////////////////// +struct SqlStmt { + const char *query; + sqlite3_stmt *stmt; +}; +////////////////////////////////////////////////////// +SqlStmt incl_insert = { "INSERT INTO includes " + "( local, id_src, id_dst ) " + "VALUES " + "(:local,:id_src,:id_dst )" + ,NULL +}; +SqlStmt incl_select = { "SELECT COUNT(*) FROM includes WHERE " + "local=:local AND id_src=:id_src AND id_dst=:id_dst" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt innerclass_insert={"INSERT INTO innerclass " + "( refid, prot, name )" + "VALUES " + "(:refid,:prot,:name )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt files_select = {"SELECT rowid FROM files WHERE name=:name" + ,NULL +}; +SqlStmt files_insert = {"INSERT INTO files " + "( name )" + "VALUES " + "(:name )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt refids_select = {"SELECT rowid FROM refids WHERE " + "refid=:refid" + ,NULL +}; +SqlStmt refids_insert = {"INSERT INTO refids " + "( refid )" + "VALUES " + "(:refid )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt xrefs_insert= {"INSERT INTO xrefs " + "( refid_src, refid_dst, id_file, line, column )" + "VALUES " + "(:refid_src,:refid_dst,:id_file,:line,:column )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt memberdef_insert={"INSERT INTO memberdef " + "( refid, prot, static, const, explicit, inline, final, sealed, new, optional, required, virt, mutable, initonly, readable, writable, gettable, settable, accessor, addable, removable, raisable, name, type, definition, argsstring, scope, initializer, kind, id_bodyfile, bodystart, bodyend, id_file, line, column, detaileddescription, briefdescription, inbodydescription)" + "VALUES " + "(:refid,:prot,:static,:const,:explicit,:inline,:final,:sealed,:new,:optional,:required,:virt,:mutable,:initonly,:readable,:writable,:gettable,:settable,:accessor,:addable,:removable,:raisable,:name,:type,:definition,:argsstring,:scope,:initializer,:kind,:id_bodyfile,:bodystart,:bodyend,:id_file,:line,:column,:detaileddescription,:briefdescription,:inbodydescription)" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt compounddef_insert={"INSERT INTO compounddef " + "( name, kind, prot, refid, id_file, line, column ) " + "VALUES " + "(:name,:kind,:prot,:refid,:id_file,:line,:column )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt basecompoundref_insert={"INSERT INTO basecompoundref " + "( base, derived, refid, prot, virt ) " + "VALUES " + "(:base,:derived,:refid,:prot,:virt )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt derivedcompoundref_insert={"INSERT INTO derivedcompoundref " + "( refid, prot, virt, base, derived ) " + "VALUES " + "(:refid,:prot,:virt,:base,:derived )" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt params_select = { "SELECT rowid FROM params WHERE " + "(attributes IS NULL OR attributes=:attributes) AND " + "(type IS NULL OR type=:type) AND " + "(declname IS NULL OR declname=:declname) AND " + "(defnname IS NULL OR defnname=:defnname) AND " + "(array IS NULL OR array=:array) AND " + "(defval IS NULL OR defval=:defval) AND " + "(briefdescription IS NULL OR briefdescription=:briefdescription)" + ,NULL +}; +SqlStmt params_insert = { "INSERT INTO params " + "( attributes, type, declname, defnname, array, defval, briefdescription ) " + "VALUES " + "(:attributes,:type,:declname,:defnname,:array,:defval,:briefdescription)" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt memberdef_params_insert={ "INSERT INTO memberdef_params " + "( id_memberdef, id_param)" + "VALUES " + "(:id_memberdef,:id_param)" + ,NULL +}; +////////////////////////////////////////////////////// +SqlStmt innernamespace_insert={"INSERT INTO innernamespaces " + "( refid, name)" + "VALUES " + "(:refid,:name)", + NULL }; @@ -242,78 +320,194 @@ class TextGeneratorSqlite3Impl : public TextGeneratorIntf }; -static void bindTextParameter(sqlite3_stmt *stmt,const char *name,const char *value, bool _static=TRUE) +static void bindTextParameter(SqlStmt &s,const char *name,const char *value, bool _static=TRUE) { - int idx = sqlite3_bind_parameter_index(stmt, name); - sqlite3_bind_text(stmt, idx, value, -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT); + int idx = sqlite3_bind_parameter_index(s.stmt, name); + sqlite3_bind_text(s.stmt, idx, value, -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT); } -static void bindIntParameter(sqlite3_stmt *stmt,const char *name,int value) +static void bindIntParameter(SqlStmt &s,const char *name,int value) { - int idx = sqlite3_bind_parameter_index(stmt, name); - sqlite3_bind_int(stmt, idx, value); + int idx = sqlite3_bind_parameter_index(s.stmt, name); + sqlite3_bind_int(s.stmt, idx, value); } -static int step(sqlite3 *db, sqlite3_stmt *stmt,bool getRowId=FALSE) +static int step(sqlite3 *db, SqlStmt &s,bool getRowId=FALSE, bool select=FALSE) { - int id=-1; - int rc = sqlite3_step(stmt); + int rowid=-1; + int rc = sqlite3_step(s.stmt); if (rc!=SQLITE_DONE && rc!=SQLITE_ROW) { msg("sqlite3_step failed: %s\n", sqlite3_errmsg(db)); + sqlite3_clear_bindings(s.stmt); return -1; } - if (getRowId) id = sqlite3_column_int(stmt, 0); - sqlite3_reset(stmt); - return id; + if (getRowId && select) rowid = sqlite3_column_int(s.stmt, 0); // works on selects, doesnt on inserts + if (getRowId && !select) rowid = sqlite3_last_insert_rowid(db); //works on inserts, doesnt on selects + sqlite3_reset(s.stmt); + sqlite3_clear_bindings(s.stmt); // XXX When should this really be called + return rowid; } static int insertFile(sqlite3 *db, const char* name) { - int id=-1; - if (name==0) return -1; + int rowid=-1; + if (name==0) return rowid; - // see if it's already in DB - bindTextParameter(id_s_files,":name",name); - id=step(db,id_s_files,TRUE); - if (id==0) + bindTextParameter(files_select,":name",name); + rowid=step(db,files_select,TRUE,TRUE); + if (rowid==0) { - // insert it - bindTextParameter(i_s_files,":name",name); + bindTextParameter(files_insert,":name",name); + rowid=step(db,files_insert,TRUE); + } + return rowid; +} + +static int insertRefid(sqlite3 *db, const char *refid) +{ + int rowid=-1; + if (refid==0) return rowid; - step(db,i_s_files); - id=sqlite3_last_insert_rowid(db); + bindTextParameter(refids_select,":refid",refid); + rowid=step(db,refids_select,TRUE,TRUE); + if (rowid==0) + { + bindTextParameter(refids_insert,":refid",refid); + rowid=step(db,refids_insert,TRUE); } - return id; + return rowid; } -static int insertMemberReference(sqlite3 *db, const char*src, const char*dst, const char *file, int line, int column) + +static void insertMemberReference(sqlite3 *db, const char*src, const char*dst, const char *file, int line, int column) { int id_file = insertFile(db,file); - bindTextParameter(i_s_xrefs,":src",src); - bindTextParameter(i_s_xrefs,":dst",dst); - - bindIntParameter(i_s_xrefs,":id_file",id_file); - bindIntParameter(i_s_xrefs,":line",line); - bindIntParameter(i_s_xrefs,":column",column); + int refid_src = insertRefid(db,src); + int refid_dst = insertRefid(db,dst); + if (id_file==-1||refid_src==-1||refid_dst==-1) + return; -return step(db,i_s_xrefs); + bindIntParameter(xrefs_insert,":refid_src",refid_src); + bindIntParameter(xrefs_insert,":refid_dst",refid_dst); + bindIntParameter(xrefs_insert,":id_file",id_file); + bindIntParameter(xrefs_insert,":line",line); + bindIntParameter(xrefs_insert,":column",1); + step(db,xrefs_insert); } static void insertMemberReference(sqlite3 *db, MemberDef *src, MemberDef *dst, const char*floc) { if (dst->getStartBodyLine()!=-1 && dst->getBodyDef()) { - char file[4096] = { 0 }; + static char file[4096]; int line=0,column=0; if (floc) { - sscanf(floc,"%[^:]:%d:%d",file,&line,&column); + int rv = sscanf(floc,"%[^:]:%d:%d",file,&line,&column); + if (rv!=3) + { + msg("unable to read file loc from[%s]\n",floc); + return; + } } insertMemberReference(db,src->anchor().data(),dst->anchor().data(),file,line,column); } } +static void insertMemberFunctionParams(sqlite3 *db,int id_memberdef,MemberDef *md,Definition *def) +{ + ArgumentList *declAl = md->declArgumentList(); + ArgumentList *defAl = md->argumentList(); + if (declAl!=0 && declAl->count()>0) + { + ArgumentListIterator declAli(*declAl); + ArgumentListIterator defAli(*defAl); + Argument *a; + for (declAli.toFirst();(a=declAli.current());++declAli) + { + Argument *defArg = defAli.current(); + + if (!a->attrib.isEmpty()) + { + bindTextParameter(params_select,":attributes",a->attrib.data()); + bindTextParameter(params_insert,":attributes",a->attrib.data()); + } + if (!a->type.isEmpty()) + { + StringList l; + linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->type); + + StringListIterator li(l); + QCString *s; + while ((s=li.current())) + { + insertMemberReference(db,md->anchor().data(),s->data(),def->getDefFileName().data(),md->getDefLine(),1); + ++li; + } + bindTextParameter(params_select,":type",a->type.data()); + bindTextParameter(params_insert,":type",a->type.data()); + } + if (!a->name.isEmpty()) + { + bindTextParameter(params_select,":declname",a->name.data()); + bindTextParameter(params_insert,":declname",a->name.data()); + } + if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name) + { + bindTextParameter(params_select,":defnname",defArg->name.data()); + bindTextParameter(params_insert,":defnname",defArg->name.data()); + } + if (!a->array.isEmpty()) + { + bindTextParameter(params_select,":array",a->array.data()); + bindTextParameter(params_insert,":array",a->array.data()); + } + if (!a->defval.isEmpty()) + { + StringList l; + linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->defval); + bindTextParameter(params_select,":defval",a->defval.data()); + bindTextParameter(params_insert,":defval",a->defval.data()); + } + if (defArg) ++defAli; + + int id_param=step(db,params_select,TRUE,TRUE); + if (id_param==0) { + id_param=step(db,params_insert,TRUE); + } + + bindIntParameter(memberdef_params_insert,":id_memberdef",id_memberdef); + bindIntParameter(memberdef_params_insert,":id_param",id_param); + step(db,memberdef_params_insert); + } + } +} + +static void insertMemberDefineParams(sqlite3 *db,int id_memberdef,MemberDef *md,Definition *def) +{ + if (md->argumentList()->count()==0) // special case for "foo()" to + // disguish it from "foo". + { + DBG_CTX(("no params\n")); + } + else + { + ArgumentListIterator ali(*md->argumentList()); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) + { + bindTextParameter(params_insert,":defnname",a->type.data()); + int id_param=step(db,params_insert,TRUE); + + bindIntParameter(memberdef_params_insert,":id_memberdef",id_memberdef); + bindIntParameter(memberdef_params_insert,":id_param",id_param); + step(db,memberdef_params_insert); + } + } +} + + static void stripQualifiers(QCString &typeStr) { bool done=FALSE; @@ -327,13 +521,13 @@ static void stripQualifiers(QCString &typeStr) } } -static int prepareStatement(sqlite3 *db, const char* query, sqlite3_stmt **statement) +static int prepareStatement(sqlite3 *db, SqlStmt &s) { int rc; - rc = sqlite3_prepare_v2(db,query,-1,statement,0); + rc = sqlite3_prepare_v2(db,s.query,-1,&s.stmt,0); if (rc!=SQLITE_OK) { - msg("prepare failed for %s\n%s\n", query, sqlite3_errmsg(db)); + msg("prepare failed for %s\n%s\n", s.query, sqlite3_errmsg(db)); return -1; } return rc; @@ -342,17 +536,22 @@ static int prepareStatement(sqlite3 *db, const char* query, sqlite3_stmt **state static int prepareStatements(sqlite3 *db) { if ( - -1==prepareStatement(db, id_q_memberdef, &id_s_memberdef) || - -1==prepareStatement(db, id_q_files, &id_s_files) || - -1==prepareStatement(db, i_q_files, &i_s_files) || - -1==prepareStatement(db, i_q_xrefs, &i_s_xrefs) || - -1==prepareStatement(db, i_q_innerclass, &i_s_innerclass) || - -1==prepareStatement(db, i_q_memberdef, &i_s_memberdef) || - -1==prepareStatement(db, i_q_compounddef, &i_s_compounddef) || - -1==prepareStatement(db, i_q_basecompoundref, &i_s_basecompoundref) || - -1==prepareStatement(db, i_q_derivedcompoundref, &i_s_derivedcompoundref) || - -1==prepareStatement(db, i_q_includes, &i_s_includes)|| - -1==prepareStatement(db, c_q_includes, &c_s_includes) + -1==prepareStatement(db, memberdef_insert) || + -1==prepareStatement(db, files_insert) || + -1==prepareStatement(db, files_select) || + -1==prepareStatement(db, refids_insert) || + -1==prepareStatement(db, refids_select) || + -1==prepareStatement(db, incl_insert)|| + -1==prepareStatement(db, incl_select)|| + -1==prepareStatement(db, params_insert) || + -1==prepareStatement(db, params_select) || + -1==prepareStatement(db, xrefs_insert) || + -1==prepareStatement(db, innerclass_insert) || + -1==prepareStatement(db, compounddef_insert) || + -1==prepareStatement(db, basecompoundref_insert) || + -1==prepareStatement(db, derivedcompoundref_insert) || + -1==prepareStatement(db, memberdef_params_insert)|| + -1==prepareStatement(db, innernamespace_insert) ) { return -1; @@ -377,6 +576,7 @@ static void pragmaTuning(sqlite3 *db) char * sErrMsg = 0; sqlite3_exec(db, "PRAGMA synchronous = OFF", NULL, NULL, &sErrMsg); sqlite3_exec(db, "PRAGMA journal_mode = MEMORY", NULL, NULL, &sErrMsg); + sqlite3_exec(db, "PRAGMA temp_store = MEMORY;", NULL, NULL, &sErrMsg); } static int initializeSchema(sqlite3* db) @@ -387,7 +587,6 @@ static int initializeSchema(sqlite3* db) msg("Initializing DB schema...\n"); for (unsigned int k = 0; k < sizeof(schema_queries) / sizeof(schema_queries[0]); k++) { - //const char *tname = schema_queries[k][0]; const char *q = schema_queries[k][1]; // create table rc = sqlite3_prepare_v2(db, q, -1, &stmt, 0); @@ -418,18 +617,17 @@ static void writeInnerClasses(sqlite3*db,const ClassSDict *cl) { if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes { - bindTextParameter(i_s_innerclass,":refid",cd->getOutputFileBase(),FALSE); - bindIntParameter(i_s_innerclass,":prot",cd->protection()); - bindTextParameter(i_s_innerclass,":name",cd->name()); - if (-1==step(db,i_s_innerclass)) - return; + bindTextParameter(innerclass_insert,":refid",cd->getOutputFileBase(),FALSE); + bindIntParameter(innerclass_insert,":prot",cd->protection()); + bindTextParameter(innerclass_insert,":name",cd->name()); + step(db,innerclass_insert); } } } -static void writeInnerNamespaces(sqlite3 * /*db*/,const NamespaceSDict *nl) + +static void writeInnerNamespaces(sqlite3 *db,const NamespaceSDict *nl) { -#warning WorkInProgress if (nl) { NamespaceSDict::Iterator nli(*nl); @@ -438,25 +636,62 @@ static void writeInnerNamespaces(sqlite3 * /*db*/,const NamespaceSDict *nl) { if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymouse scopes { -// t << " <innernamespace refid=\"" << nd->getOutputFileBase() -// << "\">" << convertToXML(nd->name()) << "</innernamespace>" << endl; + bindTextParameter(innernamespace_insert,":refid",nd->getOutputFileBase(),FALSE); + bindTextParameter(innernamespace_insert,":name",nd->name(),FALSE); + step(db,innernamespace_insert); } } } } -static void writeTemplateArgumentList(sqlite3* /*db*/, - ArgumentList * /*al*/, - Definition * /*scope*/, - FileDef * /*fileScope*/, - int /*indent*/) + +static void writeTemplateArgumentList(sqlite3* db, + ArgumentList * al, + Definition * scope, + FileDef * fileScope) { -#warning WorkInProgress + if (al) + { + ArgumentListIterator ali(*al); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) + { + if (!a->type.isEmpty()) + { + #warning linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->type); + bindTextParameter(params_select,":type",a->type); + bindTextParameter(params_insert,":type",a->type); + } + if (!a->name.isEmpty()) + { + bindTextParameter(params_select,":declname",a->name); + bindTextParameter(params_insert,":declname",a->name); + bindTextParameter(params_select,":defnname",a->name); + bindTextParameter(params_insert,":defnname",a->name); + } + if (!a->defval.isEmpty()) + { + #warning linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->defval); + bindTextParameter(params_select,":defval",a->defval); + bindTextParameter(params_insert,":defval",a->defval); + } + if (!step(db,params_select,TRUE,TRUE)) + step(db,params_insert); + } + } } +static void writeMemberTemplateLists(sqlite3* db,MemberDef *md) +{ + ArgumentList *templMd = md->templateArguments(); + if (templMd) // function template prefix + { + writeTemplateArgumentList(db,templMd,md->getClassDef(),md->getFileDef()); + } +} static void writeTemplateList(sqlite3*db,ClassDef *cd) { - writeTemplateArgumentList(db,cd->templateArguments(),cd,0,4); + writeTemplateArgumentList(db,cd->templateArguments(),cd,0); } //////////////////////////////////////////// @@ -476,7 +711,6 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) // + template arguments // (templateArguments(), definitionTemplateParameterLists()) // - call graph - msg("=====%s\n",md->name().data()); // enum values are written as part of the enum if (md->memberType()==MemberType_EnumValue) return; @@ -487,10 +721,11 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) //if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return; QCString memType; // memberdef - bindTextParameter(i_s_memberdef,":refid",md->anchor().data(),FALSE); - bindIntParameter(i_s_memberdef,":kind",md->memberType()); - bindIntParameter(i_s_memberdef,":prot",md->protection()); - bindIntParameter(i_s_memberdef,":static",md->isStatic()); + bindTextParameter(memberdef_insert,":refid",md->anchor().data(),FALSE); + bindIntParameter(memberdef_insert,":kind",md->memberType()); + bindIntParameter(memberdef_insert,":prot",md->protection()); + + bindIntParameter(memberdef_insert,":static",md->isStatic()); bool isFunc=FALSE; switch (md->memberType()) @@ -510,45 +745,44 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) ArgumentList *al = md->argumentList(); if (al!=0 && al->constSpecifier) { - bindIntParameter(i_s_memberdef,":const",al->constSpecifier); + bindIntParameter(memberdef_insert,":const",al->constSpecifier); } - - bindIntParameter(i_s_memberdef,":explicit",md->isExplicit()); - bindIntParameter(i_s_memberdef,":inline",md->isInline()); - bindIntParameter(i_s_memberdef,":final",md->isFinal()); - bindIntParameter(i_s_memberdef,":sealed",md->isSealed()); - bindIntParameter(i_s_memberdef,":new",md->isNew()); - bindIntParameter(i_s_memberdef,":optional",md->isOptional()); - bindIntParameter(i_s_memberdef,":required",md->isRequired()); - bindIntParameter(i_s_memberdef,":virt",md->virtualness()); + bindIntParameter(memberdef_insert,":explicit",md->isExplicit()); + bindIntParameter(memberdef_insert,":inline",md->isInline()); + bindIntParameter(memberdef_insert,":final",md->isFinal()); + bindIntParameter(memberdef_insert,":sealed",md->isSealed()); + bindIntParameter(memberdef_insert,":new",md->isNew()); + bindIntParameter(memberdef_insert,":optional",md->isOptional()); + bindIntParameter(memberdef_insert,":required",md->isRequired()); + + bindIntParameter(memberdef_insert,":virt",md->virtualness()); } // place in the arguments and linkify the arguments if (md->memberType() == MemberType_Variable) { - bindIntParameter(i_s_memberdef,":mutable",md->isMutable()); - bindIntParameter(i_s_memberdef,":initonly",md->isInitonly()); + bindIntParameter(memberdef_insert,":mutable",md->isMutable()); + bindIntParameter(memberdef_insert,":initonly",md->isInitonly()); } else if (md->memberType() == MemberType_Property) { - bindIntParameter(i_s_memberdef,":readable",md->isReadable()); - bindIntParameter(i_s_memberdef,":writable",md->isWritable()); - bindIntParameter(i_s_memberdef,":gettable",md->isGettable()); - bindIntParameter(i_s_memberdef,":settable",md->isSettable()); - + bindIntParameter(memberdef_insert,":readable",md->isReadable()); + bindIntParameter(memberdef_insert,":writable",md->isWritable()); + bindIntParameter(memberdef_insert,":gettable",md->isGettable()); + bindIntParameter(memberdef_insert,":settable",md->isSettable()); if (md->isAssign() || md->isCopy() || md->isRetain()) { int accessor = md->isAssign() ? md->isAssign() : (md->isCopy() ? md->isCopy() : md->isRetain()) ; - bindIntParameter(i_s_memberdef,":accessor",accessor); + bindIntParameter(memberdef_insert,":accessor",accessor); } } else if (md->memberType() == MemberType_Event) { - bindIntParameter(i_s_memberdef,":addable",md->isAddable()); - bindIntParameter(i_s_memberdef,":removable",md->isRemovable()); - bindIntParameter(i_s_memberdef,":raisable",md->isRaisable()); + bindIntParameter(memberdef_insert,":addable",md->isAddable()); + bindIntParameter(memberdef_insert,":removable",md->isRemovable()); + bindIntParameter(memberdef_insert,":raisable",md->isRaisable()); } // + declaration/definition arg lists @@ -556,121 +790,55 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) md->memberType()!=MemberType_Enumeration ) { + if (md->memberType()!=MemberType_Typedef) + { + writeMemberTemplateLists(db,md); + } QCString typeStr = md->typeString(); stripQualifiers(typeStr); StringList l; linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,typeStr); if (typeStr.data()) { - bindTextParameter(i_s_memberdef,":type",typeStr.data(),FALSE); + bindTextParameter(memberdef_insert,":type",typeStr.data(),FALSE); } if (md->definition()) { - bindTextParameter(i_s_memberdef,":definition",md->definition()); + bindTextParameter(memberdef_insert,":definition",md->definition()); } if (md->argsString()) { - bindTextParameter(i_s_memberdef,":argsstring",md->argsString()); + bindTextParameter(memberdef_insert,":argsstring",md->argsString()); } } - bindTextParameter(i_s_memberdef,":name",md->name()); + bindTextParameter(memberdef_insert,":name",md->name()); if (md->memberType() == MemberType_Property) { if (md->isReadable()) { - DBG_CTX(("<read>\n")); + bindIntParameter(memberdef_insert,":readable",1); } if (md->isWritable()) { - DBG_CTX(("<write>\n")); - } - } - if (isFunc) //function - { - ArgumentList *declAl = md->declArgumentList(); - ArgumentList *defAl = md->argumentList(); - if (declAl!=0 && declAl->count()>0) - { - ArgumentListIterator declAli(*declAl); - ArgumentListIterator defAli(*defAl); - Argument *a; - for (declAli.toFirst();(a=declAli.current());++declAli) - { - Argument *defArg = defAli.current(); - DBG_CTX(("<param>\n")); - if (!a->attrib.isEmpty()) - { - DBG_CTX(("<attributes>:%s\n",a->attrib.data())); - } - if (!a->type.isEmpty()) - { - StringList l; - linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->type); - - QCString *s=l.first(); - while (s) - { - insertMemberReference(db,md->anchor().data(),s->data(),def->getDefFileName().data(),md->getDefLine(),1); - s=l.next(); - } - } - if (!a->name.isEmpty()) - { - DBG_CTX(("<declname>%s\n",a->name.data())); - } - if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name) - { - DBG_CTX(("<defname>%s\n",defArg->name.data())); - } - if (!a->array.isEmpty()) - { - DBG_CTX(("<array>%s",a->array.data())); - } - if (!a->defval.isEmpty()) - { - StringList l; - linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->defval); - } - if (defArg) ++defAli; - } - } - } - else if (md->memberType()==MemberType_Define && - md->argsString()) // define - { - if (md->argumentList()->count()==0) // special case for "foo()" to - // disguish it from "foo". - { - DBG_CTX(("no params\n")); - } - else - { - ArgumentListIterator ali(*md->argumentList()); - Argument *a; - for (ali.toFirst();(a=ali.current());++ali) - { - DBG_CTX(("<param><defname>%s\n",a->type.data())); - } + bindIntParameter(memberdef_insert,":writable",1); } } // Extract references from initializer - // avoid that extremely large tables are written to the output. - // todo: it's better to adhere to MAX_INITIALIZER_LINES. - // drm_mod_register_buffer, - if (!md->initializer().isEmpty() && md->initializer().length()<2000) + if (md->hasMultiLineInitializer() || md->hasOneLineInitializer()) { - bindTextParameter(i_s_memberdef,":initializer",md->initializer().data()); + bindTextParameter(memberdef_insert,":initializer",md->initializer().data()); StringList l; linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,md->initializer()); - QCString *s=l.first(); - while (s) + StringListIterator li(l); + QCString *s; + while ((s=li.current())) { if (md->getBodyDef()) { @@ -681,48 +849,58 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) md->getStartBodyLine())); insertMemberReference(db,md->anchor().data(),s->data(),md->getBodyDef()->getDefFileName().data(),md->getStartBodyLine(),1); } - s=l.next(); + ++li; } } if ( md->getScopeString() ) { - bindTextParameter(i_s_memberdef,":scope",md->getScopeString().data(),FALSE); + bindTextParameter(memberdef_insert,":scope",md->getScopeString().data(),FALSE); } + // +Brief, detailed and inbody description + bindTextParameter(memberdef_insert,":briefdescription",md->briefDescription(),FALSE); + bindTextParameter(memberdef_insert,":detaileddescription",md->documentation(),FALSE); + bindTextParameter(memberdef_insert,":inbodydescription",md->inbodyDocumentation(),FALSE); + // File location if (md->getDefLine() != -1) { int id_file = insertFile(db,md->getDefFileName()); if (id_file!=-1) { - bindIntParameter(i_s_memberdef,":id_file",id_file); - bindIntParameter(i_s_memberdef,":line",md->getDefLine()); - bindIntParameter(i_s_memberdef,":column",md->getDefColumn()); + bindIntParameter(memberdef_insert,":id_file",id_file); + bindIntParameter(memberdef_insert,":line",md->getDefLine()); + bindIntParameter(memberdef_insert,":column",md->getDefColumn()); if (md->getStartBodyLine()!=-1) { - int id_bfile = insertFile(db,md->getBodyDef()->absFilePath()); - if (id_bfile == -1) + int id_bodyfile = insertFile(db,md->getBodyDef()->absFilePath()); + if (id_bodyfile == -1) { - sqlite3_clear_bindings(i_s_memberdef); - return; + sqlite3_clear_bindings(memberdef_insert.stmt); + } + else + { + bindIntParameter(memberdef_insert,":id_bodyfile",id_bodyfile); + bindIntParameter(memberdef_insert,":bodystart",md->getStartBodyLine()); + bindIntParameter(memberdef_insert,":bodyend",md->getEndBodyLine()); } - - bindIntParameter(i_s_memberdef,":id_ibfile",id_bfile); - bindIntParameter(i_s_memberdef,":bline",md->getStartBodyLine()); - - // XXX implement getStartBodyColumn - bindIntParameter(i_s_memberdef,":bcolumn",1); } } } - if (-1==step(db,i_s_memberdef)) + int id_memberdef=step(db,memberdef_insert,TRUE); + + if (isFunc) + { + insertMemberFunctionParams(db,id_memberdef,md,def); + } + else if (md->memberType()==MemberType_Define && + md->argsString()) { - sqlite3_clear_bindings(i_s_memberdef); + insertMemberDefineParams(db,id_memberdef,md,def); } - /*int id_src =*/ sqlite3_last_insert_rowid(db); // + source references // The cross-references in initializers only work when both the src and dst @@ -737,7 +915,6 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) insertMemberReference(db,md,rmd,mdi.currentKey()); } } - // + source referenced by mdict = md->getReferencedByMembers(); if (mdict!=0) @@ -762,7 +939,6 @@ static void generateSqlite3Section(sqlite3*db, int count=0; for (mli.toFirst();(md=mli.current());++mli) { - msg("I:%s\n",md->name().data()); // namespace members are also inserted in the file scope, but // to prevent this duplication in the XML output, we filter those here. if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) @@ -808,24 +984,17 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) msg("Generating Sqlite3 output for class %s\n",cd->name().data()); - //int idx,rc; - //sqlite3_stmt *stmt ; - - // + compounddef - //stmt = i_s_compounddef; - - bindTextParameter(i_s_compounddef,":name",cd->name()); - bindTextParameter(i_s_compounddef,":kind",cd->compoundTypeString(),FALSE); - bindIntParameter(i_s_compounddef,":prot",cd->protection()); - bindTextParameter(i_s_compounddef,":refid",cd->getOutputFileBase(),FALSE); + bindTextParameter(compounddef_insert,":name",cd->name()); + bindTextParameter(compounddef_insert,":kind",cd->compoundTypeString(),FALSE); + bindIntParameter(compounddef_insert,":prot",cd->protection()); + bindTextParameter(compounddef_insert,":refid",cd->getOutputFileBase(),FALSE); int id_file = insertFile(db,cd->getDefFileName().data()); - bindIntParameter(i_s_compounddef,":id_file",id_file); - bindIntParameter(i_s_compounddef,":line",cd->getDefLine()); - bindIntParameter(i_s_compounddef,":column",cd->getDefColumn()); + bindIntParameter(compounddef_insert,":id_file",id_file); + bindIntParameter(compounddef_insert,":line",cd->getDefLine()); + bindIntParameter(compounddef_insert,":column",cd->getDefColumn()); - if (-1==step(db,i_s_compounddef)) - return; + step(db,compounddef_insert); // + list of direct super classes if (cd->baseClasses()) @@ -834,21 +1003,20 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) BaseClassDef *bcd; for (bcli.toFirst();(bcd=bcli.current());++bcli) { - bindTextParameter(i_s_basecompoundref,":refid",bcd->classDef->getOutputFileBase()); - bindIntParameter(i_s_basecompoundref,":prot",bcd->prot); - bindIntParameter(i_s_basecompoundref,":virt",bcd->virt); + bindTextParameter(basecompoundref_insert,":refid",bcd->classDef->getOutputFileBase(),FALSE); + bindIntParameter(basecompoundref_insert,":prot",bcd->prot); + bindIntParameter(basecompoundref_insert,":virt",bcd->virt); if (!bcd->templSpecifiers.isEmpty()) { - bindTextParameter(i_s_basecompoundref,":base",insertTemplateSpecifierInScope(bcd->classDef->name(),bcd->templSpecifiers)); + bindTextParameter(basecompoundref_insert,":base",insertTemplateSpecifierInScope(bcd->classDef->name(),bcd->templSpecifiers),FALSE); } else { - bindTextParameter(i_s_basecompoundref,":base",bcd->classDef->displayName()); + bindTextParameter(basecompoundref_insert,":base",bcd->classDef->displayName(),FALSE); } - bindTextParameter(i_s_basecompoundref,":derived",cd->displayName()); - if (-1==step(db,i_s_basecompoundref)) - continue; + bindTextParameter(basecompoundref_insert,":derived",cd->displayName(),FALSE); + step(db,basecompoundref_insert); } } @@ -859,13 +1027,12 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) BaseClassDef *bcd; for (bcli.toFirst();(bcd=bcli.current());++bcli) { - bindTextParameter(i_s_derivedcompoundref,":base",cd->displayName()); - bindTextParameter(i_s_derivedcompoundref,":dervied",bcd->classDef->displayName()); - bindTextParameter(i_s_derivedcompoundref,":refid",bcd->classDef->getOutputFileBase()); - bindIntParameter(i_s_derivedcompoundref,":prot",bcd->prot); - bindIntParameter(i_s_derivedcompoundref,":virt",bcd->virt); - if (-1==step(db,i_s_derivedcompoundref)) - continue; + bindTextParameter(derivedcompoundref_insert,":base",cd->displayName()); + bindTextParameter(derivedcompoundref_insert,":dervied",bcd->classDef->displayName()); + bindTextParameter(derivedcompoundref_insert,":refid",bcd->classDef->getOutputFileBase()); + bindIntParameter(derivedcompoundref_insert,":prot",bcd->prot); + bindIntParameter(derivedcompoundref_insert,":virt",bcd->virt); + step(db,derivedcompoundref_insert); } } @@ -877,21 +1044,22 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); if (!nm.isEmpty()) { - bindIntParameter(c_s_includes,":local",ii->local); - bindIntParameter(c_s_includes,":id_src",id_file); - bindTextParameter(c_s_includes,":dst",nm); - int count=step(db,c_s_includes,TRUE); - if (count==0) - { - bindIntParameter(i_s_includes,":local",ii->local); - bindIntParameter(i_s_includes,":id_src",id_file); - bindTextParameter(i_s_includes,":dst",nm); - if (-1==step(db,i_s_includes)) - return; + int id_dst=insertFile(db,nm); + if (id_dst!=-1) { + bindIntParameter(incl_select,":local",ii->local); + bindIntParameter(incl_select,":id_src",id_file); + bindIntParameter(incl_select,":id_dst",id_dst); + int count=step(db,incl_select,TRUE,TRUE); + if (count==0) + { + bindIntParameter(incl_insert,":local",ii->local); + bindIntParameter(incl_insert,":id_src",id_file); + bindIntParameter(incl_insert,":id_dst",id_dst); + step(db,incl_insert); + } } } } - // + list of inner classes writeInnerClasses(db,cd->getClassSDict()); @@ -990,12 +1158,17 @@ static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) QListIterator<IncludeInfo> ili(*fd->includeFileList()); for (ili.toFirst();(ii=ili.current());++ili) { - int id_file=insertFile(db,fd->absFilePath().data()); - bindIntParameter(i_s_includes,":local",ii->local); - bindIntParameter(i_s_includes,":id_src",id_file); - bindTextParameter(i_s_includes,":dst",ii->includeName.data(),FALSE); - if (-1==step(db,i_s_includes)) - continue; + int id_src=insertFile(db,fd->absFilePath().data()); + int id_dst=insertFile(db,ii->includeName.data()); + bindIntParameter(incl_select,":local",ii->local); + bindIntParameter(incl_select,":id_src",id_src); + bindIntParameter(incl_select,":id_dst",id_dst); + if (step(db,incl_select,TRUE,TRUE)==0) { + bindIntParameter(incl_insert,":local",ii->local); + bindIntParameter(incl_insert,":id_src",id_src); + bindIntParameter(incl_insert,":id_dst",id_dst); + step(db,incl_insert); + } } } @@ -1005,13 +1178,17 @@ static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) QListIterator<IncludeInfo> ili(*fd->includedByFileList()); for (ili.toFirst();(ii=ili.current());++ili) { - int id_file=insertFile(db,ii->includeName); - bindIntParameter(i_s_includes,":local",ii->local); - bindIntParameter(i_s_includes,":id_src",id_file); - bindTextParameter(i_s_includes,":dst",fd->absFilePath().data(),FALSE); - if (-1==step(db,i_s_includes)) - continue; - + int id_src=insertFile(db,ii->includeName); + int id_dst=insertFile(db,fd->absFilePath()); + bindIntParameter(incl_select,":local",ii->local); + bindIntParameter(incl_select,":id_src",id_src); + bindIntParameter(incl_select,":id_dst",id_dst); + if (step(db,incl_select,TRUE,TRUE)==0) { + bindIntParameter(incl_insert,":local",ii->local); + bindIntParameter(incl_insert,":id_src",id_src); + bindIntParameter(incl_insert,":id_dst",id_dst); + step(db,incl_insert); + } } } @@ -1053,16 +1230,17 @@ static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) static void generateSqlite3ForGroup(sqlite3*db,GroupDef *gd) { - db=db; - gd=gd; +#warning WorkInProgress } static void generateSqlite3ForDir(sqlite3 *db,DirDef *dd) { +#warning WorkInProgress } static void generateSqlite3ForPage(sqlite3 *db,PageDef *pd,bool isExample) { +#warning WorkInProgress } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -1189,4 +1367,4 @@ void generateSqlite3() err("sqlite3 support has not been compiled in!"); } #endif - +// vim: noai:ts=2:sw=2:ss=2:expandtab diff --git a/src/sqlite3gen.h b/src/sqlite3gen.h index 689f1da..59664dd 100644 --- a/src/sqlite3gen.h +++ b/src/sqlite3gen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2012 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 diff --git a/src/store.cpp b/src/store.cpp index 7e5118a..8916015 100644 --- a/src/store.cpp +++ b/src/store.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/store.h b/src/store.h index d075dc0..597ea63 100644 --- a/src/store.h +++ b/src/store.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 03cc020..036e24f 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -1120,7 +1120,7 @@ void TagFileParser::addDocAnchors(Entry *e,const TagAnchorInfoList &l) { //printf("New sectionInfo file=%s anchor=%s\n", // ta->fileName.data(),ta->label.data()); - SectionInfo *si=new SectionInfo(ta->fileName,ta->label,ta->title, + SectionInfo *si=new SectionInfo(ta->fileName,-1,ta->label,ta->title, SectionInfo::Anchor,0,m_tagName); Doxygen::sectionDict->append(ta->label,si); e->anchors->append(si); @@ -1274,8 +1274,9 @@ static QCString stripPath(const QCString &s) void TagFileParser::buildLists(Entry *root) { // build class list - TagClassInfo *tci = m_tagFileClasses.first(); - while (tci) + QListIterator<TagClassInfo> cit(m_tagFileClasses); + TagClassInfo *tci; + for (cit.toFirst();(tci=cit.current());++cit) { Entry *ce = new Entry; ce->section = Entry::CLASS_SEC; @@ -1290,7 +1291,7 @@ void TagFileParser::buildLists(Entry *root) case TagClassInfo::Category: ce->spec = Entry::Category; break; } ce->name = tci->name; - if (tci->kind==TagClassInfo::Protocol) + if (tci->kind==TagClassInfo::Protocol) { ce->name+="-p"; } @@ -1309,14 +1310,14 @@ void TagFileParser::buildLists(Entry *root) } if (tci->templateArguments) { - if (ce->tArgLists==0) + if (ce->tArgLists==0) { ce->tArgLists = new QList<ArgumentList>; ce->tArgLists->setAutoDelete(TRUE); } ArgumentList *al = new ArgumentList; ce->tArgLists->append(al); - + QListIterator<QCString> sli(*tci->templateArguments); QCString *argName; for (;(argName=sli.current());++sli) @@ -1330,12 +1331,12 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(ce,tci->members); root->addSubEntry(ce); - tci = m_tagFileClasses.next(); } // build file list - TagFileInfo *tfi = m_tagFileFiles.first(); - while (tfi) + QListIterator<TagFileInfo> fit(m_tagFileFiles); + TagFileInfo *tfi; + for (fit.toFirst();(tfi=fit.current());++fit) { Entry *fe = new Entry; fe->section = guessSection(tfi->name); @@ -1367,12 +1368,12 @@ void TagFileParser::buildLists(Entry *root) } buildMemberList(fe,tfi->members); root->addSubEntry(fe); - tfi = m_tagFileFiles.next(); } // build namespace list - TagNamespaceInfo *tni = m_tagFileNamespaces.first(); - while (tni) + QListIterator<TagNamespaceInfo> nit(m_tagFileNamespaces); + TagNamespaceInfo *tni; + for (nit.toFirst();(tni=nit.current());++nit) { Entry *ne = new Entry; ne->section = Entry::NAMESPACE_SEC; @@ -1386,12 +1387,12 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(ne,tni->members); root->addSubEntry(ne); - tni = m_tagFileNamespaces.next(); } // build package list - TagPackageInfo *tpgi = m_tagFilePackages.first(); - while (tpgi) + QListIterator<TagPackageInfo> pit(m_tagFilePackages); + TagPackageInfo *tpgi; + for (pit.toFirst();(tpgi=pit.current());++pit) { Entry *pe = new Entry; pe->section = Entry::PACKAGE_SEC; @@ -1404,34 +1405,31 @@ void TagFileParser::buildLists(Entry *root) buildMemberList(pe,tpgi->members); root->addSubEntry(pe); - tpgi = m_tagFilePackages.next(); } - // build group list, but only if config file says to include it - //if (Config_getBool("EXTERNAL_GROUPS")) - //{ - TagGroupInfo *tgi = m_tagFileGroups.first(); - while (tgi) - { - Entry *ge = new Entry; - ge->section = Entry::GROUPDOC_SEC; - ge->name = tgi->name; - ge->type = tgi->title; - addDocAnchors(ge,tgi->docAnchors); - TagInfo *ti = new TagInfo; - ti->tagName = m_tagName; - ti->fileName = tgi->filename; - ge->tagInfo = ti; - - buildMemberList(ge,tgi->members); - root->addSubEntry(ge); - tgi = m_tagFileGroups.next(); - } - //} + // build group list + QListIterator<TagGroupInfo> git(m_tagFileGroups); + TagGroupInfo *tgi; + for (git.toFirst();(tgi=git.current());++git) + { + Entry *ge = new Entry; + ge->section = Entry::GROUPDOC_SEC; + ge->name = tgi->name; + ge->type = tgi->title; + addDocAnchors(ge,tgi->docAnchors); + TagInfo *ti = new TagInfo; + ti->tagName = m_tagName; + ti->fileName = tgi->filename; + ge->tagInfo = ti; + + buildMemberList(ge,tgi->members); + root->addSubEntry(ge); + } // build page list - TagPageInfo *tpi = m_tagFilePages.first(); - while (tpi) + QListIterator<TagPageInfo> pgit(m_tagFilePages); + TagPageInfo *tpi; + for (pgit.toFirst();(tpi=pgit.current());++pgit) { Entry *pe = new Entry; pe->section = Entry::PAGEDOC_SEC; @@ -1444,14 +1442,14 @@ void TagFileParser::buildLists(Entry *root) pe->tagInfo = ti; root->addSubEntry(pe); - tpi = m_tagFilePages.next(); } } void TagFileParser::addIncludes() { - TagFileInfo *tfi = m_tagFileFiles.first(); - while (tfi) + QListIterator<TagFileInfo> fit(m_tagFileFiles); + TagFileInfo *tfi; + for (fit.toFirst();(tfi=fit.current());++fit) { //printf("tag file tagName=%s path=%s name=%s\n",m_tagName.data(),tfi->path.data(),tfi->name.data()); FileName *fn = Doxygen::inputNameDict->find(tfi->name); @@ -1489,9 +1487,8 @@ void TagFileParser::addIncludes() } } } - } + } } - tfi = m_tagFileFiles.next(); } } diff --git a/src/tagreader.h b/src/tagreader.h index 73619db..1b5f7e3 100644 --- a/src/tagreader.h +++ b/src/tagreader.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/tclscanner.h b/src/tclscanner.h index 02627b4..baa8e84 100644 --- a/src/tclscanner.h +++ b/src/tclscanner.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 by Dimitri van Heesch. + * Copyright (C) 1997-2014 by Dimitri van Heesch. * Copyright (C) 2010-2011 by Rene Zaumseil * * Permission to use, copy, modify, and distribute this software and its diff --git a/src/template.cpp b/src/template.cpp index 8144afd..64d3523 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -29,7 +29,8 @@ class TemplateToken; //------------------------------------------------------------------- -static QValueList<QCString> split(const QCString &str,const QCString &sep,bool allowEmptyEntries=FALSE,bool cleanup=TRUE) +static QValueList<QCString> split(const QCString &str,const QCString &sep, + bool allowEmptyEntries=FALSE,bool cleanup=TRUE) { QValueList<QCString> lst; @@ -102,8 +103,8 @@ class TemplateVariant::Private int intVal; QCString strVal; bool boolVal; - const TemplateStructIntf *strukt; - const TemplateListIntf *list; + TemplateStructIntf *strukt; + TemplateListIntf *list; Delegate delegate; bool raw; }; @@ -144,17 +145,20 @@ TemplateVariant::TemplateVariant(const QCString &s,bool raw) p->raw = raw; } -TemplateVariant::TemplateVariant(const TemplateStructIntf *s) +TemplateVariant::TemplateVariant(TemplateStructIntf *s) { p = new Private; p->type = Struct; - p->strukt = s; } + p->strukt = s; + p->strukt->addRef(); +} -TemplateVariant::TemplateVariant(const TemplateListIntf *l) +TemplateVariant::TemplateVariant(TemplateListIntf *l) { p = new Private; p->type = List; p->list = l; + p->list->addRef(); } TemplateVariant::TemplateVariant(const TemplateVariant::Delegate &delegate) @@ -166,6 +170,8 @@ TemplateVariant::TemplateVariant(const TemplateVariant::Delegate &delegate) TemplateVariant::~TemplateVariant() { + if (p->type==Struct) p->strukt->release(); + else if (p->type==List) p->list->release(); delete p; } @@ -180,14 +186,20 @@ TemplateVariant::TemplateVariant(const TemplateVariant &v) 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; break; - case List: p->list = v.p->list; 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; } } 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; + p->type = v.p->type; p->raw = v.p->raw; switch (p->type) @@ -196,10 +208,14 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) 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; break; - case List: p->list = v.p->list; 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; } + + // release overwritten reference counted values + if (tmpType==Struct && tmpStruct) tmpStruct->release(); + else if (tmpType==List && tmpList ) tmpList->release(); return *this; } @@ -289,12 +305,12 @@ int TemplateVariant::toInt() const return result; } -const TemplateStructIntf *TemplateVariant::toStruct() const +TemplateStructIntf *TemplateVariant::toStruct() const { return p->type==Struct ? p->strukt : 0; } -const TemplateListIntf *TemplateVariant::toList() const +TemplateListIntf *TemplateVariant::toList() const { return p->type==List ? p->list : 0; } @@ -352,9 +368,10 @@ bool TemplateVariant::raw() const class TemplateStruct::Private { public: - Private() : fields(17) + Private() : fields(17), refCount(0) { fields.setAutoDelete(TRUE); } QDict<TemplateVariant> fields; + int refCount; }; TemplateStruct::TemplateStruct() @@ -367,6 +384,21 @@ TemplateStruct::~TemplateStruct() delete p; } +int TemplateStruct::addRef() +{ + return ++p->refCount; +} + +int TemplateStruct::release() +{ + int count = --p->refCount; + if (count<=0) + { + delete this; + } + return count; +} + void TemplateStruct::set(const char *name,const TemplateVariant &v) { TemplateVariant *pv = p->fields.find(name); @@ -386,6 +418,11 @@ TemplateVariant TemplateStruct::get(const char *name) const return v ? *v : TemplateVariant(); } +TemplateStruct *TemplateStruct::alloc() +{ + return new TemplateStruct; +} + //- Template list implementation ---------------------------------------------- @@ -393,9 +430,10 @@ TemplateVariant TemplateStruct::get(const char *name) const class TemplateList::Private { public: - Private() : index(-1) {} + Private() : index(-1), refCount(0) {} QValueList<TemplateVariant> elems; int index; + int refCount; }; @@ -409,6 +447,21 @@ TemplateList::~TemplateList() delete p; } +int TemplateList::addRef() +{ + return ++p->refCount; +} + +int TemplateList::release() +{ + int count = --p->refCount; + if (count<=0) + { + delete this; + } + return count; +} + int TemplateList::count() const { return p->elems.count(); @@ -491,6 +544,11 @@ TemplateVariant TemplateList::at(int index) const } } +TemplateList *TemplateList::alloc() +{ + return new TemplateList; +} + //- Operator types ------------------------------------------------------------ /** @brief Class representing operators that can appear in template expressions */ @@ -503,6 +561,8 @@ class Operator not in ==, !=, <, >, <=, >= + +, - + *, /, % | : , @@ -510,7 +570,9 @@ class Operator enum Type { Or, And, Not, In, Equal, NotEqual, Less, Greater, LessEqual, - GreaterEqual, Filter, Colon, Comma, Last + GreaterEqual, Plus, Minus, Multiply, Divide, Modulo, Filter, Colon, Comma, + LeftParen, RightParen, + Last }; static const char *toString(Type op) @@ -527,9 +589,16 @@ class Operator case Greater: return ">"; case LessEqual: return "<="; case GreaterEqual: return ">="; + case Plus: return "+"; + case Minus: return "-"; + case Multiply: return "*"; + case Divide: return "/"; + case Modulo: return "%"; case Filter: return "|"; case Colon: return ":"; case Comma: return ","; + case LeftParen: return "("; + case RightParen: return ")"; case Last: return "?"; } return "?"; @@ -555,13 +624,21 @@ class TemplateBlockContext QDict< QList<TemplateNodeBlock> > m_blocks; }; +/** @brief A container to store a key-value pair */ +struct TemplateKeyValue +{ + TemplateKeyValue() {} + TemplateKeyValue(const QCString &k,const TemplateVariant &v) : key(k), value(v) {} + QCString key; + TemplateVariant value; +}; /** @brief Internal class representing the implementation of a template * context */ class TemplateContextImpl : public TemplateContext { public: - TemplateContextImpl(); + TemplateContextImpl(const TemplateEngine *e); virtual ~TemplateContextImpl(); // TemplateContext methods @@ -572,33 +649,50 @@ class TemplateContextImpl : public TemplateContext const TemplateVariant *getRef(const QCString &name) const; void setOutputDirectory(const QCString &dir) { m_outputDir = dir; } - void setEscapeIntf(TemplateEscapeIntf *intf) - { m_escapeIntf = intf; } - void setSpacelessIntf(TemplateSpacelessIntf *intf) - { m_spacelessIntf = intf; } + void setEscapeIntf(const QCString &ext,TemplateEscapeIntf *intf) + { + int i=(!ext.isEmpty() && ext.at(0)=='.') ? 1 : 0; + m_escapeIntfDict.insert(ext.mid(i),new TemplateEscapeIntf*(intf)); + } + void selectEscapeIntf(const QCString &ext) + { TemplateEscapeIntf **ppIntf = m_escapeIntfDict.find(ext); + m_activeEscapeIntf = ppIntf ? *ppIntf : 0; + } + void setActiveEscapeIntf(TemplateEscapeIntf *intf) { m_activeEscapeIntf = intf; } + void setSpacelessIntf(TemplateSpacelessIntf *intf) { m_spacelessIntf = intf; } // internal methods TemplateBlockContext *blockContext(); TemplateVariant getPrimary(const QCString &name) const; void setLocation(const QCString &templateName,int line) { m_templateName=templateName; m_line=line; } - QCString templateName() const { return m_templateName; } - int line() const { return m_line; } - QCString outputDirectory() const { return m_outputDir; } - TemplateEscapeIntf *escapeIntf() const { return m_escapeIntf; } + QCString templateName() const { return m_templateName; } + int line() const { return m_line; } + QCString outputDirectory() const { return m_outputDir; } + TemplateEscapeIntf *escapeIntf() const { return m_activeEscapeIntf; } TemplateSpacelessIntf *spacelessIntf() const { return m_spacelessIntf; } - void enableSpaceless(bool b) { m_spacelessEnabled=b; } - bool spacelessEnabled() const { return m_spacelessEnabled && m_spacelessIntf; } + void enableSpaceless(bool b) { m_spacelessEnabled=b; } + bool spacelessEnabled() const { return m_spacelessEnabled && m_spacelessIntf; } + void warn(const char *fileName,int line,const char *fmt,...) const; + + // index related functions + void openSubIndex(const QCString &indexName); + void closeSubIndex(const QCString &indexName); + void addIndexEntry(const QCString &indexName,const QValueList<TemplateKeyValue> &arguments); private: + const TemplateEngine *m_engine; QCString m_templateName; int m_line; QCString m_outputDir; QList< QDict<TemplateVariant> > m_contextStack; TemplateBlockContext m_blockContext; - TemplateEscapeIntf *m_escapeIntf; + QDict<TemplateEscapeIntf*> m_escapeIntfDict; + TemplateEscapeIntf *m_activeEscapeIntf; TemplateSpacelessIntf *m_spacelessIntf; bool m_spacelessEnabled; + TemplateAutoRef<TemplateStruct> m_indices; + QDict< QStack<TemplateVariant> > m_indexStacks; }; //----------------------------------------------------------------------------- @@ -874,7 +968,7 @@ class ExprAstVariable : public ExprAst TemplateVariant v = c->get(m_name); if (!v.isValid()) { - warn(ci->templateName(),ci->line(),"undefined variable '%s' in expression",m_name.data()); + ci->warn(ci->templateName(),ci->line(),"undefined variable '%s' in expression",m_name.data()); } return v; } @@ -887,7 +981,7 @@ class ExprAstFunctionVariable : public ExprAst public: ExprAstFunctionVariable(ExprAst *var,const QList<ExprAst> &args) : m_var(var), m_args(args) - { TRACE(("ExprAstFunctionVariable(%s)\n",var->name().data())); + { TRACE(("ExprAstFunctionVariable()\n")); m_args.setAutoDelete(TRUE); } virtual TemplateVariant resolve(TemplateContext *c) @@ -928,7 +1022,7 @@ class ExprAstFilter : public ExprAst TemplateVariant result = TemplateFilterFactory::instance()->apply(m_name,v,arg,ok); if (!ok) { - warn(ci->templateName(),ci->line(),"unknown filter '%s'",m_name.data()); + ci->warn(ci->templateName(),ci->line(),"unknown filter '%s'",m_name.data()); } return result; } @@ -979,6 +1073,28 @@ class ExprAstNegate : public ExprAst ExprAst *m_expr; }; +class ExprAstUnary : public ExprAst +{ + public: + ExprAstUnary(Operator::Type op,ExprAst *exp) : m_operator(op), m_exp(exp) + { TRACE(("ExprAstUnary %s\n",Operator::toString(op))); } + ~ExprAstUnary() { delete m_exp; } + virtual TemplateVariant resolve(TemplateContext *c) + { + TemplateVariant exp = m_exp->resolve(c); + switch (m_operator) + { + case Operator::Minus: + return -exp.toInt(); + default: + return TemplateVariant(); + } + } + private: + Operator::Type m_operator; + ExprAst *m_exp; +}; + /** @brief Class representing a binary operator in the AST */ class ExprAstBinary : public ExprAst { @@ -989,6 +1105,7 @@ class ExprAstBinary : public ExprAst ~ExprAstBinary() { delete m_lhs; delete m_rhs; } virtual TemplateVariant resolve(TemplateContext *c) { + TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); TemplateVariant lhs = m_lhs->resolve(c); TemplateVariant rhs = m_rhs ? m_rhs->resolve(c) : TemplateVariant(); switch(m_operator) @@ -1037,6 +1154,44 @@ class ExprAstBinary : public ExprAst { return lhs.toInt()>=rhs.toInt(); } + case Operator::Plus: + { + return TemplateVariant(lhs.toInt() + rhs.toInt()); + } + case Operator::Minus: + { + return TemplateVariant(lhs.toInt() - rhs.toInt()); + } + case Operator::Multiply: + { + return TemplateVariant(lhs.toInt() * rhs.toInt()); + } + case Operator::Divide: + { + int denom = rhs.toInt(); + if (denom!=0) + { + return TemplateVariant(lhs.toInt() / denom); + } + else // divide by zero + { + ci->warn(ci->templateName(),ci->line(),"division by zero while evaluating expression is undefined"); + return 0; + } + } + case Operator::Modulo: + { + int denom = rhs.toInt(); + if (denom!=0) + { + return TemplateVariant(lhs.toInt() % denom); + } + else // module zero + { + ci->warn(ci->templateName(),ci->line(),"modulo zero while evaluating expression is undefined"); + return 0; + } + } default: return TemplateVariant(); } @@ -1047,6 +1202,46 @@ class ExprAstBinary : public ExprAst ExprAst *m_rhs; }; +//---------------------------------------------------------- + +/** @brief Base class of all nodes in a template's AST */ +class TemplateNode +{ + public: + TemplateNode(TemplateNode *parent) : m_parent(parent) {} + virtual ~TemplateNode() {} + + virtual void render(FTextStream &ts, TemplateContext *c) = 0; + + TemplateNode *parent() { return m_parent; } + + private: + TemplateNode *m_parent; +}; + +//---------------------------------------------------------- + +/** @brief Parser for templates */ +class TemplateParser +{ + public: + TemplateParser(const TemplateEngine *engine, + const QCString &templateName,QList<TemplateToken> &tokens); + void parse(TemplateNode *parent,int line,const QStrList &stopAt, + QList<TemplateNode> &nodes); + bool hasNextToken() const; + TemplateToken *takeNextToken(); + void removeNextToken(); + void prependToken(const TemplateToken *token); + const TemplateToken *currentToken() const; + QCString templateName() const { return m_templateName; } + void warn(const char *fileName,int line,const char *fmt,...) const; + private: + const TemplateEngine *m_engine; + QCString m_templateName; + QList<TemplateToken> &m_tokens; +}; + //-------------------------------------------------------------------- /** @brief Recursive decent parser for Django style template expressions. @@ -1054,8 +1249,8 @@ class ExprAstBinary : public ExprAst class ExpressionParser { public: - ExpressionParser(const QCString &templateName,int line) - : m_templateName(templateName), m_line(line), m_tokenStream(0) + ExpressionParser(const TemplateParser *parser,int line) + : m_parser(parser), m_line(line), m_tokenStream(0) { } virtual ~ExpressionParser() @@ -1067,23 +1262,7 @@ class ExpressionParser if (expr==0) return 0; m_tokenStream = expr; getNextToken(); - return parseOrExpression(); - } - - ExprAst *parsePrimary(const char *expr) - { - if (expr==0) return 0; - m_tokenStream = expr; - getNextToken(); - return parsePrimaryExpression(); - } - - ExprAst *parseVariable(const char *varExpr) - { - if (varExpr==0) return 0; - m_tokenStream = varExpr; - getNextToken(); - return parseFilteredVariable(); + return parseExpression(); } private: @@ -1106,6 +1285,14 @@ class ExpressionParser Operator::Type op; }; + ExprAst *parseExpression() + { + TRACE(("{parseExpression(%s)\n",m_tokenStream)); + ExprAst *result = parseOrExpression(); + TRACE(("}parseExpression(%s)\n",m_tokenStream)); + return result; + } + ExprAst *parseOrExpression() { TRACE(("{parseOrExpression(%s)\n",m_tokenStream)); @@ -1153,7 +1340,7 @@ class ExpressionParser ExprAst *expr = parseCompareExpression(); if (expr==0) { - warn(m_templateName,m_line,"argument missing for not operator"); + warn(m_parser->templateName(),m_line,"argument missing for not operator"); return 0; } result = new ExprAstNegate(expr); @@ -1169,7 +1356,7 @@ class ExpressionParser ExprAst *parseCompareExpression() { TRACE(("{parseCompareExpression(%s)\n",m_tokenStream)); - ExprAst *lhs = parsePrimaryExpression(); + ExprAst *lhs = parseAdditiveExpression(); if (lhs) { Operator::Type op = m_curToken.op; @@ -1192,6 +1379,74 @@ class ExpressionParser return lhs; } + ExprAst *parseAdditiveExpression() + { + TRACE(("{parseAdditiveExpression(%s)\n",m_tokenStream)); + ExprAst *lhs = parseMultiplicativeExpression(); + if (lhs) + { + while (m_curToken.type==ExprToken::Operator && + (m_curToken.op==Operator::Plus || m_curToken.op==Operator::Minus)) + { + Operator::Type op = m_curToken.op; + getNextToken(); + ExprAst *rhs = parseMultiplicativeExpression(); + lhs = new ExprAstBinary(op,lhs,rhs); + } + } + TRACE(("}parseAdditiveExpression(%s)\n",m_tokenStream)); + return lhs; + } + + ExprAst *parseMultiplicativeExpression() + { + TRACE(("{parseMultiplicativeExpression(%s)\n",m_tokenStream)); + ExprAst *lhs = parseUnaryExpression(); + if (lhs) + { + while (m_curToken.type==ExprToken::Operator && + (m_curToken.op==Operator::Multiply || m_curToken.op==Operator::Divide || m_curToken.op==Operator::Modulo)) + { + Operator::Type op = m_curToken.op; + getNextToken(); + ExprAst *rhs = parseUnaryExpression(); + lhs = new ExprAstBinary(op,lhs,rhs); + } + } + TRACE(("}parseMultiplicativeExpression(%s)\n",m_tokenStream)); + return lhs; + } + + ExprAst *parseUnaryExpression() + { + TRACE(("{parseUnaryExpression(%s)\n",m_tokenStream)); + ExprAst *result=0; + if (m_curToken.type==ExprToken::Operator) + { + if (m_curToken.op==Operator::Plus) + { + getNextToken(); + result = parsePrimaryExpression(); + } + else if (m_curToken.op==Operator::Minus) + { + getNextToken(); + ExprAst *rhs = parsePrimaryExpression(); + result = new ExprAstUnary(m_curToken.op,rhs); + } + else + { + result = parsePrimaryExpression(); + } + } + else + { + result = parsePrimaryExpression(); + } + TRACE(("}parseUnaryExpression(%s)\n",m_tokenStream)); + return result; + } + ExprAst *parsePrimaryExpression() { TRACE(("{parsePrimary(%s)\n",m_tokenStream)); @@ -1207,16 +1462,29 @@ class ExpressionParser case ExprToken::Literal: result = parseLiteral(); break; - default: - if (m_curToken.type==ExprToken::Operator) + case ExprToken::Operator: + if (m_curToken.op==Operator::LeftParen) { - warn(m_templateName,m_line,"unexpected operator '%s' in expression", - Operator::toString(m_curToken.op)); + getNextToken(); // skip over opening bracket + result = parseExpression(); + if (m_curToken.type!=ExprToken::Operator || + m_curToken.op!=Operator::RightParen) + { + warn(m_parser->templateName(),m_line,"missing closing parenthesis"); + } + else + { + getNextToken(); // skip over closing bracket + } } else { - warn(m_templateName,m_line,"unexpected token in expression"); + warn(m_parser->templateName(),m_line,"unexpected operator '%s' in expression", + Operator::toString(m_curToken.op)); } + break; + default: + warn(m_parser->templateName(),m_line,"unexpected token in expression"); } TRACE(("}parsePrimary(%s)\n",m_tokenStream)); return result; @@ -1321,147 +1589,185 @@ class ExpressionParser if (p==0 || *p=='\0') return FALSE; while (*p==' ') p++; // skip over spaces char c=*p; - if (strncmp(p,"not ",4)==0) - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Not; - p+=4; - } - else if (strncmp(p,"and ",4)==0) - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::And; - p+=4; - } - else if (strncmp(p,"or ",3)==0) - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Or; - p+=3; - } - else if (c=='=' && *(p+1)=='=') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Equal; - p+=2; - } - else if (c=='!' && *(p+1)=='=') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::NotEqual; - p+=2; - } - else if (c=='<' && *(p+1)=='=') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::LessEqual; - p+=2; - } - else if (c=='>' && *(p+1)=='=') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::GreaterEqual; - p+=2; - } - else if (c=='<') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Less; - p++; - } - else if (c=='>') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Greater; - p++; - } - else if (c=='|') + const char *q = p; + switch (c) { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Filter; - p++; - } - else if (c==':') - { - m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Colon; - p++; + case '=': + if (c=='=' && *(p+1)=='=') // equal + { + m_curToken.op = Operator::Equal; + p+=2; + } + break; + case '!': + if (c=='!' && *(p+1)=='=') // not equal + { + m_curToken.op = Operator::NotEqual; + p+=2; + } + break; + case '<': + if (c=='<' && *(p+1)=='=') // less or equal + { + m_curToken.op = Operator::LessEqual; + p+=2; + } + else // less + { + m_curToken.op = Operator::Less; + p++; + } + break; + case '>': + if (c=='>' && *(p+1)=='=') // greater or equal + { + m_curToken.op = Operator::GreaterEqual; + p+=2; + } + else // greater + { + m_curToken.op = Operator::Greater; + p++; + } + break; + case '(': + m_curToken.op = Operator::LeftParen; + p++; + break; + case ')': + m_curToken.op = Operator::RightParen; + p++; + break; + case '|': + m_curToken.op = Operator::Filter; + p++; + break; + case '+': + m_curToken.op = Operator::Plus; + p++; + break; + case '-': + m_curToken.op = Operator::Minus; + p++; + break; + case '*': + m_curToken.op = Operator::Multiply; + p++; + break; + case '/': + m_curToken.op = Operator::Divide; + p++; + break; + case '%': + m_curToken.op = Operator::Modulo; + p++; + break; + case ':': + m_curToken.op = Operator::Colon; + p++; + break; + case ',': + m_curToken.op = Operator::Comma; + p++; + break; + case 'n': + if (strncmp(p,"not ",4)==0) + { + m_curToken.op = Operator::Not; + p+=4; + } + break; + case 'a': + if (strncmp(p,"and ",4)==0) + { + m_curToken.op = Operator::And; + p+=4; + } + break; + case 'o': + if (strncmp(p,"or ",3)==0) + { + m_curToken.op = Operator::Or; + p+=3; + } + break; + default: + break; } - else if (c==',') + if (p!=q) // found an operator { m_curToken.type = ExprToken::Operator; - m_curToken.op = Operator::Comma; - p++; - } - else if ((c=='-' && *(p+1)>='0' && *(p+1)<='9') || (c>='0' && c<='9')) - { - m_curToken.type = ExprToken::Number; - const char *np = p; - if (c=='-') np++; - m_curToken.num = 0; - while (*np>='0' && *np<='9') - { - m_curToken.num*=10; - m_curToken.num+=*np-'0'; - np++; - } - if (c=='-') m_curToken.num=-m_curToken.num; - p=np; } - else if (c=='_' || (c>='a' && c<='z') || (c>='A' && c<='Z')) + else // no token found yet { - m_curToken.type = ExprToken::Identifier; - s[0]=c; - m_curToken.id = s; - p++; - while ((c=*p) && - (c=='_' || c=='.' || - (c>='a' && c<='z') || - (c>='A' && c<='Z') || - (c>='0' && c<='9')) - ) - { - s[0]=c; - m_curToken.id+=s; - p++; - } - if (m_curToken.id=="True") // treat true literal as numerical 1 - { - m_curToken.type = ExprToken::Number; - m_curToken.num = 1; - } - else if (m_curToken.id=="False") // treat false literal as numerical 0 + if (c>='0' && c<='9') // number? { m_curToken.type = ExprToken::Number; + const char *np = p; m_curToken.num = 0; + while (*np>='0' && *np<='9') + { + m_curToken.num*=10; + m_curToken.num+=*np-'0'; + np++; + } + p=np; } - } - else if (c=='"' || c=='\'') - { - m_curToken.type = ExprToken::Literal; - m_curToken.id.resize(0); - p++; - char tokenChar = c; - char cp=0; - while ((c=*p) && (c!=tokenChar || (c==tokenChar && cp=='\\'))) + else if (c=='_' || (c>='a' && c<='z') || (c>='A' && c<='Z')) // identifier? { + m_curToken.type = ExprToken::Identifier; s[0]=c; - if (c!='\\' || cp=='\\') // don't add escapes + m_curToken.id = s; + p++; + while ((c=*p) && + (c=='_' || c=='.' || + (c>='a' && c<='z') || + (c>='A' && c<='Z') || + (c>='0' && c<='9')) + ) { + s[0]=c; m_curToken.id+=s; + p++; + } + if (m_curToken.id=="True") // treat true literal as numerical 1 + { + m_curToken.type = ExprToken::Number; + m_curToken.num = 1; + } + else if (m_curToken.id=="False") // treat false literal as numerical 0 + { + m_curToken.type = ExprToken::Number; + m_curToken.num = 0; } - cp=c; + } + else if (c=='"' || c=='\'') // string literal + { + m_curToken.type = ExprToken::Literal; + m_curToken.id.resize(0); p++; + char tokenChar = c; + char cp=0; + while ((c=*p) && (c!=tokenChar || (c==tokenChar && cp=='\\'))) + { + s[0]=c; + if (c!='\\' || cp=='\\') // don't add escapes + { + m_curToken.id+=s; + } + cp=c; + p++; + } + if (*p==tokenChar) p++; } - if (*p==tokenChar) p++; } - else + if (p==q) // still no valid token found -> error { m_curToken.type = ExprToken::Unknown; char s[2]; s[0]=c; s[1]=0; - warn(m_templateName,m_line,"Found unknown token %s while parsing %s",s,m_tokenStream); + warn(m_parser->templateName(),m_line,"Found unknown token %s while parsing %s",s,m_tokenStream); m_curToken.id = s; p++; } @@ -1472,51 +1778,14 @@ class ExpressionParser return TRUE; } + const TemplateParser *m_parser; ExprToken m_curToken; - QCString m_templateName; int m_line; const char *m_tokenStream; }; //---------------------------------------------------------- -/** @brief Base class of all nodes in a template's AST */ -class TemplateNode -{ - public: - TemplateNode(TemplateNode *parent) : m_parent(parent) {} - virtual ~TemplateNode() {} - - virtual void render(FTextStream &ts, TemplateContext *c) = 0; - - TemplateNode *parent() { return m_parent; } - - private: - TemplateNode *m_parent; -}; - -//---------------------------------------------------------- - -/** @brief Parser for templates */ -class TemplateParser -{ - public: - TemplateParser(const QCString &templateName,QList<TemplateToken> &tokens); - void parse(TemplateNode *parent,int line,const QStrList &stopAt, - QList<TemplateNode> &nodes); - bool hasNextToken() const; - TemplateToken *takeNextToken(); - void removeNextToken(); - void prependToken(const TemplateToken *token); - const TemplateToken *currentToken() const; - QCString templateName() const { return m_templateName; } - private: - QCString m_templateName; - QList<TemplateToken> &m_tokens; -}; - -//---------------------------------------------------------- - /** @brief Class representing a lexical token in a template */ class TemplateToken { @@ -1558,28 +1827,30 @@ class TemplateImpl : public TemplateNode, public Template { public: TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data); - ~TemplateImpl() {} void render(FTextStream &ts, TemplateContext *c); TemplateEngine *engine() const { return m_engine; } TemplateBlockContext *blockContext() { return &m_blockContext; } private: + TemplateEngine *m_engine; QCString m_name; TemplateNodeList m_nodes; - TemplateEngine *m_engine; TemplateBlockContext m_blockContext; }; //---------------------------------------------------------- -TemplateContextImpl::TemplateContextImpl() - : m_templateName("<unknown>"), m_line(1), m_escapeIntf(0), - m_spacelessIntf(0), m_spacelessEnabled(FALSE) +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_indexStacks.setAutoDelete(TRUE); m_contextStack.setAutoDelete(TRUE); + m_escapeIntfDict.setAutoDelete(TRUE); push(); + set("index",m_indices.get()); } TemplateContextImpl::~TemplateContextImpl() @@ -1589,12 +1860,12 @@ TemplateContextImpl::~TemplateContextImpl() void TemplateContextImpl::set(const char *name,const TemplateVariant &v) { - TemplateVariant *pv = m_contextStack.first()->find(name); + TemplateVariant *pv = m_contextStack.getFirst()->find(name); if (pv) { - m_contextStack.first()->remove(name); + m_contextStack.getFirst()->remove(name); } - m_contextStack.first()->insert(name,new TemplateVariant(v)); + m_contextStack.getFirst()->insert(name,new TemplateVariant(v)); } TemplateVariant TemplateContextImpl::get(const QCString &name) const @@ -1704,6 +1975,118 @@ TemplateBlockContext *TemplateContextImpl::blockContext() return &m_blockContext; } +void TemplateContextImpl::warn(const char *fileName,int line,const char *fmt,...) const +{ + va_list args; + va_start(args,fmt); + va_warn(fileName,line,fmt,args); + va_end(args); + m_engine->printIncludeContext(fileName,line); +} + +void TemplateContextImpl::openSubIndex(const QCString &indexName) +{ + //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 + { + warn(m_templateName,m_line,"opensubindex for index %s without preceding indexentry",indexName.data()); + return; + } + // get the parent entry to add the list to + TemplateStruct *entry = dynamic_cast<TemplateStruct*>(stack->top()->toStruct()); + if (entry) + { + // add new list to the stack + TemplateList *list = TemplateList::alloc(); + stack->push(new TemplateVariant(list)); + entry->set("children",list); + entry->set("is_leaf_node",false); + } +} + +void TemplateContextImpl::closeSubIndex(const QCString &indexName) +{ + //printf("TemplateContextImpl::closeSubIndex(%s)\n",indexName.data()); + QStack<TemplateVariant> *stack = m_indexStacks.find(indexName); + if (!stack || stack->count()<3) + { + warn(m_templateName,m_line,"closesubindex for index %s without matching open",indexName.data()); + } + else // stack->count()>=2 + { + if (stack->top()->type()==TemplateVariant::Struct) + { + delete stack->pop(); // pop struct + delete stack->pop(); // pop list + } + else // empty list! correct "is_left_node" attribute of the parent entry + { + delete stack->pop(); // pop list + TemplateStruct *entry = dynamic_cast<TemplateStruct*>(stack->top()->toStruct()); + if (entry) + { + entry->set("is_leaf_node",true); + } + } + } +} + +void TemplateContextImpl::addIndexEntry(const QCString &indexName,const QValueList<TemplateKeyValue> &arguments) +{ + QValueListConstIterator<TemplateKeyValue> it = arguments.begin(); + //printf("TemplateContextImpl::addIndexEntry(%s)\n",indexName.data()); + //while (it!=arguments.end()) + //{ + // printf(" key=%s value=%s\n",(*it).key.data(),(*it).value.toString().data()); + // ++it; + //} + QStack<TemplateVariant> *stack = m_indexStacks.find(indexName); + if (!stack) // no stack yet, create it! + { + stack = new QStack<TemplateVariant>; + stack->setAutoDelete(TRUE); + m_indexStacks.insert(indexName,stack); + } + TemplateList *list = 0; + if (stack->isEmpty()) // first item, create empty list and add it to the index + { + list = TemplateList::alloc(); + stack->push(new TemplateVariant(list)); + m_indices->set(indexName,list); // make list available under index + } + else // stack not empty + { + if (stack->top()->type()==TemplateVariant::Struct) // already an entry in the list + { + // remove current entry from the stack + delete stack->pop(); + } + else // first entry after opensubindex + { + ASSERT(stack->top()->type()==TemplateVariant::List); + } + // get list to add new item + list = dynamic_cast<TemplateList*>(stack->top()->toList()); + } + TemplateStruct *entry = TemplateStruct::alloc(); + // add user specified fields to the entry + for (it=arguments.begin();it!=arguments.end();++it) + { + entry->set((*it).key,(*it).value); + } + if (list->count()>0) + { + TemplateStruct *lastEntry = dynamic_cast<TemplateStruct*>(list->at(list->count()-1).toStruct()); + lastEntry->set("last",false); + } + entry->set("is_leaf_node",true); + entry->set("first",list->count()==0); + entry->set("last",true); + stack->push(new TemplateVariant(entry)); + list->append(entry); +} + //---------------------------------------------------------- /** @brief Class representing a piece of plain text in a template */ @@ -1743,8 +2126,12 @@ class TemplateNodeVariable : public TemplateNode : TemplateNode(parent), m_templateName(parser->templateName()), m_line(line) { TRACE(("TemplateNodeVariable(%s)\n",var.data())); - ExpressionParser expParser(m_templateName,line); - m_var = expParser.parseVariable(var); + ExpressionParser expParser(parser,line); + m_var = expParser.parse(var); + if (m_var==0) + { + parser->warn(m_templateName,line,"invalid expression '%s' for variable",var.data()); + } } ~TemplateNodeVariable() { @@ -1755,19 +2142,22 @@ class TemplateNodeVariable : public TemplateNode { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); ci->setLocation(m_templateName,m_line); - TemplateVariant v = m_var->resolve(c); - if (v.type()==TemplateVariant::Function) - { - 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()); - } - else + if (m_var) { - ts << v.toString(); + TemplateVariant v = m_var->resolve(c); + if (v.type()==TemplateVariant::Function) + { + 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()); + } + else + { + ts << v.toString(); + } } } @@ -1818,22 +2208,45 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> TemplateNodeIf(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeIf>(parser,parent,line) { + m_ifGuardedNodes.setAutoDelete(TRUE); TRACE(("{TemplateNodeIf(%s)\n",data.data())); if (data.isEmpty()) { - warn(m_templateName,line,"missing argument for if tag"); + parser->warn(m_templateName,line,"missing argument for if tag"); } QStrList stopAt; stopAt.append("endif"); + stopAt.append("elif"); stopAt.append("else"); - parser->parse(this,line,stopAt,m_trueNodes); + + // if 'nodes' + GuardedNodes *guardedNodes = new GuardedNodes; + ExpressionParser ex(parser,line); + guardedNodes->line = line; + guardedNodes->guardAst = ex.parse(data); + parser->parse(this,line,stopAt,guardedNodes->trueNodes); + m_ifGuardedNodes.append(guardedNodes); TemplateToken *tok = parser->takeNextToken(); - ExpressionParser ex(parser->templateName(),line); - m_guardAst = ex.parse(data); + // elif 'nodes' + while (tok && tok->data.left(5)=="elif ") + { + ExpressionParser ex(parser,line); + guardedNodes = new GuardedNodes; + guardedNodes->line = tok->line; + guardedNodes->guardAst = ex.parse(tok->data.mid(5)); + parser->parse(this,tok->line,stopAt,guardedNodes->trueNodes); + m_ifGuardedNodes.append(guardedNodes); + // proceed to the next token + delete tok; + tok = parser->takeNextToken(); + } + + // else 'nodes' if (tok && tok->data=="else") { - stopAt.removeLast(); + stopAt.removeLast(); // remove "else" + stopAt.removeLast(); // remove "elif" parser->parse(this,line,stopAt,m_falseNodes); parser->removeNextToken(); // skip over endif } @@ -1842,29 +2255,48 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> } ~TemplateNodeIf() { - delete m_guardAst; } void render(FTextStream &ts, TemplateContext *c) { - dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line); + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); //printf("TemplateNodeIf::render #trueNodes=%d #falseNodes=%d\n",m_trueNodes.count(),m_falseNodes.count()); - if (m_guardAst) + bool processed=FALSE; + QListIterator<GuardedNodes> li(m_ifGuardedNodes); + GuardedNodes *nodes; + for (li.toFirst();(nodes=li.current()) && !processed;++li) { - TemplateVariant guardValue = m_guardAst->resolve(c); - if (guardValue.toBool()) // guard is true, render corresponding nodes + if (nodes->guardAst) { - m_trueNodes.render(ts,c); + TemplateVariant guardValue = nodes->guardAst->resolve(c); + if (guardValue.toBool()) // render nodes for the first guard that evaluated to 'true' + { + nodes->trueNodes.render(ts,c); + processed=TRUE; + } } - else // guard is false, render corresponding nodes + else { - m_falseNodes.render(ts,c); + ci->warn(m_templateName,nodes->line,"invalid expression for if/elif"); } } + if (!processed) + { + // all guards are false, render 'else' nodes + m_falseNodes.render(ts,c); + } } private: - ExprAst *m_guardAst; - TemplateNodeList m_trueNodes; + struct GuardedNodes + { + GuardedNodes() : guardAst(0) {} + ~GuardedNodes() { delete guardAst; } + int line; + ExprAst *guardAst; + TemplateNodeList trueNodes; + }; + QList<GuardedNodes> m_ifGuardedNodes; TemplateNodeList m_falseNodes; }; @@ -1877,8 +2309,8 @@ class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat> : TemplateNodeCreator<TemplateNodeRepeat>(parser,parent,line) { TRACE(("{TemplateNodeRepeat(%s)\n",data.data())); - ExpressionParser expParser(parser->templateName(),line); - m_expr = expParser.parseVariable(data); + ExpressionParser expParser(parser,line); + m_expr = expParser.parse(data); QStrList stopAt; stopAt.append("endrepeat"); parser->parse(this,line,stopAt,m_repeatNodes); @@ -1891,28 +2323,29 @@ class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat> } void render(FTextStream &ts, TemplateContext *c) { - dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line); + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); TemplateVariant v; if (m_expr && (v=m_expr->resolve(c)).type()==TemplateVariant::Integer) { int i, n = v.toInt(); for (i=0;i<n;i++) { - TemplateStruct s; - s.set("counter0", (int)i); - s.set("counter", (int)(i+1)); - s.set("revcounter", (int)(n-i)); - s.set("revcounter0", (int)(n-i-1)); - s.set("first",i==0); - s.set("last", i==n-1); - c->set("repeatloop",&s); + TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); + s->set("counter0", (int)i); + s->set("counter", (int)(i+1)); + s->set("revcounter", (int)(n-i)); + s->set("revcounter0", (int)(n-i-1)); + s->set("first",i==0); + s->set("last", i==n-1); + c->set("repeatloop",s.get()); // render all items for this iteration of the loop m_repeatNodes.render(ts,c); } } else // simple type... { - warn(m_templateName,m_line,"for requires a variable of list type!"); + ci->warn(m_templateName,m_line,"for requires a variable of list type!"); } } private: @@ -1922,6 +2355,176 @@ class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat> //---------------------------------------------------------- +/** @brief Class representing a 'range' tag in a template */ +class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> +{ + public: + TemplateNodeRange(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + : TemplateNodeCreator<TemplateNodeRange>(parser,parent,line) + { + TRACE(("{TemplateNodeRange(%s)\n",data.data())); + QCString start,end; + int i1 = data.find(" from "); + int i2 = data.find(" to "); + int i3 = data.find(" downto "); + if (i1==-1) + { + if (data.right(5)==" from") + { + parser->warn(m_templateName,line,"range missing after 'from' keyword"); + } + else if (data=="from") + { + parser->warn(m_templateName,line,"range needs an iterator variable and a range"); + } + else + { + parser->warn(m_templateName,line,"range is missing 'from' keyword"); + } + } + else if (i2==-1 && i3==-1) + { + if (data.right(3)==" to") + { + parser->warn(m_templateName,line,"range is missing end value after 'to' keyword"); + } + else if (data.right(7)==" downto") + { + parser->warn(m_templateName,line,"range is missing end value after 'downto' keyword"); + } + else + { + parser->warn(m_templateName,line,"range is missing 'to' or 'downto' keyword"); + } + } + else + { + m_var = data.left(i1).stripWhiteSpace(); + if (m_var.isEmpty()) + { + parser->warn(m_templateName,line,"range needs an iterator variable"); + } + start = data.mid(i1+6,i2-i1-6).stripWhiteSpace(); + if (i2!=-1) + { + end = data.right(data.length()-i2-4).stripWhiteSpace(); + m_down = FALSE; + } + else if (i3!=-1) + { + end = data.right(data.length()-i3-8).stripWhiteSpace(); + m_down = TRUE; + } + } + ExpressionParser expParser(parser,line); + m_startExpr = expParser.parse(start); + m_endExpr = expParser.parse(end); + + QStrList stopAt; + stopAt.append("endrange"); + parser->parse(this,line,stopAt,m_loopNodes); + parser->removeNextToken(); // skip over endrange + TRACE(("}TemplateNodeRange(%s)\n",data.data())); + } + + ~TemplateNodeRange() + { + delete m_startExpr; + delete m_endExpr; + } + + void render(FTextStream &ts, TemplateContext *c) + { + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); + //printf("TemplateNodeRange::render #loopNodes=%d\n", + // m_loopNodes.count()); + if (m_startExpr && m_endExpr) + { + TemplateVariant vs = m_startExpr->resolve(c); + TemplateVariant ve = m_endExpr->resolve(c); + if (vs.type()==TemplateVariant::Integer && ve.type()==TemplateVariant::Integer) + { + int s = vs.toInt(); + int e = ve.toInt(); + int l = m_down ? s-e+1 : e-s+1; + if (l>0) + { + c->push(); + //int index = m_reversed ? list.count() : 0; + TemplateVariant v; + const TemplateVariant *parentLoop = c->getRef("forloop"); + uint index = 0; + int i = m_down ? e : s; + bool done=false; + while (!done) + { + // set the forloop meta-data variable + TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); + s->set("counter0", (int)index); + s->set("counter", (int)(index+1)); + s->set("revcounter", (int)(l-index)); + s->set("revcounter0", (int)(l-index-1)); + s->set("first",index==0); + s->set("last", (int)index==l-1); + s->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); + c->set("forloop",s.get()); + + // set the iterator variable + c->set(m_var,i); + + // render all items for this iteration of the loop + m_loopNodes.render(ts,c); + + index++; + if (m_down) + { + i--; + done = i<e; + } + else + { + i++; + done = i>e; + } + } + c->pop(); + } + else + { + ci->warn(m_templateName,m_line,"range %d %s %d is empty!", + s,m_down?"downto":"to",e); + } + } + else if (vs.type()!=TemplateVariant::Integer) + { + ci->warn(m_templateName,m_line,"range requires a start value of integer type!"); + } + else if (ve.type()!=TemplateVariant::Integer) + { + ci->warn(m_templateName,m_line,"range requires an end value of integer type!"); + } + } + else if (!m_startExpr) + { + ci->warn(m_templateName,m_line,"range has empty start value"); + } + else if (!m_endExpr) + { + ci->warn(m_templateName,m_line,"range has empty end value"); + } + } + + private: + bool m_down; + ExprAst *m_startExpr; + ExprAst *m_endExpr; + QCString m_var; + TemplateNodeList m_loopNodes; +}; + +//---------------------------------------------------------- + /** @brief Class representing a 'for' tag in a template */ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> { @@ -1936,15 +2539,15 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> { if (data.right(3)==" in") { - warn(m_templateName,line,"for is missing container after 'in' keyword"); + parser->warn(m_templateName,line,"for is missing container after 'in' keyword"); } else if (data=="in") { - warn(m_templateName,line,"for needs at least one iterator variable"); + parser->warn(m_templateName,line,"for needs at least one iterator variable"); } else { - warn(m_templateName,line,"for is missing 'in' keyword"); + parser->warn(m_templateName,line,"for is missing 'in' keyword"); } } else @@ -1952,7 +2555,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> m_vars = split(data.left(i),","); if (m_vars.count()==0) { - warn(m_templateName,line,"for needs at least one iterator variable"); + parser->warn(m_templateName,line,"for needs at least one iterator variable"); } int j = data.find(" reversed",i); @@ -1965,11 +2568,11 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> } if (exprStr.isEmpty()) { - warn(m_templateName,line,"for is missing container after 'in' keyword"); + parser->warn(m_templateName,line,"for is missing container after 'in' keyword"); } } - ExpressionParser expParser(parser->templateName(),line); - m_expr = expParser.parseVariable(exprStr); + ExpressionParser expParser(parser,line); + m_expr = expParser.parse(exprStr); QStrList stopAt; stopAt.append("endfor"); @@ -1993,7 +2596,8 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> void render(FTextStream &ts, TemplateContext *c) { - dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line); + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); //printf("TemplateNodeFor::render #loopNodes=%d #emptyNodes=%d\n", // m_loopNodes.count(),m_emptyNodes.count()); if (m_expr) @@ -2018,15 +2622,15 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> (it->current(v)); m_reversed ? it->toPrev() : it->toNext()) { - TemplateStruct s; - s.set("counter0", (int)index); - s.set("counter", (int)(index+1)); - s.set("revcounter", (int)(listSize-index)); - s.set("revcounter0", (int)(listSize-index-1)); - s.set("first",index==0); - s.set("last", index==listSize-1); - s.set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); - c->set("forloop",&s); + TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); + s->set("counter0", (int)index); + s->set("counter", (int)(index+1)); + s->set("revcounter", (int)(listSize-index)); + s->set("revcounter0", (int)(listSize-index-1)); + s->set("first",index==0); + s->set("last", index==listSize-1); + s->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); + c->set("forloop",s.get()); // add variables for this loop to the context //obj->addVariableToContext(index,m_vars,c); @@ -2058,7 +2662,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> } else // simple type... { - warn(m_templateName,m_line,"for requires a variable of list type!"); + ci->warn(m_templateName,m_line,"for requires a variable of list type!"); } } } @@ -2090,14 +2694,15 @@ class TemplateNodeMsg : public TemplateNodeCreator<TemplateNodeMsg> void render(FTextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); TemplateEscapeIntf *escIntf = ci->escapeIntf(); - ci->setEscapeIntf(0); // avoid escaping things we send to standard out + ci->setActiveEscapeIntf(0); // avoid escaping things we send to standard out bool enable = ci->spacelessEnabled(); ci->enableSpaceless(FALSE); FTextStream ts(stdout); m_nodes.render(ts,c); ts << endl; - ci->setEscapeIntf(escIntf); + ci->setActiveEscapeIntf(escIntf); ci->enableSpaceless(enable); } private: @@ -2118,7 +2723,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> m_blockName = data; if (m_blockName.isEmpty()) { - warn(parser->templateName(),line,"block tag without name"); + parser->warn(parser->templateName(),line,"block tag without name"); } QStrList stopAt; stopAt.append("endblock"); @@ -2152,18 +2757,22 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> m_nodes.render(ss,c); // render parent of nb to string } // add 'block.super' variable to allow access to parent block content - TemplateStruct superBlock; - superBlock.set("super",TemplateVariant(super.data(),TRUE)); - ci->set("block",&superBlock); + TemplateAutoRef<TemplateStruct> superBlock(TemplateStruct::alloc()); + superBlock->set("super",TemplateVariant(super.data(),TRUE)); + ci->set("block",superBlock.get()); // render the overruled block contents + t->engine()->enterBlock(nb->m_templateName,nb->m_blockName,nb->m_line); nb->m_nodes.render(ts,c); + t->engine()->leaveBlock(); ci->pop(); // re-add block to the context ci->blockContext()->push(nb); } else // block has no overrule { + t->engine()->enterBlock(m_templateName,m_blockName,m_line); m_nodes.render(ts,c); + t->engine()->leaveBlock(); } } } @@ -2188,12 +2797,12 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> : TemplateNodeCreator<TemplateNodeExtend>(parser,parent,line) { TRACE(("{TemplateNodeExtend(%s)\n",data.data())); - ExpressionParser ep(m_templateName,line); + ExpressionParser ep(parser,line); if (data.isEmpty()) { - warn(m_templateName,line,"extend tag is missing template file argument"); + parser->warn(m_templateName,line,"extend tag is missing template file argument"); } - m_extendExpr = ep.parsePrimary(data); + m_extendExpr = ep.parse(data); QStrList stopAt; parser->parse(this,line,stopAt,m_nodes); TRACE(("}TemplateNodeExtend(%s)\n",data.data())); @@ -2205,20 +2814,21 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> void render(FTextStream &ts, TemplateContext *c) { - dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line); + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); if (m_extendExpr==0) return; QCString extendFile = m_extendExpr->resolve(c).toString(); if (extendFile.isEmpty()) { - warn(m_templateName,m_line,"invalid parameter for extend command"); + ci->warn(m_templateName,m_line,"invalid parameter for extend command"); } // goto root of tree (template node) TemplateImpl *t = getTemplate(); if (t) { - Template *bt = t->engine()->loadByName(extendFile); + Template *bt = t->engine()->loadByName(extendFile,m_line); TemplateImpl *baseTemplate = bt ? dynamic_cast<TemplateImpl*>(bt) : 0; if (baseTemplate) { @@ -2248,11 +2858,11 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> // clean up bc->clear(); - //delete baseTemplate; + t->engine()->unload(t); } else { - warn(m_templateName,m_line,"failed to load template %s for extend",extendFile.data()); + ci->warn(m_templateName,m_line,"failed to load template %s for extend",extendFile.data()); } } } @@ -2270,12 +2880,12 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> : TemplateNodeCreator<TemplateNodeInclude>(parser,parent,line) { TRACE(("TemplateNodeInclude(%s)\n",data.data())); - ExpressionParser ep(m_templateName,line); + ExpressionParser ep(parser,line); if (data.isEmpty()) { - warn(m_templateName,line,"include tag is missing template file argument"); + parser->warn(m_templateName,line,"include tag is missing template file argument"); } - m_includeExpr = ep.parsePrimary(data); + m_includeExpr = ep.parse(data); } ~TemplateNodeInclude() { @@ -2283,28 +2893,30 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> } void render(FTextStream &ts, TemplateContext *c) { - dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line); + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); if (m_includeExpr) { QCString includeFile = m_includeExpr->resolve(c).toString(); if (includeFile.isEmpty()) { - warn(m_templateName,m_line,"invalid parameter for include command\n"); + ci->warn(m_templateName,m_line,"invalid parameter for include command\n"); } else { TemplateImpl *t = getTemplate(); if (t) { - Template *it = t->engine()->loadByName(includeFile); + Template *it = t->engine()->loadByName(includeFile,m_line); TemplateImpl *incTemplate = it ? dynamic_cast<TemplateImpl*>(it) : 0; if (incTemplate) { incTemplate->render(ts,c); + t->engine()->unload(t); } else { - warn(m_templateName,m_line,"failed to load template '%s' for include",includeFile.data()?includeFile.data():""); + ci->warn(m_templateName,m_line,"failed to load template '%s' for include",includeFile.data()?includeFile.data():""); } } } @@ -2325,32 +2937,32 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> : TemplateNodeCreator<TemplateNodeCreate>(parser,parent,line) { TRACE(("TemplateNodeCreate(%s)\n",data.data())); - ExpressionParser ep(m_templateName,line); + ExpressionParser ep(parser,line); if (data.isEmpty()) { - warn(m_templateName,line,"create tag is missing arguments"); + parser->warn(m_templateName,line,"create tag is missing arguments"); } int i = data.find(" from "); if (i==-1) { if (data.right(3)==" from") { - warn(m_templateName,line,"create is missing template name after 'from' keyword"); + parser->warn(m_templateName,line,"create is missing template name after 'from' keyword"); } else if (data=="from") { - warn(m_templateName,line,"create needs a file name and a template name"); + parser->warn(m_templateName,line,"create needs a file name and a template name"); } else { - warn(m_templateName,line,"create is missing 'from' keyword"); + parser->warn(m_templateName,line,"create is missing 'from' keyword"); } } else { - ExpressionParser ep(m_templateName,line); - m_fileExpr = ep.parsePrimary(data.left(i).stripWhiteSpace()); - m_templateExpr = ep.parsePrimary(data.mid(i+6).stripWhiteSpace()); + ExpressionParser ep(parser,line); + m_fileExpr = ep.parse(data.left(i).stripWhiteSpace()); + m_templateExpr = ep.parse(data.mid(i+6).stripWhiteSpace()); } } ~TemplateNodeCreate() @@ -2368,21 +2980,27 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> QCString outputFile = m_fileExpr->resolve(c).toString(); if (templateFile.isEmpty()) { - warn(m_templateName,m_line,"empty template name parameter for create command\n"); + ci->warn(m_templateName,m_line,"empty template name parameter for create command\n"); } else if (outputFile.isEmpty()) { - warn(m_templateName,m_line,"empty file name parameter for create command\n"); + ci->warn(m_templateName,m_line,"empty file name parameter for create command\n"); } else { TemplateImpl *t = getTemplate(); if (t) { - Template *ct = t->engine()->loadByName(templateFile); + Template *ct = t->engine()->loadByName(templateFile,m_line); TemplateImpl *createTemplate = ct ? dynamic_cast<TemplateImpl*>(ct) : 0; if (createTemplate) { + 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()+"/"); @@ -2390,18 +3008,21 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> QFile f(outputFile); if (f.open(IO_WriteOnly)) { + TemplateEscapeIntf *escIntf = ci->escapeIntf(); + ci->selectEscapeIntf(extension); FTextStream ts(&f); createTemplate->render(ts,c); - //delete createTemplate; + t->engine()->unload(t); + ci->setActiveEscapeIntf(escIntf); } else { - warn(m_templateName,m_line,"failed to open output file '%s' for create command",outputFile.data()); + ci->warn(m_templateName,m_line,"failed to open output file '%s' for create command",outputFile.data()); } } else { - warn(m_templateName,m_line,"failed to load template '%s' for include",templateFile.data()); + ci->warn(m_templateName,m_line,"failed to load template '%s' for include",templateFile.data()); } } } @@ -2431,12 +3052,12 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> : TemplateNodeCreator<TemplateNodeTree>(parser,parent,line) { TRACE(("{TemplateNodeTree(%s)\n",data.data())); - ExpressionParser ep(m_templateName,line); + ExpressionParser ep(parser,line); if (data.isEmpty()) { - warn(m_templateName,line,"recursetree tag is missing data argument"); + parser->warn(m_templateName,line,"recursetree tag is missing data argument"); } - m_treeExpr = ep.parsePrimary(data); + m_treeExpr = ep.parse(data); QStrList stopAt; stopAt.append("endrecursetree"); parser->parse(this,line,stopAt,m_treeNodes); @@ -2508,7 +3129,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> } else { - warn(m_templateName,m_line,"recursetree's argument should be a list type"); + ci->warn(m_templateName,m_line,"recursetree's argument should be a list type"); } } @@ -2519,6 +3140,148 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> //---------------------------------------------------------- +/** @brief Class representing an 'indexentry' tag in a template */ +class TemplateNodeIndexEntry : public TemplateNodeCreator<TemplateNodeIndexEntry> +{ + struct Mapping + { + Mapping(const QCString &n,ExprAst *e) : name(n), value(e) {} + ~Mapping() { delete value; } + QCString name; + ExprAst *value; + }; + public: + TemplateNodeIndexEntry(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + : TemplateNodeCreator<TemplateNodeIndexEntry>(parser,parent,line) + { + TRACE(("{TemplateNodeIndexEntry(%s)\n",data.data())); + m_args.setAutoDelete(TRUE); + ExpressionParser expParser(parser,line); + QValueList<QCString> args = split(data," "); + QValueListIterator<QCString> it = args.begin(); + if (it==args.end() || (*it).find('=')!=-1) + { + parser->warn(parser->templateName(),line,"Missing name for indexentry tag"); + } + else + { + m_name = *it; + ++it; + while (it!=args.end()) + { + QCString arg = *it; + int j=arg.find('='); + if (j>0) + { + ExprAst *expr = expParser.parse(arg.mid(j+1)); + if (expr) + { + m_args.append(new Mapping(arg.left(j),expr)); + } + } + else + { + parser->warn(parser->templateName(),line,"invalid argument '%s' for indexentry tag",arg.data()); + } + ++it; + } + } + TRACE(("}TemplateNodeIndexEntry(%s)\n",data.data())); + } + void render(FTextStream &, TemplateContext *c) + { + if (!m_name.isEmpty()) + { + TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); + QListIterator<Mapping> it(m_args); + Mapping *mapping; + QValueList<TemplateKeyValue> list; + for (it.toFirst();(mapping=it.current());++it) + { + list.append(TemplateKeyValue(mapping->name,mapping->value->resolve(c))); + } + ci->addIndexEntry(m_name,list); + } + } + private: + QCString m_name; + QList<Mapping> m_args; +}; + +//---------------------------------------------------------- + +/** @brief Class representing an 'opensubindex' tag in a template */ +class TemplateNodeOpenSubIndex : public TemplateNodeCreator<TemplateNodeOpenSubIndex> +{ + public: + TemplateNodeOpenSubIndex(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + : TemplateNodeCreator<TemplateNodeOpenSubIndex>(parser,parent,line) + { + TRACE(("{TemplateNodeOpenSubIndex(%s)\n",data.data())); + m_name = data.stripWhiteSpace(); + if (m_name.isEmpty()) + { + parser->warn(parser->templateName(),line,"Missing argument for opensubindex tag"); + } + else if (m_name.find(' ')!=-1) + { + parser->warn(parser->templateName(),line,"Expected single argument for opensubindex tag got '%s'",data.data()); + m_name=""; + } + TRACE(("}TemplateNodeOpenSubIndex(%s)\n",data.data())); + } + void render(FTextStream &, TemplateContext *c) + { + if (!m_name.isEmpty()) + { + TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); + ci->openSubIndex(m_name); + } + } + private: + QCString m_name; +}; + +//---------------------------------------------------------- + +/** @brief Class representing an 'closesubindex' tag in a template */ +class TemplateNodeCloseSubIndex : public TemplateNodeCreator<TemplateNodeCloseSubIndex> +{ + public: + TemplateNodeCloseSubIndex(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + : TemplateNodeCreator<TemplateNodeCloseSubIndex>(parser,parent,line) + { + TRACE(("{TemplateNodeCloseSubIndex(%s)\n",data.data())); + m_name = data.stripWhiteSpace(); + if (m_name.isEmpty()) + { + parser->warn(parser->templateName(),line,"Missing argument for closesubindex tag"); + } + else if (m_name.find(' ')!=-1 || m_name.isEmpty()) + { + parser->warn(parser->templateName(),line,"Expected single argument for closesubindex tag got '%s'",data.data()); + m_name=""; + } + TRACE(("}TemplateNodeCloseSubIndex(%s)\n",data.data())); + } + void render(FTextStream &, TemplateContext *c) + { + if (!m_name.isEmpty()) + { + TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); + ci->closeSubIndex(m_name); + } + } + private: + QCString m_name; +}; + + +//---------------------------------------------------------- + /** @brief Class representing an 'with' tag in a template */ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> { @@ -2535,7 +3298,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> { TRACE(("{TemplateNodeWith(%s)\n",data.data())); m_args.setAutoDelete(TRUE); - ExpressionParser expParser(parser->templateName(),line); + ExpressionParser expParser(parser,line); QValueList<QCString> args = split(data," "); QValueListIterator<QCString> it = args.begin(); while (it!=args.end()) @@ -2544,7 +3307,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> int j=arg.find('='); if (j>0) { - ExprAst *expr = expParser.parsePrimary(arg.mid(j+1)); + ExprAst *expr = expParser.parse(arg.mid(j+1)); if (expr) { m_args.append(new Mapping(arg.left(j),expr)); @@ -2552,7 +3315,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> } else { - warn(parser->templateName(),line,"invalid argument '%s' for with tag",arg.data()); + parser->warn(parser->templateName(),line,"invalid argument '%s' for with tag",arg.data()); } ++it; } @@ -2568,6 +3331,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> void render(FTextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); c->push(); QListIterator<Mapping> it(m_args); Mapping *mapping; @@ -2596,12 +3360,12 @@ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> TRACE(("{TemplateNodeCycle(%s)\n",data.data())); m_args.setAutoDelete(TRUE); m_index=0; - ExpressionParser expParser(parser->templateName(),line); + ExpressionParser expParser(parser,line); QValueList<QCString> args = split(data," "); QValueListIterator<QCString> it = args.begin(); while (it!=args.end()) { - ExprAst *expr = expParser.parsePrimary(*it); + ExprAst *expr = expParser.parse(*it); if (expr) { m_args.append(expr); @@ -2610,13 +3374,14 @@ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> } if (m_args.count()<2) { - warn(parser->templateName(),line,"expected at least two arguments for cycle command, got %d",m_args.count()); + parser->warn(parser->templateName(),line,"expected at least two arguments for cycle command, got %d",m_args.count()); } TRACE(("}TemplateNodeCycle(%s)\n",data.data())); } void render(FTextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); if (m_index<m_args.count()) { TemplateVariant v = m_args.at(m_index)->resolve(c); @@ -2661,7 +3426,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> { TRACE(("{TemplateNodeSet(%s)\n",data.data())); m_args.setAutoDelete(TRUE); - ExpressionParser expParser(parser->templateName(),line); + ExpressionParser expParser(parser,line); QValueList<QCString> args = split(data," "); QValueListIterator<QCString> it = args.begin(); while (it!=args.end()) @@ -2670,7 +3435,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> int j=arg.find('='); if (j>0) { - ExprAst *expr = expParser.parsePrimary(arg.mid(j+1)); + ExprAst *expr = expParser.parse(arg.mid(j+1)); if (expr) { m_args.append(new Mapping(arg.left(j),expr)); @@ -2678,7 +3443,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> } else { - warn(parser->templateName(),line,"invalid argument '%s' for with tag",arg.data()); + parser->warn(parser->templateName(),line,"invalid argument '%s' for with tag",arg.data()); } ++it; } @@ -2687,6 +3452,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> void render(FTextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); QListIterator<Mapping> it(m_args); Mapping *mapping; for (it.toFirst();(mapping=it.current());++it) @@ -2718,6 +3484,7 @@ class TemplateNodeSpaceless : public TemplateNodeCreator<TemplateNodeSpaceless> void render(FTextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + ci->setLocation(m_templateName,m_line); bool wasSpaceless = ci->spacelessEnabled(); ci->enableSpaceless(TRUE); m_nodes.render(ts,c); @@ -2741,14 +3508,14 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> int w = data.find(" with "); if (i==-1 || w==-1 || w<i) { - warn(m_templateName,line,"markers tag as wrong format. Expected: markers <var> in <list> with <string_with_markers>"); + parser->warn(m_templateName,line,"markers tag as wrong format. Expected: markers <var> in <list> with <string_with_markers>"); } else { - ExpressionParser expParser(parser->templateName(),line); + ExpressionParser expParser(parser,line); m_var = data.left(i); - m_listExpr = expParser.parseVariable(data.mid(i+4,w-i-4)); - m_patternExpr = expParser.parseVariable(data.right(data.length()-w-6)); + m_listExpr = expParser.parse(data.mid(i+4,w-i-4)); + m_patternExpr = expParser.parse(data.right(data.length()-w-6)); } QStrList stopAt; stopAt.append("endmarkers"); @@ -2785,9 +3552,9 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> for (it->toFirst(); (it->current(var)) && i<entryIndex; it->toNext(),i++) {} if (ok && i==entryIndex) // found element { - TemplateStruct s; - s.set("id",(int)i); - c->set("markers",&s); + TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); + s->set("id",(int)i); + c->set("markers",s.get()); c->set(m_var,var); // define local variable to hold element of list type bool wasSpaceless = ci->spacelessEnabled(); ci->enableSpaceless(TRUE); @@ -2796,11 +3563,11 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> } else if (!ok) { - warn(m_templateName,m_line,"markers pattern string has invalid markers '%s'",str.data()); + ci->warn(m_templateName,m_line,"markers pattern string has invalid markers '%s'",str.data()); } else if (i<entryIndex) { - warn(m_templateName,m_line,"markers list does not an element for marker position %d",i); + ci->warn(m_templateName,m_line,"markers list does not an element for marker position %d",i); } index=newIndex+matchLen; // set index just after marker } @@ -2809,12 +3576,12 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> } else { - warn(m_templateName,m_line,"markers requires a parameter of string type after 'with'!"); + ci->warn(m_templateName,m_line,"markers requires a parameter of string type after 'with'!"); } } else { - warn(m_templateName,m_line,"markers requires a parameter of list type after 'in'!"); + ci->warn(m_templateName,m_line,"markers requires a parameter of list type after 'in'!"); } } } @@ -2881,12 +3648,16 @@ static TemplateNodeFactory::AutoRegister<TemplateNodeTree> autoRefTree("rec static TemplateNodeFactory::AutoRegister<TemplateNodeWith> autoRefWith("with"); static TemplateNodeFactory::AutoRegister<TemplateNodeBlock> autoRefBlock("block"); static TemplateNodeFactory::AutoRegister<TemplateNodeCycle> autoRefCycle("cycle"); +static TemplateNodeFactory::AutoRegister<TemplateNodeRange> autoRefRange("range"); static TemplateNodeFactory::AutoRegister<TemplateNodeExtend> autoRefExtend("extend"); static TemplateNodeFactory::AutoRegister<TemplateNodeCreate> autoRefCreate("create"); static TemplateNodeFactory::AutoRegister<TemplateNodeRepeat> autoRefRepeat("repeat"); static TemplateNodeFactory::AutoRegister<TemplateNodeInclude> autoRefInclude("include"); static TemplateNodeFactory::AutoRegister<TemplateNodeMarkers> autoRefMarkers("markers"); static TemplateNodeFactory::AutoRegister<TemplateNodeSpaceless> autoRefSpaceless("spaceless"); +static TemplateNodeFactory::AutoRegister<TemplateNodeIndexEntry> autoRefIndexEntry("indexentry"); +static TemplateNodeFactory::AutoRegister<TemplateNodeOpenSubIndex> autoRefOpenSubIndex("opensubindex"); +static TemplateNodeFactory::AutoRegister<TemplateNodeCloseSubIndex> autoRefCloseSubIndex("closesubindex"); //---------------------------------------------------------- @@ -2970,19 +3741,20 @@ void TemplateBlockContext::push(TemplateNodeBlock *block) class TemplateLexer { public: - TemplateLexer(const QCString &fileName,const QCString &data); + TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data); void tokenize(QList<TemplateToken> &tokens); private: void addToken(QList<TemplateToken> &tokens, const char *data,int line,int startPos,int endPos, TemplateToken::Type type); void reset(); + const TemplateEngine *m_engine; QCString m_fileName; QCString m_data; }; -TemplateLexer::TemplateLexer(const QCString &fileName,const QCString &data) : - m_fileName(fileName), m_data(data) +TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data) : + m_engine(engine), m_fileName(fileName), m_data(data) { } @@ -3049,6 +3821,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {%%...%%} block"); + m_engine->printIncludeContext(m_fileName,line); } else if (c=='%') // %} or something else { @@ -3072,6 +3845,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {%%...%%} block"); + m_engine->printIncludeContext(m_fileName,line); } state=StateTag; } @@ -3080,6 +3854,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {#...#} block"); + m_engine->printIncludeContext(m_fileName,line); } else if (c=='#') // #} or something else { @@ -3101,6 +3876,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {#...#} block"); + m_engine->printIncludeContext(m_fileName,line); } state=StateComment; } @@ -3125,6 +3901,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {{...}} block"); + m_engine->printIncludeContext(m_fileName,line); } else if (c=='}') // }} or something else { @@ -3148,6 +3925,7 @@ void TemplateLexer::tokenize(QList<TemplateToken> &tokens) if (c=='\n') { warn(m_fileName,line,"unexpected new line inside {{...}} block"); + m_engine->printIncludeContext(m_fileName,line); } state=StateVariable; } @@ -3192,9 +3970,10 @@ void TemplateLexer::addToken(QList<TemplateToken> &tokens, //---------------------------------------------------------- -TemplateParser::TemplateParser(const QCString &templateName, +TemplateParser::TemplateParser(const TemplateEngine *engine, + const QCString &templateName, QList<TemplateToken> &tokens) : - m_templateName(templateName), m_tokens(tokens) + m_engine(engine), m_templateName(templateName), m_tokens(tokens) { } @@ -3214,10 +3993,10 @@ void TemplateParser::parse( case TemplateToken::Text: nodes.append(new TemplateNodeText(this,parent,tok->line,tok->data)); break; - case TemplateToken::Variable: + case TemplateToken::Variable: // {{ var }} nodes.append(new TemplateNodeVariable(this,parent,tok->line,tok->data)); break; - case TemplateToken::Block: + case TemplateToken::Block: // {% tag %} { QCString command = tok->data; int sep = command.find(' '); @@ -3247,7 +4026,8 @@ void TemplateParser::parse( command=="endblock" || command=="endwith" || command=="endrecursetree" || command=="endspaceless" || command=="endmarkers" || command=="endmsg" || - command=="endrepeat") + command=="endrepeat" || command=="elif" || + command=="endrange") { warn(m_templateName,tok->line,"Found tag '%s' without matching start tag",command.data()); } @@ -3288,7 +4068,7 @@ TemplateToken *TemplateParser::takeNextToken() const TemplateToken *TemplateParser::currentToken() const { - return m_tokens.first(); + return m_tokens.getFirst(); }; void TemplateParser::removeNextToken() @@ -3301,6 +4081,15 @@ void TemplateParser::prependToken(const TemplateToken *token) m_tokens.prepend(token); } +void TemplateParser::warn(const char *fileName,int line,const char *fmt,...) const +{ + va_list args; + va_start(args,fmt); + va_warn(fileName,line,fmt,args); + va_end(args); + m_engine->printIncludeContext(fileName,line); +} + //---------------------------------------------------------- @@ -3311,11 +4100,11 @@ TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const QCS { m_name = name; m_engine = engine; - TemplateLexer lexer(name,data); + TemplateLexer lexer(engine,name,data); QList<TemplateToken> tokens; tokens.setAutoDelete(TRUE); lexer.tokenize(tokens); - TemplateParser parser(name,tokens); + TemplateParser parser(engine,name,tokens); parser.parse(this,1,QStrList(),m_nodes); } @@ -3348,11 +4137,35 @@ void TemplateImpl::render(FTextStream &ts, TemplateContext *c) /** @brief Private data of the template engine */ class TemplateEngine::Private { + class IncludeEntry + { + public: + enum Type { Template, Block }; + IncludeEntry(Type type,const QCString &fileName,const QCString &blockName,int line) + : m_type(type), m_fileName(fileName), m_blockName(blockName), m_line(line) {} + Type type() const { return m_type; } + QCString fileName() const { return m_fileName; } + QCString blockName() const { return m_blockName; } + int line() const { return m_line; } + + private: + Type m_type; + QCString m_fileName; + QCString m_blockName; + int m_line; + }; public: - Private(TemplateEngine *engine) : m_templateCache(17), m_engine(engine) - { m_templateCache.setAutoDelete(TRUE); } - Template *loadByName(const QCString &fileName) const + Private(TemplateEngine *engine) : m_templateCache(17) /*, m_indent(0)*/, m_engine(engine) { + m_templateCache.setAutoDelete(TRUE); + m_includeStack.setAutoDelete(TRUE); + } + Template *loadByName(const QCString &fileName,int line) + { + //for (int i=0;i<m_indent;i++) printf(" "); + //m_indent++; + //printf("loadByName(%s,%d) {\n",fileName.data(),line); + m_includeStack.append(new IncludeEntry(IncludeEntry::Template,fileName,QCString(),line)); Template *templ = m_templateCache.find(fileName); if (templ==0) { @@ -3379,10 +4192,60 @@ class TemplateEngine::Private } return templ; } + void unload(Template * /*t*/) + { + //(void)t; + //m_indent--; + //for (int i=0;i<m_indent;i++) printf(" "); + //printf("}\n"); + m_includeStack.removeLast(); + } + + void enterBlock(const QCString &fileName,const QCString &blockName,int line) + { + //for (int i=0;i<m_indent;i++) printf(" "); + //m_indent++; + //printf("enterBlock(%s,%s,%d) {\n",fileName.data(),blockName.data(),line); + m_includeStack.append(new IncludeEntry(IncludeEntry::Block,fileName,blockName,line)); + } + + void leaveBlock() + { + //m_indent--; + //for (int i=0;i<m_indent;i++) printf(" "); + //printf("}\n"); + m_includeStack.removeLast(); + } + + void printIncludeContext(const char *fileName,int line) const + { + QListIterator<IncludeEntry> li(m_includeStack); + li.toLast(); + IncludeEntry *ie=li.current(); + while ((ie=li.current())) + { + --li; + IncludeEntry *next=li.current(); + if (ie->type()==IncludeEntry::Template) + { + if (next) + { + warn(fileName,line," inside template '%s' included from template '%s' at line %d",ie->fileName().data(),next->fileName().data(),ie->line()); + } + } + else // ie->type()==IncludeEntry::Block + { + warn(fileName,line," included by block '%s' inside template '%s' at line %d",ie->blockName().data(), + ie->fileName().data(),ie->line()); + } + } + } private: - mutable QDict<Template> m_templateCache; + QDict<Template> m_templateCache; + //mutable int m_indent; TemplateEngine *m_engine; + QList<IncludeEntry> m_includeStack; }; TemplateEngine::TemplateEngine() @@ -3397,11 +4260,31 @@ TemplateEngine::~TemplateEngine() TemplateContext *TemplateEngine::createContext() const { - return new TemplateContextImpl; + return new TemplateContextImpl(this); +} + +Template *TemplateEngine::loadByName(const QCString &fileName,int line) +{ + return p->loadByName(fileName,line); +} + +void TemplateEngine::unload(Template *t) +{ + p->unload(t); +} + +void TemplateEngine::enterBlock(const QCString &fileName,const QCString &blockName,int line) +{ + p->enterBlock(fileName,blockName,line); +} + +void TemplateEngine::leaveBlock() +{ + p->leaveBlock(); } -Template *TemplateEngine::loadByName(const QCString &fileName) +void TemplateEngine::printIncludeContext(const char *fileName,int line) const { - return p->loadByName(fileName); + p->printIncludeContext(fileName,line); } diff --git a/src/template.h b/src/template.h index 9e3b106..cb4a96f 100644 --- a/src/template.h +++ b/src/template.h @@ -10,32 +10,32 @@ class TemplateListIntf; class TemplateStructIntf; class TemplateEngine; -/** @defgroup template_api Template API +/** @defgroup template_api Template API * - * This is the API for a - * <a href="https://docs.djangoproject.com/en/1.6/topics/templates/">Django</a> + * This is the API for a + * <a href="https://docs.djangoproject.com/en/1.6/topics/templates/">Django</a> * compatible template system written in C++. - * It is somewhat inspired by Stephen Kelly's + * It is somewhat inspired by Stephen Kelly's * <a href="http://www.gitorious.org/grantlee/pages/Home">Grantlee</a>. * - * A template is simply a text file. - * A template contains \b variables, which get replaced with values when the + * A template is simply a text file. + * A template contains \b variables, which get replaced with values when the * template is evaluated, and \b tags, which control the logic of the template. * * Variables look like this: `{{ variable }}` - * When the template engine encounters a variable, it evaluates that variable and - * replaces it with the result. Variable names consist of any combination of + * When the template engine encounters a variable, it evaluates that variable and + * replaces it with the result. Variable names consist of any combination of * alphanumeric characters and the underscore ("_"). * Use a dot (.) to access attributes of a structured variable. - * + * * One can modify variables for display by using \b filters, for example: * `{{ value|default:"nothing" }}` * - * Tags look like this: `{% tag %}`. Tags are more complex than variables: - * Some create text in the output, some control flow by performing loops or logic, + * Tags look like this: `{% tag %}`. Tags are more complex than variables: + * Some create text in the output, some control flow by performing loops or logic, * and some load external information into the template to be used by later variables. * - * To comment-out part of a line in a template, use the comment syntax: + * To comment-out part of a line in a template, use the comment syntax: * `{# comment text #}`. * * Supported Django tags: @@ -144,17 +144,15 @@ class TemplateVariant /** Constructs a new variant with a string value \a s. */ TemplateVariant(const QCString &s,bool raw=FALSE); - /** Constructs a new variant with a struct value \a s. - * @note. Only a pointer to the struct is stored. The caller - * is responsible to manage the memory for the struct object. + /** Constructs a new variant with a struct value \a s. + * @note. The variant will hold a reference to the object. */ - TemplateVariant(const TemplateStructIntf *s); + TemplateVariant(TemplateStructIntf *s); - /** Constructs a new variant with a list value \a l. - * @note. Only a pointer to the struct is stored. The caller - * is responsible to manage the memory for the list object. + /** Constructs a new variant with a list value \a l. + * @note. The variant will hold a reference to the object. */ - TemplateVariant(const TemplateListIntf *l); + TemplateVariant(TemplateListIntf *l); /** Constructs a new variant which represents a method call * @param[in] delegate Delegate object to invoke when @@ -168,7 +166,7 @@ class TemplateVariant /** Destroys the Variant object */ ~TemplateVariant(); - /** Constructs a copy of the variant, \a v, + /** Constructs a copy of the variant, \a v, * passed as the argument to this constructor. */ TemplateVariant(const TemplateVariant &v); @@ -176,7 +174,7 @@ class TemplateVariant /** Assigns the value of the variant \a v to this variant. */ TemplateVariant &operator=(const TemplateVariant &v); - /** Compares this QVariant with v and returns true if they are equal; + /** Compares this QVariant with v and returns true if they are equal; * otherwise returns false. */ bool operator==(TemplateVariant &other); @@ -190,22 +188,22 @@ class TemplateVariant /** Returns the variant as an integer. */ int toInt() const; - /** Returns the pointer to list referenced by this variant - * or 0 if this variant does not have list type. + /** Returns the pointer to list referenced by this variant + * or 0 if this variant does not have list type. */ - const TemplateListIntf *toList() const; + TemplateListIntf *toList() const; - /** Returns the pointer to struct referenced by this variant - * or 0 if this variant does not have struct type. + /** Returns the pointer to struct referenced by this variant + * or 0 if this variant does not have struct type. */ - const TemplateStructIntf *toStruct() const; + TemplateStructIntf *toStruct() const; /** 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); - /** Sets whether or not the value of the Variant should be + /** 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. */ @@ -223,7 +221,28 @@ class TemplateVariant //------------------------------------------------------------------------ -/** @brief Abstract read-only interface for a context value of type list. +template<class T> class TemplateAutoRef +{ + public: + TemplateAutoRef(T *obj) : m_obj(obj) + { + m_obj->addRef(); + } + ~TemplateAutoRef() + { + m_obj->release(); + } + T &operator*() const { return *m_obj; } + T *operator->() const { return m_obj; } + T *get() const { return m_obj; } + + private: + T *m_obj; +}; + +//------------------------------------------------------------------------ + +/** @brief Abstract read-only interface for a context value of type list. * @note The values of the list are TemplateVariants. */ class TemplateListIntf @@ -245,7 +264,7 @@ class TemplateListIntf virtual void toPrev() = 0; /* Returns TRUE if the iterator points to a valid element * in the list, or FALSE otherwise. - * If TRUE is returned, the value pointed to be the + * If TRUE is returned, the value pointed to be the * iterator is assigned to \a v. */ virtual bool current(TemplateVariant &v) const = 0; @@ -260,30 +279,41 @@ class TemplateListIntf /** Returns the element at index position \a index. */ virtual TemplateVariant at(int index) const = 0; - /** Creates a new iterator for this list. + /** Creates a new iterator for this list. * @note the user should call delete on the returned pointer. */ virtual TemplateListIntf::ConstIterator *createIterator() const = 0; + + /** Increase object's reference count */ + virtual int addRef() = 0; + + /** Decreases object's referenc count, destroy object if 0 */ + virtual int release() = 0; }; /** @brief Default implementation of a context value of type list. */ class TemplateList : public TemplateListIntf { public: - /** Creates a list */ - TemplateList(); - /** Destroys the list */ - ~TemplateList(); - // TemplateListIntf methods virtual int count() const; virtual TemplateVariant at(int index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; - + virtual int addRef(); + virtual int release(); + + /** Creates an instance with ref count set to 0 */ + static TemplateList *alloc(); + /** Appends element \a v to the end of the list */ virtual void append(const TemplateVariant &v); private: + /** Creates a list */ + TemplateList(); + /** Destroys the list */ + ~TemplateList(); + friend class TemplateListConstIterator; class Private; Private *p; @@ -302,6 +332,12 @@ class TemplateStructIntf * @param[in] name The name of the field. */ virtual TemplateVariant get(const char *name) const = 0; + + /** Increase object's reference count */ + virtual int addRef() = 0; + + /** Decreases object's referenc count, destroy object if 0 */ + virtual int release() = 0; }; @@ -309,13 +345,13 @@ class TemplateStructIntf class TemplateStruct : public TemplateStructIntf { public: - /** Creates a struct */ - TemplateStruct(); - /** Destroys the struct */ - virtual ~TemplateStruct(); - // TemplateStructIntf methods virtual TemplateVariant get(const char *name) const; + virtual int addRef(); + virtual int release(); + + /** Creates an instance with ref count set to 0. */ + static TemplateStruct *alloc(); /** Sets the value the field of a struct * @param[in] name The name of the field. @@ -323,7 +359,13 @@ class TemplateStruct : public TemplateStructIntf */ virtual void set(const char *name,const TemplateVariant &v); + private: + /** Creates a struct */ + TemplateStruct(); + /** Destroys the struct */ + virtual ~TemplateStruct(); + class Private; Private *p; }; @@ -350,14 +392,14 @@ class TemplateSpacelessIntf //------------------------------------------------------------------------ -/** @brief Abstract interface for a template context. - * +/** @brief Abstract interface for a template context. + * * A Context consists of a stack of dictionaries. * A dictionary consists of a mapping of string keys onto TemplateVariant values. * A key is searched starting with the dictionary at the top of the stack * and searching downwards until it is found. The stack is used to create * local scopes. - * @note This object must be created by TemplateEngine + * @note This object must be created by TemplateEngine::createContext() */ class TemplateContext { @@ -370,10 +412,10 @@ class TemplateContext /** Pop the current scope from the stack. */ virtual void pop() = 0; - /** Sets a value in the current scope. + /** Sets a value in the current scope. * @param[in] name The name of the value; the key in the dictionary. * @param[in] v The value associated with the key. - * @note When a given key is already present, + * @note When a given key is already present, * its value will be replaced by \a v */ virtual void set(const char *name,const TemplateVariant &v) = 0; @@ -399,7 +441,7 @@ class TemplateContext /** Sets the interface that will be used for escaping the result * of variable expansion before writing it to the output. */ - virtual void setEscapeIntf(TemplateEscapeIntf *intf) = 0; + virtual void setEscapeIntf(const QCString &extension, TemplateEscapeIntf *intf) = 0; /** Sets the interface that will be used inside a spaceless block * to remove any redundant whitespace. @@ -409,8 +451,8 @@ class TemplateContext //------------------------------------------------------------------------ -/** @brief Abstract interface for a template. - * @note Must be created by TemplateEngine +/** @brief Abstract interface for a template. + * @note Must be created and is deleted by the TemplateEngine */ class Template { @@ -418,7 +460,7 @@ class Template /** Destructor */ virtual ~Template() {} - /** Renders a template instance to a stream. + /** Renders a template instance to a stream. * @param[in] ts The text stream to write the results to. * @param[in] c The context containing data that can be used * when instantiating the template. @@ -444,13 +486,25 @@ class TemplateEngine TemplateContext *createContext() const; /** Creates a new template whole contents are in a file. - * @param[in] fileName The name of the file containing the + * @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. */ - Template *loadByName(const QCString &fileName); + Template *loadByName(const QCString &fileName,int fromLine); + + /** Indicates that template \a t is no longer needed. The engine + * may decide to delete it. + */ + void unload(Template *t); + + void printIncludeContext(const char *fileName,int line) const; private: + friend class TemplateNodeBlock; + void enterBlock(const QCString &fileName,const QCString &blockName,int line); + void leaveBlock(); + class Private; Private *p; }; diff --git a/src/textdocvisitor.cpp b/src/textdocvisitor.cpp index 9275846..6f3151f 100644 --- a/src/textdocvisitor.cpp +++ b/src/textdocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -19,115 +19,21 @@ #include <qdir.h> #include "textdocvisitor.h" #include "message.h" +#include "util.h" +#include "htmlentity.h" //------------------------------------------------------------------------- void TextDocVisitor::visit(DocSymbol *s) { - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->html(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "©"; break; - case DocSymbol::Tm: m_t << "&tm;"; break; - case DocSymbol::Reg: m_t << "®"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "‘"; break; - case DocSymbol::Rsquo: m_t << "’"; break; - case DocSymbol::Ldquo: m_t << "“"; break; - case DocSymbol::Rdquo: m_t << "”"; break; - case DocSymbol::Ndash: m_t << "–"; break; - case DocSymbol::Mdash: m_t << "—"; break; - case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; - case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; - case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; - case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; - case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; - case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; - case DocSymbol::Szlig: m_t << "ß"; break; - case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; - case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; - case DocSymbol::Nbsp: m_t << " "; break; - case DocSymbol::Aelig: m_t << "æ"; break; - case DocSymbol::AElig: m_t << "Æ"; break; - case DocSymbol::GrkGamma: m_t << "Γ"; break; - case DocSymbol::GrkDelta: m_t << "Δ"; break; - case DocSymbol::GrkTheta: m_t << "Θ"; break; - case DocSymbol::GrkLambda: m_t << "Λ"; break; - case DocSymbol::GrkXi: m_t << "Ξ"; break; - case DocSymbol::GrkPi: m_t << "Π"; break; - case DocSymbol::GrkSigma: m_t << "Σ"; break; - case DocSymbol::GrkUpsilon: m_t << "Υ"; break; - case DocSymbol::GrkPhi: m_t << "Φ"; break; - case DocSymbol::GrkPsi: m_t << "Ψ"; break; - case DocSymbol::GrkOmega: m_t << "Ω"; break; - case DocSymbol::Grkalpha: m_t << "α"; break; - case DocSymbol::Grkbeta: m_t << "β"; break; - case DocSymbol::Grkgamma: m_t << "γ"; break; - case DocSymbol::Grkdelta: m_t << "δ"; break; - case DocSymbol::Grkepsilon: m_t << "ε"; break; - case DocSymbol::Grkzeta: m_t << "ζ"; break; - case DocSymbol::Grketa: m_t << "η"; break; - case DocSymbol::Grktheta: m_t << "θ"; break; - case DocSymbol::Grkiota: m_t << "ι"; break; - case DocSymbol::Grkkappa: m_t << "κ"; break; - case DocSymbol::Grklambda: m_t << "λ"; break; - case DocSymbol::Grkmu: m_t << "μ"; break; - case DocSymbol::Grknu: m_t << "ν"; break; - case DocSymbol::Grkxi: m_t << "ξ"; break; - case DocSymbol::Grkpi: m_t << "π"; break; - case DocSymbol::Grkrho: m_t << "ρ"; break; - case DocSymbol::Grksigma: m_t << "σ"; break; - case DocSymbol::Grktau: m_t << "τ"; break; - case DocSymbol::Grkupsilon: m_t << "υ"; break; - case DocSymbol::Grkphi: m_t << "φ"; break; - case DocSymbol::Grkchi: m_t << "χ"; break; - case DocSymbol::Grkpsi: m_t << "ψ"; break; - case DocSymbol::Grkomega: m_t << "ω"; break; - case DocSymbol::Grkvarsigma: m_t << "ς"; break; - case DocSymbol::Section: m_t << "§"; break; - case DocSymbol::Degree: m_t << "°"; break; - case DocSymbol::Prime: m_t << "′"; break; - case DocSymbol::DoublePrime: m_t << "″"; break; - case DocSymbol::Infinity: m_t << "∞"; break; - case DocSymbol::EmptySet: m_t << "∅"; break; - case DocSymbol::PlusMinus: m_t << "±"; break; - case DocSymbol::Times: m_t << "×"; break; - case DocSymbol::Minus: m_t << "−"; break; - case DocSymbol::CenterDot: m_t << "⋅"; break; - case DocSymbol::Partial: m_t << "∂"; break; - case DocSymbol::Nabla: m_t << "∇"; break; - case DocSymbol::SquareRoot: m_t << "√"; break; - case DocSymbol::Perpendicular: m_t << "⊥"; break; - case DocSymbol::Sum: m_t << "∑"; break; - case DocSymbol::Integral: m_t << "∫"; break; - case DocSymbol::Product: m_t << "∏"; break; - case DocSymbol::Similar: m_t << "∼"; break; - case DocSymbol::Approx: m_t << "≈"; break; - case DocSymbol::NotEqual: m_t << "≠"; break; - case DocSymbol::Equivalent: m_t << "≡"; break; - case DocSymbol::Proportional: m_t << "∝"; break; - case DocSymbol::LessEqual: m_t << "≤"; break; - case DocSymbol::GreaterEqual: m_t << "≥"; break; - case DocSymbol::LeftArrow: m_t << "←"; break; - case DocSymbol::RightArrow: m_t << "→"; break; - case DocSymbol::SetIn: m_t << "∈"; break; - case DocSymbol::SetNotIn: m_t << "∉"; break; - case DocSymbol::LeftCeil: m_t << "⌈"; break; - case DocSymbol::RightCeil: m_t << "⌉"; break; - case DocSymbol::LeftFloor: m_t << "⌊"; break; - case DocSymbol::RightFloor: m_t << "⌋"; break; - default: - err("unknown symbol found\n"); + m_t << res; + } + else + { + err("text: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h index 9045d21..b17065d 100644 --- a/src/textdocvisitor.h +++ b/src/textdocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/tooltip.cpp b/src/tooltip.cpp index 041aa16..8085bff 100644 --- a/src/tooltip.cpp +++ b/src/tooltip.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/tooltip.h b/src/tooltip.h index b4a4af4..ea8948d 100644 --- a/src/tooltip.h +++ b/src/tooltip.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator.h b/src/translator.h index 49a8135..32eaf09 100644 --- a/src/translator.h +++ b/src/translator.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_am.h b/src/translator_am.h index fd8b1dd..9eaba0e 100644 --- a/src/translator_am.h +++ b/src/translator_am.h @@ -2,7 +2,7 @@ *
*
*
- * Copyright (C) 1997-2013 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
diff --git a/src/translator_ar.h b/src/translator_ar.h index 143170d..5d37b69 100644 --- a/src/translator_ar.h +++ b/src/translator_ar.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_br.h b/src/translator_br.h index f9dba84..b381495 100644 --- a/src/translator_br.h +++ b/src/translator_br.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 1997-2013 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 diff --git a/src/translator_ca.h b/src/translator_ca.h index 1291a8c..5c3e595 100644 --- a/src/translator_ca.h +++ b/src/translator_ca.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_cn.h b/src/translator_cn.h index f8e03c5..fc01ce0 100644 --- a/src/translator_cn.h +++ b/src/translator_cn.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_cz.h b/src/translator_cz.h index 2793519..b83eb92 100644 --- a/src/translator_cz.h +++ b/src/translator_cz.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_de.h b/src/translator_de.h index d13d99c..d936bf1 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_dk.h b/src/translator_dk.h index 16ffae4..74b07f4 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_en.h b/src/translator_en.h index 0535b6b..ca0a151 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -530,7 +530,7 @@ class TranslatorEnglish : public Translator /*! this text is generated when the \\sa command is used. */ virtual QCString trSeeAlso() - { return "See Also"; } + { return "See also"; } /*! this text is generated when the \\param command is used. */ virtual QCString trParameters() diff --git a/src/translator_eo.h b/src/translator_eo.h index 3c5b9a5..e1513cb 100644 --- a/src/translator_eo.h +++ b/src/translator_eo.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_es.h b/src/translator_es.h index d6738e0..ba6e823 100644 --- a/src/translator_es.h +++ b/src/translator_es.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_fa.h b/src/translator_fa.h index bcc0572..7b6f9d7 100644 --- a/src/translator_fa.h +++ b/src/translator_fa.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_fi.h b/src/translator_fi.h index fa42259..eeeb9a5 100644 --- a/src/translator_fi.h +++ b/src/translator_fi.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_fr.h b/src/translator_fr.h index 28468e7..2c548c2 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_gr.h b/src/translator_gr.h index 1523445..fa7a682 100644 --- a/src/translator_gr.h +++ b/src/translator_gr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_hr.h b/src/translator_hr.h index 5c79f61..70dba21 100644 --- a/src/translator_hr.h +++ b/src/translator_hr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_hu.h b/src/translator_hu.h index 157247c..610af8e 100644 --- a/src/translator_hu.h +++ b/src/translator_hu.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_id.h b/src/translator_id.h index 7ecdbe7..5647bc0 100644 --- a/src/translator_id.h +++ b/src/translator_id.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_it.h b/src/translator_it.h index 912f389..59799a3 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_je.h b/src/translator_je.h index 894452a..4dbcb4e 100644 --- a/src/translator_je.h +++ b/src/translator_je.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_jp.h b/src/translator_jp.h index febf353..ae3605a 100644 --- a/src/translator_jp.h +++ b/src/translator_jp.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_ke.h b/src/translator_ke.h index 357465d..56a70b3 100644 --- a/src/translator_ke.h +++ b/src/translator_ke.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_kr.h b/src/translator_kr.h index 348fa10..6919763 100644 --- a/src/translator_kr.h +++ b/src/translator_kr.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_lt.h b/src/translator_lt.h index 9edbe57..000dc6e 100644 --- a/src/translator_lt.h +++ b/src/translator_lt.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_lv.h b/src/translator_lv.h index 054310c..135cd11 100644 --- a/src/translator_lv.h +++ b/src/translator_lv.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2012 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 diff --git a/src/translator_mk.h b/src/translator_mk.h index b753756..510561e 100644 --- a/src/translator_mk.h +++ b/src/translator_mk.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_nl.h b/src/translator_nl.h index 2525b4f..2ffacb6 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_no.h b/src/translator_no.h index 3d20f08..2662e47 100644 --- a/src/translator_no.h +++ b/src/translator_no.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_pl.h b/src/translator_pl.h index d819f66..6f2e14c 100644 --- a/src/translator_pl.h +++ b/src/translator_pl.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_pt.h b/src/translator_pt.h index 8e91181..95a62b0 100644 --- a/src/translator_pt.h +++ b/src/translator_pt.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 1997-2013 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 diff --git a/src/translator_ro.h b/src/translator_ro.h index 9bbadeb..ea0988d 100644 --- a/src/translator_ro.h +++ b/src/translator_ro.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_ru.h b/src/translator_ru.h index 07aa63b..54174d7 100644 --- a/src/translator_ru.h +++ b/src/translator_ru.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -532,7 +532,7 @@ class TranslatorRussian : public Translator * related classes */ virtual QCString trRelatedFunctionDocumentation() - { return "Документация по друзьям класса и функциям, отноносящимся" + { return "Документация по друзьям класса и функциям, относящимся" " к классу"; } ////////////////////////////////////////////////////////////////////////// @@ -1678,7 +1678,7 @@ class TranslatorRussian : public Translator case ClassDef::Union: result+="объединению"; break; case ClassDef::Interface: result+="интерфейсу"; break; case ClassDef::Protocol: result+="протоколу"; break; - case ClassDef::Category: result+="кетегории"; break; + case ClassDef::Category: result+="категории"; break; case ClassDef::Exception: result+="исключению"; break; default: break; } @@ -1954,7 +1954,7 @@ class TranslatorRussian : public Translator { // single is true implies a single file QCString result=(QCString)"Документация для этого сервиса " - "сгенерированна из следующего файл"; + "сгенерирована из следующего файл"; if (single) result+="а:"; else result+="ов:"; return result; } @@ -1963,7 +1963,7 @@ class TranslatorRussian : public Translator { // single is true implies a single file QCString result=(QCString)"Документация по этому одиночке " - "сгенерированна из следующего файл"; + "сгенерирована из следующего файл"; if (single) result+="а:"; else result+="ов:"; return result; } diff --git a/src/translator_sc.h b/src/translator_sc.h index af2d7df..84e8756 100644 --- a/src/translator_sc.h +++ b/src/translator_sc.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_si.h b/src/translator_si.h index 57ca5c4..33bc27a 100644 --- a/src/translator_si.h +++ b/src/translator_si.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_sk.h b/src/translator_sk.h index 8c51147..0fc826b 100644 --- a/src/translator_sk.h +++ b/src/translator_sk.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_sr.h b/src/translator_sr.h index 11ebac2..f58ac13 100644 --- a/src/translator_sr.h +++ b/src/translator_sr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_sv.h b/src/translator_sv.h index 4ef2bc4..f4d0a35 100644 --- a/src/translator_sv.h +++ b/src/translator_sv.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -21,6 +21,7 @@ Svensk översättning av: Samuel Hägglund <sahag96@ite.mh.se> Xet Erixon <xet@xeqt.com> Mikael Hallin <mikaelhallin@yahoo.se> 2003-07-28 +Björn Palmqvist <bjorn@aidium.se> 2014-02-01 ================================================================================== Uppdateringar. 1999/04/29 @@ -69,7 +70,7 @@ Problem! #ifndef TRANSLATOR_SE_H #define TRANSLATOR_SE_H -class TranslatorSwedish : public TranslatorAdapter_1_6_0 +class TranslatorSwedish : public Translator { public: @@ -389,7 +390,7 @@ class TranslatorSwedish : public TranslatorAdapter_1_6_0 { return "Dokumentation över typdefinitioner"; } virtual QCString trEnumerationTypeDocumentation() - { return "Dokumentation över egenuppräknande typer"; } + { return "Dokumentation över egenuppräknande typer"; ; } virtual QCString trFunctionDocumentation() { return "Dokumentation över funktioner"; } @@ -1085,7 +1086,7 @@ class TranslatorSwedish : public TranslatorAdapter_1_6_0 */ virtual QCString trNamespace(bool first_capital, bool singular) { - QCString result((first_capital ? "Namnrymd" : "namnrynd")); + QCString result((first_capital ? "Namnrymd" : "namnrymd")); if (!singular) result+="er"; return result; } @@ -1604,6 +1605,262 @@ class TranslatorSwedish : public TranslatorAdapter_1_6_0 { return "Typbegränsningar"; } + +////////////////////////////////////////////////////////////////////////// +// new since 1.6.0 (mainly for the new search engine) +////////////////////////////////////////////////////////////////////////// + + /*! directory relation for \a name */ + virtual QCString trDirRelation(const char *name) + { + return QCString(name)+" Relation"; + } + + /*! Loading message shown when loading search results */ + virtual QCString trLoading() + { + return "Laddar..."; + } + + /*! Label used for search results in the global namespace */ + virtual QCString trGlobalNamespace() + { + return "Globalnamnrymd"; + } + + /*! Message shown while searching */ + virtual QCString trSearching() + { + return "Söker..."; + } + + /*! Text shown when no search results are found */ + virtual QCString trNoMatches() + { + return "Inga träffar"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.6.3 (missing items for the directory pages) +////////////////////////////////////////////////////////////////////////// + + /*! when clicking a directory dependency label, a page with a + * table is shown. The heading for the first column mentions the + * source file that has a relation to another file. + */ + virtual QCString trFileIn(const char *name) + { + return (QCString)"Fil i "+name; + } + + /*! when clicking a directory dependency label, a page with a + * table is shown. The heading for the second column mentions the + * destination file that is included. + */ + virtual QCString trIncludesFileIn(const char *name) + { + return (QCString)"Inkluderar fil i "+name; + } + + /** Compiles a date string. + * @param year Year in 4 digits + * @param month Month of the year: 1=January + * @param day Day of the Month: 1..31 + * @param dayOfWeek Day of the week: 1=Monday..7=Sunday + * @param hour Hour of the day: 0..23 + * @param minutes Minutes in the hour: 0..59 + * @param seconds Seconds within the minute: 0..59 + * @param includeTime Include time in the result string? + */ + virtual QCString trDateTime(int year,int month,int day,int dayOfWeek, + int hour,int minutes,int seconds, + bool includeTime) + { + static const char *days[] = { "Mån","Tis","Ons","Tor","Fre","Lör","Sön" }; + static const char *months[] = { "Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; + QCString sdate; + sdate.sprintf("%s %d %s %d",days[dayOfWeek-1],day,months[month-1],year); + if (includeTime) + { + QCString stime; + stime.sprintf(" %.2d:%.2d:%.2d",hour,minutes,seconds); + sdate+=stime; + } + return sdate; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.7.5 +////////////////////////////////////////////////////////////////////////// + + /*! Header for the page with bibliographic citations */ + virtual QCString trCiteReferences() + { return "Bibliografiska Referenser"; } + + /*! Text for copyright paragraph */ + virtual QCString trCopyright() + { return "Copyright"; } + + /*! Header for the graph showing the directory dependencies */ + virtual QCString trDirDepGraph(const char *name) + { return QCString("Katalogberoendegraf för ")+name+":"; } + +////////////////////////////////////////////////////////////////////////// +// new since 1.8.0 +////////////////////////////////////////////////////////////////////////// + + /*! Detail level selector shown for hierarchical indices */ + virtual QCString trDetailLevel() + { return "detaljnivå"; } + + /*! Section header for list of template parameters */ + virtual QCString trTemplateParameters() + { return "Mall Parametrar"; } + + /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ + virtual QCString trAndMore(const QCString &number) + { return "och "+number+" mera..."; } + + /*! Used file list for a Java enum */ + virtual QCString trEnumGeneratedFromFiles(bool single) + { QCString result = "Dokumentationen för denna enum var genererad från föjlande fil"; + if (!single) result += "er"; + result+=":"; + return result; + } + + /*! Header of a Java enum page (Java enums are represented as classes). */ + virtual QCString trEnumReference(const char *name) + { return QCString(name)+" Enum Referens"; } + + /*! Used for a section containing inherited members */ + virtual QCString trInheritedFrom(const char *members,const char *what) + { return QCString(members)+" ärvd ifrån "+what; } + + /*! Header of the sections with inherited members specific for the + * base class(es) + */ + virtual QCString trAdditionalInheritedMembers() + { return "Ytterliga Ärvda Medlemmar"; } + +////////////////////////////////////////////////////////////////////////// +// 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 ? "aktivera" : "inaktivera"; + return "klicka för att "+opt+" panel synkronisering"; + } + + /*! 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 "Tillhandahålls av kategori @1."; + } + + /*! 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 "Utökar klass @1."; + } + + /*! 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 "Klassmetoder"; + } + + /*! 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 "Instansmetoder"; + } + + /*! Used as the header of the member functions of an Objective-C class. + */ + virtual QCString trMethodDocumentation() + { + return "Metoddokumentation"; + } + + /*! Used as the title of the design overview picture created for the + * VHDL output. + */ + virtual QCString trDesignOverview() + { + return "Designöversikt"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.8.4 +////////////////////////////////////////////////////////////////////////// + + /** old style UNO IDL services: implemented interfaces */ + virtual QCString trInterfaces() + { return "Exporterade Interface"; } + + /** old style UNO IDL services: inherited services */ + virtual QCString trServices() + { return "Inkuderade Tjänster"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroups() + { return "Konstant Grupper"; } + + /** UNO IDL constant groups */ + virtual QCString trConstantGroupReference(const char *namespaceName) + { + QCString result=namespaceName; + result+=" Konstant Grupp Referens"; + return result; + } + /** UNO IDL service page title */ + virtual QCString trServiceReference(const char *sName) + { + QCString result=(QCString)sName; + result+=" Tjänstereferens"; + return result; + } + /** UNO IDL singleton page title */ + virtual QCString trSingletonReference(const char *sName) + { + QCString result=(QCString)sName; + result+=" Singleton Referens"; + return result; + } + /** UNO IDL service page */ + virtual QCString trServiceGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"Dokumentationen för denna tjänst " + "genererades från följande fil"; + if (single) result+=":"; else result+="er:"; + return result; + } + /** UNO IDL singleton page */ + virtual QCString trSingletonGeneratedFromFiles(bool single) + { + // single is true implies a single file + QCString result=(QCString)"Dokumentationen för denna singleton" + "genererades från följande fil"; + if (single) result+=":"; else result+="er:"; + return result; + } /*---------- For internal use: ----------------------------------------*/ protected: diff --git a/src/translator_tr.h b/src/translator_tr.h index 2dbfcd8..56b4a19 100644 --- a/src/translator_tr.h +++ b/src/translator_tr.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_tw.h b/src/translator_tw.h index 86e0a02..581d7fe 100644 --- a/src/translator_tw.h +++ b/src/translator_tw.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_ua.h b/src/translator_ua.h index 9c89c40..b7ca86a 100644 --- a/src/translator_ua.h +++ b/src/translator_ua.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_vi.h b/src/translator_vi.h index 6657c6b..54c68b8 100644 --- a/src/translator_vi.h +++ b/src/translator_vi.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/translator_za.h b/src/translator_za.h index 184eaa9..f47052e 100644 --- a/src/translator_za.h +++ b/src/translator_za.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/types.h b/src/types.h index 0c269be..688d664 100644 --- a/src/types.h +++ b/src/types.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -210,4 +210,11 @@ enum MemberType MemberType_Service, }; +enum FortranFormat +{ + FortranFormat_Unknown, + FortranFormat_Free, + FortranFormat_Fixed +}; + #endif diff --git a/src/util.cpp b/src/util.cpp index 545cd43..fecf632 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,8 +1,7 @@ /***************************************************************************** - * * * - * Copyright (C) 1997-2013 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 @@ -61,6 +60,7 @@ #include "filename.h" #include "membergroup.h" #include "dirdef.h" +#include "htmlentity.h" #define ENABLE_TRACINGSUPPORT 0 @@ -2143,11 +2143,12 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType,bool showDefVals { QCString result; if (al==0) return result; - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a=ali.current(); result+="("; while (a) { - QCString type1 = useCanonicalType && !a->canType.isEmpty() ? + QCString type1 = useCanonicalType && !a->canType.isEmpty() ? a->canType : a->type; QCString type2; int i=type1.find(")("); // hack to deal with function pointers @@ -2172,8 +2173,9 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType,bool showDefVals { result+="="+a->defval; } - a = al->next(); - if (a) result+=", "; + ++ali; + a = ali.current(); + if (a) result+=", "; } result+=")"; if (al->constSpecifier) result+=" const"; @@ -2188,7 +2190,8 @@ QCString tempArgListToString(ArgumentList *al) QCString result; if (al==0) return result; result="<"; - Argument *a=al->first(); + ArgumentListIterator ali(*al); + Argument *a=ali.current(); while (a) { if (!a->name.isEmpty()) // add template argument name @@ -2216,7 +2219,8 @@ QCString tempArgListToString(ArgumentList *al) result+=a->type; } } - a=al->next(); + ++ali; + a=ali.current(); if (a) result+=", "; } result+=">"; @@ -2486,13 +2490,13 @@ int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) int m=maxInheritanceDepth; if (cd->baseClasses()) { - BaseClassDef *bcdi = cd->baseClasses()->first(); - while (bcdi) + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcdi; + for (;(bcdi=bcli.current());++bcli) { int mc=minClassDistance(bcdi->classDef,bcd,level+1); if (mc<m) m=mc; if (m<0) break; - bcdi = cd->baseClasses()->next(); } } return m; @@ -2516,13 +2520,13 @@ Protection classInheritedProtectionLevel(ClassDef *cd,ClassDef *bcd,Protection p } else if (cd->baseClasses()) { - BaseClassDef *bcdi = cd->baseClasses()->first(); - while (bcdi && prot!=Private) + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcdi; + for (;(bcdi=bcli.current()) && prot!=Private;++bcli) { Protection baseProt = classInheritedProtectionLevel(bcdi->classDef,bcd,bcdi->prot,level+1); if (baseProt==Private) prot=Private; else if (baseProt==Protected) prot=Protected; - bcdi = cd->baseClasses()->next(); } } exit: @@ -4285,10 +4289,10 @@ bool getDefs(const QCString &scName, //printf("found %d members\n",members.count()); if (members.count()!=1 && args && !qstrcmp(args,"()")) { - // no exact match found, but if args="()" an arbitrary + // no exact match found, but if args="()" an arbitrary // member will do - md=mn->last(); - while (md /* && md->isLinkable()*/) + MemberListIterator mni(*mn); + for (mni.toLast();(md=mni.current());--mni) { //printf("Found member `%s'\n",md->name().data()); //printf("member is linkable md->name()=`%s'\n",md->name().data()); @@ -4302,7 +4306,6 @@ bool getDefs(const QCString &scName, { members.append(md); } - md=mn->prev(); } } //printf("found %d candidate members\n",members.count()); @@ -4311,23 +4314,22 @@ bool getDefs(const QCString &scName, if (currentFile) { //printf("multiple results; pick one from file:%s\n", currentFile->name().data()); - md = members.first(); - while (md) + QListIterator<MemberDef> mit(members); + for (mit.toFirst();(md=mit.current());++mit) { if (md->getFileDef() && md->getFileDef()->name() == currentFile->name()) { break; // found match in the current file } - md=members.next(); } if (!md) // member not in the current file { - md=members.last(); + md=members.getLast(); } - } - else + } + else { - md=members.last(); + md=members.getLast(); } } if (md && (md->getEnumScope()==0 || !md->getEnumScope()->isStrong())) @@ -5142,6 +5144,7 @@ bool hasVisibleRoot(BaseClassList *bcl) QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore) { static bool caseSenseNames = Config_getBool("CASE_SENSE_NAMES"); + static bool allowUnicodeNames = Config_getBool("ALLOW_UNICODE_NAMES"); static GrowBuf growBuf; growBuf.clear(); char c; @@ -5177,15 +5180,57 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor default: if (c<0) { - static char map[] = "0123456789ABCDEF"; char ids[5]; - unsigned char id = (unsigned char)c; - ids[0]='_'; - ids[1]='x'; - ids[2]=map[id>>4]; - ids[3]=map[id&0xF]; - ids[4]=0; - growBuf.addStr(ids); + const unsigned char uc = (unsigned char)c; + bool doEscape = TRUE; + if (allowUnicodeNames && uc <= 0xf7) + { + const char* pt = p; + ids[ 0 ] = c; + int l = 0; + if ((uc&0xE0)==0xC0) + { + l=2; // 11xx.xxxx: >=2 byte character + } + if ((uc&0xF0)==0xE0) + { + l=3; // 111x.xxxx: >=3 byte character + } + if ((uc&0xF8)==0xF0) + { + l=4; // 1111.xxxx: >=4 byte character + } + doEscape = l==0; + for (int m=1; m<l && !doEscape; ++m) + { + unsigned char ct = (unsigned char)*pt; + if (ct==0 || (ct&0xC0)!=0x80) // invalid unicode character + { + doEscape=TRUE; + } + else + { + ids[ m ] = *pt++; + } + } + if ( !doEscape ) // got a valid unicode character + { + ids[ l ] = 0; + growBuf.addStr( ids ); + p += l - 1; + } + } + if (doEscape) // not a valid unicode char or escaping needed + { + static char map[] = "0123456789ABCDEF"; + unsigned char id = (unsigned char)c; + ids[0]='_'; + ids[1]='x'; + ids[2]=map[id>>4]; + ids[3]=map[id&0xF]; + ids[4]=0; + growBuf.addStr(ids); + } } else if (caseSenseNames || !isupper(c)) { @@ -5632,146 +5677,8 @@ QCString convertToJSString(const char *s) QCString convertCharEntitiesToUTF8(const QCString &s) { - static QDict<char> entityMap(127); - static bool init=TRUE; QCString result; - static QRegExp entityPat("&[a-zA-Z]+;"); - - if (init) - { - entityMap.insert("copy", "\xC2\xA9"); - entityMap.insert("tm", "\xE2\x84\xA2"); - entityMap.insert("trade", "\xE2\x84\xA2"); - entityMap.insert("reg", "\xC2\xAE"); - entityMap.insert("lsquo", "\xE2\x80\x98"); - entityMap.insert("rsquo", "\xE2\x80\x99"); - entityMap.insert("ldquo", "\xE2\x80\x9C"); - entityMap.insert("rdquo", "\xE2\x80\x9D"); - entityMap.insert("ndash", "\xE2\x80\x93"); - entityMap.insert("mdash", "\xE2\x80\x94"); - entityMap.insert("Auml", "\xC3\x84"); - entityMap.insert("Euml", "\xC3\x8B"); - entityMap.insert("Iuml", "\xC3\x8F"); - entityMap.insert("Ouml", "\xC3\x96"); - entityMap.insert("Uuml", "\xC3\x9C"); - entityMap.insert("Yuml", "\xC5\xB8"); - entityMap.insert("auml", "\xC3\xA4"); - entityMap.insert("euml", "\xC3\xAB"); - entityMap.insert("iuml", "\xC3\xAF"); - entityMap.insert("ouml", "\xC3\xB6"); - entityMap.insert("uuml", "\xC3\xBC"); - entityMap.insert("yuml", "\xC3\xBF"); - entityMap.insert("Aacute", "\xC3\x81"); - entityMap.insert("Eacute", "\xC3\x89"); - entityMap.insert("Iacute", "\xC3\x8D"); - entityMap.insert("Oacute", "\xC3\x93"); - entityMap.insert("Uacute", "\xC3\x9A"); - entityMap.insert("aacute", "\xC3\xA1"); - entityMap.insert("eacute", "\xC3\xA9"); - entityMap.insert("iacute", "\xC3\xAD"); - entityMap.insert("oacute", "\xC3\xB3"); - entityMap.insert("uacute", "\xC3\xBA"); - entityMap.insert("Agrave", "\xC3\x80"); - entityMap.insert("Egrave", "\xC3\x88"); - entityMap.insert("Igrave", "\xC3\x8C"); - entityMap.insert("Ograve", "\xC3\x92"); - entityMap.insert("Ugrave", "\xC3\x99"); - entityMap.insert("agrave", "\xC3\xA0"); - entityMap.insert("egrave", "\xC3\xA8"); - entityMap.insert("igrave", "\xC3\xAC"); - entityMap.insert("ograve", "\xC3\xB2"); - entityMap.insert("ugrave", "\xC3\xB9"); - entityMap.insert("Acirc", "\xC3\x82"); - entityMap.insert("Ecirc", "\xC3\x8A"); - entityMap.insert("Icirc", "\xC3\x8E"); - entityMap.insert("Ocirc", "\xC3\x94"); - entityMap.insert("Ucirc", "\xC3\x9B"); - entityMap.insert("acirc", "\xC3\xA2"); - entityMap.insert("ecirc", "\xC3\xAA"); - entityMap.insert("icirc", "\xC3\xAE"); - entityMap.insert("ocirc", "\xC3\xB4"); - entityMap.insert("ucirc", "\xC3\xBB"); - entityMap.insert("Atilde", "\xC3\x83"); - entityMap.insert("Ntilde", "\xC3\x91"); - entityMap.insert("Otilde", "\xC3\x95"); - entityMap.insert("atilde", "\xC3\xA3"); - entityMap.insert("ntilde", "\xC3\xB1"); - entityMap.insert("otilde", "\xC3\xB5"); - entityMap.insert("szlig", "\xC3\x9F"); - entityMap.insert("Ccedil", "\xC3\x87"); - entityMap.insert("ccedil", "\xC3\xA7"); - entityMap.insert("Aring", "\xC3\x85"); - entityMap.insert("aring", "\xC3\xA5"); - entityMap.insert("nbsp", "\xC2\xA0"); - entityMap.insert("Gamma", "\xCE\x93"); - entityMap.insert("Delta", "\xCE\x94"); - entityMap.insert("Theta", "\xCE\x98"); - entityMap.insert("Lambda", "\xCE\x9B"); - entityMap.insert("Xi", "\xCE\x9E"); - entityMap.insert("Pi", "\xCE\xA0"); - entityMap.insert("Sigma", "\xCE\xA3"); - entityMap.insert("Upsilon", "\xCE\xA5"); - entityMap.insert("Phi", "\xCE\xA6"); - entityMap.insert("Psi", "\xCE\xA8"); - entityMap.insert("Omega", "\xCE\xA9"); - entityMap.insert("alpha", "\xCE\xB1"); - entityMap.insert("beta", "\xCE\xB2"); - entityMap.insert("gamma", "\xCE\xB3"); - entityMap.insert("delta", "\xCE\xB4"); - entityMap.insert("epsilon", "\xCE\xB5"); - entityMap.insert("zeta", "\xCE\xB6"); - entityMap.insert("eta", "\xCE\xB8"); - entityMap.insert("theta", "\xCE\xB8"); - entityMap.insert("iota", "\xCE\xB9"); - entityMap.insert("kappa", "\xCE\xBA"); - entityMap.insert("lambda", "\xCE\xBB"); - entityMap.insert("mu", "\xCE\xBC"); - entityMap.insert("nu", "\xCE\xBD"); - entityMap.insert("xi", "\xCE\xBE"); - entityMap.insert("pi", "\xCF\x80"); - entityMap.insert("rho", "\xCF\x81"); - entityMap.insert("sigma", "\xCF\x83"); - entityMap.insert("tau", "\xCF\x84"); - entityMap.insert("upsilon", "\xCF\x85"); - entityMap.insert("phi", "\xCF\x86"); - entityMap.insert("chi", "\xCF\x87"); - entityMap.insert("psi", "\xCF\x88"); - entityMap.insert("omega", "\xCF\x89"); - entityMap.insert("sigmaf", "\xCF\x82"); - entityMap.insert("sect", "\xC2\xA7"); - entityMap.insert("deg", "\xC2\xB0"); - entityMap.insert("prime", "\xE2\x80\xB2"); - entityMap.insert("Prime", "\xE2\x80\xB2"); - entityMap.insert("infin", "\xE2\x88\x9E"); - entityMap.insert("empty", "\xE2\x88\x85"); - entityMap.insert("plusmn", "\xC2\xB1"); - entityMap.insert("times", "\xC3\x97"); - entityMap.insert("minus", "\xE2\x88\x92"); - entityMap.insert("sdot", "\xE2\x8B\x85"); - entityMap.insert("part", "\xE2\x88\x82"); - entityMap.insert("nabla", "\xE2\x88\x87"); - entityMap.insert("radic", "\xE2\x88\x9A"); - entityMap.insert("perp", "\xE2\x8A\xA5"); - entityMap.insert("sum", "\xE2\x88\x91"); - entityMap.insert("int", "\xE2\x88\xAB"); - entityMap.insert("prod", "\xE2\x88\x8F"); - entityMap.insert("sim", "\xE2\x88\xBC"); - entityMap.insert("asymp", "\xE2\x89\x88"); - entityMap.insert("ne", "\xE2\x89\xA0"); - entityMap.insert("equiv", "\xE2\x89\xA1"); - entityMap.insert("prop", "\xE2\x88\x9D"); - entityMap.insert("le", "\xE2\x89\xA4"); - entityMap.insert("ge", "\xE2\x89\xA5"); - entityMap.insert("larr", "\xE2\x86\x90"); - entityMap.insert("rarr", "\xE2\x86\x92"); - entityMap.insert("isin", "\xE2\x88\x88"); - entityMap.insert("notin", "\xE2\x88\x89"); - entityMap.insert("lceil", "\xE2\x8C\x88"); - entityMap.insert("rceil", "\xE2\x8C\x89"); - entityMap.insert("lfloor", "\xE2\x8C\x8A"); - entityMap.insert("rfloor", "\xE2\x8C\x8B"); - init=FALSE; - } + static QRegExp entityPat("&[a-zA-Z]+[0-9]*;"); if (s.length()==0) return result; static GrowBuf growBuf; @@ -5779,13 +5686,14 @@ QCString convertCharEntitiesToUTF8(const QCString &s) int p,i=0,l; while ((p=entityPat.match(s,i,&l))!=-1) { - if (p>i) + if (p>i) { growBuf.addStr(s.mid(i,p-i)); } - QCString entity = s.mid(p+1,l-2); - char *code = entityMap.find(entity); - if (code) + QCString entity = s.mid(p,l); + DocSymbol::SymType symType = HtmlEntityMapper::instance()->name2sym(entity); + const char *code=0; + if (symType!=DocSymbol::Sym_Unknown && (code=HtmlEntityMapper::instance()->utf8(symType))) { growBuf.addStr(code); } @@ -5829,8 +5737,9 @@ void addMembersToMemberGroup(MemberList *ml, MemberList *fmdl=md->enumFieldList(); if (fmdl!=0) { - MemberDef *fmd=fmdl->first(); - while (fmd) + MemberListIterator fmli(*fmdl); + MemberDef *fmd; + for (fmli.toFirst();(fmd=fmli.current());++fmli) { int groupId=fmd->getMemberGroupId(); if (groupId!=-1) @@ -5861,7 +5770,6 @@ void addMembersToMemberGroup(MemberList *ml, fmd->setMemberGroup(mg); } } - fmd=fmdl->next(); } } } @@ -6059,15 +5967,16 @@ QCString substituteTemplateArgumentsInString( result += name.mid(p,i-p); QCString n = name.mid(i,l); ArgumentListIterator formAli(*formalArgs); + ArgumentListIterator actAli(*actualArgs); Argument *formArg; - Argument *actArg=actualArgs->first(); + Argument *actArg; // if n is a template argument, then we substitute it // for its template instance argument. bool found=FALSE; for (formAli.toFirst(); - (formArg=formAli.current()) && !found; - ++formAli,actArg=actualArgs->next() + (formArg=formAli.current()) && !found && (actArg=actAli.current()); + ++formAli,++actAli ) { if (formArg->type.left(6)=="class " && formArg->name.isEmpty()) @@ -6371,14 +6280,29 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, { file=pd->getOutputFileBase(); } - SectionInfo *si=new SectionInfo( - file,pd->name(),pd->title(),SectionInfo::Page,0,pd->getReference()); - //printf("si->label=`%s' si->definition=%s si->fileName=`%s'\n", - // si->label.data(),si->definition?si->definition->name().data():"<none>", - // si->fileName.data()); - //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); - //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data()); - Doxygen::sectionDict->append(pd->name(),si); + SectionInfo *si = Doxygen::sectionDict->find(pd->name()); + if (si) + { + if (si->lineNr != -1) + { + warn(file,-1,"multiple use of section label '%s', (first occurrence: %s, line %d)",pd->name().data(),si->fileName.data(),si->lineNr); + } + else + { + warn(file,-1,"multiple use of section label '%s', (first occurrence: %s)",pd->name().data(),si->fileName.data()); + } + } + else + { + si=new SectionInfo( + file,-1,pd->name(),pd->title(),SectionInfo::Page,0,pd->getReference()); + //printf("si->label=`%s' si->definition=%s si->fileName=`%s'\n", + // si->label.data(),si->definition?si->definition->name().data():"<none>", + // si->fileName.data()); + //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); + //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data()); + Doxygen::sectionDict->append(pd->name(),si); + } } } return pd; @@ -6481,9 +6405,9 @@ void filterLatexString(FTextStream &t,const char *str, case '^': t << "$^\\wedge$"; break; case '&': t << "\\&"; break; case '*': t << "$\\ast$"; break; - case '_': if (!insideTabbing) t << "\\-"; + case '_': if (!insideTabbing) t << "\\+"; t << "\\_"; - if (!insideTabbing) t << "\\-"; + if (!insideTabbing) t << "\\+"; break; case '{': t << "\\{"; break; case '}': t << "\\}"; break; @@ -6504,14 +6428,9 @@ void filterLatexString(FTextStream &t,const char *str, break; case '-': t << "-\\/"; break; - case '\\': if (*p=='<') - { t << "$<$"; p++; } - else if (*p=='>') - { t << "$>$"; p++; } - else - { t << "\\textbackslash{}"; } + case '\\': t << "\\textbackslash{}"; break; - case '"': { t << "\\char`\\\"{}"; } + case '"': t << "\\char`\\\"{}"; break; default: @@ -6520,7 +6439,7 @@ void filterLatexString(FTextStream &t,const char *str, ((c>='A' && c<='Z' && pc!=' ' && pc!='\0') || (c==':' && pc!=':') || (pc=='.' && isId(c))) ) { - t << "\\-"; + t << "\\+"; } t << (char)c; } @@ -6720,23 +6639,25 @@ static struct Lang2ExtMap } g_lang2extMap[] = { -// language parser parser option - { "idl", "c", SrcLangExt_IDL }, - { "java", "c", SrcLangExt_Java }, - { "javascript", "c", SrcLangExt_JS }, - { "csharp", "c", SrcLangExt_CSharp }, - { "d", "c", SrcLangExt_D }, - { "php", "c", SrcLangExt_PHP }, - { "objective-c", "c", SrcLangExt_ObjC }, - { "c", "c", SrcLangExt_Cpp }, - { "c++", "c", SrcLangExt_Cpp }, - { "python", "python", SrcLangExt_Python }, - { "fortran", "fortran", SrcLangExt_Fortran }, - { "vhdl", "vhdl", SrcLangExt_VHDL }, - { "dbusxml", "dbusxml", SrcLangExt_XML }, - { "tcl", "tcl", SrcLangExt_Tcl }, - { "md", "md", SrcLangExt_Markdown }, - { 0, 0, (SrcLangExt)0 } +// language parser parser option + { "idl", "c", SrcLangExt_IDL }, + { "java", "c", SrcLangExt_Java }, + { "javascript", "c", SrcLangExt_JS }, + { "csharp", "c", SrcLangExt_CSharp }, + { "d", "c", SrcLangExt_D }, + { "php", "c", SrcLangExt_PHP }, + { "objective-c", "c", SrcLangExt_ObjC }, + { "c", "c", SrcLangExt_Cpp }, + { "c++", "c", SrcLangExt_Cpp }, + { "python", "python", SrcLangExt_Python }, + { "fortran", "fortran", SrcLangExt_Fortran }, + { "fortranfree", "fortranfree", SrcLangExt_Fortran }, + { "fortranfixed", "fortranfixed", SrcLangExt_Fortran }, + { "vhdl", "vhdl", SrcLangExt_VHDL }, + { "dbusxml", "dbusxml", SrcLangExt_XML }, + { "tcl", "tcl", SrcLangExt_Tcl }, + { "md", "md", SrcLangExt_Markdown }, + { 0, 0, (SrcLangExt)0 } }; bool updateLanguageMapping(const QCString &extension,const QCString &language) @@ -6919,14 +6840,25 @@ const char *writeUtf8Char(FTextStream &t,const char *s) t << c; if (c<0) // multibyte character { - t << *s++; - if (((uchar)c&0xE0)==0xE0) + if (((uchar)c&0xE0)==0xC0) + { + t << *s++; // 11xx.xxxx: >=2 byte character + } + if (((uchar)c&0xF0)==0xE0) { t << *s++; // 111x.xxxx: >=3 byte character } - if (((uchar)c&0xF0)==0xF0) + if (((uchar)c&0xF8)==0xF0) + { + t << *s++; // 1111.xxxx: >=4 byte character + } + if (((uchar)c&0xFC)==0xF8) { - t << *s++; // 1111.xxxx: 4 byte character + t << *s++; // 1111.1xxx: >=5 byte character + } + if (((uchar)c&0xFE)==0xFC) + { + t << *s++; // 1111.1xxx: 6 byte character } } return s; @@ -6939,14 +6871,25 @@ int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos) char c = utf8Str[startPos]; if (c<0) // multibyte utf-8 character { - bytes++; // 1xxx.xxxx: >=2 byte character - if (((uchar)c&0xE0)==0xE0) + if (((uchar)c&0xE0)==0xC0) + { + bytes++; // 11xx.xxxx: >=2 byte character + } + if (((uchar)c&0xF0)==0xE0) { bytes++; // 111x.xxxx: >=3 byte character } - if (((uchar)c&0xF0)==0xF0) + if (((uchar)c&0xF8)==0xF0) + { + bytes++; // 1111.xxxx: >=4 byte character + } + if (((uchar)c&0xFC)==0xF8) { - bytes++; // 1111.xxxx: 4 byte character + bytes++; // 1111.1xxx: >=5 byte character + } + if (((uchar)c&0xFE)==0xFC) + { + bytes++; // 1111.1xxx: 6 byte character } } else if (c=='&') // skip over character entities @@ -7517,9 +7460,14 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList) { QStrListIterator it(*patList); QCString pattern; + + QCString fn = fi.fileName().data(); + QCString fp = fi.filePath().data(); + QCString afp= fi.absFilePath().data(); + for (it.toFirst();(pattern=it.current());++it) { - if (!pattern.isEmpty() && !found) + if (!pattern.isEmpty()) { int i=pattern.find('='); if (i!=-1) pattern=pattern.left(i); // strip of the extension specific filter name @@ -7529,9 +7477,10 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList) #else // unix QRegExp re(pattern,TRUE,TRUE); // case sensitive match #endif - found = found || re.match(fi.fileName().data())!=-1 || - re.match(fi.filePath().data())!=-1 || - re.match(fi.absFilePath().data())!=-1; + found = re.match(fn)!=-1 || + re.match(fp)!=-1 || + re.match(afp)!=-1; + if (found) break; //printf("Matching `%s' against pattern `%s' found=%d\n", // fi->fileName().data(),pattern.data(),found); } @@ -8025,7 +7974,7 @@ bool namespaceHasVisibleChild(NamespaceDef *nd,bool includeClasses) NamespaceDef *cnd; for (cnli.toFirst();(cnd=cnli.current());++cnli) { - if (cnd->isLinkable() && cnd->localName().find('@')==-1) + if (cnd->isLinkableInProject() && cnd->localName().find('@')==-1) { return TRUE; } @@ -8271,3 +8220,4 @@ void convertProtectionLevel( //printf("convertProtectionLevel(type=%d prot=%d): %d,%d\n", // inListType,inProt,*outListType1,*outListType2); } + @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -26,6 +26,7 @@ #include <ctype.h> #include "types.h" #include "sortdict.h" +#include "docparser.h" //-------------------------------------------------------------------- @@ -95,12 +96,6 @@ class LetterToIndexMap : public SIntDict<T> { public: LetterToIndexMap() { SIntDict<T>::setAutoDelete(TRUE); } - int compareItems(QCollection::Item item1, QCollection::Item item2) - { - T *l1=(T *)item1; - T *l2=(T *)item2; - return (int)l1->letter()-(int)l2->letter(); - } void append(uint letter,typename T::ElementType *elem) { T *l = SIntDict<T>::find((int)letter); @@ -111,6 +106,11 @@ class LetterToIndexMap : public SIntDict<T> } l->append(elem); } + private: + int compareValues(const T *l1, const T *l2) const + { + return (int)l1->letter()-(int)l2->letter(); + } }; //-------------------------------------------------------------------- @@ -414,6 +414,7 @@ QCString externalRef(const QCString &relPath,const QCString &ref,bool href); int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos); const char *writeUtf8Char(FTextStream &t,const char *s); + /** Data associated with a HSV colored image. */ struct ColoredImgDataItem { diff --git a/src/version.h b/src/version.h index 9d523c1..b31fe4f 100644 --- a/src/version.h +++ b/src/version.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/version.py b/src/version.py index c53303d..003cf95 100755 --- a/src/version.py +++ b/src/version.py @@ -9,6 +9,7 @@ # the collected information is written to: `../VERSION` and `../src/version.cpp` # import sys +import os # # set 'default' values # @@ -46,7 +47,7 @@ mnt = mnt.replace('\n','') # close files # f1 = open('../VERSION','w') -f2 = open('../src/version.cpp','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 + '";') diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 94ba3c0..d8586ab 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -436,9 +436,10 @@ static void setParameterList(MemberDef *md) { g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; ArgumentList *al = md->argumentList(); - if (al==0) return; - Argument *a = al->first(); - while (a) + if (al==0) return; + ArgumentListIterator ali(*al); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) { g_parmName = a->name.copy(); g_parmType = a->type.copy(); @@ -449,7 +450,6 @@ static void setParameterList(MemberDef *md) g_parmType.stripPrefix("const "); g_parmType=g_parmType.stripWhiteSpace(); // g_theVarContext.addVariable(g_parmType,g_parmName); - a = al->next(); } } diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index aa0207a..4ff5f9d 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -167,7 +167,8 @@ static void createSVG() QRegExp ep("[\\s]"); QCString vlargs="-Tsvg \""+ov+"\" "+dir ; - if (portable_system("dot",vlargs)!=0) + QCString dotExe = Config_getString("DOT_PATH")+"dot"; + if (portable_system(dotExe,vlargs)!=0) { err("could not create dot file"); } @@ -2221,7 +2222,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, } bool htmlOn = ol.isEnabled(OutputGenerator::Html); - if (htmlOn && /*Config_getBool("HTML_ALIGN_MEMBERS") &&*/ !ltype.isEmpty()) + if (htmlOn && !ltype.isEmpty()) { ol.disable(OutputGenerator::Html); } @@ -2772,7 +2773,6 @@ static void writeUCFLink(const MemberDef* mdef,OutputList &ol) bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) { - FileName *fn=Doxygen::inputNameList->first(); //LayoutNavEntry *cc = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Files); LayoutNavEntry *kk = lne->parent();// find(LayoutNavEntry::Files); @@ -2788,17 +2788,22 @@ bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) kk->addChild(oo); } - while (fn) + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileDef *fd=fn->first(); - if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) { - file = convertNameToFile(fd->name().data(),FALSE,FALSE); - LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); - kk->addChild(ucf); - break; + if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) + { + file = convertNameToFile(fd->name().data(),FALSE,FALSE); + LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); + kk->addChild(ucf); + break; + } } - fn=Doxygen::inputNameList->next(); } return FALSE; } @@ -3880,8 +3885,9 @@ void FlowChart::createSVG() ov+="/flow_design.dot"; QCString vlargs="-Tsvg "+ov+dir ; + QCString dotExe = Config_getString("DOT_PATH")+"dot"; - if (portable_system("dot",vlargs)!=0) + if (portable_system(dotExe,vlargs)!=0) { err("could not create dot file"); } diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 7c78373..45ceb06 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 diff --git a/src/vhdlparser.y b/src/vhdlparser.y index 4e4e675..247ac8a 100644 --- a/src/vhdlparser.y +++ b/src/vhdlparser.y @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -2364,7 +2364,7 @@ static void addConfigureNode(const char* a,const char*b, bool,bool isLeaf,bool i if(!configL.isEmpty()) { - VhdlConfNode* vc=configL.last(); + VhdlConfNode* vc=configL.getLast(); level=vc->level; if (levelCounter==0) pushLabel(forL,ent); diff --git a/src/vhdlscanner.h b/src/vhdlscanner.h index 1d799d0..9b7c292 100644 --- a/src/vhdlscanner.h +++ b/src/vhdlscanner.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l index 716c0c0..a3603c8 100644 --- a/src/vhdlscanner.l +++ b/src/vhdlscanner.l @@ -543,7 +543,7 @@ BR [ \t\n\r] . { /* unknown characters */ } -<*>{BR}*"--!"[^{}\n]*[^\n]*\n/{B}*"--!" { // multi line comment +<*>{B}*"--!"[^{}\n]*[^\n]*\n/{B}*"--!" { // multi line comment if (iDocLine==-1) iDocLine=yyLineNr; QCString qc(vhdlscannerYYtext); int len=qc.contains('\n')+yyLineNr-1; @@ -988,7 +988,7 @@ static bool checkMultiComment(QCString& qcs,int line) qcs.stripPrefix("--!"); while (!pTemp->isEmpty()) { - Entry *e=(Entry*)pTemp->first(); + Entry *e=(Entry*)pTemp->getFirst(); e->briefLine=line; e->brief+=qcs; iDocLine=-1; diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 8df1acf..f74a6a2 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 @@ -30,6 +30,7 @@ #include "parserintf.h" #include "filename.h" #include "config.h" +#include "htmlentity.h" XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) @@ -70,110 +71,14 @@ void XmlDocVisitor::visit(DocWhiteSpace *w) void XmlDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->xml(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "<copy/>"; break; - case DocSymbol::Tm: m_t << "<trademark/>"; break; - case DocSymbol::Reg: m_t << "<registered/>"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "<lsquo/>"; break; - case DocSymbol::Rsquo: m_t << "<rsquo/>"; break; - case DocSymbol::Ldquo: m_t << "<ldquo/>"; break; - case DocSymbol::Rdquo: m_t << "<rdquo/>"; break; - case DocSymbol::Ndash: m_t << "<ndash/>"; break; - case DocSymbol::Mdash: m_t << "<mdash/>"; break; - case DocSymbol::Uml: m_t << "<umlaut char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Acute: m_t << "<acute char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Grave: m_t << "<grave char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Circ: m_t << "<circ char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Tilde: m_t << "<tilde char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Szlig: m_t << "<szlig/>"; break; - case DocSymbol::Cedil: m_t << "<cedil char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Ring: m_t << "<ring char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Slash: m_t << "<slash char=\"" << s->letter() << "\"/>"; break; - case DocSymbol::Nbsp: m_t << "<nonbreakablespace/>"; break; - case DocSymbol::Aelig: m_t << "<aelig/>"; break; - case DocSymbol::AElig: m_t << "<AElig/>"; break; - case DocSymbol::GrkGamma: m_t << "<Gamma/>"; break; - case DocSymbol::GrkDelta: m_t << "<Delta/>"; break; - case DocSymbol::GrkTheta: m_t << "<Theta/>"; break; - case DocSymbol::GrkLambda: m_t << "<Lambda/>"; break; - case DocSymbol::GrkXi: m_t << "<Xi/>"; break; - case DocSymbol::GrkPi: m_t << "<Pi/>"; break; - case DocSymbol::GrkSigma: m_t << "<Sigma/>"; break; - case DocSymbol::GrkUpsilon: m_t << "<Upsilon/>"; break; - case DocSymbol::GrkPhi: m_t << "<Phi/>"; break; - case DocSymbol::GrkPsi: m_t << "<Psi/>"; break; - case DocSymbol::GrkOmega: m_t << "<Omega/>"; break; - case DocSymbol::Grkalpha: m_t << "<alpha/>"; break; - case DocSymbol::Grkbeta: m_t << "<beta/>"; break; - case DocSymbol::Grkgamma: m_t << "<gamma/>"; break; - case DocSymbol::Grkdelta: m_t << "<delta/>"; break; - case DocSymbol::Grkepsilon: m_t << "<epsilon/>"; break; - case DocSymbol::Grkzeta: m_t << "<zeta/>"; break; - case DocSymbol::Grketa: m_t << "<eta/>"; break; - case DocSymbol::Grktheta: m_t << "<theta/>"; break; - case DocSymbol::Grkiota: m_t << "<iota/>"; break; - case DocSymbol::Grkkappa: m_t << "<kappa/>"; break; - case DocSymbol::Grklambda: m_t << "<lambda/>"; break; - case DocSymbol::Grkmu: m_t << "<mu/>"; break; - case DocSymbol::Grknu: m_t << "<nu/>"; break; - case DocSymbol::Grkxi: m_t << "<xi/>"; break; - case DocSymbol::Grkpi: m_t << "<pi/>"; break; - case DocSymbol::Grkrho: m_t << "<rho/>"; break; - case DocSymbol::Grksigma: m_t << "<sigma/>"; break; - case DocSymbol::Grktau: m_t << "<tau/>"; break; - case DocSymbol::Grkupsilon: m_t << "<upsilon/>"; break; - case DocSymbol::Grkphi: m_t << "<phi/>"; break; - case DocSymbol::Grkchi: m_t << "<chi/>"; break; - case DocSymbol::Grkpsi: m_t << "<psi/>"; break; - case DocSymbol::Grkomega: m_t << "<omega/>"; break; - case DocSymbol::Grkvarsigma: m_t << "<sigmaf/>"; break; - case DocSymbol::Section: m_t << "<sect/>"; break; - case DocSymbol::Degree: m_t << "<deg/>"; break; - case DocSymbol::Prime: m_t << "<prime/>"; break; - case DocSymbol::DoublePrime: m_t << "<Prime/>"; break; - case DocSymbol::Infinity: m_t << "<infin/>"; break; - case DocSymbol::EmptySet: m_t << "<empty/>"; break; - case DocSymbol::PlusMinus: m_t << "<plusmn/>"; break; - case DocSymbol::Times: m_t << "<times/>"; break; - case DocSymbol::Minus: m_t << "<minus/>"; break; - case DocSymbol::CenterDot: m_t << "<sdot/>"; break; - case DocSymbol::Partial: m_t << "<part/>"; break; - case DocSymbol::Nabla: m_t << "<nabla/>"; break; - case DocSymbol::SquareRoot: m_t << "<radic/>"; break; - case DocSymbol::Perpendicular: m_t << "<perp/>"; break; - case DocSymbol::Sum: m_t << "<sum/>"; break; - case DocSymbol::Integral: m_t << "<int/>"; break; - case DocSymbol::Product: m_t << "<prod/>"; break; - case DocSymbol::Similar: m_t << "<sim/>"; break; - case DocSymbol::Approx: m_t << "<asymp/>"; break; - case DocSymbol::NotEqual: m_t << "<ne/>"; break; - case DocSymbol::Equivalent: m_t << "<equiv/>"; break; - case DocSymbol::Proportional: m_t << "<prop/>"; break; - case DocSymbol::LessEqual: m_t << "<le/>"; break; - case DocSymbol::GreaterEqual: m_t << "<ge/>"; break; - case DocSymbol::LeftArrow: m_t << "<larr/>"; break; - case DocSymbol::RightArrow: m_t << "<rarr/>"; break; - case DocSymbol::SetIn: m_t << "<isin/>"; break; - case DocSymbol::SetNotIn: m_t << "<notin/>"; break; - case DocSymbol::LeftCeil: m_t << "<lceil/>"; break; - case DocSymbol::RightCeil: m_t << "<rceil/>"; break; - case DocSymbol::LeftFloor: m_t << "<lfloor/>"; break; - case DocSymbol::RightFloor: m_t << "<rfloor/>"; break; - default: - err("unknown symbol found\n"); + m_t << res; + } + else + { + err("XML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } @@ -350,6 +255,11 @@ void XmlDocVisitor::visit(DocInclude *inc) filter(inc->text()); m_t << "</htmlonly>"; break; + case DocInclude::LatexInclude: + m_t << "<latexonly>"; + filter(inc->text()); + m_t << "</latexonly>"; + break; case DocInclude::VerbInclude: m_t << "<verbatim>"; filter(inc->text()); @@ -427,9 +337,13 @@ void XmlDocVisitor::visit(DocIndexEntry *ie) "</indexentry>"; } -void XmlDocVisitor::visit(DocSimpleSectSep *) +void XmlDocVisitor::visit(DocSimpleSectSep *sep) { - m_t << "<simplesectsep/>"; + if (sep->parent() && sep->parent()->kind()==DocNode::Kind_SimpleSect) + { + visitPost((DocSimpleSect*)sep->parent()); // end current section + visitPre((DocSimpleSect*)sep->parent()); // start new section + } } void XmlDocVisitor::visit(DocCite *cite) diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 6dc189c..3e2236c 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 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 diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 570901f..efddcd4 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright (C) 1997-2013 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 @@ -45,6 +45,7 @@ #include "membergroup.h" #include "dirdef.h" #include "section.h" +#include "htmlentity.h" // no debug info #define XML_DB(x) do {} while(0) @@ -1844,7 +1845,7 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) SectionInfo *si = Doxygen::sectionDict->find(pd->name()); if (si) { - t << " <title>" << convertToXML(convertCharEntitiesToUTF8(si->title)) + t << " <title>" << convertToXML(convertCharEntitiesToUTF8(filterTitle(si->title))) << "</title>" << endl; } } @@ -1897,7 +1898,32 @@ void generateXML() err("Cannot open file %s for writing!\n",fileName.data()); return; } - f.writeBlock(compound_xsd,qstrlen(compound_xsd)); + + // write compound.xsd, but replace special marker with the entities + const char *startLine = compound_xsd; + while (*startLine) + { + // find end of the line + const char *endLine = startLine+1; + while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n + int len=endLine-startLine; + if (len>0) + { + QCString s(len+1); + qstrncpy(s.data(),startLine,len); + s[len]='\0'; + if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) + { + FTextStream t(&f); + HtmlEntityMapper::instance()->writeXMLSchema(t); + } + else + { + f.writeBlock(startLine,len); + } + } + startLine=endLine; + } f.close(); fileName=outputDirectory+"/index.xml"; diff --git a/src/xmlgen.h b/src/xmlgen.h index b89b10f..9c9ae17 100644 --- a/src/xmlgen.h +++ b/src/xmlgen.h @@ -2,7 +2,7 @@ * * * - * Copyright (C) 1997-2013 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 |