diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-09 10:53:07 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-13 10:02:42 (GMT) |
commit | ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a (patch) | |
tree | 644b3706cf39c3d7dd4acf28ce94dfa0d9ff4a4b | |
parent | 3941a16cc77f317329596b01294e021c150f88da (diff) | |
download | Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.zip Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.tar.gz Doxygen-ded4e9a92670d0157cdcc5cbf7a4a1e3193e179a.tar.bz2 |
Made several improvements to the performance of template engine
-rw-r--r-- | qtools/qgdict.cpp | 26 | ||||
-rw-r--r-- | src/context.cpp | 2887 | ||||
-rw-r--r-- | src/definition.cpp | 7 | ||||
-rw-r--r-- | src/definition.h | 7 | ||||
-rw-r--r-- | src/template.cpp | 274 | ||||
-rw-r--r-- | src/template.h | 103 |
6 files changed, 1895 insertions, 1409 deletions
diff --git a/qtools/qgdict.cpp b/qtools/qgdict.cpp index 2530986..4fe1a26 100644 --- a/qtools/qgdict.cpp +++ b/qtools/qgdict.cpp @@ -154,6 +154,32 @@ int QGDict::hashKeyAscii( const char *key ) return index; } +#if 0 +int QGDict::hashKeyAscii( const char *key ) +{ +#if defined(CHECK_NULL) + if ( key == 0 ) + { + qWarning( "QGDict::hashAsciiKey: Invalid null key" ); + return 0; + } +#endif + unsigned int hash = 5381; + int c; + // use djb2 by Dan Bernstein + if (cases) + { + while ((c=*key++)) hash = ((hash<<5)+hash)+c; + } + else + { + while ((c=*key++)) hash = ((hash<<5)+hash)+tolower(c); + } + int index = hash; + return index<0 ? -index : index; +} +#endif + #ifndef QT_NO_DATASTREAM /*! diff --git a/src/context.cpp b/src/context.cpp index c1cc57f..d32f6ea 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -221,38 +221,35 @@ class GenericNodeListContext : public TemplateListIntf //------------------------------------------------------------------------ /** @brief Helper class to map a property name to a handler member function */ -class PropertyMapper +template<typename T> +class PropertyMapper { private: struct PropertyFuncIntf { virtual ~PropertyFuncIntf() {} - virtual TemplateVariant operator()() const = 0; + virtual TemplateVariant operator()(const T *obj) const = 0; }; - template<typename T> struct PropertyFunc : public PropertyFuncIntf { typedef TemplateVariant (T::*Handler)() const; - PropertyFunc(const T *o,Handler h) : obj(o), handler(h) {} - TemplateVariant operator()() const + PropertyFunc(Handler h) : handler(h) {} + TemplateVariant operator()(const T *obj) const { return (obj->*handler)(); } - const T *obj; Handler handler; }; public: - PropertyMapper() { m_map.setAutoDelete(TRUE); } + PropertyMapper() : m_map(63) { m_map.setAutoDelete(TRUE); } /** Add a property to the map * @param[in] name The name of the property to add. * @param[in] obj The object handling access to the property. * @param[in] handle The method to call when the property is accessed. */ - template<typename T> - void addProperty(const char *name,const T* obj, - typename PropertyFunc<T>::Handler handle) + void addProperty(const char *name,typename PropertyFunc::Handler handle) { if (m_map.find(name)) { @@ -260,7 +257,7 @@ class PropertyMapper } else { - m_map.insert(name,new PropertyFunc<T>(obj,handle)); + m_map.insert(name,new PropertyFunc(handle)); } } @@ -269,14 +266,14 @@ class PropertyMapper * @returns A variant representing the properties value or an * invalid variant if it was not found. */ - TemplateVariant get(const char *name) const + TemplateVariant get(const T *obj,const char *name) const { //printf("PropertyMapper::get(%s)\n",name); TemplateVariant result; PropertyFuncIntf *func = m_map.find(name); if (func) { - result = (*func)(); + result = (*func)(obj); } return result; } @@ -363,7 +360,7 @@ TemplateVariant ConfigContext::get(const char *name) const //%% struct Doxygen: global information //%% { -class DoxygenContext::Private : public PropertyMapper +class DoxygenContext::Private { public: TemplateVariant version() const @@ -380,12 +377,21 @@ class DoxygenContext::Private : public PropertyMapper } Private() { - //%% string version - addProperty("version",this,&Private::version); //makeProperty(this,&Private::version)); - //%% string date - addProperty("date", this,&Private::date); - //%% string maxJaxCodeFile - addProperty("mathJaxCodeFile", this,&Private::maxJaxCodeFile); + static bool init=FALSE; + if (!init) + { + //%% string version + s_inst.addProperty("version", &Private::version); + //%% string date + s_inst.addProperty("date", &Private::date); + //%% string maxJaxCodeFile + s_inst.addProperty("mathJaxCodeFile", &Private::maxJaxCodeFile); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } private: struct Cachable @@ -394,9 +400,13 @@ class DoxygenContext::Private : public PropertyMapper QCString maxJaxCodeFile; }; mutable Cachable m_cache; + static PropertyMapper<DoxygenContext::Private> s_inst; }; //%% } +PropertyMapper<DoxygenContext::Private> DoxygenContext::Private::s_inst; +// (PropertyMapper<DoxygenContext::Private>::instance()); + DoxygenContext::DoxygenContext() : RefCountedContext("DoxygenContext") { p = new Private; @@ -416,7 +426,7 @@ TemplateVariant DoxygenContext::get(const char *n) const //%% struct Translator: translation methods //%% { -class TranslateContext::Private : public PropertyMapper +class TranslateContext::Private { public: @@ -990,202 +1000,215 @@ class TranslateContext::Private : public PropertyMapper } Private() { - //%% string generatedBy - addProperty("generatedBy", this,&Private::generatedBy); - //%% string generatedAt - addProperty("generatedAt", this,&Private::generatedAt); - //%% string search - addProperty("search", this,&Private::search); - //%% string mainPage - addProperty("mainPage", this,&Private::mainPage); - //%% string classes - addProperty("classes", this,&Private::classes); - //%% string classList - addProperty("classList", this,&Private::classList); - //%% string classListDescription - addProperty("classListDescription", this,&Private::classListDescription); - //%% string classIndex - addProperty("classIndex", this,&Private::classIndex); - //%% string namespaceIndex - addProperty("namespaceIndex", this,&Private::namespaceIndex); - //%% string classHierarchy - addProperty("classHierarchy", this,&Private::classHierarchy); - //%% string classMembers - addProperty("classMembers", this,&Private::classMembers); - //%% string classMembersDescription - addProperty("classMembersDescription",this,&Private::classMembersDescription); - //%% string modules - addProperty("modules", this,&Private::modules); - //%% string moduleIndex - addProperty("moduleIndex", this,&Private::moduleIndex); - //%% string namespaces - addProperty("namespaces", this,&Private::namespaces); - //%% string fileIndex - addProperty("fileIndex", this,&Private::fileIndex); - //%% string files - addProperty("files", this,&Private::files); - //%% string pages - addProperty("pages", this,&Private::pages); - //%% string examples - addProperty("examples", this,&Private::examples); - //%% string namespaceList - addProperty("namespaceList", this,&Private::namespaceList); - //%% string namespaceMembers - addProperty("namespaceMembers", this,&Private::namespaceMembers); - //%% srting fileList - addProperty("fileList", this,&Private::fileList); - //%% string fileMembers - addProperty("fileMembers", this,&Private::fileMembers); - //%% string fileMembersDescription - addProperty("fileMembersDescription", this,&Private::fileMembersDescription); - //%% string relatedPagesDescripiton - addProperty("relatedPagesDesc", this,&Private::relatedPagesDesc); - //%% string more - addProperty("more", this,&Private::more); - //%% string detailedDescription - addProperty("detailedDesc", this,&Private::detailedDesc); - //%% string inheritanceDiagramFor - addProperty("inheritanceDiagramFor", this,&Private::inheritanceDiagramFor); - //%% string collaborationDiagramFor - addProperty("collaborationDiagramFor", this,&Private::collaborationDiagramFor); - //%% markerstring inheritsList - addProperty("inheritsList", this,&Private::inheritsList); - //%% markerstring inheritedByList - addProperty("inheritedByList", this,&Private::inheritedByList); - //%% markerstring definedAtLineInSourceFile - addProperty("definedAtLineInSourceFile", this,&Private::definedAtLineInSourceFile); - //%% string typeConstraints - addProperty("typeConstraints", this,&Private::typeConstraints); - //%% string exampleList - addProperty("exampleList", this,&Private::exampleList); - //%% string listOfAllMembers - addProperty("listOfAllMembers", this,&Private::listOfAllMembers); - //%% string memberList - addProperty("memberList", this,&Private::memberList); - //%% string theListOfAllMembers - addProperty("theListOfAllMembers",this,&Private::theListOfAllMembers); - //%% string incInheritedMembers - addProperty("incInheritedMembers",this,&Private::incInheritedMembers); - //%% string defineValue - addProperty("defineValue", this,&Private::defineValue); - //%% string initialValue - addProperty("initialValue", this,&Private::initialValue); - //%% markerstring implements - addProperty("implements", this,&Private::implements); - //%% markerstring reimplements - addProperty("reimplements", this,&Private::reimplements); - //%% markerstring implementedBy - addProperty("implementedBy", this,&Private::implementedBy); - //%% markerstring reimplementedBy - addProperty("reimplementedBy", this,&Private::reimplementedBy); - //%% markerstring sourceRefs - addProperty("sourceRefs", this,&Private::sourceRefs); - //%% markerstring sourceRefBys - addProperty("sourceRefBys", this,&Private::sourceRefBys); - //%% string callGraph - addProperty("callGraph", this,&Private::callGraph); - //%% string callerGraph - addProperty("callerGraph", this,&Private::callerGraph); - //%% markerstring inheritedFrom - addProperty("inheritedFrom", this,&Private::inheritedFrom); - //%% string addtionalInheritedMembers - addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers); - //%% string includeDependencyGraph:container_name - addProperty("includeDependencyGraph",this,&Private::includeDependencyGraph); - //%% string includedByDependencyGraph - addProperty("includedByDependencyGraph",this,&Private::includedByDependencyGraph); - //%% string gotoSourceCode - addProperty("gotoSourceCode", this,&Private::gotoSourceCode); - //%% string gotoDocumentation - addProperty("gotoDocumentation", this,&Private::gotoDocumentation); - //%% string constantgroups - addProperty("constantgroups", this,&Private::constantgroups); - //%% string classDocumentation - addProperty("classDocumentation", this,&Private::classDocumentation); - //%% string namespaceDocumentation - addProperty("namespaceDocumentation", this,&Private::namespaceDocumentation); - //%% string moduleDocumentation - addProperty("moduleDocumentation",this,&Private::moduleDocumentation); - //%% string fileDocumentation - addProperty("fileDocumentation", this,&Private::fileDocumentation); - //%% string compoundMembers - addProperty("compoundMembers", this,&Private::compoundMembers); - //%% string detailLevel - addProperty("detailLevel", this,&Private::detailLevel); - //%% string fileListDescription - addProperty("fileListDescription",this,&Private::fileListDescription); - //%% string namespaceListDescription - addProperty("namespaceListDescription",this,&Private::namespaceListDescription); - //%% string directories - addProperty("directories", this,&Private::directories); - //%% string moduleDescription - addProperty("modulesDescription", this,&Private::modulesDescription); - //%% string all - addProperty("all", this,&Private::all); - //%% string functions - addProperty("functions", this,&Private::functions); - //%% string variables - addProperty("variables", this,&Private::variables); - //%% string typedefs - addProperty("typedefs", this,&Private::typedefs); - //%% string enums - addProperty("enums", this,&Private::enums); - //%% string enumValues - addProperty("enumValues", this,&Private::enumerationValues); - //%% string properties - addProperty("properties", this,&Private::properties); - //%% string events - addProperty("events", this,&Private::events); - //%% string related - addProperty("related", this,&Private::related); - //%% string macros - addProperty("macros", this,&Private::macros); - //%% string namespaceMembersDescription - addProperty("namespaceMembersDescription",this,&Private::namespaceMembersDescription); - //%% string classHierarchyDescription - addProperty("classHierarchyDescription",this,&Private::classHierarchyDescription); - //%% string gotoGraphicalHierarchy - addProperty("gotoGraphicalHierarchy",this,&Private::gotoGraphicalHierarchy); - //%% string gotoTextualHierarchy - addProperty("gotoTextualHierarchy",this,&Private::gotoTextualHierarchy); - //%% string loading - addProperty("loading", this,&Private::loading); - //%% string searching - addProperty("searching", this,&Private::searching); - //%% string noMatches - addProperty("noMatches", this,&Private::noMatches); - //%% string enumValue - addProperty("enumValue", this,&Private::enumValue); - //%% string enumName - addProperty("enumName", this,&Private::enumName); - //%% string referenceManual - addProperty("referenceManual", this,&Private::referenceManual); - //%% string index - addProperty("index", this,&Private::index); - //%% string panelSyncOn - addProperty("panelSyncOn", this,&Private::panelSyncOn); - //%% string panelSyncOff - addProperty("panelSyncOff", this,&Private::panelSyncOff); - //%% string dirDependencyGraph - addProperty("dirDependencyGraphFor", this,&Private::dirDependencyGraphFor); - //%% string providedByCategory - addProperty("providedByCategory", this,&Private::providedByCategory); - //%% string extendsClass - addProperty("extendsClass", this,&Private::extendsClass); - //%% string examplesDescription - addProperty("examplesDescription",this,&Private::examplesDescription); + static bool init=FALSE; + if (!init) + { + //%% string generatedBy + s_inst.addProperty("generatedBy", &Private::generatedBy); + //%% string generatedAt + s_inst.addProperty("generatedAt", &Private::generatedAt); + //%% string search + s_inst.addProperty("search", &Private::search); + //%% string mainPage + s_inst.addProperty("mainPage", &Private::mainPage); + //%% string classes + s_inst.addProperty("classes", &Private::classes); + //%% string classList + s_inst.addProperty("classList", &Private::classList); + //%% string classListDescription + s_inst.addProperty("classListDescription", &Private::classListDescription); + //%% string classIndex + s_inst.addProperty("classIndex", &Private::classIndex); + //%% string namespaceIndex + s_inst.addProperty("namespaceIndex", &Private::namespaceIndex); + //%% string classHierarchy + s_inst.addProperty("classHierarchy", &Private::classHierarchy); + //%% string classMembers + s_inst.addProperty("classMembers", &Private::classMembers); + //%% string classMembersDescription + s_inst.addProperty("classMembersDescription",&Private::classMembersDescription); + //%% string modules + s_inst.addProperty("modules", &Private::modules); + //%% string moduleIndex + s_inst.addProperty("moduleIndex", &Private::moduleIndex); + //%% string namespaces + s_inst.addProperty("namespaces", &Private::namespaces); + //%% string fileIndex + s_inst.addProperty("fileIndex", &Private::fileIndex); + //%% string files + s_inst.addProperty("files", &Private::files); + //%% string pages + s_inst.addProperty("pages", &Private::pages); + //%% string examples + s_inst.addProperty("examples", &Private::examples); + //%% string namespaceList + s_inst.addProperty("namespaceList", &Private::namespaceList); + //%% string namespaceMembers + s_inst.addProperty("namespaceMembers", &Private::namespaceMembers); + //%% srting fileList + s_inst.addProperty("fileList", &Private::fileList); + //%% string fileMembers + s_inst.addProperty("fileMembers", &Private::fileMembers); + //%% string fileMembersDescription + s_inst.addProperty("fileMembersDescription", &Private::fileMembersDescription); + //%% string relatedPagesDescripiton + s_inst.addProperty("relatedPagesDesc", &Private::relatedPagesDesc); + //%% string more + s_inst.addProperty("more", &Private::more); + //%% string detailedDescription + s_inst.addProperty("detailedDesc", &Private::detailedDesc); + //%% string inheritanceDiagramFor + s_inst.addProperty("inheritanceDiagramFor", &Private::inheritanceDiagramFor); + //%% string collaborationDiagramFor + s_inst.addProperty("collaborationDiagramFor", &Private::collaborationDiagramFor); + //%% markerstring inheritsList + s_inst.addProperty("inheritsList", &Private::inheritsList); + //%% markerstring inheritedByList + s_inst.addProperty("inheritedByList", &Private::inheritedByList); + //%% markerstring definedAtLineInSourceFile + s_inst.addProperty("definedAtLineInSourceFile", &Private::definedAtLineInSourceFile); + //%% string typeConstraints + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + //%% string exampleList + s_inst.addProperty("exampleList", &Private::exampleList); + //%% string listOfAllMembers + s_inst.addProperty("listOfAllMembers", &Private::listOfAllMembers); + //%% string memberList + s_inst.addProperty("memberList", &Private::memberList); + //%% string theListOfAllMembers + s_inst.addProperty("theListOfAllMembers",&Private::theListOfAllMembers); + //%% string incInheritedMembers + s_inst.addProperty("incInheritedMembers",&Private::incInheritedMembers); + //%% string defineValue + s_inst.addProperty("defineValue", &Private::defineValue); + //%% string initialValue + s_inst.addProperty("initialValue", &Private::initialValue); + //%% markerstring implements + s_inst.addProperty("implements", &Private::implements); + //%% markerstring reimplements + s_inst.addProperty("reimplements", &Private::reimplements); + //%% markerstring implementedBy + s_inst.addProperty("implementedBy", &Private::implementedBy); + //%% markerstring reimplementedBy + s_inst.addProperty("reimplementedBy", &Private::reimplementedBy); + //%% markerstring sourceRefs + s_inst.addProperty("sourceRefs", &Private::sourceRefs); + //%% markerstring sourceRefBys + s_inst.addProperty("sourceRefBys", &Private::sourceRefBys); + //%% string callGraph + s_inst.addProperty("callGraph", &Private::callGraph); + //%% string callerGraph + s_inst.addProperty("callerGraph", &Private::callerGraph); + //%% markerstring inheritedFrom + s_inst.addProperty("inheritedFrom", &Private::inheritedFrom); + //%% string addtionalInheritedMembers + s_inst.addProperty("additionalInheritedMembers",&Private::additionalInheritedMembers); + //%% string includeDependencyGraph:container_name + s_inst.addProperty("includeDependencyGraph",&Private::includeDependencyGraph); + //%% string includedByDependencyGraph + s_inst.addProperty("includedByDependencyGraph",&Private::includedByDependencyGraph); + //%% string gotoSourceCode + s_inst.addProperty("gotoSourceCode", &Private::gotoSourceCode); + //%% string gotoDocumentation + s_inst.addProperty("gotoDocumentation", &Private::gotoDocumentation); + //%% string constantgroups + s_inst.addProperty("constantgroups", &Private::constantgroups); + //%% string classDocumentation + s_inst.addProperty("classDocumentation", &Private::classDocumentation); + //%% string namespaceDocumentation + s_inst.addProperty("namespaceDocumentation", &Private::namespaceDocumentation); + //%% string moduleDocumentation + s_inst.addProperty("moduleDocumentation",&Private::moduleDocumentation); + //%% string fileDocumentation + s_inst.addProperty("fileDocumentation", &Private::fileDocumentation); + //%% string compoundMembers + s_inst.addProperty("compoundMembers", &Private::compoundMembers); + //%% string detailLevel + s_inst.addProperty("detailLevel", &Private::detailLevel); + //%% string fileListDescription + s_inst.addProperty("fileListDescription",&Private::fileListDescription); + //%% string namespaceListDescription + s_inst.addProperty("namespaceListDescription",&Private::namespaceListDescription); + //%% string directories + s_inst.addProperty("directories", &Private::directories); + //%% string moduleDescription + s_inst.addProperty("modulesDescription", &Private::modulesDescription); + //%% string all + s_inst.addProperty("all", &Private::all); + //%% string functions + s_inst.addProperty("functions", &Private::functions); + //%% string variables + s_inst.addProperty("variables", &Private::variables); + //%% string typedefs + s_inst.addProperty("typedefs", &Private::typedefs); + //%% string enums + s_inst.addProperty("enums", &Private::enums); + //%% string enumValues + s_inst.addProperty("enumValues", &Private::enumerationValues); + //%% string properties + s_inst.addProperty("properties", &Private::properties); + //%% string events + s_inst.addProperty("events", &Private::events); + //%% string related + s_inst.addProperty("related", &Private::related); + //%% string macros + s_inst.addProperty("macros", &Private::macros); + //%% string namespaceMembersDescription + s_inst.addProperty("namespaceMembersDescription",&Private::namespaceMembersDescription); + //%% string classHierarchyDescription + s_inst.addProperty("classHierarchyDescription",&Private::classHierarchyDescription); + //%% string gotoGraphicalHierarchy + s_inst.addProperty("gotoGraphicalHierarchy",&Private::gotoGraphicalHierarchy); + //%% string gotoTextualHierarchy + s_inst.addProperty("gotoTextualHierarchy",&Private::gotoTextualHierarchy); + //%% string loading + s_inst.addProperty("loading", &Private::loading); + //%% string searching + s_inst.addProperty("searching", &Private::searching); + //%% string noMatches + s_inst.addProperty("noMatches", &Private::noMatches); + //%% string enumValue + s_inst.addProperty("enumValue", &Private::enumValue); + //%% string enumName + s_inst.addProperty("enumName", &Private::enumName); + //%% string referenceManual + s_inst.addProperty("referenceManual", &Private::referenceManual); + //%% string index + s_inst.addProperty("index", &Private::index); + //%% string panelSyncOn + s_inst.addProperty("panelSyncOn", &Private::panelSyncOn); + //%% string panelSyncOff + s_inst.addProperty("panelSyncOff", &Private::panelSyncOff); + //%% string dirDependencyGraph + s_inst.addProperty("dirDependencyGraphFor", &Private::dirDependencyGraphFor); + //%% string providedByCategory + s_inst.addProperty("providedByCategory", &Private::providedByCategory); + //%% string extendsClass + s_inst.addProperty("extendsClass", &Private::extendsClass); + //%% string examplesDescription + s_inst.addProperty("examplesDescription",&Private::examplesDescription); + + init=TRUE; + } m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); m_vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } private: bool m_javaOpt; bool m_fortranOpt; bool m_vhdlOpt; + static PropertyMapper<TranslateContext::Private> s_inst; }; //%% } +PropertyMapper<TranslateContext::Private> TranslateContext::Private::s_inst; + TranslateContext::TranslateContext() : RefCountedContext("TranslateContext") { p = new Private; @@ -1331,81 +1354,51 @@ static TemplateVariant parseCode(FileDef *fd,const QCString &relPath) //%% struct Symbol: shared info for all symbols //%% { template<typename T> -class DefinitionContext : public PropertyMapper +class DefinitionContext { public: DefinitionContext(Definition *d) : m_def(d) { assert(d!=0); + } + void addBaseProperties(PropertyMapper<T> &inst) + { //%% string name: the name of the symbol - addProperty("name",this,&DefinitionContext::name); + inst.addProperty("name",&DefinitionContext::name); //%% string bareName: the bare name of the symbol with scope info - addProperty("bareName",this,&DefinitionContext::bareName); + inst.addProperty("bareName",&DefinitionContext::bareName); //%% string relPath: the relative path to the root of the output (CREATE_SUBDIRS) - addProperty("relPath",this,&DefinitionContext::relPath); + inst.addProperty("relPath",&DefinitionContext::relPath); //%% string fileName: the file name of the output file associated with the symbol (without extension) - addProperty("fileName",this,&DefinitionContext::fileName); + inst.addProperty("fileName",&DefinitionContext::fileName); //%% string anchor: anchor within the page - addProperty("anchor",this,&DefinitionContext::anchor); + inst.addProperty("anchor",&DefinitionContext::anchor); //%% string details: the detailed documentation for this symbol - addProperty("details",this,&DefinitionContext::details); + inst.addProperty("details",&DefinitionContext::details); //%% string brief: the brief description for this symbol - addProperty("brief",this,&DefinitionContext::brief); + inst.addProperty("brief",&DefinitionContext::brief); //%% string inbodyDocs: the documentation found in the body - addProperty("inbodyDocs",this,&DefinitionContext::inbodyDocs); + inst.addProperty("inbodyDocs",&DefinitionContext::inbodyDocs); //%% string sourceFileName: the file name of the source file (without extension) - addProperty("sourceFileName",this,&DefinitionContext::sourceFileName); + inst.addProperty("sourceFileName",&DefinitionContext::sourceFileName); //%% bool isLinkable: can the symbol be linked to? - addProperty("isLinkable",this,&DefinitionContext::isLinkable); + inst.addProperty("isLinkable",&DefinitionContext::isLinkable); //%% bool isLinkableInProject: can the symbol be linked within this project? - addProperty("isLinkableInProject",this,&DefinitionContext::isLinkableInProject); + inst.addProperty("isLinkableInProject",&DefinitionContext::isLinkableInProject); //%% int dynSectionId: identifier that can be used for collapsable sections - addProperty("dynSectionId",this,&DefinitionContext::dynSectionId); + inst.addProperty("dynSectionId",&DefinitionContext::dynSectionId); //%% string language: the programming language in which the symbol is written - addProperty("language",this,&DefinitionContext::language); + inst.addProperty("language",&DefinitionContext::language); //%% string sourceDef: A link to the source definition - addProperty("sourceDef",this,&DefinitionContext::sourceDef); + inst.addProperty("sourceDef",&DefinitionContext::sourceDef); //%% list[Definition] navigationPath: Breadcrumb navigation path to this item - addProperty("navigationPath",this,&DefinitionContext::navigationPath); + inst.addProperty("navigationPath",&DefinitionContext::navigationPath); //%% string kind: Kind of compound object: class, namespace, module, package, page, dir - addProperty("compoundKind",this,&DefinitionContext::compoundKind); + inst.addProperty("compoundKind",&DefinitionContext::compoundKind); //%% bool isReference: is this definition imported via a tag file - addProperty("isReference",this,&DefinitionContext::isReference); + inst.addProperty("isReference",&DefinitionContext::isReference); //%% string externalReference: the link to the element in the remote documentation - addProperty("externalReference",this,&DefinitionContext::externalReference); - - m_cache.sourceDef.reset(TemplateList::alloc()); - m_cache.lineLink.reset(TemplateStruct::alloc()); - m_cache.fileLink.reset(TemplateStruct::alloc()); - - if (m_def && !m_def->getSourceFileBase().isEmpty()) - { - m_cache.lineLink->set("text",m_def->getStartBodyLine()); - m_cache.lineLink->set("isLinkable",TRUE); - m_cache.lineLink->set("fileName",m_def->getSourceFileBase()); - m_cache.lineLink->set("anchor",m_def->getSourceAnchor()); - m_cache.lineLink->set("isReference",FALSE); - m_cache.lineLink->set("externalReference",""); - if (m_def->definitionType()==Definition::TypeFile) - { - m_cache.fileLink->set("text",m_def->name()); - } - else if (m_def->getBodyDef()) - { - m_cache.fileLink->set("text",m_def->getBodyDef()->name()); - } - else - { - m_cache.fileLink->set("text",name()); - } - m_cache.fileLink->set("isLinkable",TRUE); - m_cache.fileLink->set("fileName",m_def->getSourceFileBase()); - m_cache.fileLink->set("anchor",QCString()); - m_cache.fileLink->set("isReference",FALSE); - m_cache.fileLink->set("externalReference",""); - m_cache.sourceDef->append(m_cache.lineLink.get()); - m_cache.sourceDef->append(m_cache.fileLink.get()); - } + inst.addProperty("externalReference",&DefinitionContext::externalReference); } TemplateVariant fileName() const { @@ -1446,47 +1439,50 @@ class DefinitionContext : public PropertyMapper } TemplateVariant details() const { - if (!m_cache.details || g_globals.outputFormat!=m_cache.detailsOutputFormat) + Cachable &cache = getCache(); + if (!cache.details || g_globals.outputFormat!=cache.detailsOutputFormat) { - m_cache.details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(), + cache.details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(), relPathAsString(),m_def->documentation(),FALSE))); - m_cache.detailsOutputFormat = g_globals.outputFormat; + cache.detailsOutputFormat = g_globals.outputFormat; } - return *m_cache.details; + return *cache.details; } TemplateVariant brief() const { - if (!m_cache.brief || g_globals.outputFormat!=m_cache.briefOutputFormat) + Cachable &cache = getCache(); + if (!cache.brief || g_globals.outputFormat!=cache.briefOutputFormat) { if (m_def->hasBriefDescription()) { - m_cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), + cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), relPathAsString(),m_def->briefDescription(),TRUE))); - m_cache.briefOutputFormat = g_globals.outputFormat; + cache.briefOutputFormat = g_globals.outputFormat; } else { - m_cache.brief.reset(new TemplateVariant("")); + cache.brief.reset(new TemplateVariant("")); } } - return *m_cache.brief; + return *cache.brief; } TemplateVariant inbodyDocs() const { - if (!m_cache.inbodyDocs || g_globals.outputFormat!=m_cache.inbodyDocsOutputFormat) + Cachable &cache = getCache(); + if (!cache.inbodyDocs || g_globals.outputFormat!=cache.inbodyDocsOutputFormat) { if (!m_def->inbodyDocumentation().isEmpty()) { - m_cache.inbodyDocs.reset(new TemplateVariant(parseDoc(m_def,m_def->inbodyFile(),m_def->inbodyLine(), + cache.inbodyDocs.reset(new TemplateVariant(parseDoc(m_def,m_def->inbodyFile(),m_def->inbodyLine(), relPathAsString(),m_def->inbodyDocumentation(),FALSE))); - m_cache.inbodyDocsOutputFormat = g_globals.outputFormat; + cache.inbodyDocsOutputFormat = g_globals.outputFormat; } else { - m_cache.inbodyDocs.reset(new TemplateVariant("")); + cache.inbodyDocs.reset(new TemplateVariant("")); } } - return *m_cache.inbodyDocs; + return *cache.inbodyDocs; } TemplateVariant dynSectionId() const { @@ -1536,9 +1532,10 @@ class DefinitionContext : public PropertyMapper } TemplateVariant sourceDef() const { - if (m_cache.sourceDef->count()==2) + Cachable &cache = getCache(); + if (cache.sourceDef->count()==2) { - return m_cache.sourceDef.get(); + return cache.sourceDef.get(); } else { @@ -1561,7 +1558,8 @@ class DefinitionContext : public PropertyMapper } TemplateVariant navigationPath() const { - if (!m_cache.navPath) + Cachable &cache = getCache(); + if (!cache.navPath) { TemplateList *list = TemplateList::alloc(); if (m_def->getOuterScope() && m_def->getOuterScope()!=Doxygen::globalScope) @@ -1572,9 +1570,9 @@ class DefinitionContext : public PropertyMapper { fillPath(((const FileDef *)m_def)->getDirDef(),list); } - m_cache.navPath.reset(list); + cache.navPath.reset(list); } - return m_cache.navPath.get(); + return cache.navPath.get(); } TemplateVariant isReference() const { @@ -1585,13 +1583,46 @@ class DefinitionContext : public PropertyMapper return m_def->externalReference(relPathAsString()); } - private: - Definition *m_def; - struct Cachable + protected: + struct Cachable : public Definition::Cookie { - Cachable() : detailsOutputFormat(ContextOutputFormat_Unspecified), - briefOutputFormat(ContextOutputFormat_Unspecified), - inbodyDocsOutputFormat(ContextOutputFormat_Unspecified) { } + Cachable(Definition *def) : detailsOutputFormat(ContextOutputFormat_Unspecified), + briefOutputFormat(ContextOutputFormat_Unspecified), + inbodyDocsOutputFormat(ContextOutputFormat_Unspecified) + { + sourceDef.reset(TemplateList::alloc()); + lineLink.reset(TemplateStruct::alloc()); + fileLink.reset(TemplateStruct::alloc()); + + if (def && !def->getSourceFileBase().isEmpty()) + { + lineLink->set("text",def->getStartBodyLine()); + lineLink->set("isLinkable",TRUE); + lineLink->set("fileName",def->getSourceFileBase()); + lineLink->set("anchor",def->getSourceAnchor()); + lineLink->set("isReference",FALSE); + lineLink->set("externalReference",""); + if (def->definitionType()==Definition::TypeFile) + { + fileLink->set("text",def->name()); + } + else if (def->getBodyDef()) + { + fileLink->set("text",def->getBodyDef()->name()); + } + else + { + fileLink->set("text",def->displayName(TRUE)); + } + fileLink->set("isLinkable",TRUE); + fileLink->set("fileName",def->getSourceFileBase()); + fileLink->set("anchor",QCString()); + fileLink->set("isReference",FALSE); + fileLink->set("externalReference",""); + sourceDef->append(lineLink.get()); + sourceDef->append(fileLink.get()); + } + } ScopedPtr<TemplateVariant> details; ContextOutputFormat detailsOutputFormat; ScopedPtr<TemplateVariant> brief; @@ -1603,7 +1634,16 @@ class DefinitionContext : public PropertyMapper SharedPtr<TemplateStruct> fileLink; SharedPtr<TemplateStruct> lineLink; }; - mutable Cachable m_cache; + + + private: + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_def->cookie()); + assert(c!=0); + return *c; + } + Definition *m_def; }; //%% } @@ -1611,21 +1651,27 @@ class DefinitionContext : public PropertyMapper //%% struct IncludeInfo: include file information //%% { -class IncludeInfoContext::Private : public PropertyMapper +class IncludeInfoContext::Private { public: Private(const IncludeInfo *info,SrcLangExt lang) : m_info(info), m_lang(lang) { - if (m_info) + static bool init=FALSE; + if (!init) { - addProperty("file",this,&Private::file); - addProperty("name",this,&Private::name); - addProperty("isImport",this,&Private::isImport); - addProperty("isLocal",this,&Private::isLocal); + s_inst.addProperty("file",&Private::file); + s_inst.addProperty("name",&Private::name); + s_inst.addProperty("isImport",&Private::isImport); + s_inst.addProperty("isLocal",&Private::isLocal); + init=TRUE; } } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant isLocal() const { bool isIDLorJava = m_lang==SrcLangExt_IDL || m_lang==SrcLangExt_Java; @@ -1658,8 +1704,11 @@ class IncludeInfoContext::Private : public PropertyMapper const IncludeInfo *m_info; mutable SharedPtr<FileContext> m_fileContext; SrcLangExt m_lang; + static PropertyMapper<IncludeInfoContext::Private> s_inst; }; +PropertyMapper<IncludeInfoContext::Private> IncludeInfoContext::Private::s_inst; + IncludeInfoContext::IncludeInfoContext(const IncludeInfo *info,SrcLangExt lang) : RefCountedContext("IncludeContext") { p = new Private(info,lang); @@ -1732,74 +1781,85 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd), m_classDef(cd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("generatedFromFiles", this,&Private::generatedFromFiles); - addProperty("usedFiles", this,&Private::usedFiles); - addProperty("hasInheritanceDiagram", this,&Private::hasInheritanceDiagram); - addProperty("inheritanceDiagram", this,&Private::inheritanceDiagram); - addProperty("hasCollaborationDiagram", this,&Private::hasCollaborationDiagram); - addProperty("collaborationDiagram", this,&Private::collaborationDiagram); - addProperty("includeInfo", this,&Private::includeInfo); - addProperty("inherits", this,&Private::inherits); - addProperty("inheritedBy", this,&Private::inheritedBy); - addProperty("unoIDLServices", this,&Private::unoIDLServices); - addProperty("unoIDLInterfaces", this,&Private::unoIDLInterfaces); - addProperty("signals", this,&Private::signals); - addProperty("publicTypes", this,&Private::publicTypes); - addProperty("publicMethods", this,&Private::publicMethods); - addProperty("publicStaticMethods", this,&Private::publicStaticMethods); - addProperty("publicAttributes", this,&Private::publicAttributes); - addProperty("publicStaticAttributes", this,&Private::publicStaticAttributes); - addProperty("publicSlots", this,&Private::publicSlots); - addProperty("protectedTypes", this,&Private::protectedTypes); - addProperty("protectedMethods", this,&Private::protectedMethods); - addProperty("protectedStaticMethods", this,&Private::protectedStaticMethods); - addProperty("protectedAttributes", this,&Private::protectedAttributes); - addProperty("protectedStaticAttributes", this,&Private::protectedStaticAttributes); - addProperty("protectedSlots", this,&Private::protectedSlots); - addProperty("privateTypes", this,&Private::privateTypes); - addProperty("privateMethods", this,&Private::privateMethods); - addProperty("privateStaticMethods", this,&Private::privateStaticMethods); - addProperty("privateAttributes", this,&Private::privateAttributes); - addProperty("privateStaticAttributes", this,&Private::privateStaticAttributes); - addProperty("privateSlots", this,&Private::privateSlots); - addProperty("packageTypes", this,&Private::packageTypes); - addProperty("packageMethods", this,&Private::packageMethods); - addProperty("packageStaticMethods", this,&Private::packageStaticMethods); - addProperty("packageAttributes", this,&Private::packageAttributes); - addProperty("packageStaticAttributes", this,&Private::packageStaticAttributes); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("friends", this,&Private::friends); - addProperty("related", this,&Private::related); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedServices", this,&Private::detailedServices); - addProperty("detailedInterfaces", this,&Private::detailedInterfaces); - addProperty("detailedConstructors", this,&Private::detailedConstructors); - addProperty("detailedMethods", this,&Private::detailedMethods); - addProperty("detailedRelated", this,&Private::detailedRelated); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("detailedProperties", this,&Private::detailedProperties); - addProperty("detailedEvents", this,&Private::detailedEvents); - addProperty("classes", this,&Private::classes); - addProperty("innerClasses", this,&Private::innerClasses); - addProperty("compoundType", this,&Private::compoundType); - addProperty("templateDecls", this,&Private::templateDecls); - addProperty("typeConstraints", this,&Private::typeConstraints); - addProperty("examples", this,&Private::examples); - addProperty("members", this,&Private::members); - addProperty("allMembersList", this,&Private::allMembersList); - addProperty("allMembersFileName", this,&Private::allMembersFileName); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers); - addProperty("isSimple", this,&Private::isSimple); - addProperty("categoryOf", this,&Private::categoryOf); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("generatedFromFiles", &Private::generatedFromFiles); + s_inst.addProperty("usedFiles", &Private::usedFiles); + s_inst.addProperty("hasInheritanceDiagram", &Private::hasInheritanceDiagram); + s_inst.addProperty("inheritanceDiagram", &Private::inheritanceDiagram); + s_inst.addProperty("hasCollaborationDiagram", &Private::hasCollaborationDiagram); + s_inst.addProperty("collaborationDiagram", &Private::collaborationDiagram); + s_inst.addProperty("includeInfo", &Private::includeInfo); + s_inst.addProperty("inherits", &Private::inherits); + s_inst.addProperty("inheritedBy", &Private::inheritedBy); + s_inst.addProperty("unoIDLServices", &Private::unoIDLServices); + s_inst.addProperty("unoIDLInterfaces", &Private::unoIDLInterfaces); + s_inst.addProperty("signals", &Private::signals); + s_inst.addProperty("publicTypes", &Private::publicTypes); + s_inst.addProperty("publicMethods", &Private::publicMethods); + s_inst.addProperty("publicStaticMethods", &Private::publicStaticMethods); + s_inst.addProperty("publicAttributes", &Private::publicAttributes); + s_inst.addProperty("publicStaticAttributes", &Private::publicStaticAttributes); + s_inst.addProperty("publicSlots", &Private::publicSlots); + s_inst.addProperty("protectedTypes", &Private::protectedTypes); + s_inst.addProperty("protectedMethods", &Private::protectedMethods); + s_inst.addProperty("protectedStaticMethods", &Private::protectedStaticMethods); + s_inst.addProperty("protectedAttributes", &Private::protectedAttributes); + s_inst.addProperty("protectedStaticAttributes", &Private::protectedStaticAttributes); + s_inst.addProperty("protectedSlots", &Private::protectedSlots); + s_inst.addProperty("privateTypes", &Private::privateTypes); + s_inst.addProperty("privateMethods", &Private::privateMethods); + s_inst.addProperty("privateStaticMethods", &Private::privateStaticMethods); + s_inst.addProperty("privateAttributes", &Private::privateAttributes); + s_inst.addProperty("privateStaticAttributes", &Private::privateStaticAttributes); + s_inst.addProperty("privateSlots", &Private::privateSlots); + s_inst.addProperty("packageTypes", &Private::packageTypes); + s_inst.addProperty("packageMethods", &Private::packageMethods); + s_inst.addProperty("packageStaticMethods", &Private::packageStaticMethods); + s_inst.addProperty("packageAttributes", &Private::packageAttributes); + s_inst.addProperty("packageStaticAttributes", &Private::packageStaticAttributes); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("friends", &Private::friends); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedServices", &Private::detailedServices); + s_inst.addProperty("detailedInterfaces", &Private::detailedInterfaces); + s_inst.addProperty("detailedConstructors", &Private::detailedConstructors); + s_inst.addProperty("detailedMethods", &Private::detailedMethods); + s_inst.addProperty("detailedRelated", &Private::detailedRelated); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("detailedProperties", &Private::detailedProperties); + s_inst.addProperty("detailedEvents", &Private::detailedEvents); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("innerClasses", &Private::innerClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + s_inst.addProperty("templateDecls", &Private::templateDecls); + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("allMembersList", &Private::allMembersList); + s_inst.addProperty("allMembersFileName", &Private::allMembersFileName); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("additionalInheritedMembers",&Private::additionalInheritedMembers); + s_inst.addProperty("isSimple", &Private::isSimple); + s_inst.addProperty("categoryOf", &Private::categoryOf); + init=TRUE; + } + if (!cd->cookie()) { cd->setCookie(new ClassContext::Private::Cachable(cd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_classDef->title()); @@ -1822,27 +1882,30 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant usedFiles() const { - if (!m_cache.usedFiles) + Cachable &cache = getCache(); + if (!cache.usedFiles) { - m_cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef)); + cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef)); } - return m_cache.usedFiles.get(); + return cache.usedFiles.get(); } DotClassGraph *getClassGraph() const { - if (!m_cache.classGraph) + Cachable &cache = getCache(); + if (!cache.classGraph) { - m_cache.classGraph.reset(new DotClassGraph(m_classDef,DotNode::Inheritance)); + cache.classGraph.reset(new DotClassGraph(m_classDef,DotNode::Inheritance)); } - return m_cache.classGraph.get(); + return cache.classGraph.get(); } int numInheritanceNodes() const { - if (m_cache.inheritanceNodes==-1) + Cachable &cache = getCache(); + if (cache.inheritanceNodes==-1) { - m_cache.inheritanceNodes=m_classDef->countInheritanceNodes(); + cache.inheritanceNodes=m_classDef->countInheritanceNodes(); } - return m_cache.inheritanceNodes>0; + return cache.inheritanceNodes>0; } TemplateVariant hasInheritanceDiagram() const { @@ -1934,11 +1997,12 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } DotClassGraph *getCollaborationGraph() const { - if (!m_cache.collaborationGraph) + Cachable &cache = getCache(); + if (!cache.collaborationGraph) { - m_cache.collaborationGraph.reset(new DotClassGraph(m_classDef,DotNode::Collaboration)); + cache.collaborationGraph.reset(new DotClassGraph(m_classDef,DotNode::Collaboration)); } - return m_cache.collaborationGraph.get(); + return cache.collaborationGraph.get(); } TemplateVariant hasCollaborationDiagram() const { @@ -1985,13 +2049,14 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> TemplateVariant includeInfo() const { - if (!m_cache.includeInfo && m_classDef->includeInfo()) + Cachable &cache = getCache(); + if (!cache.includeInfo && m_classDef->includeInfo()) { - m_cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage())); + cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage())); } - if (m_cache.includeInfo) + if (cache.includeInfo) { - return m_cache.includeInfo.get(); + return cache.includeInfo.get(); } else { @@ -2000,19 +2065,21 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant inherits() const { - if (!m_cache.inheritsList) + Cachable &cache = getCache(); + if (!cache.inheritsList) { - m_cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE)); + cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE)); } - return m_cache.inheritsList.get(); + return cache.inheritsList.get(); } TemplateVariant inheritedBy() const { - if (!m_cache.inheritedByList) + Cachable &cache = getCache(); + if (!cache.inheritedByList) { - m_cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE)); + cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE)); } - return m_cache.inheritedByList.get(); + return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -2036,171 +2103,172 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant unoIDLServices() const { - return getMemberList(m_cache.unoIDLServices,MemberListType_services,theTranslator->trServices()); + return getMemberList(getCache().unoIDLServices,MemberListType_services,theTranslator->trServices()); } TemplateVariant unoIDLInterfaces() const { - return getMemberList(m_cache.unoIDLInterfaces,MemberListType_interfaces,theTranslator->trInterfaces()); + return getMemberList(getCache().unoIDLInterfaces,MemberListType_interfaces,theTranslator->trInterfaces()); } TemplateVariant signals() const { - return getMemberList(m_cache.signals,MemberListType_signals,theTranslator->trSignals()); + return getMemberList(getCache().signals,MemberListType_signals,theTranslator->trSignals()); } TemplateVariant publicTypes() const { - return getMemberList(m_cache.publicTypes,MemberListType_pubTypes,theTranslator->trPublicTypes()); + return getMemberList(getCache().publicTypes,MemberListType_pubTypes,theTranslator->trPublicTypes()); } TemplateVariant publicMethods() const { - return getMemberList(m_cache.publicMethods,MemberListType_pubMethods, + return getMemberList(getCache().publicMethods,MemberListType_pubMethods, m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trInstanceMethods() : theTranslator->trPublicMembers()); } TemplateVariant publicStaticMethods() const { - return getMemberList(m_cache.publicStaticMethods,MemberListType_pubStaticMethods, + return getMemberList(getCache().publicStaticMethods,MemberListType_pubStaticMethods, m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trClassMethods() : theTranslator->trStaticPublicMembers()); } TemplateVariant publicAttributes() const { - return getMemberList(m_cache.publicAttributes,MemberListType_pubAttribs,theTranslator->trPublicAttribs()); + return getMemberList(getCache().publicAttributes,MemberListType_pubAttribs,theTranslator->trPublicAttribs()); } TemplateVariant publicStaticAttributes() const { - return getMemberList(m_cache.publicStaticAttributes,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs()); + return getMemberList(getCache().publicStaticAttributes,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs()); } TemplateVariant publicSlots() const { - return getMemberList(m_cache.publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); + return getMemberList(getCache().publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); } TemplateVariant protectedTypes() const { - return getMemberList(m_cache.protectedTypes,MemberListType_proTypes,theTranslator->trProtectedTypes()); + return getMemberList(getCache().protectedTypes,MemberListType_proTypes,theTranslator->trProtectedTypes()); } TemplateVariant protectedMethods() const { - return getMemberList(m_cache.protectedMethods,MemberListType_proMethods,theTranslator->trProtectedMembers()); + return getMemberList(getCache().protectedMethods,MemberListType_proMethods,theTranslator->trProtectedMembers()); } TemplateVariant protectedStaticMethods() const { - return getMemberList(m_cache.protectedStaticMethods,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers()); + return getMemberList(getCache().protectedStaticMethods,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers()); } TemplateVariant protectedAttributes() const { - return getMemberList(m_cache.protectedAttributes,MemberListType_proAttribs,theTranslator->trProtectedAttribs()); + return getMemberList(getCache().protectedAttributes,MemberListType_proAttribs,theTranslator->trProtectedAttribs()); } TemplateVariant protectedStaticAttributes() const { - return getMemberList(m_cache.protectedStaticAttributes,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs()); + return getMemberList(getCache().protectedStaticAttributes,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs()); } TemplateVariant protectedSlots() const { - return getMemberList(m_cache.protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); + return getMemberList(getCache().protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); } TemplateVariant privateTypes() const { - return getMemberList(m_cache.privateTypes,MemberListType_priTypes,theTranslator->trPrivateTypes()); + return getMemberList(getCache().privateTypes,MemberListType_priTypes,theTranslator->trPrivateTypes()); } TemplateVariant privateSlots() const { - return getMemberList(m_cache.privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); + return getMemberList(getCache().privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); } TemplateVariant privateMethods() const { - return getMemberList(m_cache.privateMethods,MemberListType_priMethods,theTranslator->trPrivateMembers()); + return getMemberList(getCache().privateMethods,MemberListType_priMethods,theTranslator->trPrivateMembers()); } TemplateVariant privateStaticMethods() const { - return getMemberList(m_cache.privateStaticMethods,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers()); + return getMemberList(getCache().privateStaticMethods,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers()); } TemplateVariant privateAttributes() const { - return getMemberList(m_cache.privateAttributes,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); + return getMemberList(getCache().privateAttributes,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); } TemplateVariant privateStaticAttributes() const { - return getMemberList(m_cache.privateStaticAttributes,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); + return getMemberList(getCache().privateStaticAttributes,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); } TemplateVariant packageTypes() const { - return getMemberList(m_cache.packageTypes,MemberListType_pacTypes,theTranslator->trPackageTypes()); + return getMemberList(getCache().packageTypes,MemberListType_pacTypes,theTranslator->trPackageTypes()); } TemplateVariant packageMethods() const { - return getMemberList(m_cache.packageMethods,MemberListType_pacMethods,theTranslator->trPackageMembers()); + return getMemberList(getCache().packageMethods,MemberListType_pacMethods,theTranslator->trPackageMembers()); } TemplateVariant packageStaticMethods() const { - return getMemberList(m_cache.packageStaticMethods,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers()); + return getMemberList(getCache().packageStaticMethods,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers()); } TemplateVariant packageAttributes() const { - return getMemberList(m_cache.packageAttributes,MemberListType_pacAttribs,theTranslator->trPackageAttribs()); + return getMemberList(getCache().packageAttributes,MemberListType_pacAttribs,theTranslator->trPackageAttribs()); } TemplateVariant packageStaticAttributes() const { - return getMemberList(m_cache.packageStaticAttributes,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs()); + return getMemberList(getCache().packageStaticAttributes,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs()); } TemplateVariant properties() const { - return getMemberList(m_cache.properties,MemberListType_properties,theTranslator->trProperties()); + return getMemberList(getCache().properties,MemberListType_properties,theTranslator->trProperties()); } TemplateVariant events() const { - return getMemberList(m_cache.events,MemberListType_events,theTranslator->trEvents()); + return getMemberList(getCache().events,MemberListType_events,theTranslator->trEvents()); } TemplateVariant friends() const { - return getMemberList(m_cache.friends,MemberListType_friends,theTranslator->trFriends()); + return getMemberList(getCache().friends,MemberListType_friends,theTranslator->trFriends()); } TemplateVariant related() const { - return getMemberList(m_cache.related,MemberListType_related,theTranslator->trRelatedFunctions()); + return getMemberList(getCache().related,MemberListType_related,theTranslator->trRelatedFunctions()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation(),TRUE); + return getMemberList(getCache().detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation(),TRUE); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation(),TRUE); + return getMemberList(getCache().detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation(),TRUE); } TemplateVariant detailedServices() const { - return getMemberList(m_cache.detailedServices,MemberListType_serviceMembers,theTranslator->trServices(),TRUE); + return getMemberList(getCache().detailedServices,MemberListType_serviceMembers,theTranslator->trServices(),TRUE); } TemplateVariant detailedInterfaces() const { - return getMemberList(m_cache.detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces(),TRUE); + return getMemberList(getCache().detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces(),TRUE); } TemplateVariant detailedConstructors() const { - return getMemberList(m_cache.detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation(),TRUE); + return getMemberList(getCache().detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation(),TRUE); } TemplateVariant detailedMethods() const { - return getMemberList(m_cache.detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation(),TRUE); + return getMemberList(getCache().detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation(),TRUE); } TemplateVariant detailedRelated() const { - return getMemberList(m_cache.detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation(),TRUE); + return getMemberList(getCache().detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation(),TRUE); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation(),TRUE); + return getMemberList(getCache().detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation(),TRUE); } TemplateVariant detailedProperties() const { - return getMemberList(m_cache.detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation(),TRUE); + return getMemberList(getCache().detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation(),TRUE); } TemplateVariant detailedEvents() const { - return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE); + return getMemberList(getCache().detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE); } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_classDef->getClassSDict()) @@ -2215,13 +2283,14 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant innerClasses() const { - if (!m_cache.innerClasses) + Cachable &cache = getCache(); + if (!cache.innerClasses) { TemplateList *classList = TemplateList::alloc(); if (m_classDef->getClassSDict()) @@ -2240,9 +2309,9 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } } } - m_cache.innerClasses.reset(classList); + cache.innerClasses.reset(classList); } - return m_cache.innerClasses.get(); + return cache.innerClasses.get(); } TemplateVariant compoundType() const { @@ -2288,55 +2357,60 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant templateDecls() const { - if (!m_cache.templateDecls) + Cachable &cache = getCache(); + if (!cache.templateDecls) { TemplateList *tl = TemplateList::alloc(); addTemplateDecls(m_classDef,tl); - m_cache.templateDecls.reset(tl); + cache.templateDecls.reset(tl); } - return m_cache.templateDecls.get(); + return cache.templateDecls.get(); } TemplateVariant typeConstraints() const { if (m_classDef->typeConstraints()) { - if (!m_cache.typeConstraints && m_classDef->typeConstraints()) + Cachable &cache = getCache(); + if (!cache.typeConstraints && m_classDef->typeConstraints()) { - m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString())); + cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString())); } - return m_cache.typeConstraints.get(); + return cache.typeConstraints.get(); } return FALSE; } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } void addMembers(ClassDef *cd,MemberListType lt) const { MemberList *ml = cd->getMemberList(lt); if (ml) { + Cachable &cache = getCache(); MemberListIterator li(*ml); const MemberDef *md; for (li.toFirst();(md=li.current());++li) { if (md->isBriefSectionVisible()) { - m_cache.allMembers.append(md); + cache.allMembers.append(md); } } } } TemplateVariant members() const { - if (!m_cache.members) + Cachable &cache = getCache(); + if (!cache.members) { addMembers(m_classDef,MemberListType_pubTypes); addMembers(m_classDef,MemberListType_services); @@ -2367,25 +2441,26 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> addMembers(m_classDef,MemberListType_priAttribs); addMembers(m_classDef,MemberListType_priStaticAttribs); addMembers(m_classDef,MemberListType_related); - m_cache.members.reset(MemberListContext::alloc(&m_cache.allMembers)); + cache.members.reset(MemberListContext::alloc(&cache.allMembers)); } - return m_cache.members.get(); + return cache.members.get(); } TemplateVariant allMembersList() const { - if (!m_cache.allMembersList) + Cachable &cache = getCache(); + if (!cache.allMembersList) { if (m_classDef->memberNameInfoSDict()) { AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoSDict()); - m_cache.allMembersList.reset(ml); + cache.allMembersList.reset(ml); } else { - m_cache.allMembersList.reset(AllMembersListContext::alloc()); + cache.allMembersList.reset(AllMembersListContext::alloc()); } } - return m_cache.allMembersList.get(); + return cache.allMembersList.get(); } TemplateVariant allMembersFileName() const { @@ -2393,22 +2468,24 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_classDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant additionalInheritedMembers() const { - if (!m_cache.additionalInheritedMembers) + Cachable &cache = getCache(); + if (!cache.additionalInheritedMembers) { InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); ctx->addMemberList(m_classDef,MemberListType_pubTypes,theTranslator->trPublicTypes()); @@ -2444,9 +2521,9 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ctx->addMemberList(m_classDef,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); ctx->addMemberList(m_classDef,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); ctx->addMemberList(m_classDef,MemberListType_related,theTranslator->trRelatedFunctions()); - m_cache.additionalInheritedMembers.reset(ctx); + cache.additionalInheritedMembers.reset(ctx); } - return m_cache.additionalInheritedMembers.get(); + return cache.additionalInheritedMembers.get(); } TemplateVariant isSimple() const { @@ -2454,13 +2531,14 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant categoryOf() const { - if (!m_cache.categoryOf && m_classDef->categoryOf()) + Cachable &cache = getCache(); + if (!cache.categoryOf && m_classDef->categoryOf()) { - m_cache.categoryOf.reset(ClassContext::alloc(m_classDef->categoryOf())); + cache.categoryOf.reset(ClassContext::alloc(m_classDef->categoryOf())); } - if (m_cache.categoryOf) + if (cache.categoryOf) { - return m_cache.categoryOf.get(); + return cache.categoryOf.get(); } else { @@ -2470,9 +2548,10 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> private: ClassDef *m_classDef; - struct Cachable + struct Cachable : public DefinitionContext<ClassContext::Private>::Cachable { - Cachable() : inheritanceNodes(-1) { } + Cachable(ClassDef *cd) : DefinitionContext<ClassContext::Private>::Cachable(cd), + inheritanceNodes(-1) { } SharedPtr<IncludeInfoContext> includeInfo; SharedPtr<InheritanceListContext> inheritsList; SharedPtr<InheritanceListContext> inheritedByList; @@ -2533,10 +2612,18 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> int inheritanceNodes; MemberList allMembers; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_classDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<ClassContext::Private> s_inst; }; //%% } +PropertyMapper<ClassContext::Private> ClassContext::Private::s_inst; + ClassContext::ClassContext(ClassDef *cd) : RefCountedContext("ClassContext") { //printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():"<none>"); @@ -2560,28 +2647,40 @@ TemplateVariant ClassContext::get(const char *n) const class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Private> { public: - Private(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>(nd) , m_namespaceDef(nd) - { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("compoundType", this,&Private::compoundType); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("classes", this,&Private::classes); - addProperty("namespaces", this,&Private::namespaces); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("inlineClasses", this,&Private::inlineClasses); + Private(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>(nd), + m_namespaceDef(nd) + { + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("compoundType", &Private::compoundType); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + init=TRUE; + } + if (!nd->cookie()) { nd->setCookie(new NamespaceContext::Private::Cachable(nd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_namespaceDef->title()); @@ -2604,7 +2703,8 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_namespaceDef->getClassSDict()) @@ -2619,13 +2719,14 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_namespaceDef->getNamespaceSDict()) @@ -2640,13 +2741,14 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_namespaceDef->getNamespaceSDict()) @@ -2661,9 +2763,9 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -2687,11 +2789,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant functions() const { @@ -2699,49 +2801,51 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri SrcLangExt lang = m_namespaceDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_namespaceDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroupSDict(),m_namespaceDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroupSDict(),m_namespaceDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_namespaceDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_namespaceDef->getClassSDict()) @@ -2759,14 +2863,15 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } private: NamespaceDef *m_namespaceDef; - struct Cachable + struct Cachable : public DefinitionContext<NamespaceContext::Private>::Cachable { + Cachable(NamespaceDef *nd) : DefinitionContext<NamespaceContext::Private>::Cachable(nd) {} SharedPtr<TemplateList> classes; SharedPtr<TemplateList> namespaces; SharedPtr<TemplateList> constantgroups; @@ -2781,10 +2886,18 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri SharedPtr<MemberListInfoContext> detailedVariables; SharedPtr<TemplateList> inlineClasses; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_namespaceDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<NamespaceContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceContext::Private> NamespaceContext::Private::s_inst; + NamespaceContext::NamespaceContext(NamespaceDef *nd) : RefCountedContext("NamespaceContext") { p = new Private(nd); @@ -2810,37 +2923,48 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> Private(FileDef *fd) : DefinitionContext<FileContext::Private>(fd) , m_fileDef(fd) { if (fd==0) abort(); - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("versionInfo", this,&Private::versionInfo); - addProperty("includeList", this,&Private::includeList); - addProperty("hasIncludeGraph", this,&Private::hasIncludeGraph); - addProperty("hasIncludedByGraph", this,&Private::hasIncludedByGraph); - addProperty("includeGraph", this,&Private::includeGraph); - addProperty("includedByGraph", this,&Private::includedByGraph); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("hasSourceFile", this,&Private::hasSourceFile); - addProperty("sources", this,&Private::sources); - addProperty("version", this,&Private::version); - addProperty("classes", this,&Private::classes); - addProperty("namespaces", this,&Private::namespaces); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("macros", this,&Private::macros); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedMacros", this,&Private::detailedMacros); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("inlineClasses", this,&Private::inlineClasses); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("versionInfo", &Private::versionInfo); + s_inst.addProperty("includeList", &Private::includeList); + s_inst.addProperty("hasIncludeGraph", &Private::hasIncludeGraph); + s_inst.addProperty("hasIncludedByGraph", &Private::hasIncludedByGraph); + s_inst.addProperty("includeGraph", &Private::includeGraph); + s_inst.addProperty("includedByGraph", &Private::includedByGraph); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("hasSourceFile", &Private::hasSourceFile); + s_inst.addProperty("sources", &Private::sources); + s_inst.addProperty("version", &Private::version); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedMacros", &Private::detailedMacros); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!fd->cookie()) { fd->setCookie(new FileContext::Private::Cachable(fd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return m_fileDef->title(); @@ -2859,14 +2983,15 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant includeList() const { - if (!m_cache.includeInfoList && m_fileDef->includeFileList()) + Cachable &cache = getCache(); + if (!cache.includeInfoList && m_fileDef->includeFileList()) { - m_cache.includeInfoList.reset(IncludeInfoListContext::alloc( + cache.includeInfoList.reset(IncludeInfoListContext::alloc( *m_fileDef->includeFileList(),m_fileDef->getLanguage())); } - if (m_cache.includeInfoList) + if (cache.includeInfoList) { - return m_cache.includeInfoList.get(); + return cache.includeInfoList.get(); } else { @@ -2875,11 +3000,12 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } DotInclDepGraph *getIncludeGraph() const { - if (!m_cache.includeGraph) + Cachable &cache = getCache(); + if (!cache.includeGraph) { - m_cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE)); + cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE)); } - return m_cache.includeGraph.get(); + return cache.includeGraph.get(); } TemplateVariant hasIncludeGraph() const { @@ -2926,11 +3052,12 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } DotInclDepGraph *getIncludedByGraph() const { - if (!m_cache.includedByGraph) + Cachable &cache = getCache(); + if (!cache.includedByGraph) { - m_cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE)); + cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE)); } - return m_cache.includedByGraph.get(); + return cache.includedByGraph.get(); } TemplateVariant hasIncludedByGraph() const { @@ -2985,18 +3112,19 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant sources() const { - if (!m_cache.sources) + Cachable &cache = getCache(); + if (!cache.sources) { if (m_fileDef->generateSourceFile()) { - m_cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString()))); + cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString()))); } else { - m_cache.sources.reset(new TemplateVariant("")); + cache.sources.reset(new TemplateVariant("")); } } - return *m_cache.sources; + return *cache.sources; } TemplateVariant version() const { @@ -3004,7 +3132,8 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_fileDef->getClassSDict()) @@ -3019,13 +3148,14 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_fileDef->getNamespaceSDict()) @@ -3040,13 +3170,14 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_fileDef->getNamespaceSDict()) @@ -3061,9 +3192,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, MemberListType type,const char *title,bool detailed=FALSE) const @@ -3087,15 +3218,15 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } TemplateVariant macros() const { - return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines()); + return getMemberList(getCache().macros,MemberListType_decDefineMembers,theTranslator->trDefines()); } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant functions() const { @@ -3103,53 +3234,55 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> SrcLangExt lang = m_fileDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_fileDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedMacros() const { - return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); + return getMemberList(getCache().detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_fileDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_fileDef->getClassSDict()) @@ -3167,9 +3300,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } TemplateVariant compoundType() const { @@ -3178,8 +3311,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> private: FileDef *m_fileDef; - struct Cachable + struct Cachable : public DefinitionContext<FileContext::Private>::Cachable { + Cachable(FileDef *fd) : DefinitionContext<FileContext::Private>::Cachable(fd) {} SharedPtr<IncludeInfoListContext> includeInfoList; ScopedPtr<DotInclDepGraph> includeGraph; ScopedPtr<DotInclDepGraph> includedByGraph; @@ -3200,10 +3334,18 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> SharedPtr<MemberListInfoContext> detailedVariables; SharedPtr<TemplateList> inlineClasses; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_fileDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<FileContext::Private> s_inst; }; //%% } +PropertyMapper<FileContext::Private> FileContext::Private::s_inst; + FileContext::FileContext(FileDef *fd) : RefCountedContext("FileContext") { p = new Private(fd); @@ -3228,18 +3370,29 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> public: Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("dirName", this,&Private::dirName); - addProperty("dirs", this,&Private::dirs); - addProperty("files", this,&Private::files); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("hasDirGraph", this,&Private::hasDirGraph); - addProperty("dirGraph", this,&Private::dirGraph); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("dirName", &Private::dirName); + s_inst.addProperty("dirs", &Private::dirs); + s_inst.addProperty("files", &Private::files); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("hasDirGraph", &Private::hasDirGraph); + s_inst.addProperty("dirGraph", &Private::dirGraph); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!dd->cookie()) { dd->setCookie(new DirContext::Private::Cachable(dd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_dirDef->shortTitle()); @@ -3258,26 +3411,27 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } TemplateVariant dirs() const { - if (!m_cache.dirs) + Cachable &cache = getCache(); + if (!cache.dirs) { - m_cache.dirs.reset(TemplateList::alloc()); + cache.dirs.reset(TemplateList::alloc()); const DirList &subDirs = m_dirDef->subDirs(); QListIterator<DirDef> it(subDirs); DirDef *dd; for (it.toFirst();(dd=it.current());++it) { DirContext *dc = new DirContext(dd); - m_cache.dirs->append(dc); + cache.dirs->append(dc); } } - return m_cache.dirs.get(); + return cache.dirs.get(); } TemplateVariant files() const { - // FileList *list = m_dirDef->getFiles(); - if (!m_cache.files) + Cachable &cache = getCache(); + if (!cache.files) { - m_cache.files.reset(TemplateList::alloc()); + cache.files.reset(TemplateList::alloc()); FileList *files = m_dirDef->getFiles(); if (files) { @@ -3286,11 +3440,11 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> for (it.toFirst();(fd=it.current());++it) { FileContext *fc = FileContext::alloc(fd); - m_cache.files->append(fc); + cache.files->append(fc); } } } - return m_cache.files.get(); + return cache.files.get(); } TemplateVariant hasDetails() const { @@ -3306,11 +3460,12 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } DotDirDeps *getDirDepsGraph() const { - if (!m_cache.dirDepsGraph) + Cachable &cache = getCache(); + if (!cache.dirDepsGraph) { - m_cache.dirDepsGraph.reset(new DotDirDeps(m_dirDef)); + cache.dirDepsGraph.reset(new DotDirDeps(m_dirDef)); } - return m_cache.dirDepsGraph.get(); + return cache.dirDepsGraph.get(); } TemplateVariant hasDirGraph() const { @@ -3371,17 +3526,25 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> private: DirDef *m_dirDef; - struct Cachable + struct Cachable : public DefinitionContext<DirContext::Private>::Cachable { - Cachable() {} + Cachable(DirDef *dd) : DefinitionContext<DirContext::Private>::Cachable(dd) {} SharedPtr<TemplateList> dirs; SharedPtr<TemplateList> files; ScopedPtr<DotDirDeps> dirDepsGraph; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_dirDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<DirContext::Private> s_inst; }; //%% } +PropertyMapper<DirContext::Private> DirContext::Private::s_inst; + DirContext::DirContext(DirDef *fd) : RefCountedContext("DirContext") { p = new Private(fd); @@ -3408,12 +3571,23 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> : DefinitionContext<PageContext::Private>(pd) , m_pageDef(pd), m_isMainPage(isMainPage), m_isExample(isExample) { - addProperty("title",this,&Private::title); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subHighlight); - addProperty("example",this,&Private::example); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subHighlight); + s_inst.addProperty("example", &Private::example); + init=TRUE; + } + if (!pd->cookie()) { pd->setCookie(new PageContext::Private::Cachable(pd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { if (m_isMainPage) @@ -3466,14 +3640,15 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> { if (m_isExample) { - if (!m_cache.example || g_globals.outputFormat!=m_cache.exampleOutputFormat) + Cachable &cache = getCache(); + if (!cache.example || g_globals.outputFormat!=cache.exampleOutputFormat) { - m_cache.example.reset(new TemplateVariant( + cache.example.reset(new TemplateVariant( parseDoc(m_pageDef,m_pageDef->docFile(),m_pageDef->docLine(), relPathAsString(),"\\include "+m_pageDef->name(),FALSE))); - m_cache.exampleOutputFormat = g_globals.outputFormat; + cache.exampleOutputFormat = g_globals.outputFormat; } - return *m_cache.example; + return *cache.example; } else { @@ -3482,18 +3657,27 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> } private: PageDef *m_pageDef; - struct Cachable + struct Cachable : public DefinitionContext<PageContext::Private>::Cachable { - Cachable() : exampleOutputFormat(ContextOutputFormat_Unspecified) { } + Cachable(PageDef *pd) : DefinitionContext<PageContext::Private>::Cachable(pd), + exampleOutputFormat(ContextOutputFormat_Unspecified) { } ScopedPtr<TemplateVariant> example; ContextOutputFormat exampleOutputFormat; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_pageDef->cookie()); + assert(c!=0); + return *c; + } bool m_isMainPage; bool m_isExample; + static PropertyMapper<PageContext::Private> s_inst; }; //%% } +PropertyMapper<PageContext::Private> PageContext::Private::s_inst; + PageContext::PageContext(PageDef *pd,bool isMainPage,bool isExample) : RefCountedContext("PageContext") { p = new Private(pd,isMainPage,isExample); @@ -3676,152 +3860,184 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> public: Private(MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md) { - addProperty("isSignal", this,&Private::isSignal); - addProperty("isSlot", this,&Private::isSlot); - addProperty("isVariable", this,&Private::isVariable); - addProperty("isEnumeration", this,&Private::isEnumeration); - addProperty("isEnumValue", this,&Private::isEnumValue); - addProperty("isTypedef", this,&Private::isTypedef); - addProperty("isFunction", this,&Private::isFunction); - addProperty("isFunctionPtr", this,&Private::isFunctionPtr); - addProperty("isDefine", this,&Private::isDefine); - addProperty("isFriend", this,&Private::isFriend); - addProperty("isProperty", this,&Private::isProperty); - addProperty("isEvent", this,&Private::isEvent); - addProperty("isRelated", this,&Private::isRelated); - addProperty("isForeign", this,&Private::isForeign); - addProperty("isStatic", this,&Private::isStatic); - addProperty("isInline", this,&Private::isInline); - addProperty("isExplicit", this,&Private::isExplicit); - addProperty("isMutable", this,&Private::isMutable); - addProperty("isGettable", this,&Private::isGettable); - addProperty("isPrivateGettable", this,&Private::isPrivateGettable); - addProperty("isProtectedGettable", this,&Private::isProtectedGettable); - addProperty("isSettable", this,&Private::isSettable); - addProperty("isPrivateSettable", this,&Private::isPrivateSettable); - addProperty("isProtectedSettable", this,&Private::isProtectedSettable); - addProperty("isReadable", this,&Private::isReadable); - addProperty("isWritable", this,&Private::isWritable); - addProperty("isAddable", this,&Private::isAddable); - addProperty("isRemovable", this,&Private::isRemovable); - addProperty("isRaisable", this,&Private::isRaisable); - addProperty("isFinal", this,&Private::isFinal); - addProperty("isAbstract", this,&Private::isAbstract); - addProperty("isOverride", this,&Private::isOverride); - addProperty("isInitonly", this,&Private::isInitonly); - addProperty("isOptional", this,&Private::isOptional); - addProperty("isRequired", this,&Private::isRequired); - addProperty("isNonAtomic", this,&Private::isNonAtomic); - addProperty("isCopy", this,&Private::isCopy); - addProperty("isAssign", this,&Private::isAssign); - addProperty("isRetain", this,&Private::isRetain); - addProperty("isWeak", this,&Private::isWeak); - addProperty("isStrong", this,&Private::isStrong); - addProperty("isUnretained", this,&Private::isUnretained); - addProperty("isNew", this,&Private::isNew); - addProperty("isSealed", this,&Private::isSealed); - addProperty("isImplementation", this,&Private::isImplementation); - addProperty("isExternal", this,&Private::isExternal); - addProperty("isAlias", this,&Private::isAlias); - addProperty("isDefault", this,&Private::isDefault); - addProperty("isDelete", this,&Private::isDelete); - addProperty("isNoExcept", this,&Private::isNoExcept); - addProperty("isAttribute", this,&Private::isAttribute); - addProperty("isUNOProperty", this,&Private::isUNOProperty); - addProperty("isReadonly", this,&Private::isReadonly); - addProperty("isBound", this,&Private::isBound); - addProperty("isConstrained", this,&Private::isConstrained); - addProperty("isTransient", this,&Private::isTransient); - addProperty("isMaybeVoid", this,&Private::isMaybeVoid); - addProperty("isMaybeDefault", this,&Private::isMaybeDefault); - addProperty("isMaybeAmbiguous", this,&Private::isMaybeAmbiguous); - addProperty("isPublished", this,&Private::isPublished); - addProperty("isTemplateSpecialization",this,&Private::isTemplateSpecialization); - addProperty("isObjCMethod", this,&Private::isObjCMethod); - addProperty("isObjCProperty", this,&Private::isObjCProperty); - addProperty("isAnonymous", this,&Private::isAnonymous); - addProperty("hasParameters", this,&Private::hasParameters); - addProperty("declType", this,&Private::declType); - addProperty("declArgs", this,&Private::declArgs); - addProperty("anonymousType", this,&Private::anonymousType); - addProperty("anonymousMember", this,&Private::anonymousMember); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("exception", this,&Private::exception); - addProperty("bitfields", this,&Private::bitfields); - addProperty("initializer", this,&Private::initializer); - addProperty("initializerAsCode", this,&Private::initializerAsCode); - addProperty("hasOneLineInitializer", this,&Private::hasOneLineInitializer); - addProperty("hasMultiLineInitializer", this,&Private::hasMultiLineInitializer); - addProperty("templateArgs", this,&Private::templateArgs); - addProperty("templateAlias", this,&Private::templateAlias); - addProperty("propertyAttrs", this,&Private::propertyAttrs); - addProperty("eventAttrs", this,&Private::eventAttrs); - addProperty("category", this,&Private::category); - addProperty("categoryRelation", this,&Private::categoryRelation); - addProperty("class", this,&Private::getClass); - addProperty("file", this,&Private::getFile); - addProperty("namespace", this,&Private::getNamespace); - addProperty("definition", this,&Private::definition); - addProperty("parameters", this,&Private::parameters); - addProperty("hasConstQualifier", this,&Private::hasConstQualifier); - addProperty("hasVolatileQualifier",this,&Private::hasVolatileQualifier); - addProperty("trailingReturnType", this,&Private::trailingReturnType); - addProperty("extraTypeChars", this,&Private::extraTypeChars); - addProperty("templateDecls", this,&Private::templateDecls); - addProperty("labels", this,&Private::labels); - addProperty("enumBaseType", this,&Private::enumBaseType); - addProperty("enumValues", this,&Private::enumValues); - addProperty("paramDocs", this,&Private::paramDocs); - addProperty("reimplements", this,&Private::reimplements); - addProperty("implements", this,&Private::implements); - addProperty("reimplementedBy", this,&Private::reimplementedBy); - addProperty("implementedBy", this,&Private::implementedBy); - addProperty("examples", this,&Private::examples); - addProperty("typeConstraints", this,&Private::typeConstraints); - addProperty("functionQualifier", this,&Private::functionQualifier); - addProperty("sourceRefs", this,&Private::sourceRefs); - addProperty("sourceRefBys", this,&Private::sourceRefBys); - addProperty("hasSources", this,&Private::hasSources); - addProperty("sourceCode", this,&Private::sourceCode); - addProperty("hasCallGraph", this,&Private::hasCallGraph); - addProperty("callGraph", this,&Private::callGraph); - addProperty("hasCallerGraph", this,&Private::hasCallerGraph); - addProperty("callerGraph", this,&Private::callerGraph); - addProperty("fieldType", this,&Private::fieldType); - addProperty("type", this,&Private::type); - addProperty("detailsVisibleFor", this,&Private::detailsVisibleFor); - addProperty("nameWithContextFor", this,&Private::nameWithContextFor); - - m_cache.propertyAttrs.reset(TemplateList::alloc()); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("isSignal", &Private::isSignal); + s_inst.addProperty("isSlot", &Private::isSlot); + s_inst.addProperty("isVariable", &Private::isVariable); + s_inst.addProperty("isEnumeration", &Private::isEnumeration); + s_inst.addProperty("isEnumValue", &Private::isEnumValue); + s_inst.addProperty("isTypedef", &Private::isTypedef); + s_inst.addProperty("isFunction", &Private::isFunction); + s_inst.addProperty("isFunctionPtr", &Private::isFunctionPtr); + s_inst.addProperty("isDefine", &Private::isDefine); + s_inst.addProperty("isFriend", &Private::isFriend); + s_inst.addProperty("isProperty", &Private::isProperty); + s_inst.addProperty("isEvent", &Private::isEvent); + s_inst.addProperty("isRelated", &Private::isRelated); + s_inst.addProperty("isForeign", &Private::isForeign); + s_inst.addProperty("isStatic", &Private::isStatic); + s_inst.addProperty("isInline", &Private::isInline); + s_inst.addProperty("isExplicit", &Private::isExplicit); + s_inst.addProperty("isMutable", &Private::isMutable); + s_inst.addProperty("isGettable", &Private::isGettable); + s_inst.addProperty("isPrivateGettable", &Private::isPrivateGettable); + s_inst.addProperty("isProtectedGettable", &Private::isProtectedGettable); + s_inst.addProperty("isSettable", &Private::isSettable); + s_inst.addProperty("isPrivateSettable", &Private::isPrivateSettable); + s_inst.addProperty("isProtectedSettable", &Private::isProtectedSettable); + s_inst.addProperty("isReadable", &Private::isReadable); + s_inst.addProperty("isWritable", &Private::isWritable); + s_inst.addProperty("isAddable", &Private::isAddable); + s_inst.addProperty("isRemovable", &Private::isRemovable); + s_inst.addProperty("isRaisable", &Private::isRaisable); + s_inst.addProperty("isFinal", &Private::isFinal); + s_inst.addProperty("isAbstract", &Private::isAbstract); + s_inst.addProperty("isOverride", &Private::isOverride); + s_inst.addProperty("isInitonly", &Private::isInitonly); + s_inst.addProperty("isOptional", &Private::isOptional); + s_inst.addProperty("isRequired", &Private::isRequired); + s_inst.addProperty("isNonAtomic", &Private::isNonAtomic); + s_inst.addProperty("isCopy", &Private::isCopy); + s_inst.addProperty("isAssign", &Private::isAssign); + s_inst.addProperty("isRetain", &Private::isRetain); + s_inst.addProperty("isWeak", &Private::isWeak); + s_inst.addProperty("isStrong", &Private::isStrong); + s_inst.addProperty("isUnretained", &Private::isUnretained); + s_inst.addProperty("isNew", &Private::isNew); + s_inst.addProperty("isSealed", &Private::isSealed); + s_inst.addProperty("isImplementation", &Private::isImplementation); + s_inst.addProperty("isExternal", &Private::isExternal); + s_inst.addProperty("isAlias", &Private::isAlias); + s_inst.addProperty("isDefault", &Private::isDefault); + s_inst.addProperty("isDelete", &Private::isDelete); + s_inst.addProperty("isNoExcept", &Private::isNoExcept); + s_inst.addProperty("isAttribute", &Private::isAttribute); + s_inst.addProperty("isUNOProperty", &Private::isUNOProperty); + s_inst.addProperty("isReadonly", &Private::isReadonly); + s_inst.addProperty("isBound", &Private::isBound); + s_inst.addProperty("isConstrained", &Private::isConstrained); + s_inst.addProperty("isTransient", &Private::isTransient); + s_inst.addProperty("isMaybeVoid", &Private::isMaybeVoid); + s_inst.addProperty("isMaybeDefault", &Private::isMaybeDefault); + s_inst.addProperty("isMaybeAmbiguous", &Private::isMaybeAmbiguous); + s_inst.addProperty("isPublished", &Private::isPublished); + s_inst.addProperty("isTemplateSpecialization",&Private::isTemplateSpecialization); + s_inst.addProperty("isObjCMethod", &Private::isObjCMethod); + s_inst.addProperty("isObjCProperty", &Private::isObjCProperty); + s_inst.addProperty("isAnonymous", &Private::isAnonymous); + s_inst.addProperty("hasParameters", &Private::hasParameters); + s_inst.addProperty("declType", &Private::declType); + s_inst.addProperty("declArgs", &Private::declArgs); + s_inst.addProperty("anonymousType", &Private::anonymousType); + s_inst.addProperty("anonymousMember", &Private::anonymousMember); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("exception", &Private::exception); + s_inst.addProperty("bitfields", &Private::bitfields); + s_inst.addProperty("initializer", &Private::initializer); + s_inst.addProperty("initializerAsCode", &Private::initializerAsCode); + s_inst.addProperty("hasOneLineInitializer", &Private::hasOneLineInitializer); + s_inst.addProperty("hasMultiLineInitializer", &Private::hasMultiLineInitializer); + s_inst.addProperty("templateArgs", &Private::templateArgs); + s_inst.addProperty("templateAlias", &Private::templateAlias); + s_inst.addProperty("propertyAttrs", &Private::propertyAttrs); + s_inst.addProperty("eventAttrs", &Private::eventAttrs); + s_inst.addProperty("category", &Private::category); + s_inst.addProperty("categoryRelation", &Private::categoryRelation); + s_inst.addProperty("class", &Private::getClass); + s_inst.addProperty("file", &Private::getFile); + s_inst.addProperty("namespace", &Private::getNamespace); + s_inst.addProperty("definition", &Private::definition); + s_inst.addProperty("parameters", &Private::parameters); + s_inst.addProperty("hasConstQualifier", &Private::hasConstQualifier); + s_inst.addProperty("hasVolatileQualifier",&Private::hasVolatileQualifier); + s_inst.addProperty("trailingReturnType", &Private::trailingReturnType); + s_inst.addProperty("extraTypeChars", &Private::extraTypeChars); + s_inst.addProperty("templateDecls", &Private::templateDecls); + s_inst.addProperty("labels", &Private::labels); + s_inst.addProperty("enumBaseType", &Private::enumBaseType); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("paramDocs", &Private::paramDocs); + s_inst.addProperty("reimplements", &Private::reimplements); + s_inst.addProperty("implements", &Private::implements); + s_inst.addProperty("reimplementedBy", &Private::reimplementedBy); + s_inst.addProperty("implementedBy", &Private::implementedBy); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("typeConstraints", &Private::typeConstraints); + s_inst.addProperty("functionQualifier", &Private::functionQualifier); + s_inst.addProperty("sourceRefs", &Private::sourceRefs); + s_inst.addProperty("sourceRefBys", &Private::sourceRefBys); + s_inst.addProperty("hasSources", &Private::hasSources); + s_inst.addProperty("sourceCode", &Private::sourceCode); + s_inst.addProperty("hasCallGraph", &Private::hasCallGraph); + s_inst.addProperty("callGraph", &Private::callGraph); + s_inst.addProperty("hasCallerGraph", &Private::hasCallerGraph); + s_inst.addProperty("callerGraph", &Private::callerGraph); + s_inst.addProperty("fieldType", &Private::fieldType); + s_inst.addProperty("type", &Private::type); + s_inst.addProperty("detailsVisibleFor", &Private::detailsVisibleFor); + s_inst.addProperty("nameWithContextFor", &Private::nameWithContextFor); + init=TRUE; + } + if (!md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); } + + Cachable &cache = getCache(); + cache.propertyAttrs.reset(TemplateList::alloc()); if (md && md->isProperty()) { - if (md->isGettable()) m_cache.propertyAttrs->append("get"); - if (md->isPrivateGettable()) m_cache.propertyAttrs->append("private get"); - if (md->isProtectedGettable()) m_cache.propertyAttrs->append("protected get"); - if (md->isSettable()) m_cache.propertyAttrs->append("set"); - if (md->isPrivateSettable()) m_cache.propertyAttrs->append("private set"); - if (md->isProtectedSettable()) m_cache.propertyAttrs->append("protected set"); + if (md->isGettable()) cache.propertyAttrs->append("get"); + if (md->isPrivateGettable()) cache.propertyAttrs->append("private get"); + if (md->isProtectedGettable()) cache.propertyAttrs->append("protected get"); + if (md->isSettable()) cache.propertyAttrs->append("set"); + if (md->isPrivateSettable()) cache.propertyAttrs->append("private set"); + if (md->isProtectedSettable()) cache.propertyAttrs->append("protected set"); } - m_cache.eventAttrs.reset(TemplateList::alloc()); + cache.eventAttrs.reset(TemplateList::alloc()); if (md && md->isEvent()) { - if (md->isAddable()) m_cache.eventAttrs->append("add"); - if (md->isRemovable()) m_cache.eventAttrs->append("remove"); - if (md->isRaisable()) m_cache.eventAttrs->append("raise"); + if (md->isAddable()) cache.eventAttrs->append("add"); + if (md->isRemovable()) cache.eventAttrs->append("remove"); + if (md->isRaisable()) cache.eventAttrs->append("raise"); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant fieldType() const { return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->fieldType()); } TemplateVariant declType() const { - return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); + Cachable &cache = getCache(); + if (!cache.declTypeParsed) + { + cache.declType=createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); + cache.declTypeParsed = TRUE; + return cache.declType; + } + else + { + return cache.declType; + } } TemplateVariant declArgs() const { - return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->argsString()); + Cachable &cache = getCache(); + if (!cache.declArgsParsed) + { + cache.declArgs=createLinkedText(m_memberDef,relPathAsString(),m_memberDef->argsString()); + cache.declArgsParsed = TRUE; + return cache.declArgs; + } + else + { + return cache.declArgs; + } } TemplateVariant exception() const { @@ -4085,7 +4301,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant initializerAsCode() const { - if (!m_cache.initializerParsed) + Cachable &cache = getCache(); + if (!cache.initializerParsed) { QCString scopeName; if (m_memberDef->getClassDef()) @@ -4096,11 +4313,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - m_cache.initializer = parseCode(m_memberDef,scopeName,relPathAsString(), + cache.initializer = parseCode(m_memberDef,scopeName,relPathAsString(), m_memberDef->initializer()); - m_cache.initializerParsed = TRUE; + cache.initializerParsed = TRUE; } - return m_cache.initializer; + return cache.initializer; } TemplateVariant isDefine() const { @@ -4113,17 +4330,18 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant anonymousType() const { - if (!m_cache.anonymousType) + Cachable &cache = getCache(); + if (!cache.anonymousType) { ClassDef *cd = m_memberDef->getClassDefOfAnonymousType(); if (cd) { - m_cache.anonymousType.reset(ClassContext::alloc(cd)); + cache.anonymousType.reset(ClassContext::alloc(cd)); } } - if (m_cache.anonymousType) + if (cache.anonymousType) { - return m_cache.anonymousType.get(); + return cache.anonymousType.get(); } else { @@ -4132,17 +4350,18 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant anonymousMember() const { - if (!m_cache.anonymousMember) + Cachable &cache = getCache(); + if (!cache.anonymousMember) { MemberDef *md = m_memberDef->fromAnonymousMember(); if (md) { - m_cache.anonymousMember.reset(MemberContext::alloc(md)); + cache.anonymousMember.reset(MemberContext::alloc(md)); } } - if (m_cache.anonymousMember) + if (cache.anonymousMember) { - return m_cache.anonymousMember.get(); + return cache.anonymousMember.get(); } else { @@ -4167,29 +4386,31 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant enumValues() const { - if (!m_cache.enumValues) + Cachable &cache = getCache(); + if (!cache.enumValues) { MemberList *ml = m_memberDef->enumFieldList(); if (ml) { - m_cache.enumValues.reset(MemberListContext::alloc(ml)); + cache.enumValues.reset(MemberListContext::alloc(ml)); } else { - m_cache.enumValues.reset(MemberListContext::alloc()); + cache.enumValues.reset(MemberListContext::alloc()); } } - return m_cache.enumValues.get(); + return cache.enumValues.get(); } TemplateVariant templateArgs() const { - if (!m_cache.templateArgs && m_memberDef->templateArguments()) + Cachable &cache = getCache(); + if (!cache.templateArgs && m_memberDef->templateArguments()) { - m_cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); + cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString())); } - if (m_cache.templateArgs) + if (cache.templateArgs) { - return m_cache.templateArgs.get(); + return cache.templateArgs.get(); } else { @@ -4207,21 +4428,22 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant propertyAttrs() const { - return m_cache.propertyAttrs.get(); + return getCache().propertyAttrs.get(); } TemplateVariant eventAttrs() const { - return m_cache.eventAttrs.get(); + return getCache().eventAttrs.get(); } TemplateVariant getClass() const { - if (!m_cache.classDef && m_memberDef->getClassDef()) + Cachable &cache = getCache(); + if (!cache.classDef && m_memberDef->getClassDef()) { - m_cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef())); + cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef())); } - if (m_cache.classDef) + if (cache.classDef) { - return m_cache.classDef.get(); + return cache.classDef.get(); } else { @@ -4230,13 +4452,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant category() const { - if (!m_cache.category && m_memberDef->category()) + Cachable &cache = getCache(); + if (!cache.category && m_memberDef->category()) { - m_cache.category.reset(ClassContext::alloc(m_memberDef->category())); + cache.category.reset(ClassContext::alloc(m_memberDef->category())); } - if (m_cache.category) + if (cache.category) { - return m_cache.category.get(); + return cache.category.get(); } else { @@ -4245,13 +4468,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant categoryRelation() const { - if (!m_cache.categoryRelation && m_memberDef->categoryRelation()) + Cachable &cache = getCache(); + if (!cache.categoryRelation && m_memberDef->categoryRelation()) { - m_cache.categoryRelation.reset(MemberContext::alloc(m_memberDef->categoryRelation())); + cache.categoryRelation.reset(MemberContext::alloc(m_memberDef->categoryRelation())); } - if (m_cache.categoryRelation) + if (cache.categoryRelation) { - return m_cache.categoryRelation.get(); + return cache.categoryRelation.get(); } else { @@ -4260,13 +4484,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant getFile() const { - if (!m_cache.fileDef && m_memberDef->getFileDef()) + Cachable &cache = getCache(); + if (!cache.fileDef && m_memberDef->getFileDef()) { - m_cache.fileDef.reset(FileContext::alloc(m_memberDef->getFileDef())); + cache.fileDef.reset(FileContext::alloc(m_memberDef->getFileDef())); } - if (m_cache.fileDef) + if (cache.fileDef) { - return m_cache.fileDef.get(); + return cache.fileDef.get(); } else { @@ -4275,13 +4500,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant getNamespace() const { - if (!m_cache.namespaceDef && m_memberDef->getNamespaceDef()) + Cachable &cache = getCache(); + if (!cache.namespaceDef && m_memberDef->getNamespaceDef()) { - m_cache.namespaceDef.reset(NamespaceContext::alloc(m_memberDef->getNamespaceDef())); + cache.namespaceDef.reset(NamespaceContext::alloc(m_memberDef->getNamespaceDef())); } - if (m_cache.namespaceDef) + if (cache.namespaceDef) { - return m_cache.namespaceDef.get(); + return cache.namespaceDef.get(); } else { @@ -4300,19 +4526,20 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant parameters() const { - if (!m_cache.arguments) + Cachable &cache = getCache(); + if (!cache.arguments) { ArgumentList *defArgList = getDefArgList(); if (defArgList && !m_memberDef->isProperty()) { - m_cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString())); + cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString())); } else { - m_cache.arguments.reset(ArgumentListContext::alloc()); + cache.arguments.reset(ArgumentListContext::alloc()); } } - return m_cache.arguments.get(); + return cache.arguments.get(); } TemplateVariant hasParameters() const { @@ -4389,17 +4616,19 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant templateDecls() const { - if (!m_cache.templateDecls) + Cachable &cache = getCache(); + if (!cache.templateDecls) { TemplateList *tl = TemplateList::alloc(); addTemplateDecls(tl); - m_cache.templateDecls.reset(tl); + cache.templateDecls.reset(tl); } - return m_cache.templateDecls.get(); + return cache.templateDecls.get(); } TemplateVariant labels() const { - if (!m_cache.labels) + Cachable &cache = getCache(); + if (!cache.labels) { QStrList sl; m_memberDef->getLabels(sl,m_memberDef->getOuterScope()); @@ -4412,13 +4641,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> tl->append(*it); } } - m_cache.labels.reset(tl); + cache.labels.reset(tl); } - return m_cache.labels.get(); + return cache.labels.get(); } TemplateVariant paramDocs() const { - if (!m_cache.paramDocs) + Cachable &cache = getCache(); + if (!cache.paramDocs) { if (m_memberDef->argumentList() && m_memberDef->argumentList()->hasDocumentation()) { @@ -4434,59 +4664,62 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> paramDocs+="@param"+direction+" "+a->name+" "+a->docs; } } - m_cache.paramDocs.reset(new TemplateVariant(parseDoc(m_memberDef, + cache.paramDocs.reset(new TemplateVariant(parseDoc(m_memberDef, m_memberDef->docFile(),m_memberDef->docLine(), relPathAsString(),paramDocs,FALSE))); } else { - m_cache.paramDocs.reset(new TemplateVariant("")); + cache.paramDocs.reset(new TemplateVariant("")); } } - return *m_cache.paramDocs; + return *cache.paramDocs; } TemplateVariant implements() const { - if (!m_cache.implements) + Cachable &cache = getCache(); + if (!cache.implements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.implements.reset(TemplateList::alloc()); + cache.implements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { MemberContext *mc = MemberContext::alloc(md); - m_cache.implements->append(mc); + cache.implements->append(mc); } } } - return m_cache.implements.get(); + return cache.implements.get(); } TemplateVariant reimplements() const { - if (!m_cache.reimplements) + Cachable &cache = getCache(); + if (!cache.reimplements) { MemberDef *md = m_memberDef->reimplements(); - m_cache.reimplements.reset(TemplateList::alloc()); + cache.reimplements.reset(TemplateList::alloc()); if (md) { ClassDef *cd = md->getClassDef(); if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { MemberContext *mc = MemberContext::alloc(md); - m_cache.reimplements->append(mc); + cache.reimplements->append(mc); } } } - return m_cache.reimplements.get(); + return cache.reimplements.get(); } TemplateVariant implementedBy() const { - if (!m_cache.implementedBy) + Cachable &cache = getCache(); + if (!cache.implementedBy) { MemberList *ml = m_memberDef->reimplementedBy(); - m_cache.implementedBy.reset(TemplateList::alloc()); + cache.implementedBy.reset(TemplateList::alloc()); if (ml) { MemberListIterator mli(*ml); @@ -4497,18 +4730,19 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface)) { MemberContext *mc = new MemberContext(md); - m_cache.implementedBy->append(mc); + cache.implementedBy->append(mc); } } } } - return m_cache.implementedBy.get(); + return cache.implementedBy.get(); } TemplateVariant reimplementedBy() const { - if (!m_cache.reimplementedBy) + Cachable &cache = getCache(); + if (!cache.reimplementedBy) { - m_cache.reimplementedBy.reset(TemplateList::alloc()); + cache.reimplementedBy.reset(TemplateList::alloc()); MemberList *ml = m_memberDef->reimplementedBy(); if (ml) { @@ -4520,12 +4754,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface) { MemberContext *mc = new MemberContext(md); - m_cache.reimplementedBy->append(mc); + cache.reimplementedBy->append(mc); } } } } - return m_cache.reimplementedBy.get(); + return cache.reimplementedBy.get(); } void addExamples(TemplateList *list) const { @@ -4548,25 +4782,27 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); addExamples(exampleList); - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } TemplateVariant typeConstraints() const { - if (!m_cache.typeConstraints && m_memberDef->typeConstraints()) + Cachable &cache = getCache(); + if (!cache.typeConstraints && m_memberDef->typeConstraints()) { - m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); + cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString())); } else { - m_cache.typeConstraints.reset(ArgumentListContext::alloc()); + cache.typeConstraints.reset(ArgumentListContext::alloc()); } - return m_cache.typeConstraints.get(); + return cache.typeConstraints.get(); } TemplateVariant functionQualifier() const { @@ -4585,19 +4821,21 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant sourceRefs() const { - if (!m_cache.sourceRefs) + Cachable &cache = getCache(); + if (!cache.sourceRefs) { - m_cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); + cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); } - return m_cache.sourceRefs.get(); + return cache.sourceRefs.get(); } TemplateVariant sourceRefBys() const { - if (!m_cache.sourceRefBys) + Cachable &cache = getCache(); + if (!cache.sourceRefBys) { - m_cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); + cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); } - return m_cache.sourceRefBys.get(); + return cache.sourceRefBys.get(); } TemplateVariant hasSources() const { @@ -4605,7 +4843,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant sourceCode() const { - if (!m_cache.sourceCodeParsed) + Cachable &cache = getCache(); + if (!cache.sourceCodeParsed) { QCString codeFragment; FileDef *fd = m_memberDef->getBodyDef(); @@ -4624,19 +4863,20 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - m_cache.sourceCode = parseCode(m_memberDef,scopeName,relPathAsString(),codeFragment,startLine,endLine,TRUE); - m_cache.sourceCodeParsed = TRUE; + cache.sourceCode = parseCode(m_memberDef,scopeName,relPathAsString(),codeFragment,startLine,endLine,TRUE); + cache.sourceCodeParsed = TRUE; } } - return m_cache.sourceCode; + return cache.sourceCode; } DotCallGraph *getCallGraph() const { - if (!m_cache.callGraph) + Cachable &cache = getCache(); + if (!cache.callGraph) { - m_cache.callGraph.reset(new DotCallGraph(m_memberDef,FALSE)); + cache.callGraph.reset(new DotCallGraph(m_memberDef,FALSE)); } - return m_cache.callGraph.get(); + return cache.callGraph.get(); } TemplateVariant hasCallGraph() const { @@ -4691,11 +4931,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } DotCallGraph *getCallerGraph() const { - if (!m_cache.callerGraph) + Cachable &cache = getCache(); + if (!cache.callerGraph) { - m_cache.callerGraph.reset(new DotCallGraph(m_memberDef,TRUE)); + cache.callerGraph.reset(new DotCallGraph(m_memberDef,TRUE)); } - return m_cache.callerGraph.get(); + return cache.callerGraph.get(); } TemplateVariant hasCallerGraph() const { @@ -4802,11 +5043,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } private: MemberDef *m_memberDef; - struct Cachable + struct Cachable : public DefinitionContext<MemberContext::Private>::Cachable { - Cachable() : initializerParsed(FALSE), sourceCodeParsed(FALSE) - { - } + Cachable(MemberDef *md) : DefinitionContext<MemberContext::Private>::Cachable(md), + initializerParsed(FALSE), sourceCodeParsed(FALSE), + declArgsParsed(FALSE), declTypeParsed(FALSE) { } SharedPtr<ArgumentListContext> templateArgs; SharedPtr<ArgumentListContext> arguments; SharedPtr<MemberListContext> enumValues; @@ -4832,16 +5073,28 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> bool initializerParsed; TemplateVariant sourceCode; bool sourceCodeParsed; + TemplateVariant declArgs; + bool declArgsParsed; + TemplateVariant declType; + bool declTypeParsed; SharedPtr<TemplateList> examples; SharedPtr<TemplateList> exampleList; SharedPtr<ArgumentListContext> typeConstraints; SharedPtr<TemplateList> propertyAttrs; SharedPtr<TemplateList> eventAttrs; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_memberDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<MemberContext::Private> s_inst; }; //%% } +PropertyMapper<MemberContext::Private> MemberContext::Private::s_inst; + MemberContext::MemberContext(MemberDef *md) : RefCountedContext("MemberContext") { p = new Private(md); @@ -4867,50 +5120,61 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> public: Private(GroupDef *gd) : DefinitionContext<ModuleContext::Private>(gd) , m_groupDef(gd) { - addProperty("title", this,&Private::title); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subHighlight); - addProperty("hasGroupGraph", this,&Private::hasGroupGraph); - addProperty("groupGraph", this,&Private::groupGraph); - addProperty("hasDetails", this,&Private::hasDetails); - addProperty("modules", this,&Private::modules); - addProperty("dirs", this,&Private::dirs); - addProperty("files", this,&Private::files); - addProperty("namespaces", this,&Private::namespaces); - addProperty("classes", this,&Private::classes); - addProperty("constantgroups", this,&Private::constantgroups); - addProperty("examples", this,&Private::examples); - addProperty("macros", this,&Private::macros); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumvalues", this,&Private::enumValues); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("signals", this,&Private::signals); - addProperty("publicSlots", this,&Private::publicSlots); - addProperty("protectedSlots", this,&Private::protectedSlots); - addProperty("privateSlots", this,&Private::privateSlots); - addProperty("events", this,&Private::events); - addProperty("properties", this,&Private::properties); - addProperty("friends", this,&Private::friends); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("detailedMacros", this,&Private::detailedMacros); - addProperty("detailedTypedefs", this,&Private::detailedTypedefs); - addProperty("detailedEnums", this,&Private::detailedEnums); - addProperty("detailedEnumValues", this,&Private::detailedEnumValues); - addProperty("detailedFunctions", this,&Private::detailedFunctions); - addProperty("detailedVariables", this,&Private::detailedVariables); - addProperty("detailedSignals", this,&Private::detailedSignals); - addProperty("detailedPublicSlots", this,&Private::detailedPublicSlots); - addProperty("detailedProtectedSlots", this,&Private::detailedProtectedSlots); - addProperty("detailedPrivateSlots", this,&Private::detailedPrivateSlots); - addProperty("detailedEvents", this,&Private::detailedEvents); - addProperty("detailedProperties", this,&Private::detailedProperties); - addProperty("detailedFriends", this,&Private::detailedFriends); - addProperty("inlineClasses", this,&Private::inlineClasses); - addProperty("compoundType", this,&Private::compoundType); + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("hasGroupGraph", &Private::hasGroupGraph); + s_inst.addProperty("groupGraph", &Private::groupGraph); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("modules", &Private::modules); + s_inst.addProperty("dirs", &Private::dirs); + s_inst.addProperty("files", &Private::files); + s_inst.addProperty("namespaces", &Private::namespaces); + s_inst.addProperty("classes", &Private::classes); + s_inst.addProperty("constantgroups", &Private::constantgroups); + s_inst.addProperty("examples", &Private::examples); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumvalues", &Private::enumValues); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("signals", &Private::signals); + s_inst.addProperty("publicSlots", &Private::publicSlots); + s_inst.addProperty("protectedSlots", &Private::protectedSlots); + s_inst.addProperty("privateSlots", &Private::privateSlots); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("friends", &Private::friends); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("detailedMacros", &Private::detailedMacros); + s_inst.addProperty("detailedTypedefs", &Private::detailedTypedefs); + s_inst.addProperty("detailedEnums", &Private::detailedEnums); + s_inst.addProperty("detailedEnumValues", &Private::detailedEnumValues); + s_inst.addProperty("detailedFunctions", &Private::detailedFunctions); + s_inst.addProperty("detailedVariables", &Private::detailedVariables); + s_inst.addProperty("detailedSignals", &Private::detailedSignals); + s_inst.addProperty("detailedPublicSlots", &Private::detailedPublicSlots); + s_inst.addProperty("detailedProtectedSlots", &Private::detailedProtectedSlots); + s_inst.addProperty("detailedPrivateSlots", &Private::detailedPrivateSlots); + s_inst.addProperty("detailedEvents", &Private::detailedEvents); + s_inst.addProperty("detailedProperties", &Private::detailedProperties); + s_inst.addProperty("detailedFriends", &Private::detailedFriends); + s_inst.addProperty("inlineClasses", &Private::inlineClasses); + s_inst.addProperty("compoundType", &Private::compoundType); + init=TRUE; + } + if (!gd->cookie()) { gd->setCookie(new ModuleContext::Private::Cachable(gd)); } } virtual ~Private() {} + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant title() const { return TemplateVariant(m_groupDef->groupTitle()); @@ -4925,11 +5189,12 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } DotGroupCollaboration *getGroupGraph() const { - if (!m_cache.groupGraph) + Cachable &cache = getCache(); + if (!cache.groupGraph) { - m_cache.groupGraph.reset(new DotGroupCollaboration(m_groupDef)); + cache.groupGraph.reset(new DotGroupCollaboration(m_groupDef)); } - return m_cache.groupGraph.get(); + return cache.groupGraph.get(); } TemplateVariant hasGroupGraph() const { @@ -4991,7 +5256,8 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant modules() const { - if (!m_cache.modules) + Cachable &cache = getCache(); + if (!cache.modules) { TemplateList *moduleList = TemplateList::alloc(); if (m_groupDef->getSubGroups()) @@ -5006,13 +5272,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.modules.reset(moduleList); + cache.modules.reset(moduleList); } - return m_cache.modules.get(); + return cache.modules.get(); } TemplateVariant examples() const { - if (!m_cache.examples) + Cachable &cache = getCache(); + if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); if (m_groupDef->getExamples()) @@ -5024,13 +5291,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> exampleList->append(PageContext::alloc(ex,FALSE,TRUE)); } } - m_cache.examples.reset(exampleList); + cache.examples.reset(exampleList); } - return m_cache.examples.get(); + return cache.examples.get(); } TemplateVariant pages() const { - if (!m_cache.pages) + Cachable &cache = getCache(); + if (!cache.pages) { TemplateList *pageList = TemplateList::alloc(); if (m_groupDef->getExamples()) @@ -5042,13 +5310,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> pageList->append(PageContext::alloc(ex,FALSE,TRUE)); } } - m_cache.pages.reset(pageList); + cache.pages.reset(pageList); } - return m_cache.pages.get(); + return cache.pages.get(); } TemplateVariant dirs() const { - if (!m_cache.dirs) + Cachable &cache = getCache(); + if (!cache.dirs) { TemplateList *dirList = TemplateList::alloc(); if (m_groupDef->getDirs()) @@ -5060,13 +5329,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> dirList->append(DirContext::alloc(dd)); } } - m_cache.dirs.reset(dirList); + cache.dirs.reset(dirList); } - return m_cache.dirs.get(); + return cache.dirs.get(); } TemplateVariant files() const { - if (!m_cache.files) + Cachable &cache = getCache(); + if (!cache.files) { TemplateList *fileList = TemplateList::alloc(); if (m_groupDef->getFiles()) @@ -5078,13 +5348,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> fileList->append(FileContext::alloc(fd)); } } - m_cache.files.reset(fileList); + cache.files.reset(fileList); } - return m_cache.files.get(); + return cache.files.get(); } TemplateVariant classes() const { - if (!m_cache.classes) + Cachable &cache = getCache(); + if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); if (m_groupDef->getClasses()) @@ -5099,13 +5370,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.classes.reset(classList); + cache.classes.reset(classList); } - return m_cache.classes.get(); + return cache.classes.get(); } TemplateVariant namespaces() const { - if (!m_cache.namespaces) + Cachable &cache = getCache(); + if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); if (m_groupDef->getNamespaces()) @@ -5120,13 +5392,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.namespaces.reset(namespaceList); + cache.namespaces.reset(namespaceList); } - return m_cache.namespaces.get(); + return cache.namespaces.get(); } TemplateVariant constantgroups() const { - if (!m_cache.constantgroups) + Cachable &cache = getCache(); + if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); if (m_groupDef->getNamespaces()) @@ -5141,9 +5414,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.constantgroups.reset(namespaceList); + cache.constantgroups.reset(namespaceList); } - return m_cache.constantgroups.get(); + return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, @@ -5168,19 +5441,19 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant macros() const { - return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines()); + return getMemberList(getCache().macros,MemberListType_decDefineMembers,theTranslator->trDefines()); } TemplateVariant typedefs() const { - return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); + return getMemberList(getCache().typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs()); } TemplateVariant enums() const { - return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); + return getMemberList(getCache().enums,MemberListType_decEnumMembers,theTranslator->trEnumerations()); } TemplateVariant enumValues() const { - return getMemberList(m_cache.enums,MemberListType_decEnumValMembers,theTranslator->trEnumerationValues()); + return getMemberList(getCache().enums,MemberListType_decEnumValMembers,theTranslator->trEnumerationValues()); } TemplateVariant functions() const { @@ -5188,113 +5461,115 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> SrcLangExt lang = m_groupDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprograms(); else if (lang==SrcLangExt_VHDL) title=VhdlDocGen::trFunctionAndProc(); - return getMemberList(m_cache.functions,MemberListType_decFuncMembers,title); + return getMemberList(getCache().functions,MemberListType_decFuncMembers,title); } TemplateVariant variables() const { - return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables()); + return getMemberList(getCache().variables,MemberListType_decVarMembers,theTranslator->trVariables()); } TemplateVariant signals() const { - return getMemberList(m_cache.signals,MemberListType_signals,theTranslator->trSignals()); + return getMemberList(getCache().signals,MemberListType_signals,theTranslator->trSignals()); } TemplateVariant publicSlots() const { - return getMemberList(m_cache.publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); + return getMemberList(getCache().publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); } TemplateVariant protectedSlots() const { - return getMemberList(m_cache.protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); + return getMemberList(getCache().protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); } TemplateVariant privateSlots() const { - return getMemberList(m_cache.privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); + return getMemberList(getCache().privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); } TemplateVariant events() const { - return getMemberList(m_cache.events,MemberListType_events,theTranslator->trEvents()); + return getMemberList(getCache().events,MemberListType_events,theTranslator->trEvents()); } TemplateVariant properties() const { - return getMemberList(m_cache.properties,MemberListType_properties,theTranslator->trProperties()); + return getMemberList(getCache().properties,MemberListType_properties,theTranslator->trProperties()); } TemplateVariant friends() const { - return getMemberList(m_cache.friends,MemberListType_friends,theTranslator->trFriends()); + return getMemberList(getCache().friends,MemberListType_friends,theTranslator->trFriends()); } TemplateVariant memberGroups() const { - if (!m_cache.memberGroups) + Cachable &cache = getCache(); + if (!cache.memberGroups) { if (m_groupDef->getMemberGroupSDict()) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroupSDict(),m_groupDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroupSDict(),m_groupDef->subGrouping())); } else { - m_cache.memberGroups.reset(MemberGroupListContext::alloc()); + cache.memberGroups.reset(MemberGroupListContext::alloc()); } } - return m_cache.memberGroups.get(); + return cache.memberGroups.get(); } TemplateVariant detailedMacros() const { - return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); + return getMemberList(getCache().detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation()); } TemplateVariant detailedTypedefs() const { - return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); + return getMemberList(getCache().detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation()); } TemplateVariant detailedEnums() const { - return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); + return getMemberList(getCache().detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation()); } TemplateVariant detailedEnumValues() const { - return getMemberList(m_cache.detailedEnumValues,MemberListType_docEnumValMembers,theTranslator->trEnumerationValueDocumentation()); + return getMemberList(getCache().detailedEnumValues,MemberListType_docEnumValMembers,theTranslator->trEnumerationValueDocumentation()); } TemplateVariant detailedFunctions() const { QCString title = theTranslator->trFunctionDocumentation(); SrcLangExt lang = m_groupDef->getLanguage(); if (lang==SrcLangExt_Fortran) title=theTranslator->trSubprogramDocumentation(); - return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,title); + return getMemberList(getCache().detailedFunctions,MemberListType_docFuncMembers,title); } TemplateVariant detailedVariables() const { - return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); + return getMemberList(getCache().detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation()); } TemplateVariant detailedSignals() const { - return getMemberList(m_cache.detailedSignals,MemberListType_docSignalMembers,theTranslator->trSignals()); + return getMemberList(getCache().detailedSignals,MemberListType_docSignalMembers,theTranslator->trSignals()); } TemplateVariant detailedPublicSlots() const { - return getMemberList(m_cache.detailedPublicSlots,MemberListType_docPubSlotMembers,theTranslator->trPublicSlots()); + return getMemberList(getCache().detailedPublicSlots,MemberListType_docPubSlotMembers,theTranslator->trPublicSlots()); } TemplateVariant detailedProtectedSlots() const { - return getMemberList(m_cache.detailedProtectedSlots,MemberListType_docProSlotMembers,theTranslator->trProtectedSlots()); + return getMemberList(getCache().detailedProtectedSlots,MemberListType_docProSlotMembers,theTranslator->trProtectedSlots()); } TemplateVariant detailedPrivateSlots() const { - return getMemberList(m_cache.detailedPrivateSlots,MemberListType_docPriSlotMembers,theTranslator->trPrivateSlots()); + return getMemberList(getCache().detailedPrivateSlots,MemberListType_docPriSlotMembers,theTranslator->trPrivateSlots()); } TemplateVariant detailedEvents() const { - return getMemberList(m_cache.detailedEvents,MemberListType_docEventMembers,theTranslator->trEventDocumentation(),TRUE); + return getMemberList(getCache().detailedEvents,MemberListType_docEventMembers,theTranslator->trEventDocumentation(),TRUE); } TemplateVariant detailedProperties() const { - return getMemberList(m_cache.detailedProperties,MemberListType_docPropMembers,theTranslator->trPropertyDocumentation(),TRUE); + return getMemberList(getCache().detailedProperties,MemberListType_docPropMembers,theTranslator->trPropertyDocumentation(),TRUE); } TemplateVariant detailedFriends() const { - return getMemberList(m_cache.detailedFriends,MemberListType_docFriendMembers,theTranslator->trFriends(),TRUE); + return getMemberList(getCache().detailedFriends,MemberListType_docFriendMembers,theTranslator->trFriends(),TRUE); } TemplateVariant inlineClasses() const { - if (!m_cache.inlineClasses) + Cachable &cache = getCache(); + if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); if (m_groupDef->getClasses()) @@ -5312,9 +5587,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } } } - m_cache.inlineClasses.reset(classList); + cache.inlineClasses.reset(classList); } - return m_cache.inlineClasses.get(); + return cache.inlineClasses.get(); } TemplateVariant compoundType() const { @@ -5322,8 +5597,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } private: GroupDef *m_groupDef; - struct Cachable + struct Cachable : public DefinitionContext<ModuleContext::Private>::Cachable { + Cachable(GroupDef *gd) : DefinitionContext<ModuleContext::Private>::Cachable(gd) {} SharedPtr<TemplateList> modules; SharedPtr<TemplateList> dirs; SharedPtr<TemplateList> files; @@ -5362,10 +5638,18 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> SharedPtr<TemplateList> inlineClasses; ScopedPtr<DotGroupCollaboration> groupGraph; }; - mutable Cachable m_cache; + Cachable &getCache() const + { + Cachable *c = static_cast<Cachable*>(m_groupDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper<ModuleContext::Private> s_inst; }; //%% } +PropertyMapper<ModuleContext::Private> ModuleContext::Private::s_inst; + ModuleContext::ModuleContext(GroupDef *gd) : RefCountedContext("ModuleContext") { p = new Private(gd); @@ -5440,17 +5724,26 @@ TemplateListIntf::ConstIterator *ClassListContext::createIterator() const //------------------------------------------------------------------------ //%% list ClassIndex[Class] : list of classes -class ClassIndexContext::Private : public PropertyMapper +class ClassIndexContext::Private { public: Private() { - addProperty("list", this,&Private::list); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("list", &Private::list); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant list() const { @@ -5519,8 +5812,11 @@ class ClassIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> classes; }; mutable Cachable m_cache; + static PropertyMapper<ClassIndexContext::Private> s_inst; }; +PropertyMapper<ClassIndexContext::Private> ClassIndexContext::Private::s_inst; + ClassIndexContext::ClassIndexContext() : RefCountedContext("ClassIndexContext") { p = new Private; @@ -5614,7 +5910,7 @@ static int computePreferredDepth(const TemplateListIntf *list,int maxDepth) //%% struct ClassHierarchy: inheritance tree //%% { -class ClassHierarchyContext::Private : public PropertyMapper +class ClassHierarchyContext::Private { public: Private() @@ -5625,15 +5921,24 @@ class ClassHierarchyContext::Private : public PropertyMapper m_classTree->addClassHierarchy(*Doxygen::classSDict,TRUE); m_classTree->addClassHierarchy(*Doxygen::hiddenClasses,TRUE); //%% ClassInheritance tree - addProperty("tree", this,&Private::tree); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight", this,&Private::subhighlight); - addProperty("title", this,&Private::title); - addProperty("preferredDepth", this,&Private::preferredDepth); - addProperty("maxDepth", this,&Private::maxDepth); - addProperty("diagrams", this,&Private::diagrams); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth", &Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + s_inst.addProperty("diagrams", &Private::diagrams); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -5727,9 +6032,12 @@ class ClassHierarchyContext::Private : public PropertyMapper ScopedPtr<DotGfxHierarchyTable> hierarchy; }; mutable Cachable m_cache; + static PropertyMapper<ClassHierarchyContext::Private> s_inst; }; //%% } +PropertyMapper<ClassHierarchyContext::Private> ClassHierarchyContext::Private::s_inst; + ClassHierarchyContext::ClassHierarchyContext() : RefCountedContext("ClassHierarchyContext") { p = new Private; @@ -5749,7 +6057,7 @@ TemplateVariant ClassHierarchyContext::get(const char *name) const //%% struct NestingNode: node is a nesting relation tree //%% { -class NestingNodeContext::Private : public PropertyMapper +class NestingNodeContext::Private { public: Private(const NestingNodeContext *parent,const NestingNodeContext *thisNode, @@ -5757,36 +6065,41 @@ class NestingNodeContext::Private : public PropertyMapper : m_parent(parent), m_def(d), m_level(level), m_index(index) { m_children.reset(NestingContext::alloc(thisNode,level+1)); - //%% bool is_leaf_node: true if this node does not have any children - addProperty("is_leaf_node",this,&Private::isLeafNode); - //%% Nesting children: list of nested classes/namespaces - addProperty("children",this,&Private::children); - //%% [optional] Class class: class info (if this node represents a class) - addProperty("class",this,&Private::getClass); - //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) - addProperty("namespace",this,&Private::getNamespace); - //%% [optional] File file: file info (if this node represents a file) - addProperty("file",this,&Private::getFile); - //%% [optional] Dir dir: directory info (if this node represents a directory) - addProperty("dir",this,&Private::getDir); - //%% [optional] Page page: page info (if this node represents a page) - addProperty("page",this,&Private::getPage); - //%% [optional] Module module: module info (if this node represents a module) - addProperty("module",this,&Private::getModule); - //%% int id - addProperty("id",this,&Private::id); - //%% string level - addProperty("level",this,&Private::level); - //%% string name - addProperty("name",this,&Private::name); - //%% string brief - addProperty("brief",this,&Private::brief); - //%% bool isLinkable - addProperty("isLinkable",this,&Private::isLinkable); - addProperty("anchor",this,&Private::anchor); - addProperty("fileName",this,&Private::fileName); - addProperty("isReference",this,&Private::isReference); - addProperty("externalReference",this,&Private::externalReference); + static bool init=FALSE; + if (!init) + { + //%% bool is_leaf_node: true if this node does not have any children + s_inst.addProperty("is_leaf_node",&Private::isLeafNode); + //%% Nesting children: list of nested classes/namespaces + s_inst.addProperty("children",&Private::children); + //%% [optional] Class class: class info (if this node represents a class) + s_inst.addProperty("class",&Private::getClass); + //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) + s_inst.addProperty("namespace",&Private::getNamespace); + //%% [optional] File file: file info (if this node represents a file) + s_inst.addProperty("file",&Private::getFile); + //%% [optional] Dir dir: directory info (if this node represents a directory) + s_inst.addProperty("dir",&Private::getDir); + //%% [optional] Page page: page info (if this node represents a page) + s_inst.addProperty("page",&Private::getPage); + //%% [optional] Module module: module info (if this node represents a module) + s_inst.addProperty("module",&Private::getModule); + //%% int id + s_inst.addProperty("id",&Private::id); + //%% string level + s_inst.addProperty("level",&Private::level); + //%% string name + s_inst.addProperty("name",&Private::name); + //%% string brief + s_inst.addProperty("brief",&Private::brief); + //%% bool isLinkable + s_inst.addProperty("isLinkable",&Private::isLinkable); + s_inst.addProperty("anchor",&Private::anchor); + s_inst.addProperty("fileName",&Private::fileName); + s_inst.addProperty("isReference",&Private::isReference); + s_inst.addProperty("externalReference",&Private::externalReference); + init=TRUE; + } addNamespaces(addCls); addClasses(inherit,hideSuper); @@ -5794,6 +6107,10 @@ class NestingNodeContext::Private : public PropertyMapper addPages(); addModules(); } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); + } TemplateVariant isLeafNode() const { return m_children->count()==0; @@ -6036,9 +6353,12 @@ class NestingNodeContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> brief; }; mutable Cachable m_cache; + static PropertyMapper<NestingNodeContext::Private> s_inst; }; //%% } +PropertyMapper<NestingNodeContext::Private> NestingNodeContext::Private::s_inst; + NestingNodeContext::NestingNodeContext(const NestingNodeContext *parent, Definition *d,int index,int level,bool addClass,bool inherit,bool hideSuper) : RefCountedContext("NestingNodeContext") @@ -6368,7 +6688,7 @@ void NestingContext::addDerivedClasses(const BaseClassList *bcl,bool hideSuper) //%% struct ClassTree: Class nesting relations //%% { -class ClassTreeContext::Private : public PropertyMapper +class ClassTreeContext::Private { public: Private() @@ -6383,14 +6703,23 @@ class ClassTreeContext::Private : public PropertyMapper m_classTree->addClasses(*Doxygen::classSDict,TRUE); } //%% Nesting tree - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6459,9 +6788,12 @@ class ClassTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<ClassTreeContext::Private> s_inst; }; //%% } +PropertyMapper<ClassTreeContext::Private> ClassTreeContext::Private::s_inst; + ClassTreeContext::ClassTreeContext() : RefCountedContext("ClassTreeContext") { p = new Private; @@ -6528,7 +6860,7 @@ TemplateListIntf::ConstIterator *NamespaceListContext::createIterator() const //%% struct NamespaceTree: tree of nested namespace //%% { -class NamespaceTreeContext::Private : public PropertyMapper +class NamespaceTreeContext::Private { public: Private() @@ -6539,14 +6871,23 @@ class NamespaceTreeContext::Private : public PropertyMapper m_namespaceTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE); } //%% Nesting tree - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6615,9 +6956,12 @@ class NamespaceTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<NamespaceTreeContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceTreeContext::Private> NamespaceTreeContext::Private::s_inst; + NamespaceTreeContext::NamespaceTreeContext() : RefCountedContext("NamespaceTreeContext") { p = new Private; @@ -6789,7 +7133,7 @@ void UsedFilesContext::addFile(FileDef *fd) //%% struct FileTree: tree of directories and files //%% { -class FileTreeContext::Private : public PropertyMapper +class FileTreeContext::Private { public: Private() @@ -6805,14 +7149,23 @@ class FileTreeContext::Private : public PropertyMapper m_dirFileTree->addFiles(*Doxygen::inputNameList); } //%% DirFile tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6868,9 +7221,12 @@ class FileTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<FileTreeContext::Private> s_inst; }; //%% } +PropertyMapper<FileTreeContext::Private> FileTreeContext::Private::s_inst; + FileTreeContext::FileTreeContext() : RefCountedContext("FileTreeContext") { p = new Private; @@ -6890,7 +7246,7 @@ TemplateVariant FileTreeContext::get(const char *name) const //%% struct PageTree: tree of related pages //%% { -class PageTreeContext::Private : public PropertyMapper +class PageTreeContext::Private { public: Private(const PageSDict *pages) @@ -6903,14 +7259,23 @@ class PageTreeContext::Private : public PropertyMapper } //%% PageNodeList tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -6965,9 +7330,12 @@ class PageTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<PageTreeContext::Private> s_inst; }; //%% } +PropertyMapper<PageTreeContext::Private> PageTreeContext::Private::s_inst; + PageTreeContext::PageTreeContext(const PageSDict *pages) : RefCountedContext("PageTreeContext") { p = new Private(pages); @@ -7130,7 +7498,7 @@ TemplateListIntf::ConstIterator *ModuleListContext::createIterator() const //%% struct ModuleTree: tree of modules //%% { -class ModuleTreeContext::Private : public PropertyMapper +class ModuleTreeContext::Private { public: Private() @@ -7143,14 +7511,23 @@ class ModuleTreeContext::Private : public PropertyMapper } //%% ModuleList tree: - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -7205,9 +7582,12 @@ class ModuleTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<ModuleTreeContext::Private> s_inst; }; //%% } +PropertyMapper<ModuleTreeContext::Private> ModuleTreeContext::Private::s_inst; + ModuleTreeContext::ModuleTreeContext() : RefCountedContext("ModuleTreeContext") { p = new Private; @@ -7227,17 +7607,26 @@ TemplateVariant ModuleTreeContext::get(const char *name) const //%% struct NavPathElem: list of examples page //%% { -class NavPathElemContext::Private : public PropertyMapper +class NavPathElemContext::Private { public: Private(Definition *def) : m_def(def) { - addProperty("isLinkable",this,&Private::isLinkable); - addProperty("fileName",this,&Private::fileName); - addProperty("anchor",this,&Private::anchor); - addProperty("text",this,&Private::text); - addProperty("isReference",this,&Private::isReference); - addProperty("externalReference",this,&Private::externalReference); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("isLinkable", &Private::isLinkable); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("text", &Private::text); + s_inst.addProperty("isReference", &Private::isReference); + s_inst.addProperty("externalReference",&Private::externalReference); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant isLinkable() const { @@ -7287,9 +7676,12 @@ class NavPathElemContext::Private : public PropertyMapper } private: Definition *m_def; + static PropertyMapper<NavPathElemContext::Private> s_inst; }; //%% } +PropertyMapper<NavPathElemContext::Private> NavPathElemContext::Private::s_inst; + NavPathElemContext::NavPathElemContext(Definition *def) : RefCountedContext("NavPathElemContext") { p = new Private(def); @@ -7310,7 +7702,7 @@ TemplateVariant NavPathElemContext::get(const char *name) const //%% struct ExampleList: list of examples page //%% { -class ExampleTreeContext::Private : public PropertyMapper +class ExampleTreeContext::Private { public: Private() @@ -7322,14 +7714,23 @@ class ExampleTreeContext::Private : public PropertyMapper m_exampleTree->addPages(*Doxygen::exampleSDict,TRUE); } - addProperty("tree",this,&Private::tree); - addProperty("fileName",this,&Private::fileName); - addProperty("relPath",this,&Private::relPath); - addProperty("highlight",this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title",this,&Private::title); - addProperty("preferredDepth",this,&Private::preferredDepth); - addProperty("maxDepth",this,&Private::maxDepth); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant tree() const { @@ -7384,9 +7785,12 @@ class ExampleTreeContext::Private : public PropertyMapper bool preferredDepthComputed; }; mutable Cachable m_cache; + static PropertyMapper<ExampleTreeContext::Private> s_inst; }; //%% } +PropertyMapper<ExampleTreeContext::Private> ExampleTreeContext::Private::s_inst; + ExampleTreeContext::ExampleTreeContext() : RefCountedContext("ExampleTreeContext") { p = new Private; @@ -7406,26 +7810,35 @@ TemplateVariant ExampleTreeContext::get(const char *name) const //%% struct GlobalsIndex: list of examples page //%% { -class GlobalsIndexContext::Private : public PropertyMapper +class GlobalsIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -7529,9 +7942,12 @@ class GlobalsIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> macros; }; mutable Cachable m_cache; + static PropertyMapper<GlobalsIndexContext::Private> s_inst; }; //%% } +PropertyMapper<GlobalsIndexContext::Private> GlobalsIndexContext::Private::s_inst; + GlobalsIndexContext::GlobalsIndexContext() : RefCountedContext("GlobalsIndexContext") { p = new Private; @@ -7551,26 +7967,35 @@ TemplateVariant GlobalsIndexContext::get(const char *name) const //%% struct ClassMembersIndex: list of examples page //%% { -class ClassMembersIndexContext::Private : public PropertyMapper +class ClassMembersIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -7676,9 +8101,12 @@ class ClassMembersIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> related; }; mutable Cachable m_cache; + static PropertyMapper<ClassMembersIndexContext::Private> s_inst; }; //%% } +PropertyMapper<ClassMembersIndexContext::Private> ClassMembersIndexContext::Private::s_inst; + ClassMembersIndexContext::ClassMembersIndexContext() : RefCountedContext("ClassMembersIndexContext") { p = new Private; @@ -7698,26 +8126,35 @@ TemplateVariant ClassMembersIndexContext::get(const char *name) const //%% struct NamespaceMembersIndex: list of examples page //%% { -class NamespaceMembersIndexContext::Private : public PropertyMapper +class NamespaceMembersIndexContext::Private { public: Private() { - addProperty("all", this,&Private::all); - addProperty("functions", this,&Private::functions); - addProperty("variables", this,&Private::variables); - addProperty("typedefs", this,&Private::typedefs); - addProperty("enums", this,&Private::enums); - addProperty("enumValues", this,&Private::enumValues); - addProperty("macros", this,&Private::macros); - addProperty("properties", this,&Private::properties); - addProperty("events", this,&Private::events); - addProperty("related", this,&Private::related); - addProperty("fileName", this,&Private::fileName); - addProperty("relPath", this,&Private::relPath); - addProperty("highlight", this,&Private::highlight); - addProperty("subhighlight",this,&Private::subhighlight); - addProperty("title", this,&Private::title); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("all", &Private::all); + s_inst.addProperty("functions", &Private::functions); + s_inst.addProperty("variables", &Private::variables); + s_inst.addProperty("typedefs", &Private::typedefs); + s_inst.addProperty("enums", &Private::enums); + s_inst.addProperty("enumValues", &Private::enumValues); + s_inst.addProperty("macros", &Private::macros); + s_inst.addProperty("properties", &Private::properties); + s_inst.addProperty("events", &Private::events); + s_inst.addProperty("related", &Private::related); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight",&Private::subhighlight); + s_inst.addProperty("title", &Private::title); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } typedef bool (MemberDef::*MemberFunc)() const; TemplateVariant getMembersFiltered(SharedPtr<TemplateList> &listRef,MemberFunc filter) const @@ -7820,9 +8257,12 @@ class NamespaceMembersIndexContext::Private : public PropertyMapper SharedPtr<TemplateList> enumValues; }; mutable Cachable m_cache; + static PropertyMapper<NamespaceMembersIndexContext::Private> s_inst; }; //%% } +PropertyMapper<NamespaceMembersIndexContext::Private> NamespaceMembersIndexContext::Private::s_inst; + NamespaceMembersIndexContext::NamespaceMembersIndexContext() : RefCountedContext("NamespaceMembersIndexContext") { p = new Private; @@ -7842,12 +8282,21 @@ TemplateVariant NamespaceMembersIndexContext::get(const char *name) const //%% struct InheritanceGraph: a connected graph reprenting part of the overall interitance tree //%% { -class InheritanceGraphContext::Private : public PropertyMapper +class InheritanceGraphContext::Private { public: Private(DotGfxHierarchyTable *hierarchy,DotNode *n,int id) : m_hierarchy(hierarchy), m_node(n), m_id(id) { - addProperty("graph",this,&Private::graph); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("graph",&Private::graph); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant graph() const { @@ -7870,8 +8319,11 @@ class InheritanceGraphContext::Private : public PropertyMapper DotGfxHierarchyTable *m_hierarchy; DotNode *m_node; int m_id; + static PropertyMapper<InheritanceGraphContext::Private> s_inst; }; +PropertyMapper<InheritanceGraphContext::Private> InheritanceGraphContext::Private::s_inst; + InheritanceGraphContext::InheritanceGraphContext(DotGfxHierarchyTable *hierarchy,DotNode *n,int id) : RefCountedContext("InheritanceGraphContext") { @@ -7893,13 +8345,22 @@ TemplateVariant InheritanceGraphContext::get(const char *name) const //%% struct InheritanceNode: a class in the inheritance list //%% { -class InheritanceNodeContext::Private : public PropertyMapper +class InheritanceNodeContext::Private { public: Private(ClassDef *cd,const QCString &name) : m_classDef(cd), m_name(name) { - addProperty("class",this,&Private::getClass); - addProperty("name",this,&Private::name); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("class",&Private::getClass); + s_inst.addProperty("name", &Private::name); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant getClass() const { @@ -7917,9 +8378,12 @@ class InheritanceNodeContext::Private : public PropertyMapper ClassDef *m_classDef; mutable SharedPtr<ClassContext> m_classContext; QCString m_name; + static PropertyMapper<InheritanceNodeContext::Private> s_inst; }; //%% } +PropertyMapper<InheritanceNodeContext::Private> InheritanceNodeContext::Private::s_inst; + InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) : RefCountedContext("InheritanceNodeContext") { p = new Private(cd,name); @@ -8074,19 +8538,28 @@ TemplateListIntf::ConstIterator *MemberListContext::createIterator() const //%% struct MemberInfo: member information //%% { -class MemberInfoContext::Private : public PropertyMapper +class MemberInfoContext::Private { public: Private(const MemberInfo *mi) : m_memberInfo(mi) { - //%% string protection - addProperty("protection",this,&Private::protection); - //%% string virtualness - addProperty("virtualness",this,&Private::virtualness); - //%% string ambiguityScope - addProperty("ambiguityScope",this,&Private::ambiguityScope); - //%% Member member - addProperty("member",this,&Private::member); + static bool init=FALSE; + if (!init) + { + //%% string protection + s_inst.addProperty("protection", &Private::protection); + //%% string virtualness + s_inst.addProperty("virtualness", &Private::virtualness); + //%% string ambiguityScope + s_inst.addProperty("ambiguityScope",&Private::ambiguityScope); + //%% Member member + s_inst.addProperty("member", &Private::member); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant protection() const { @@ -8131,9 +8604,12 @@ class MemberInfoContext::Private : public PropertyMapper private: const MemberInfo *m_memberInfo; mutable SharedPtr<MemberContext> m_member; + static PropertyMapper<MemberInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberInfoContext::Private> MemberInfoContext::Private::s_inst; + MemberInfoContext::MemberInfoContext(const MemberInfo *mi) : RefCountedContext("MemberInfoContext") { p = new Private(mi); @@ -8223,7 +8699,7 @@ TemplateListIntf::ConstIterator *AllMembersListContext::createIterator() const //%% struct MemberGroupInfo: member group information //%% { -class MemberGroupInfoContext::Private : public PropertyMapper +class MemberGroupInfoContext::Private { public: Private(Definition *def,const QCString &relPath,const MemberGroup *mg) : @@ -8231,13 +8707,22 @@ class MemberGroupInfoContext::Private : public PropertyMapper m_relPath(relPath), m_memberGroup(mg) { - addProperty("members", this,&Private::members); - addProperty("title", this,&Private::groupTitle); - addProperty("subtitle", this,&Private::groupSubtitle); - addProperty("anchor", this,&Private::groupAnchor); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("docs", this,&Private::docs); - addProperty("inherited", this,&Private::inherited); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("title", &Private::groupTitle); + s_inst.addProperty("subtitle", &Private::groupSubtitle); + s_inst.addProperty("anchor", &Private::groupAnchor); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("docs", &Private::docs); + s_inst.addProperty("inherited", &Private::inherited); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant members() const { @@ -8301,9 +8786,12 @@ class MemberGroupInfoContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> docs; }; mutable Cachable m_cache; + static PropertyMapper<MemberGroupInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberGroupInfoContext::Private> MemberGroupInfoContext::Private::s_inst; + MemberGroupInfoContext::MemberGroupInfoContext(Definition *def, const QCString &relPath,const MemberGroup *mg) : RefCountedContext("MemberGroupInfoContext") { @@ -8394,7 +8882,7 @@ TemplateListIntf::ConstIterator *MemberGroupListContext::createIterator() const //%% struct MemberListInfo: member list information //%% { -class MemberListInfoContext::Private : public PropertyMapper +class MemberListInfoContext::Private { public: Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) : @@ -8404,12 +8892,21 @@ class MemberListInfoContext::Private : public PropertyMapper m_title(title), m_subtitle(subtitle) { - addProperty("members", this,&Private::members); - addProperty("title", this,&Private::title); - addProperty("subtitle", this,&Private::subtitle); - addProperty("anchor", this,&Private::anchor); - addProperty("memberGroups", this,&Private::memberGroups); - addProperty("inherited", this,&Private::inherited); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("subtitle", &Private::subtitle); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("memberGroups", &Private::memberGroups); + s_inst.addProperty("inherited", &Private::inherited); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant members() const { @@ -8470,9 +8967,12 @@ class MemberListInfoContext::Private : public PropertyMapper SharedPtr<InheritedMemberInfoListContext> inherited; }; mutable Cachable m_cache; + static PropertyMapper<MemberListInfoContext::Private> s_inst; }; //%% } +PropertyMapper<MemberListInfoContext::Private> MemberListInfoContext::Private::s_inst; + MemberListInfoContext::MemberListInfoContext( Definition *def,const QCString &relPath,const MemberList *ml, const QCString &title,const QCString &subtitle) : RefCountedContext("MemberListInfoContext") @@ -8494,17 +8994,26 @@ TemplateVariant MemberListInfoContext::get(const char *name) const //%% struct InheritedMemberInfo: inherited member information //%% { -class InheritedMemberInfoContext::Private : public PropertyMapper +class InheritedMemberInfoContext::Private { public: Private(ClassDef *cd,MemberList *ml,const QCString &title) : m_class(cd), m_memberList(ml), m_title(title) { - addProperty("class", this,&Private::getClass); - addProperty("title", this,&Private::title); - addProperty("members", this,&Private::members); - addProperty("id", this,&Private::id); - addProperty("inheritedFrom", this,&Private::inheritedFrom); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("class", &Private::getClass); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("members", &Private::members); + s_inst.addProperty("id", &Private::id); + s_inst.addProperty("inheritedFrom", &Private::inheritedFrom); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } virtual ~Private() { @@ -8553,9 +9062,12 @@ class InheritedMemberInfoContext::Private : public PropertyMapper mutable SharedPtr<ClassContext> m_classCtx; mutable SharedPtr<MemberListContext> m_memberListCtx; mutable SharedPtr<TemplateList> m_inheritedFrom; + static PropertyMapper<InheritedMemberInfoContext::Private> s_inst; }; //%% } +PropertyMapper<InheritedMemberInfoContext::Private> InheritedMemberInfoContext::Private::s_inst; + InheritedMemberInfoContext::InheritedMemberInfoContext(ClassDef *cd,MemberList *ml, const QCString &title) : RefCountedContext("InheritedMemberInfoContext") { @@ -8732,19 +9244,28 @@ TemplateListIntf::ConstIterator *InheritedMemberInfoListContext::createIterator( //%% struct Argument: parameter information //%% { -class ArgumentContext::Private : public PropertyMapper +class ArgumentContext::Private { public: Private(const Argument *arg,Definition *def,const QCString &relPath) : m_argument(arg), m_def(def), m_relPath(relPath) { - addProperty("type", this,&Private::type); - addProperty("name", this,&Private::name); - addProperty("defVal", this,&Private::defVal); - addProperty("docs", this,&Private::docs); - addProperty("attrib", this,&Private::attrib); - addProperty("array", this,&Private::array); - addProperty("namePart", this,&Private::namePart); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("type", &Private::type); + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("defVal", &Private::defVal); + s_inst.addProperty("docs", &Private::docs); + s_inst.addProperty("attrib", &Private::attrib); + s_inst.addProperty("array", &Private::array); + s_inst.addProperty("namePart", &Private::namePart); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant type() const { @@ -8803,9 +9324,12 @@ class ArgumentContext::Private : public PropertyMapper ScopedPtr<TemplateVariant> docs; }; mutable Cachable m_cache; + static PropertyMapper<ArgumentContext::Private> s_inst; }; //%% } +PropertyMapper<ArgumentContext::Private> ArgumentContext::Private::s_inst; + ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath) : RefCountedContext("ArgumentContext") { p = new Private(al,def,relPath); @@ -8895,16 +9419,25 @@ TemplateListIntf::ConstIterator *ArgumentListContext::createIterator() const //%% struct SymbolGroup: search group of similar symbols //%% { -class SymbolContext::Private : public PropertyMapper +class SymbolContext::Private { public: Private(const Definition *d,const Definition *prev, const Definition *next) : m_def(d), m_prevDef(prev), m_nextDef(next) { - addProperty("fileName",this,&Private::fileName); - addProperty("anchor", this,&Private::anchor); - addProperty("scope", this,&Private::scope); - addProperty("relPath", this,&Private::relPath); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("fileName",&Private::fileName); + s_inst.addProperty("anchor", &Private::anchor); + s_inst.addProperty("scope", &Private::scope); + s_inst.addProperty("relPath", &Private::relPath); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant fileName() const { @@ -8990,9 +9523,12 @@ class SymbolContext::Private : public PropertyMapper const Definition *m_def; const Definition *m_prevDef; const Definition *m_nextDef; + static PropertyMapper<SymbolContext::Private> s_inst; }; //%% } +PropertyMapper<SymbolContext::Private> SymbolContext::Private::s_inst; + SymbolContext::SymbolContext(const Definition *def,const Definition *prevDef,const Definition *nextDef) : RefCountedContext("SymbolContext") { @@ -9061,14 +9597,23 @@ TemplateListIntf::ConstIterator *SymbolListContext::createIterator() const //%% struct SymbolGroup: search group of similar symbols //%% { -class SymbolGroupContext::Private : public PropertyMapper +class SymbolGroupContext::Private { public: Private(const SearchDefinitionList *sdl) : m_sdl(sdl) { - addProperty("id", this,&Private::id); - addProperty("name", this,&Private::name); - addProperty("symbols",this,&Private::symbolList); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("id", &Private::id); + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("symbols",&Private::symbolList); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant id() const { @@ -9093,9 +9638,12 @@ class SymbolGroupContext::Private : public PropertyMapper SharedPtr<SymbolListContext> symbolList; }; mutable Cachable m_cache; + static PropertyMapper<SymbolGroupContext::Private> s_inst; }; //%% } +PropertyMapper<SymbolGroupContext::Private> SymbolGroupContext::Private::s_inst; + SymbolGroupContext::SymbolGroupContext(const SearchDefinitionList *sdl) : RefCountedContext("SymbolGroupContext") { @@ -9160,14 +9708,23 @@ TemplateListIntf::ConstIterator *SymbolGroupListContext::createIterator() const //%% struct SymbolIndex: search index //%% { -class SymbolIndexContext::Private : public PropertyMapper +class SymbolIndexContext::Private { public: Private(const SearchIndexList *sl,const QCString &name) : m_searchList(sl), m_name(name) { - addProperty("name", this,&Private::name); - addProperty("letter", this,&Private::letter); - addProperty("symbolGroups",this,&Private::symbolGroups); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("letter", &Private::letter); + s_inst.addProperty("symbolGroups",&Private::symbolGroups); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant name() const { @@ -9193,9 +9750,12 @@ class SymbolIndexContext::Private : public PropertyMapper SharedPtr<SymbolGroupListContext> symbolGroups; }; mutable Cachable m_cache; + static PropertyMapper<SymbolIndexContext::Private> s_inst; }; //%% } +PropertyMapper<SymbolIndexContext::Private> SymbolIndexContext::Private::s_inst; + SymbolIndexContext::SymbolIndexContext(const SearchIndexList *sl,const QCString &name) : RefCountedContext("SymbolIndexContext") { @@ -9260,14 +9820,23 @@ TemplateListIntf::ConstIterator *SymbolIndicesContext::createIterator() const //%% struct SearchIndex: search index //%% { -class SearchIndexContext::Private : public PropertyMapper +class SearchIndexContext::Private { public: Private(const SearchIndexInfo *info) : m_info(info) { - addProperty("name", this,&Private::name); - addProperty("text", this,&Private::text); - addProperty("symbolIndices",this,&Private::symbolIndices); + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("name", &Private::name); + s_inst.addProperty("text", &Private::text); + s_inst.addProperty("symbolIndices",&Private::symbolIndices); + init=TRUE; + } + } + TemplateVariant get(const char *n) const + { + return s_inst.get(this,n); } TemplateVariant name() const { @@ -9292,9 +9861,12 @@ class SearchIndexContext::Private : public PropertyMapper SharedPtr<SymbolIndicesContext> symbolIndices; }; mutable Cachable m_cache; + static PropertyMapper<SearchIndexContext::Private> s_inst; }; //%% } +PropertyMapper<SearchIndexContext::Private> SearchIndexContext::Private::s_inst; + SearchIndexContext::SearchIndexContext(const SearchIndexInfo *info) : RefCountedContext("SearchIndexContext") { @@ -9608,6 +10180,7 @@ void generateOutputViaTemplate() // TODO: clean index before each run... //if (Config_getBool("GENERATE_LATEX")) + if (0) { // render LaTeX output Template *tpl = e.loadByName("latexlayout.tpl",1); if (tpl) diff --git a/src/definition.cpp b/src/definition.cpp index a210295..39164d5 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -282,7 +282,7 @@ void Definition::removeFromMap(Definition *d) Definition::Definition(const char *df,int dl,int dc, const char *name,const char *b, - const char *d,bool isSymbol) + const char *d,bool isSymbol) : m_cookie(0) { m_name = name; m_defLine = dl; @@ -299,7 +299,7 @@ Definition::Definition(const char *df,int dl,int dc, } } -Definition::Definition(const Definition &d) : DefinitionIntf() +Definition::Definition(const Definition &d) : DefinitionIntf(), m_cookie(0) { m_name = d.m_name; m_defLine = d.m_defLine; @@ -380,7 +380,7 @@ Definition::Definition(const Definition &d) : DefinitionIntf() Definition::~Definition() { - if (m_isSymbol) + if (m_isSymbol) { removeFromMap(this); } @@ -389,6 +389,7 @@ Definition::~Definition() delete m_impl; m_impl=0; } + delete m_cookie; } void Definition::setName(const char *name) diff --git a/src/definition.h b/src/definition.h index 4fe953b..2a66ebc 100644 --- a/src/definition.h +++ b/src/definition.h @@ -92,7 +92,8 @@ class DefinitionIntf class Definition : public DefinitionIntf { public: - + struct Cookie {}; + /*! Create a new definition */ Definition( const char *defFileName,int defLine,int defColumn, @@ -344,6 +345,9 @@ class Definition : public DefinitionIntf void addSectionsToIndex(); void writeToc(OutputList &ol); + void setCookie(Cookie *cookie) { m_cookie = cookie; } + Cookie *cookie() const { return m_cookie; } + protected: Definition(const Definition &d); @@ -367,6 +371,7 @@ class Definition : public DefinitionIntf QCString m_symbolName; int m_defLine; int m_defColumn; + Cookie *m_cookie; }; /** A list of Definition objects. */ diff --git a/src/template.cpp b/src/template.cpp index 6ce187b..2ad5ecc 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -142,92 +142,38 @@ static QCString replace(const char *s,char csrc,char cdst) //- TemplateVariant implementation ------------------------------------------- -/** @brief Private data of a template variant object */ -class TemplateVariant::Private -{ - public: - Private(Type t) : type(t), intVal(0), boolVal(TRUE), strukt(0), list(0), raw(FALSE) {} - Type type; - int intVal; - QCString strVal; - bool boolVal; - TemplateStructIntf *strukt; - TemplateListIntf *list; - Delegate delegate; - bool raw; -}; - -TemplateVariant::TemplateVariant() -{ - p = new Private(None); -} - -TemplateVariant::TemplateVariant(bool b) -{ - p = new Private(Bool); - p->boolVal = b; -} - -TemplateVariant::TemplateVariant(int v) -{ - p = new Private(Integer); - p->intVal = v; -} - -TemplateVariant::TemplateVariant(const char *s,bool raw) -{ - p = new Private(String); - p->strVal = s; - p->raw = raw; -} - -TemplateVariant::TemplateVariant(const QCString &s,bool raw) -{ - p = new Private(String); - p->strVal = s; - p->raw = raw; -} TemplateVariant::TemplateVariant(TemplateStructIntf *s) + : m_type(Struct), m_strukt(s), m_raw(FALSE) { - p = new Private(Struct); - p->strukt = s; - p->strukt->addRef(); + m_strukt->addRef(); } TemplateVariant::TemplateVariant(TemplateListIntf *l) + : m_type(List), m_list(l), m_raw(FALSE) { - p = new Private(List); - p->list = l; - p->list->addRef(); -} - -TemplateVariant::TemplateVariant(const TemplateVariant::Delegate &delegate) -{ - p = new Private(Function); - p->delegate = delegate; + m_list->addRef(); } TemplateVariant::~TemplateVariant() { - if (p->type==Struct) p->strukt->release(); - else if (p->type==List) p->list->release(); - delete p; + if (m_type==Struct) m_strukt->release(); + else if (m_type==List) m_list->release(); } TemplateVariant::TemplateVariant(const TemplateVariant &v) + : m_type(v.m_type), m_strukt(0), m_raw(FALSE) { - p = new Private(v.p->type); - p->raw = v.p->raw; - switch (p->type) + m_raw = v.m_raw; + switch (m_type) { case None: break; - case Bool: p->boolVal = v.p->boolVal; break; - case Integer: p->intVal = v.p->intVal; break; - case String: p->strVal = v.p->strVal; break; - case Struct: p->strukt = v.p->strukt; p->strukt->addRef(); break; - case List: p->list = v.p->list; p->list->addRef(); break; - case Function: p->delegate= v.p->delegate;break; + case Bool: m_boolVal = v.m_boolVal; break; + case Integer: m_intVal = v.m_intVal; break; + case String: m_strVal = v.m_strVal; break; + case Struct: m_strukt = v.m_strukt; m_strukt->addRef(); break; + case List: m_list = v.m_list; m_list->addRef(); break; + case Function: m_delegate= v.m_delegate;break; } } @@ -235,21 +181,21 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) { // assignment can change the type of the variable, so we have to be // careful with reference counted content. - TemplateStructIntf *tmpStruct = p->type==Struct ? p->strukt : 0; - TemplateListIntf *tmpList = p->type==List ? p->list : 0; - Type tmpType = p->type; + TemplateStructIntf *tmpStruct = m_type==Struct ? m_strukt : 0; + TemplateListIntf *tmpList = m_type==List ? m_list : 0; + Type tmpType = m_type; - p->type = v.p->type; - p->raw = v.p->raw; - switch (p->type) + m_type = v.m_type; + m_raw = v.m_raw; + switch (m_type) { case None: break; - case Bool: p->boolVal = v.p->boolVal; break; - case Integer: p->intVal = v.p->intVal; break; - case String: p->strVal = v.p->strVal; break; - case Struct: p->strukt = v.p->strukt; p->strukt->addRef(); break; - case List: p->list = v.p->list; p->list->addRef(); break; - case Function: p->delegate= v.p->delegate;break; + case Bool: m_boolVal = v.m_boolVal; break; + case Integer: m_intVal = v.m_intVal; break; + case String: m_strVal = v.m_strVal; break; + case Struct: m_strukt = v.m_strukt; m_strukt->addRef(); break; + case List: m_list = v.m_list; m_list->addRef(); break; + case Function: m_delegate= v.m_delegate;break; } // release overwritten reference counted values @@ -258,161 +204,34 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) return *this; } -QCString TemplateVariant::toString() const -{ - QCString result; - switch (p->type) - { - case None: - break; - case Bool: - result=p->boolVal ? "true" : "false"; - break; - case Integer: - result=QCString().setNum(p->intVal); - break; - case String: - result=p->strVal; - break; - case Struct: - result="[struct]"; - break; - case List: - result="[list]"; - break; - case Function: - result="[function]"; - break; - } - return result; -} - bool TemplateVariant::toBool() const { - bool result=FALSE; - switch (p->type) + switch (m_type) { - case None: - break; - case Bool: - result = p->boolVal; - break; - case Integer: - result = p->intVal!=0; - break; - case String: - result = !p->strVal.isEmpty(); // && p->strVal!="false" && p->strVal!="0"; - break; - case Struct: - result = TRUE; - break; - case List: - result = p->list->count()!=0; - break; - case Function: - result = FALSE; - break; + case None: return FALSE; + case Bool: return m_boolVal; + case Integer: return m_intVal!=0; + case String: return !m_strVal.isEmpty(); + case Struct: return TRUE; + case List: return m_list->count()!=0; + case Function: return FALSE; } - return result; + return FALSE; } int TemplateVariant::toInt() const { - int result=0; - switch (p->type) - { - case None: - break; - case Bool: - result = p->boolVal ? 1 : 0; - break; - case Integer: - result = p->intVal; - break; - case String: - result = p->strVal.toInt(); - break; - case Struct: - break; - case List: - result = p->list->count(); - break; - case Function: - result = 0; - break; - } - return result; -} - -TemplateStructIntf *TemplateVariant::toStruct() const -{ - return p->type==Struct ? p->strukt : 0; -} - -TemplateListIntf *TemplateVariant::toList() const -{ - return p->type==List ? p->list : 0; -} - -TemplateVariant TemplateVariant::call(const QValueList<TemplateVariant> &args) -{ - if (p->type==Function) return p->delegate(args); - return TemplateVariant(); -} - -bool TemplateVariant::operator==(TemplateVariant &other) -{ - if (p->type==None) - { - return FALSE; - } - if (p->type==TemplateVariant::List && other.p->type==TemplateVariant::List) - { - return p->list==other.p->list; // TODO: improve me - } - else if (p->type==TemplateVariant::Struct && other.p->type==TemplateVariant::Struct) - { - return p->strukt==other.p->strukt; // TODO: improve me - } - else - { - return toString()==other.toString(); - } -} - -TemplateVariant::Type TemplateVariant::type() const -{ - return p->type; -} - -QCString TemplateVariant::typeAsString() const -{ - switch (p->type) + switch (m_type) { - case None: return "none"; - case Bool: return "bool"; - case Integer: return "integer"; - case String: return "string"; - case Struct: return "struct"; - case List: return "list"; - case Function: return "function"; + case None: return 0; + case Bool: return m_boolVal ? 1 : 0; + case Integer: return m_intVal; + case String: return m_strVal.toInt(); + case Struct: return 0; + case List: return m_list->count(); + case Function: return 0; } - return "invalid"; -} - -bool TemplateVariant::isValid() const -{ - return p->type!=None; -} - -void TemplateVariant::setRaw(bool b) -{ - p->raw = b; -} - -bool TemplateVariant::raw() const -{ - return p->raw; + return 0; } //- Template struct implementation -------------------------------------------- @@ -2491,9 +2310,8 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const } else // obj.prop { - TemplateVariant v; QCString objName = name.left(i); - v = getPrimary(objName); + TemplateVariant v = getPrimary(objName); QCString propName = name.mid(i+1); while (!propName.isEmpty()) { diff --git a/src/template.h b/src/template.h index d1501ce..3cd89b3 100644 --- a/src/template.h +++ b/src/template.h @@ -139,28 +139,41 @@ class TemplateVariant enum Type { None, Bool, Integer, String, Struct, List, Function }; /** Returns the type of the value stored in the variant */ - Type type() const; + Type type() const { return m_type; } /** Return a string representation of the type of the value stored in the variant */ - QCString typeAsString() const; + QCString typeAsString() const + { + switch (m_type) + { + case None: return "none"; + case Bool: return "bool"; + case Integer: return "integer"; + case String: return "string"; + case Struct: return "struct"; + case List: return "list"; + case Function: return "function"; + } + return "invalid"; + } /** Returns TRUE if the variant holds a valid value, or FALSE otherwise */ - bool isValid() const; + bool isValid() const { return m_type!=None; } /** Constructs an invalid variant. */ - TemplateVariant(); + TemplateVariant() : m_type(None), m_strukt(0), m_raw(FALSE) {} /** Constructs a new variant with a boolean value \a b. */ - explicit TemplateVariant(bool b); + explicit TemplateVariant(bool b) : m_type(Bool), m_boolVal(b), m_raw(FALSE) {} /** Constructs a new variant with a integer value \a v. */ - TemplateVariant(int v); + TemplateVariant(int v) : m_type(Integer), m_intVal(v), m_raw(FALSE) {} /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const char *s,bool raw=FALSE); + TemplateVariant(const char *s,bool raw=FALSE) : m_type(String), m_strVal(s), m_strukt(0), m_raw(raw) {} /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const QCString &s,bool raw=FALSE); + TemplateVariant(const QCString &s,bool raw=FALSE) : m_type(String), m_strVal(s), m_strukt(0), m_raw(raw) {} /** Constructs a new variant with a struct value \a s. * @note. The variant will hold a reference to the object. @@ -179,7 +192,7 @@ class TemplateVariant * TemplateVariant::Delegate::fromFunction() to create * Delegate objects. */ - TemplateVariant(const Delegate &delegate); + TemplateVariant(const Delegate &delegate) : m_type(Function), m_strukt(0), m_delegate(delegate), m_raw(FALSE) {} /** Destroys the Variant object */ ~TemplateVariant(); @@ -195,46 +208,96 @@ class TemplateVariant /** Compares this QVariant with v and returns true if they are equal; * otherwise returns false. */ - bool operator==(TemplateVariant &other); + bool operator==(TemplateVariant &other) + { + if (m_type==None) + { + return FALSE; + } + if (m_type==TemplateVariant::List && other.m_type==TemplateVariant::List) + { + return m_list==other.m_list; // TODO: improve me + } + else if (m_type==TemplateVariant::Struct && other.m_type==TemplateVariant::Struct) + { + return m_strukt==other.m_strukt; // TODO: improve me + } + else + { + return toString()==other.toString(); + } + } /** Returns the variant as a string. */ - QCString toString() const; + QCString toString() const + { + switch (m_type) + { + case None: return QCString(); + case Bool: return m_boolVal ? "true" : "false"; + case Integer: return QCString().setNum(m_intVal); + case String: return m_strVal; + case Struct: return "[struct]"; + case List: return "[list]"; + case Function: return "[function]"; + } + return QCString(); + } /** Returns the variant as a boolean. */ - bool toBool() const; + bool toBool() const; /** Returns the variant as an integer. */ - int toInt() const; + int toInt() const; /** Returns the pointer to list referenced by this variant * or 0 if this variant does not have list type. */ - TemplateListIntf *toList() const; + TemplateListIntf *toList() const + { + return m_type==List ? m_list : 0; + } /** Returns the pointer to struct referenced by this variant * or 0 if this variant does not have struct type. */ - TemplateStructIntf *toStruct() const; + TemplateStructIntf *toStruct() const + { + return m_type==Struct ? m_strukt : 0; + } /** Return the result of apply this function with \a args. * Returns an empty string if the variant type is not a function. */ - TemplateVariant call(const QValueList<TemplateVariant> &args); + TemplateVariant call(const QValueList<TemplateVariant> &args) + { + if (m_type==Function) return m_delegate(args); + return TemplateVariant(); + } /** Sets whether or not the value of the Variant should be * escaped or written as-is (raw). * @param[in] b TRUE means write as-is, FALSE means apply escaping. */ - void setRaw(bool b); + void setRaw(bool b) { m_raw = b; } /** Returns whether or not the value of the Value is raw. * @see setRaw() */ - bool raw() const; + bool raw() const { return m_raw; } private: - class Private; - Private *p; + Type m_type; + QCString m_strVal; + union + { + int m_intVal; + bool m_boolVal; + TemplateStructIntf *m_strukt; + TemplateListIntf *m_list; + }; + Delegate m_delegate; + bool m_raw; }; //------------------------------------------------------------------------ |