diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 4 | ||||
-rw-r--r-- | src/commentcnv.l | 36 | ||||
-rwxr-xr-x | src/configgen.py | 67 | ||||
-rw-r--r-- | src/context.cpp | 468 | ||||
-rw-r--r-- | src/context.h | 38 | ||||
-rw-r--r-- | src/dirdef.cpp | 8 | ||||
-rw-r--r-- | src/docparser.cpp | 1 | ||||
-rw-r--r-- | src/doxygen.cpp | 28 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 7 | ||||
-rw-r--r-- | src/htmlgen.cpp | 4 | ||||
-rw-r--r-- | src/index.cpp | 42 | ||||
-rw-r--r-- | src/memberdef.cpp | 15 | ||||
-rw-r--r-- | src/memberdef.h | 2 | ||||
-rw-r--r-- | src/pre.l | 50 | ||||
-rw-r--r-- | src/pycode.l | 2 | ||||
-rw-r--r-- | src/pyscanner.l | 34 | ||||
-rw-r--r-- | src/qcstring.h | 13 | ||||
-rw-r--r-- | src/scanner.l | 2 | ||||
-rw-r--r-- | src/searchindex.cpp | 1 | ||||
-rwxr-xr-x | src/template.cpp | 76 | ||||
-rw-r--r-- | src/template.h | 12 |
21 files changed, 756 insertions, 154 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 9f2fe12..c3a3160 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -2893,7 +2893,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const first = false; } ol.writeString(" <tr"); - if ((idx&1)==0) ol.writeString(" class=\"even\""); + if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\""); idx++; ol.writeString("><td class=\"entry\">"); if (cd->isObjectiveC()) @@ -2951,7 +2951,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const first = false; } ol.writeString(" <tr bgcolor=\"#f0f0f0\""); - if ((idx&1)==0) ol.writeString(" class=\"even\""); + if ((idx&1)==0) ol.writeString(" class=\"even\""); else ol.writeString(" class=\"odd\""); idx++; ol.writeString("><td class=\"entry\">"); if (cd->isObjectiveC()) diff --git a/src/commentcnv.l b/src/commentcnv.l index d331fa4..aaf1162 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -134,6 +134,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z %x SkipChar %x SComment %x CComment +%x CNComment %x Verbatim %x VerbatimCode %x ReadLine @@ -346,7 +347,10 @@ SLASHopt [/]* yyextra->nestingCount=1; clearCommentStack(yyscanner); /* to be on the save side */ copyToOutput(yyscanner,yytext,(int)yyleng); - BEGIN(CComment); + if (yyextra->specialComment) + BEGIN(CComment); + else + BEGIN(CNComment); yyextra->commentStack.push(yyextra->lineNr); } <Scan>"#"("#")? { @@ -402,8 +406,8 @@ SLASHopt [/]* yyextra->commentStack.push(yyextra->lineNr); } } -<CComment,ReadLine>{MAILADR} | -<CComment,ReadLine>"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block +<CComment,CNComment,ReadLine>{MAILADR} | +<CComment,CNComment,ReadLine>"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block copyToOutput(yyscanner,yytext,(int)yyleng); } <CComment>"{@code"/[ \t\n] { @@ -618,10 +622,10 @@ SLASHopt [/]* copyToOutput(yyscanner,yytext,(int)yyleng); } -<CComment>[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ +<CComment,CNComment>[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } -<CComment>"*"+[^*\/\\@\n{\"]* { /* stars without slashes */ +<CComment,CNComment>"*"+[^*\/\\@\n{\"]* { /* stars without slashes */ copyToOutput(yyscanner,yytext,(int)yyleng); } <CComment>"\"\"\"" { /* end of Python docstring */ @@ -637,7 +641,7 @@ SLASHopt [/]* BEGIN(Scan); } } -<CComment>\n { /* new line in comment */ +<CComment,CNComment>\n { /* new line in comment */ copyToOutput(yyscanner,yytext,(int)yyleng); /* in case of Fortran always end of comment */ if (yyextra->lang==SrcLangExt_Fortran) @@ -645,7 +649,7 @@ SLASHopt [/]* BEGIN(Scan); } } -<CComment>"/"+"*" { /* nested C comment */ +<CComment,CNComment>"/"+"*" { /* nested C comment */ if (yyextra->lang==SrcLangExt_Python || yyextra->lang==SrcLangExt_Markdown) { @@ -655,7 +659,7 @@ SLASHopt [/]* yyextra->commentStack.push(yyextra->lineNr); copyToOutput(yyscanner,yytext,(int)yyleng); } -<CComment>"*"+"/" { /* end of C comment */ +<CComment,CNComment>"*"+"/" { /* end of C comment */ if (yyextra->lang==SrcLangExt_Python || yyextra->lang==SrcLangExt_Markdown) { @@ -676,8 +680,8 @@ SLASHopt [/]* } } } - /* Python an VHDL share CComment, so special attention for ending comments is required */ -<CComment>"\n"/[ \t]*"#" { + /* Python an VHDL share CComment,CNComment, so special attention for ending comments is required */ +<CComment,CNComment>"\n"/[ \t]*"#" { if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; @@ -696,7 +700,7 @@ SLASHopt [/]* } } } -<CComment>"\n"/[ \t]*"-" { +<CComment,CNComment>"\n"/[ \t]*"-" { if (yyextra->lang!=SrcLangExt_Python || yyextra->pythonDocString) { REJECT; @@ -707,7 +711,7 @@ SLASHopt [/]* BEGIN(Scan); } } -<CComment>"\n"/[ \t]*[^ \t#\-] { +<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] { if (yyextra->lang==SrcLangExt_Python) { if (yyextra->pythonDocString) @@ -739,18 +743,18 @@ SLASHopt [/]* } } /* removed for bug 674842 (bug was introduced in rev 768) -<CComment>"'" { +<CComment,CNComment>"'" { yyextra->charContext = YY_START; copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipChar); } -<CComment>"\"" { +<CComment,CNComment>"\"" { yyextra->stringContext = YY_START; copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipString); } */ -<CComment>. { +<CComment,CNComment>. { copyToOutput(yyscanner,yytext,(int)yyleng); } <SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n { @@ -838,7 +842,7 @@ SLASHopt [/]* copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(yyextra->readLineCtx); } -<CComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command +<CComment,CNComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command copyToOutput(yyscanner,yytext,(int)yyleng); } <CComment,ReadLine>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section diff --git a/src/configgen.py b/src/configgen.py index 5c4c39a..b7736c4 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -696,34 +696,35 @@ def main(): print(" static ConfigValues &instance() { static ConfigValues theInstance; return theInstance; }") for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: - if (n.nodeName == "group"): + if n.nodeName == "group": parseGroupMapGetter(n) for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: - if (n.nodeName == "group"): + if n.nodeName == "group": parseGroupMapSetter(n) print(" void init();") - print(" struct Info"); - print(" {"); - print(" enum Type { Bool, Int, String, List, Unknown };"); - print(" Info(Type t,bool ConfigValues::*b) : type(t), value(b) {}"); - print(" Info(Type t,int ConfigValues::*i) : type(t), value(i) {}"); - print(" Info(Type t,QCString ConfigValues::*s) : type(t), value(s) {}"); - print(" Info(Type t,StringVector ConfigValues::*l) : type(t), value(l) {}"); - print(" Type type;"); - print(" union Item"); - print(" {"); - print(" Item(bool ConfigValues::*v) : b(v) {}"); - print(" Item(int ConfigValues::*v) : i(v) {}"); - print(" Item(QCString ConfigValues::*v) : s(v) {}"); - print(" Item(StringVector ConfigValues::*v) : l(v) {}"); - print(" bool ConfigValues::*b;"); - print(" int ConfigValues::*i;"); - print(" QCString ConfigValues::*s;"); - print(" StringVector ConfigValues::*l;"); - print(" } value;"); - print(" };"); - print(" const Info *get(const QCString &tag) const;"); + print(" StringVector fields() const;") + print(" struct Info") + print(" {") + print(" enum Type { Bool, Int, String, List, Unknown };") + print(" Info(Type t,bool ConfigValues::*b) : type(t), value(b) {}") + print(" Info(Type t,int ConfigValues::*i) : type(t), value(i) {}") + print(" Info(Type t,QCString ConfigValues::*s) : type(t), value(s) {}") + print(" Info(Type t,StringVector ConfigValues::*l) : type(t), value(l) {}") + print(" Type type;") + print(" union Item") + print(" {") + print(" Item(bool ConfigValues::*v) : b(v) {}") + print(" Item(int ConfigValues::*v) : i(v) {}") + print(" Item(QCString ConfigValues::*v) : s(v) {}") + print(" Item(StringVector ConfigValues::*v) : l(v) {}") + print(" bool ConfigValues::*b;") + print(" int ConfigValues::*i;") + print(" QCString ConfigValues::*s;") + print(" StringVector ConfigValues::*l;") + print(" } value;") + print(" };") + print(" const Info *get(const QCString &tag) const;") print(" private:") for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: @@ -765,6 +766,26 @@ def main(): if (n.nodeName == "group"): parseGroupInit(n) print("}") + print("") + print("StringVector ConfigValues::fields() const") + print("{") + print(" return {"); + first=True + for n in elem.childNodes: + if n.nodeType == Node.ELEMENT_NODE: + if (n.nodeName == "group"): + for c in n.childNodes: + if c.nodeType == Node.ELEMENT_NODE: + name = c.getAttribute('id') + type = c.getAttribute('type') + if type!='obsolete': + if not first: + print(",") + first=False + sys.stdout.write(' "'+name+'"') + print("") + print(" };") + print("}") elif (sys.argv[1] == "-cpp"): print("/* WARNING: This file is generated!") print(" * Do not edit this file, but edit config.xml instead and run") diff --git a/src/context.cpp b/src/context.cpp index fc7a586..7d1c6a7 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -279,6 +279,17 @@ class PropertyMapper return it!=m_map.end() ? (*it->second)(obj) : TemplateVariant(); } + StringVector fields() const + { + StringVector result; + for (const auto &kv : m_map) + { + result.push_back(kv.first); + } + std::sort(result.begin(),result.end()); + return result; + } + private: std::unordered_map<std::string,std::unique_ptr<PropertyFuncIntf>> m_map; }; @@ -364,6 +375,11 @@ TemplateVariant ConfigContext::get(const QCString &name) const return result; } +StringVector ConfigContext::fields() const +{ + return ConfigValues::instance().fields(); +} + //------------------------------------------------------------------------ //%% struct Doxygen: global information @@ -401,6 +417,10 @@ class DoxygenContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } private: struct Cachable { @@ -430,6 +450,11 @@ TemplateVariant DoxygenContext::get(const QCString &n) const return p->get(n); } +StringVector DoxygenContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct Translator: translation methods @@ -1019,6 +1044,10 @@ class TranslateContext::Private { return HtmlHelp::getLanguageString(); } + TemplateVariant code() const + { + return theTranslator->trCode(); + } Private() { static bool init=FALSE; @@ -1214,6 +1243,8 @@ class TranslateContext::Private s_inst.addProperty("examplesDescription",&Private::examplesDescription); //%% string langstring s_inst.addProperty("langString", &Private::langString); + //%% string code + s_inst.addProperty("code", &Private::code); init=TRUE; } @@ -1227,6 +1258,10 @@ class TranslateContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } private: bool m_javaOpt; bool m_fortranOpt; @@ -1253,6 +1288,11 @@ TemplateVariant TranslateContext::get(const QCString &n) const return p->get(n); } +StringVector TranslateContext::fields() const +{ + return p->fields(); +} + static TemplateVariant parseDoc(const Definition *def,const QCString &file,int line, const QCString &relPath,const QCString &docStr,bool isBrief) { @@ -1698,6 +1738,10 @@ class IncludeInfoContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant isLocal() const { bool isIDLorJava = m_lang==SrcLangExt_IDL || m_lang==SrcLangExt_Java; @@ -1749,6 +1793,12 @@ TemplateVariant IncludeInfoContext::get(const QCString &n) const { return p->get(n); } + +StringVector IncludeInfoContext::fields() const +{ + return p->fields(); +} + //%% } //------------------------------------------------------------------------ @@ -1881,6 +1931,10 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { return TemplateVariant(m_classDef->title()); @@ -2652,6 +2706,11 @@ TemplateVariant ClassContext::get(const QCString &n) const return p->get(n); } +StringVector ClassContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct Namespace(Symbol): namespace information @@ -2698,6 +2757,10 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { return TemplateVariant(m_namespaceDef->title()); @@ -2943,6 +3006,11 @@ TemplateVariant NamespaceContext::get(const QCString &n) const return p->get(n); } +StringVector NamespaceContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct File(Symbol): file information @@ -2999,6 +3067,10 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { return m_fileDef->title(); @@ -3395,6 +3467,11 @@ TemplateVariant FileContext::get(const QCString &n) const return p->get(n); } +StringVector FileContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct Dir(Symbol): directory information @@ -3427,6 +3504,10 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { return TemplateVariant(m_dirDef->shortTitle()); @@ -3584,6 +3665,11 @@ TemplateVariant DirContext::get(const QCString &n) const return p->get(n); } +StringVector DirContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct Page(Symbol): page information @@ -3612,6 +3698,10 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { if (m_isMainPage) @@ -3717,6 +3807,11 @@ TemplateVariant PageContext::get(const QCString &n) const return p->get(n); } +StringVector PageContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ class TextGeneratorHtml : public TextGeneratorIntf @@ -4063,6 +4158,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant fieldType() const { return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->fieldType()); @@ -5164,6 +5263,10 @@ TemplateVariant MemberContext::get(const QCString &n) const return p->get(n); } +StringVector MemberContext::fields() const +{ + return p->fields(); +} //------------------------------------------------------------------------ @@ -5229,6 +5332,10 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant title() const { return TemplateVariant(m_groupDef->groupTitle()); @@ -5675,6 +5782,11 @@ TemplateVariant ModuleContext::get(const QCString &n) const return p->get(n); } +StringVector ModuleContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list ClassList[Class] : list of classes @@ -5753,6 +5865,10 @@ class ClassIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant list() const { if (!m_cache.classes) @@ -5840,6 +5956,11 @@ TemplateVariant ClassIndexContext::get(const QCString &n) const return p->get(n); } +StringVector ClassIndexContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ static int computeMaxDepth(const TemplateListIntf *list) @@ -5945,6 +6066,10 @@ class ClassHierarchyContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_classTree.get(); @@ -6053,6 +6178,11 @@ TemplateVariant ClassHierarchyContext::get(const QCString &name) const return p->get(name); } +StringVector ClassHierarchyContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct NestingNode: node is a nesting relation tree @@ -6066,6 +6196,7 @@ class NestingNodeContext::Private : m_parent(parent), m_def(d), m_level(level), m_index(index) { m_children.reset(NestingContext::alloc(thisNode,level+1)); + m_members.reset(NestingContext::alloc(thisNode,level+1)); static bool init=FALSE; if (!init) { @@ -6073,6 +6204,8 @@ class NestingNodeContext::Private s_inst.addProperty("is_leaf_node",&Private::isLeafNode); //%% Nesting children: list of nested classes/namespaces s_inst.addProperty("children",&Private::children); + //%% Nesting children: list of nested classes/namespaces + s_inst.addProperty("members",&Private::members); //%% [optional] Class class: class info (if this node represents a class) s_inst.addProperty("class",&Private::getClass); //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) @@ -6085,6 +6218,8 @@ class NestingNodeContext::Private s_inst.addProperty("page",&Private::getPage); //%% [optional] Module module: module info (if this node represents a module) s_inst.addProperty("module",&Private::getModule); + //%% [optional] Member member: member info (if this node represents a member) + s_inst.addProperty("member",&Private::getMember); //%% int id s_inst.addProperty("id",&Private::id); //%% string level @@ -6107,11 +6242,16 @@ class NestingNodeContext::Private addDirFiles(visitedClasses); addPages(visitedClasses); addModules(visitedClasses); + addMembers(visitedClasses); } TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant isLeafNode() const { return m_children->count()==0; @@ -6120,6 +6260,10 @@ class NestingNodeContext::Private { return m_children.get(); } + TemplateVariant members() const + { + return m_members.get(); + } TemplateVariant getClass() const { if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass) @@ -6210,6 +6354,21 @@ class NestingNodeContext::Private return TemplateVariant(FALSE); } } + TemplateVariant getMember() const + { + if (!m_cache.memberContext && m_def->definitionType()==Definition::TypeMember) + { + m_cache.memberContext.reset(MemberContext::alloc(toMemberDef(m_def))); + } + if (m_cache.memberContext) + { + return m_cache.memberContext.get(); + } + else + { + return TemplateVariant(FALSE); + } + } TemplateVariant level() const { return m_level; @@ -6272,26 +6431,26 @@ class NestingNodeContext::Private void addClasses(bool inherit, bool hideSuper,ClassDefSet &visitedClasses) { const ClassDef *cd = toClassDef(m_def); - if (cd && inherit) + if (cd) { - bool hasChildren = visitedClasses.find(cd)==visitedClasses.end() && - !hideSuper && classHasVisibleChildren(cd); - if (hasChildren) + if (inherit) { - visitedClasses.insert(cd); - if (cd->getLanguage()==SrcLangExt_VHDL) + bool hasChildren = visitedClasses.find(cd)==visitedClasses.end() && + !hideSuper && classHasVisibleChildren(cd); + if (hasChildren) { - m_children->addDerivedClasses(cd->baseClasses(),false,visitedClasses); - } - else - { - m_children->addDerivedClasses(cd->subClasses(),false,visitedClasses); + visitedClasses.insert(cd); + if (cd->getLanguage()==SrcLangExt_VHDL) + { + m_children->addDerivedClasses(cd->baseClasses(),false,visitedClasses); + } + else + { + m_children->addDerivedClasses(cd->subClasses(),false,visitedClasses); + } } } - } - else - { - if (cd) + else { m_children->addClasses(cd->getClasses(),FALSE,visitedClasses); } @@ -6300,13 +6459,16 @@ class NestingNodeContext::Private void addNamespaces(bool addClasses,ClassDefSet &visitedClasses) { const NamespaceDef *nd = toNamespaceDef(m_def); - if (nd && !nd->getNamespaces().empty()) - { - m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,visitedClasses); - } - if (addClasses && nd) + if (nd) { - m_children->addClasses(nd->getClasses(),FALSE,visitedClasses); + if (!nd->getNamespaces().empty()) + { + m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,visitedClasses); + } + if (addClasses) + { + m_children->addClasses(nd->getClasses(),FALSE,visitedClasses); + } } } void addDirFiles(ClassDefSet &visitedClasses) @@ -6334,10 +6496,53 @@ class NestingNodeContext::Private m_children->addModules(gd->getSubGroups(),visitedClasses); } } + void addMembers(ClassDefSet &visitedClasses) + { + if (m_def->definitionType()==Definition::TypeNamespace) + { + // add namespace members + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) + { + if (lde->kind()==LayoutDocEntry::MemberDef) + { + const LayoutDocEntryMemberDef *lmd = (const LayoutDocEntryMemberDef*)lde.get(); + const MemberList *ml = toNamespaceDef(m_def)->getMemberList(lmd->type); + m_members->addMembers(ml,visitedClasses); + } + } + } + else if (m_def->definitionType()==Definition::TypeClass) + { + // add class members + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Class)) + { + if (lde->kind()==LayoutDocEntry::MemberDef) + { + const LayoutDocEntryMemberDef *lmd = (const LayoutDocEntryMemberDef*)lde.get(); + const MemberList *ml = toClassDef(m_def)->getMemberList(lmd->type); + m_members->addMembers(ml,visitedClasses); + } + } + } + else if (m_def->definitionType()==Definition::TypeFile) + { + // add class members + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File)) + { + if (lde->kind()==LayoutDocEntry::MemberDef) + { + const LayoutDocEntryMemberDef *lmd = (const LayoutDocEntryMemberDef*)lde.get(); + const MemberList *ml = toFileDef(m_def)->getMemberList(lmd->type); + m_members->addMembers(ml,visitedClasses); + } + } + } + } private: const NestingNodeContext *m_parent; const Definition *m_def; SharedPtr<NestingContext> m_children; + SharedPtr<NestingContext> m_members; int m_level; int m_index; struct Cachable @@ -6348,6 +6553,7 @@ class NestingNodeContext::Private SharedPtr<FileContext> fileContext; SharedPtr<PageContext> pageContext; SharedPtr<ModuleContext> moduleContext; + SharedPtr<MemberContext> memberContext; ScopedPtr<TemplateVariant> brief; }; mutable Cachable m_cache; @@ -6375,6 +6581,11 @@ TemplateVariant NestingNodeContext::get(const QCString &n) const return p->get(n); } +StringVector NestingNodeContext::fields() const +{ + return p->fields(); +} + QCString NestingNodeContext::id() const { return p->id().toString(); @@ -6485,7 +6696,8 @@ class NestingContext::Private : public GenericNodeListContext { if (fd->getDirDef()==0) // top level file { - append(NestingNodeContext::alloc(m_parent,fd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,fd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses); + append(nnc); m_index++; } } @@ -6495,7 +6707,8 @@ class NestingContext::Private : public GenericNodeListContext { for (const auto &fd : fList) { - append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + NestingNodeContext *nnc=NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses); + append(nnc); m_index++; } } @@ -6605,6 +6818,21 @@ class NestingContext::Private : public GenericNodeListContext } } } + void addMembers(const MemberList *ml,ClassDefSet &visitedClasses) + { + if (ml) + { + for (const auto &md : *ml) + { + if (md->visibleInIndex()) + { + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,md,m_index,m_level+1,TRUE,TRUE,FALSE,visitedClasses); + append(nnc); + m_index++; + } + } + } + } private: const NestingNodeContext *m_parent; @@ -6708,6 +6936,11 @@ void NestingContext::addDerivedClasses(const BaseClassList &bcl,bool hideSuper,C p->addDerivedClasses(bcl,hideSuper,visitedClasses); } +void NestingContext::addMembers(const MemberList *ml,ClassDefSet &visitedClasses) +{ + p->addMembers(ml,visitedClasses); +} + //------------------------------------------------------------------------ //%% struct ClassTree: Class nesting relations @@ -6740,6 +6973,10 @@ class ClassTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_classTree.get(); @@ -6828,6 +7065,11 @@ TemplateVariant ClassTreeContext::get(const QCString &name) const return p->get(name); } +StringVector ClassTreeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list NamespaceList[Namespace] : list of namespaces @@ -6904,6 +7146,10 @@ class NamespaceTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_namespaceTree.get(); @@ -6994,6 +7240,12 @@ TemplateVariant NamespaceTreeContext::get(const QCString &name) const return p->get(name); } +StringVector NamespaceTreeContext::fields() const +{ + return p->fields(); +} + + //------------------------------------------------------------------------ //%% list FileList[File] : list of files @@ -7174,6 +7426,10 @@ class FileTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_dirFileTree.get(); @@ -7249,6 +7505,11 @@ TemplateVariant FileTreeContext::get(const QCString &name) const return p->get(name); } +StringVector FileTreeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct PageTree: tree of related pages @@ -7282,6 +7543,10 @@ class PageTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_pageTree.get(); @@ -7357,6 +7622,11 @@ TemplateVariant PageTreeContext::get(const QCString &name) const return p->get(name); } +StringVector PageTreeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list PageList[Page]: list of pages @@ -7524,6 +7794,10 @@ class ModuleTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_moduleTree.get(); @@ -7599,6 +7873,11 @@ TemplateVariant ModuleTreeContext::get(const QCString &name) const return p->get(name); } +StringVector ModuleTreeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct NavPathElem: list of examples page @@ -7624,6 +7903,10 @@ class NavPathElemContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant isLinkable() const { return m_def->isLinkable(); @@ -7693,6 +7976,10 @@ TemplateVariant NavPathElemContext::get(const QCString &name) const return p->get(name); } +StringVector NavPathElemContext::fields() const +{ + return p->fields(); +} //------------------------------------------------------------------------ @@ -7726,6 +8013,10 @@ class ExampleTreeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant tree() const { return m_exampleTree.get(); @@ -7801,6 +8092,11 @@ TemplateVariant ExampleTreeContext::get(const QCString &name) const return p->get(name); } +StringVector ExampleTreeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct GlobalsIndex: list of examples page @@ -7835,6 +8131,10 @@ class GlobalsIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const { @@ -7954,6 +8254,12 @@ TemplateVariant GlobalsIndexContext::get(const QCString &name) const return p->get(name); } +StringVector GlobalsIndexContext::fields() const +{ + return p->fields(); +} + + //------------------------------------------------------------------------ //%% struct ClassMembersIndex: list of examples page @@ -7988,6 +8294,10 @@ class ClassMembersIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const { @@ -8109,6 +8419,11 @@ TemplateVariant ClassMembersIndexContext::get(const QCString &name) const return p->get(name); } +StringVector ClassMembersIndexContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct NamespaceMembersIndex: list of examples page @@ -8143,6 +8458,10 @@ class NamespaceMembersIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const { @@ -8261,6 +8580,11 @@ TemplateVariant NamespaceMembersIndexContext::get(const QCString &name) const return p->get(name); } +StringVector NamespaceMembersIndexContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct InheritanceGraph: a connected graph representing part of the overall inheritance tree @@ -8281,6 +8605,10 @@ class InheritanceGraphContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant graph() const { TextStream t; @@ -8322,6 +8650,10 @@ TemplateVariant InheritanceGraphContext::get(const QCString &name) const return p->get(name); } +StringVector InheritanceGraphContext::fields() const +{ + return p->fields(); +} //------------------------------------------------------------------------ @@ -8344,6 +8676,10 @@ class InheritanceNodeContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant getClass() const { if (!m_classContext) @@ -8381,6 +8717,11 @@ TemplateVariant InheritanceNodeContext::get(const QCString &name) const return p->get(name); } +StringVector InheritanceNodeContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list InheritanceList[InheritanceNode] : list of inherited classes @@ -8528,6 +8869,10 @@ class MemberInfoContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant protection() const { switch (m_memberInfo->prot()) @@ -8592,6 +8937,10 @@ TemplateVariant MemberInfoContext::get(const QCString &name) const return p->get(name); } +StringVector MemberInfoContext::fields() const +{ + return p->fields(); +} //------------------------------------------------------------------------ @@ -8680,6 +9029,10 @@ class MemberGroupInfoContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant members() const { if (!m_cache.memberListContext) @@ -8764,6 +9117,11 @@ TemplateVariant MemberGroupInfoContext::get(const QCString &name) const return p->get(name); } +StringVector MemberGroupInfoContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list MemberGroupList[MemberGroupInfo] : list of member groups @@ -8854,6 +9212,10 @@ class MemberListInfoContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant members() const { if (!m_cache.memberListContext) @@ -8936,6 +9298,11 @@ TemplateVariant MemberListInfoContext::get(const QCString &name) const return p->get(name); } +StringVector MemberListInfoContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% struct InheritedMemberInfo: inherited member information @@ -8961,6 +9328,10 @@ class InheritedMemberInfoContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } virtual ~Private() { delete m_memberList; @@ -9030,6 +9401,11 @@ TemplateVariant InheritedMemberInfoContext::get(const QCString &name) const return p->get(name); } +StringVector InheritedMemberInfoContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list InheritedMemberList[InheritedMemberInfo] : list of inherited classes @@ -9193,6 +9569,10 @@ class ArgumentContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant type() const { return createLinkedText(m_def,m_relPath,m_argument.type); @@ -9271,6 +9651,11 @@ TemplateVariant ArgumentContext::get(const QCString &name) const return p->get(name); } +StringVector ArgumentContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list ArgumentList[Argument] : list of inherited classes @@ -9360,6 +9745,10 @@ class SymbolContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant fileName() const { return m_def->getOutputFileBase(); @@ -9486,6 +9875,11 @@ TemplateVariant SymbolContext::get(const QCString &name) const return p->get(name); } +StringVector SymbolContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list SymbolList[Symbol] : list of search symbols with the same name @@ -9558,6 +9952,10 @@ class SymbolGroupContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant id() const { return searchId(*m_start); @@ -9605,6 +10003,11 @@ TemplateVariant SymbolGroupContext::get(const QCString &name) const return p->get(name); } +StringVector SymbolGroupContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list SymbolGroupList[SymbolGroup] : list of search groups one per by name @@ -9688,6 +10091,10 @@ class SymbolIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant name() const { return m_name; @@ -9735,6 +10142,11 @@ TemplateVariant SymbolIndexContext::get(const QCString &name) const return p->get(name); } +StringVector SymbolIndexContext::fields() const +{ + return p->fields(); +} + //------------------------------------------------------------------------ //%% list SymbolIndices[SymbolIndex] : list of search indices one per by type @@ -9799,6 +10211,10 @@ class SearchIndexContext::Private { return s_inst.get(this,n); } + StringVector fields() const + { + return s_inst.fields(); + } TemplateVariant name() const { return m_info.name; @@ -9844,6 +10260,12 @@ TemplateVariant SearchIndexContext::get(const QCString &name) const return p->get(name); } +StringVector SearchIndexContext::fields() const +{ + return p->fields(); +} + + //------------------------------------------------------------------------ //%% list SearchIndices[SearchIndex] : list of search indices one per by type diff --git a/src/context.h b/src/context.h index 1fb934e..bff4903 100644 --- a/src/context.h +++ b/src/context.h @@ -135,6 +135,7 @@ class ConfigContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -154,6 +155,7 @@ class DoxygenContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -173,6 +175,7 @@ class TranslateContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -217,6 +220,7 @@ class IncludeInfoContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -259,6 +263,7 @@ class ClassContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -278,6 +283,7 @@ class NamespaceContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -297,6 +303,7 @@ class FileContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -315,6 +322,7 @@ class DirContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -335,6 +343,7 @@ class PageContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -354,6 +363,7 @@ class MemberContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -374,6 +384,7 @@ class ModuleContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -414,6 +425,7 @@ class ClassIndexContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -434,6 +446,7 @@ class InheritanceGraphContext : public RefCountedContext, public TemplateStructI // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -454,6 +467,7 @@ class ClassInheritanceNodeContext : public RefCountedContext, public TemplateStr // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -496,6 +510,7 @@ class ClassHierarchyContext : public RefCountedContext, public TemplateStructInt // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -520,6 +535,7 @@ class NestingNodeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -562,6 +578,7 @@ class NestingContext : public RefCountedContext, public TemplateListIntf void addModules(const GroupList &modules,ClassDefSet &visitedClasses); void addClassHierarchy(const ClassLinkedMap &clLinkedMap,ClassDefSet &visitedClasses); void addDerivedClasses(const BaseClassList &bcl,bool hideSuper,ClassDefSet &visitedClasses); + void addMembers(const MemberList *ml,ClassDefSet &visitedClasses); private: NestingContext(const NestingNodeContext *parent,int level); @@ -579,6 +596,7 @@ class ClassTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -619,6 +637,7 @@ class NamespaceTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -680,6 +699,7 @@ class FileTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -722,6 +742,7 @@ class PageTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -741,6 +762,7 @@ class ModuleNodeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -784,6 +806,7 @@ class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -825,6 +848,7 @@ class ExampleTreeContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -844,6 +868,7 @@ class GlobalsIndexContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -863,6 +888,7 @@ class ClassMembersIndexContext : public RefCountedContext, public TemplateStruct // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -882,6 +908,7 @@ class NamespaceMembersIndexContext : public RefCountedContext, public TemplateSt // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -901,6 +928,7 @@ class NavPathElemContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -922,6 +950,7 @@ class InheritanceNodeContext : public RefCountedContext, public TemplateStructIn // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -992,6 +1021,7 @@ class MemberGroupInfoContext : public RefCountedContext, public TemplateStructIn // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1043,6 +1073,7 @@ class MemberListInfoContext : public RefCountedContext, public TemplateStructInt // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1064,6 +1095,7 @@ class MemberInfoContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1084,6 +1116,7 @@ class InheritedMemberInfoContext : public RefCountedContext, public TemplateStru // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1148,6 +1181,7 @@ class ArgumentContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1192,6 +1226,7 @@ class SymbolContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1237,6 +1272,7 @@ class SymbolGroupContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1281,6 +1317,7 @@ class SymbolIndexContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1323,6 +1360,7 @@ class SearchIndexContext : public RefCountedContext, public TemplateStructIntf // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 1814b51..f4354a4 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -341,7 +341,7 @@ void DirDefImpl::writeSubDirList(OutputList &ol) if (dd->hasDocumentation() || dd->getFiles().empty()) { ol.startMemberDeclaration(); - ol.startMemberItem(dd->getOutputFileBase(),0); + ol.startMemberItem(dd->anchor(),0); ol.parseText(theTranslator->trDir(FALSE,TRUE)+" "); ol.insertMemberAlign(); ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName()); @@ -359,7 +359,7 @@ void DirDefImpl::writeSubDirList(OutputList &ol) ); ol.endMemberDescription(); } - ol.endMemberDeclaration(QCString(),QCString()); + ol.endMemberDeclaration(dd->anchor(),QCString()); } } @@ -390,7 +390,7 @@ void DirDefImpl::writeFileList(OutputList &ol) if (fd->hasDocumentation()) { ol.startMemberDeclaration(); - ol.startMemberItem(fd->getOutputFileBase(),0); + ol.startMemberItem(fd->anchor(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.insertMemberAlign(); if (fd->isLinkable()) @@ -429,7 +429,7 @@ void DirDefImpl::writeFileList(OutputList &ol) ); ol.endMemberDescription(); } - ol.endMemberDeclaration(QCString(),QCString()); + ol.endMemberDeclaration(fd->anchor(),QCString()); } } ol.endMemberList(); diff --git a/src/docparser.cpp b/src/docparser.cpp index 331355f..4e316a8 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -6771,6 +6771,7 @@ reparsetoken: } else { + m_children.push_back(std::make_unique<DocWord>(this,g_token->name)); warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unsupported symbol %s found", qPrint(g_token->name)); } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 51fcd16..9e2f737 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -741,7 +741,7 @@ static Definition *buildScopeFromQualifiedName(const QCString &name_,SrcLangExt else if (nd==0 && cd==0 && fullScope.find('<')==-1) // scope is not known and could be a namespace! { // introduce bogus namespace - //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),tagInfo); + //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),(void*)tagInfo); NamespaceDefMutable *newNd= toNamespaceDefMutable( Doxygen::namespaceLinkedMap->add(fullScope, @@ -1686,6 +1686,11 @@ static void buildNamespaceList(const Entry *root) // file definition containing the namespace nd FileDef *fd=root->fileDef(); + if (nd->isArtificial()) + { + nd->setArtificial(FALSE); // found namespace explicitly, so cannot be artificial + nd->setDefFile(root->fileName,root->startLine,root->startColumn); + } // insert the namespace in the file definition if (fd) fd->insertNamespace(nd); addNamespaceToGroups(root,nd); @@ -1971,15 +1976,16 @@ static void buildListOfUsingDecls(const Entry *root) } -static void findUsingDeclarations(const Entry *root) +static void findUsingDeclarations(const Entry *root,bool filterPythonPackages) { if (root->section==Entry::USINGDECL_SEC && - !(root->parent()->section&Entry::COMPOUND_MASK) // not a class/struct member + !(root->parent()->section&Entry::COMPOUND_MASK) && // not a class/struct member + (!filterPythonPackages || (root->lang==SrcLangExt_Python && root->fileName.endsWith("__init__.py"))) ) { //printf("Found using declaration %s at line %d of %s inside section %x\n", // qPrint(root->name),root->startLine,qPrint(root->fileName), - // rootNav->parent()->section()); + // root->parent()->section); if (!root->name.isEmpty()) { ClassDefMutable *usingCd = 0; @@ -2018,7 +2024,7 @@ static void findUsingDeclarations(const Entry *root) usingCd = toClassDefMutable(Doxygen::hiddenClassLinkedMap->find(name)); // check if it is already hidden } - //printf("%s -> %p\n",qPrint(root->name),usingCd); + //printf("%s -> %p\n",qPrint(root->name),(void*)usingCd); if (usingCd==0) // definition not in the input => add an artificial class { Debug::print(Debug::Classes,0," New using class '%s' (sec=0x%08x)! #tArgLists=%d\n", @@ -2054,7 +2060,7 @@ static void findUsingDeclarations(const Entry *root) } } } - for (const auto &e : root->children()) findUsingDeclarations(e.get()); + for (const auto &e : root->children()) findUsingDeclarations(e.get(),filterPythonPackages); } //---------------------------------------------------------------------- @@ -9930,6 +9936,13 @@ static void readDir(FileInfo *fi, } } } + if (resultList) + { + // sort the resulting list to make the order platform independent. + std::sort(resultList->begin(), + resultList->end(), + [](const auto &f1,const auto &f2) { return qstricmp(f1.c_str(),f2.c_str())<0; }); + } } @@ -11510,7 +11523,8 @@ void parseInput() g_s.begin("Searching for members imported via using declarations...\n"); // this should be after buildTypedefList in order to properly import // used typedefs - findUsingDeclarations(root.get()); + findUsingDeclarations(root.get(),TRUE); // do for python packages first + findUsingDeclarations(root.get(),FALSE); // then the rest g_s.end(); g_s.begin("Searching for included using directives...\n"); diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index e4ec0d6..cfc1b91 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -1266,7 +1266,12 @@ void HtmlDocVisitor::visitPre(DocPara *p) //printf(" needsTag=%d\n",needsTag); // write the paragraph tag (if needed) if (needsTag) - m_t << "<p class=\"" << contexts[t] << "\"" << htmlAttribsToString(p->attribs()) << ">"; + { + if (strlen(contexts[t])) + m_t << "<p class=\"" << contexts[t] << "\"" << htmlAttribsToString(p->attribs()) << ">"; + else + m_t << "<p " << htmlAttribsToString(p->attribs()) << ">"; + } } void HtmlDocVisitor::visitPost(DocPara *p) diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 94d9056..c8c8021 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -2886,14 +2886,14 @@ void HtmlGenerator::startHeaderSection() void HtmlGenerator::startTitleHead(const QCString &) { - m_t << " <div class=\"headertitle\">\n"; + m_t << " <div class=\"headertitle\">"; startTitle(); } void HtmlGenerator::endTitleHead(const QCString &,const QCString &) { endTitle(); - m_t << " </div>\n"; + m_t << "</div>\n"; } void HtmlGenerator::endHeaderSection() diff --git a/src/index.cpp b/src/index.cpp index 99942f1..de50cc5 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -289,18 +289,6 @@ void endFileWithNavPath(const Definition *d,OutputList &ol) //---------------------------------------------------------------------- -static bool memberVisibleInIndex(const MemberDef *md) -{ - bool isAnonymous = md->isAnonymous(); - bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); - bool extractStatic = Config_getBool(EXTRACT_STATIC); - return (!isAnonymous && - (!hideUndocMembers || md->hasDocumentation()) && - (!md->isStatic() || extractStatic) && - md->isLinkable() - ); -} - static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool addToIndex) { bool isAnonymous = md->isAnonymous(); @@ -388,7 +376,7 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, { for (const auto &md : *ml) { - if (memberVisibleInIndex(md)) + if (md->visibleInIndex()) { writeMemberToIndex(def,md,addToIndex); } @@ -1611,7 +1599,7 @@ static int countVisibleMembers(const NamespaceDef *nd) { for (const auto &md : *ml) { - if (memberVisibleInIndex(md)) + if (md->visibleInIndex()) { count++; } @@ -1634,8 +1622,8 @@ static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex) { for (const auto &md : *ml) { - //printf(" member %s visible=%d\n",qPrint(md->name()),memberVisibleInIndex(md)); - if (memberVisibleInIndex(md)) + //printf(" member %s visible=%d\n",qPrint(md->name()),md->visibleInIndex()); + if (md->visibleInIndex()) { writeMemberToIndex(nd,md,addToIndex); } @@ -2180,7 +2168,9 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct // write character heading ol.writeString("<dt class=\"alphachar\">"); QCString s = letterToLabel(cl.first.c_str()); - ol.writeString("<a name=\"letter_"); + ol.writeString("<a id=\"letter_"); + ol.writeString(s); + ol.writeString("\" name=\"letter_"); ol.writeString(s); ol.writeString("\">"); ol.writeString(cl.first.c_str()); @@ -2511,10 +2501,10 @@ static void writeClassLinkForMember(OutputList &ol,const MemberDef *md,const QCS const ClassDef *cd=md->getClassDef(); if ( cd && prevClassName!=cd->displayName()) { - ol.docify(separator); + ol.writeString(separator); ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), cd->displayName()); - ol.writeString("\n"); + //ol.writeString("\n"); prevClassName = cd->displayName(); } } @@ -2525,10 +2515,10 @@ static void writeFileLinkForMember(OutputList &ol,const MemberDef *md,const QCSt const FileDef *fd=md->getFileDef(); if (fd && prevFileName!=fd->name()) { - ol.docify(separator); + ol.writeString(separator); ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), fd->name()); - ol.writeString("\n"); + //ol.writeString("\n"); prevFileName = fd->name(); } } @@ -2539,10 +2529,10 @@ static void writeNamespaceLinkForMember(OutputList &ol,const MemberDef *md,const const NamespaceDef *nd=md->getNamespaceDef(); if (nd && prevNamespaceName!=nd->displayName()) { - ol.docify(separator); + ol.writeString(separator); ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(), nd->displayName()); - ol.writeString("\n"); + //ol.writeString("\n"); prevNamespaceName = nd->displayName(); } } @@ -2625,11 +2615,11 @@ static void writeMemberList(OutputList &ol,bool useSections,const std::string &p firstItem=FALSE; ol.docify(name); if (isFunc) ol.docify("()"); - ol.writeString("\n"); + //ol.writeString("\n"); // link to class prevDefName=""; - sep = ": "; + sep = " : "; prevName = name.data()+startIndex; } else // same entry @@ -3512,7 +3502,7 @@ static void writeExampleIndex(OutputList &ol) } } ol.endItemListItem(); - ol.writeString("\n"); + //ol.writeString("\n"); } ol.endItemList(); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index af05535..7133641 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -321,6 +321,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual void writeTagFile(TextStream &) const; virtual void warnIfUndocumented() const; virtual void warnIfUndocumentedParams() const; + virtual bool visibleInIndex() const; virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const; virtual MemberDefMutable *createTemplateInstanceMember(const ArgumentList &formalArgs, const std::unique_ptr<ArgumentList> &actualArgs) const; @@ -744,6 +745,8 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> { return getMdAlias()->getDeclColumn(); } virtual QCString requiresClause() const { return getMdAlias()->requiresClause(); } + virtual bool visibleInIndex() const + { return getMdAlias()->visibleInIndex(); } virtual void warnIfUndocumented() const {} virtual void warnIfUndocumentedParams() const {} @@ -3844,6 +3847,18 @@ void MemberDefImpl::warnIfUndocumented() const warnIfUndocumentedParams(); } } + +bool MemberDefImpl::visibleInIndex() const +{ + bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); + bool extractStatic = Config_getBool(EXTRACT_STATIC); + return (!isAnonymous() && + (!hideUndocMembers || hasDocumentation()) && + (!isStatic() || extractStatic) && + isLinkable() + ); +} + static QCString stripTrailingReturn(const QCString &trailRet) { QCString ret = trailRet; diff --git a/src/memberdef.h b/src/memberdef.h index 1d1e744..ca745a0 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -285,9 +285,11 @@ class MemberDef : public Definition virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const = 0; virtual void warnIfUndocumented() const = 0; virtual void warnIfUndocumentedParams() const = 0; + virtual bool visibleInIndex() const = 0; // TODO: this is not a getter, should be passed at construction virtual void setMemberGroup(MemberGroup *grp) = 0; + }; class MemberDefMutable : public DefinitionMutable, public MemberDef @@ -3241,48 +3241,32 @@ static void initPredefined(yyscan_t yyscanner,const QCString &fileName) ) // predefined function macro definition { static const reg::Ex reId(R"(\a\w*)"); - reg::Iterator end; - bool varArgs = false; - int count = 0; std::map<std::string,int> argMap; - if (ds.substr(i_obrace+1,i_cbrace-i_obrace-1)=="...") + std::string args = ds.substr(i_obrace+1,i_cbrace-i_obrace-1); // part between ( and ) + bool hasVarArgs = args.find("...")!=std::string::npos; + //printf("predefined function macro '%s'\n",ds.c_str()); + int count = 0; + reg::Iterator arg_it(args,reId,0); + reg::Iterator arg_end; + // gather the formal arguments in a dictionary + for (; arg_it!=arg_end; ++arg_it) { - varArgs = true; - argMap.emplace("__VA_ARGS__",count); - count++; + argMap.emplace(arg_it->str(),count++); } - else + if (hasVarArgs) // add the variable argument if present { - size_t i=i_obrace+1; - //printf("predefined function macro '%s'\n",ds.c_str()); - reg::Iterator it(ds,reId,i); - // gather the formal arguments in a dictionary - while (i<i_cbrace && it!=end) - { - const auto &match = *it; - size_t pi = match.position(); - size_t l = match.length(); - if (l>0) // see bug375037 - { - argMap.emplace(match.str(),count); - count++; - i=pi+l; - } - else - { - i++; - } - ++it; - } + argMap.emplace("__VA_ARGS__",count++); } + // strip definition part std::string definition; std::string in=ds.substr(i_equals+1); reg::Iterator re_it(in,reId); + reg::Iterator re_end; size_t i=0; // substitute all occurrences of formal arguments by their // corresponding markers - for (; re_it!=end; ++re_it) + for (; re_it!=re_end; ++re_it) { const auto &match = *re_it; size_t pi = match.position(); @@ -3317,11 +3301,11 @@ static void initPredefined(yyscan_t yyscanner,const QCString &fileName) def.nonRecursive = nonRecursive; def.fileDef = state->yyFileDef; def.fileName = fileName; - def.varArgs = varArgs; + def.varArgs = hasVarArgs; state->contextDefines.insert(std::make_pair(def.name.str(),def)); - //printf("#define '%s' '%s' #nargs=%d\n", - // qPrint(def->name),qPrint(def->definition),def->nargs); + //printf("#define '%s' '%s' #nargs=%d hasVarArgs=%d\n", + // qPrint(def.name),qPrint(def.definition),def.nargs,def.varArgs); } } else if (!ds.empty()) // predefined non-function macro definition diff --git a/src/pycode.l b/src/pycode.l index 6acf333..f24c8c9 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -183,7 +183,7 @@ LONGSTRINGCHAR [^\\"'] ESCAPESEQ ("\\")(.) LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ}) SMALLQUOTE ("\"\""|"\""|"'"|"''") -LONGSTRINGBLOCK ({LONGSTRINGITEM}+|{SMALLQUOTE}) +LONGSTRINGBLOCK ({LONGSTRINGITEM}|{SMALLQUOTE}) SHORTSTRING ("'"{SHORTSTRINGITEM}*"'"|'"'{SHORTSTRINGITEM}*'"') SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ}) diff --git a/src/pyscanner.l b/src/pyscanner.l index 4f331c9..a34dc18 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -180,7 +180,7 @@ LONGSTRINGCHAR [^\\"'] ESCAPESEQ ("\\")(.) LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ}) SMALLQUOTE ("\"\""|"\""|"'"|"''") -LONGSTRINGBLOCK ({LONGSTRINGITEM}+|{SMALLQUOTE}) +LONGSTRINGBLOCK ({LONGSTRINGITEM}|{SMALLQUOTE}) SHORTSTRING ("'"{SHORTSTRINGITEM}*"'"|'"'{SHORTSTRINGITEM}*'"') SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ}) @@ -1838,18 +1838,26 @@ static void parseMain(yyscan_t yyscanner, const QCString &fileName,const char *f yyextra->moduleScope+=baseName; } - yyextra->current = std::make_shared<Entry>(); - initEntry(yyscanner); - yyextra->current->name = yyextra->moduleScope; - yyextra->current->section = Entry::NAMESPACE_SEC; - yyextra->current->type = "namespace"; - yyextra->current->fileName = yyextra->yyFileName; - yyextra->current->startLine = yyextra->yyLineNr; - yyextra->current->bodyLine = yyextra->yyLineNr; - - yyextra->current_root = yyextra->current; - - rt->moveToSubEntryAndRefresh(yyextra->current); + // add namespaces for each scope + QCString scope = yyextra->moduleScope; + int startPos = 0; + int pos; + do + { + pos = scope.find("::",startPos); + startPos=pos+2; + if (pos==-1) pos=(int)scope.length(); + yyextra->current = std::make_shared<Entry>(); + initEntry(yyscanner); + yyextra->current->name = scope.left(pos); + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "namespace"; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current_root = yyextra->current; + rt->moveToSubEntryAndRefresh(yyextra->current); + } while (pos<(int)scope.length()); initParser(yyscanner); diff --git a/src/qcstring.h b/src/qcstring.h index ba5ac95..0b23071 100644 --- a/src/qcstring.h +++ b/src/qcstring.h @@ -398,6 +398,19 @@ class QCString return m_rep.rfind(s.str(),0)==0; // looking "backward" starting and ending at index 0 } + bool endsWith(const char *s) const + { + if (m_rep.empty() || s==0) return s==0; + size_t l = strlen(s); + return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s, l)==0; + } + + bool endsWith(const QCString &s) const + { + size_t l = s.length(); + return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s.str())==0; + } + #define HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING 0 #if HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING /** Converts the string to a plain C string */ diff --git a/src/scanner.l b/src/scanner.l index 00fa3b4..4fb625f 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1955,7 +1955,7 @@ NONLopt [^\n]* //printf("Found %s\n",qPrint(yyextra->current->name)); BEGIN( ReadFuncArgType ) ; } - else if (yyextra->sharpCount<=0) + else { yyextra->current->name+="("; yyextra->roundCount++; diff --git a/src/searchindex.cpp b/src/searchindex.cpp index cf09e67..f87cd33 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -1214,6 +1214,7 @@ void writeJavaScriptSearchIndex() t << "</html>\n"; } } + Doxygen::indexList->addStyleSheetFile("search/search.js"); } diff --git a/src/template.cpp b/src/template.cpp index a9c5421..e1d9c79 100755 --- a/src/template.cpp +++ b/src/template.cpp @@ -291,6 +291,17 @@ TemplateVariant TemplateStruct::get(const QCString &name) const return it!=p->fields.end() ? it->second : TemplateVariant(); } +StringVector TemplateStruct::fields() const +{ + StringVector result; + for (const auto &kv : p->fields) + { + result.push_back(kv.first); + } + std::sort(result.begin(),result.end()); + return result; +} + TemplateStruct *TemplateStruct::alloc() { return new TemplateStruct; @@ -1316,6 +1327,23 @@ class FilterUpper //-------------------------------------------------------------------- +/** @brief The implementation of the "upper" filter */ +class FilterHex +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid()) + { + return QCString().sprintf("%x",v.toInt()); + } + return v; + } +}; + + +//-------------------------------------------------------------------- + /** @brief The implementation of the "e" filter */ class FilterEscape { @@ -1408,6 +1436,7 @@ class TemplateFilterFactory // register a handlers for each filter we support static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add"); static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get"); +static TemplateFilterFactory::AutoRegister<FilterHex> fHex("hex"); static TemplateFilterFactory::AutoRegister<FilterRaw> fRaw("raw"); static TemplateFilterFactory::AutoRegister<FilterList> fList("list"); static TemplateFilterFactory::AutoRegister<FilterLower> fLower("lower"); @@ -2360,6 +2389,7 @@ class TemplateStructWeakRef : public TemplateStructIntf public: TemplateStructWeakRef(TemplateStructIntf *ref) : m_ref(ref), m_refCount(0) {} virtual TemplateVariant get(const QCString &name) const { return m_ref->get(name); } + virtual StringVector fields() const { return m_ref->fields(); } virtual int addRef() { return ++m_refCount; } virtual int release() { int count=--m_refCount; if (count<=0) { delete this; } return count; } private: @@ -5301,4 +5331,50 @@ void TemplateEngine::setTemplateDir(const QCString &dirName) p->setTemplateDir(dirName); } +//----------------------------------------------------------------------------------------- + +QCString TemplateVariant::listToString() const +{ + QCString result="["; + TemplateListIntf *list = toList(); + if (list) + { + bool first=true; + TemplateVariant ve; + TemplateListIntf::ConstIterator *it = list->createIterator(); + for (it->toFirst();it->current(ve);it->toNext()) + { + if (!first) result+=",\n"; + result+="'"+ve.toString()+"'"; + first=false; + } + delete it; + } + result+="]"; + return result; +} + +QCString TemplateVariant::structToString() const +{ + QCString result="{"; + TemplateStructIntf *strukt = toStruct(); + if (strukt) + { + bool first=true; + for (const auto &s : strukt->fields()) + { + if (!first) result+=","; + result+=s; + if (dynamic_cast<TemplateStructWeakRef*>(strukt)==0) // avoid endless recursion + { + result+=":'"; + result+=strukt->get(QCString(s)).toString(); + result+="'"; + } + first=false; + } + } + result+="}"; + return result; +} diff --git a/src/template.h b/src/template.h index 18e8b06..7d803a3 100644 --- a/src/template.h +++ b/src/template.h @@ -19,6 +19,7 @@ #include <vector> #include "qcstring.h" +#include "containers.h" class TemplateListIntf; class TemplateStructIntf; @@ -231,6 +232,9 @@ class TemplateVariant } } + QCString listToString() const; + QCString structToString() const; + /** Returns the variant as a string. */ QCString toString() const { @@ -240,8 +244,8 @@ class TemplateVariant case Bool: return m_boolVal ? "true" : "false"; case Integer: return QCString().setNum(m_intVal); case String: return m_strVal; - case Struct: return "[struct]"; - case List: return "[list]"; + case Struct: return structToString(); + case List: return listToString(); case Function: return "[function]"; } return QCString(); @@ -417,6 +421,9 @@ class TemplateStructIntf */ virtual TemplateVariant get(const QCString &name) const = 0; + /** Return the list of fields. */ + virtual StringVector fields() const = 0; + /** Increase object's reference count */ virtual int addRef() = 0; @@ -431,6 +438,7 @@ class TemplateStruct : public TemplateStructIntf public: // TemplateStructIntf methods virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; virtual int addRef(); virtual int release(); |