summaryrefslogtreecommitdiff
path: root/src/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/context.cpp')
-rw-r--r--src/context.cpp2452
1 files changed, 1791 insertions, 661 deletions
diff --git a/src/context.cpp b/src/context.cpp
index e573dde..2d46c86 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -27,6 +27,8 @@
// TODO: pass the current file to Dot*::writeGraph, so the user can put dot graphs in other
// files as well
+#define ADD_PROPERTY(name) addProperty(#name,this,&Private::name);
+
struct ContextGlobals
{
enum OutputFormat
@@ -65,12 +67,37 @@ template<class T> class ScopedPtr
void reset(T *p=0) { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } }
};
+/** @brief Reference counting smart pointer */
+template<class T> class SharedPtr
+{
+ private:
+ T *m_ptr;
+ SharedPtr(const SharedPtr &);
+ SharedPtr &operator=(const SharedPtr &p);
+ void operator==(const SharedPtr &) const;
+ void operator!=(const SharedPtr &) const;
+
+ public:
+ typedef T Type;
+ explicit SharedPtr(T *p=0) : m_ptr(p) { if (m_ptr) m_ptr->addRef(); }
+ ~SharedPtr() { if (m_ptr) m_ptr->release(); };
+ T &operator*() const { return *m_ptr; }
+ T *operator->() const { return m_ptr; }
+ T *get() const { return m_ptr; }
+ operator bool() const { return m_ptr!=0; }
+ void reset(T *p=0)
+ {
+ if (p) p->addRef();
+ if (m_ptr) m_ptr->release();
+ m_ptr = p;
+ }
+};
+
/** @brief Template List iterator support */
-template<class T>
class GenericConstIterator : public TemplateListIntf::ConstIterator
{
public:
- GenericConstIterator(const QList<T> &list)
+ GenericConstIterator(const QList<TemplateVariant> &list)
: m_it(list) { }
virtual ~GenericConstIterator() {}
void toFirst()
@@ -93,7 +120,7 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator
{
if (m_it.current())
{
- v = m_it.current();
+ v = *m_it.current();
return TRUE;
}
else
@@ -103,17 +130,16 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator
}
}
private:
- QListIterator<T> m_it;
+ QListIterator<TemplateVariant> m_it;
};
//------------------------------------------------------------------------
/** @brief standard template list implementation */
-template<class T>
class GenericNodeListContext : public TemplateListIntf
{
public:
- GenericNodeListContext()
+ GenericNodeListContext() : m_refCount(0)
{
m_children.setAutoDelete(TRUE);
}
@@ -128,31 +154,45 @@ class GenericNodeListContext : public TemplateListIntf
TemplateVariant result;
if (index>=0 && index<count())
{
- result = m_children.at(index);
+ result = *m_children.at(index);
}
return result;
}
TemplateListIntf::ConstIterator *createIterator() const
{
- return new GenericConstIterator<T>(m_children);
+ return new GenericConstIterator(m_children);
}
- void append(T *ctn)
+ void append(const TemplateVariant &ctn)
{
- m_children.append(ctn);
+ m_children.append(new TemplateVariant(ctn));
}
bool isEmpty() const
{
return m_children.isEmpty();
}
+ int addRef()
+ {
+ return ++m_refCount;
+ }
+ int release()
+ {
+ int count = --m_refCount;
+ if (count<=0)
+ {
+ delete this;
+ }
+ return count;
+ }
private:
- mutable QList<T> m_children;
+ mutable QList<TemplateVariant> m_children;
+ int m_refCount;
};
//------------------------------------------------------------------------
/** @brief Helper class to map a property name to a handler member function */
-class PropertyMapper
+class PropertyMapper
{
private:
struct PropertyFuncIntf
@@ -224,29 +264,34 @@ class PropertyMapper
class ConfigContext::Private
{
public:
- Private() { cachedLists.setAutoDelete(TRUE); }
+ Private() { m_cachedLists.setAutoDelete(TRUE); }
+ ~Private() { }
TemplateVariant fetchList(const QCString &name,const QStrList *list)
{
- TemplateList *tlist = cachedLists.find(name);
- if (tlist==0)
+ TemplateVariant *v = m_cachedLists.find(name);
+ if (v==0)
{
- tlist = new TemplateList;
- cachedLists.insert(name,tlist);
+ TemplateList *tlist = TemplateList::alloc();
+ m_cachedLists.insert(name,new TemplateVariant(tlist));
QStrListIterator li(*list);
char *s;
for (li.toFirst();(s=li.current());++li)
{
tlist->append(s);
}
+ return tlist;
+ }
+ else
+ {
+ return *v;
}
- return tlist;
}
private:
- QDict<TemplateList> cachedLists;
+ QDict<TemplateVariant> m_cachedLists;
};
//%% }
-ConfigContext::ConfigContext()
+ConfigContext::ConfigContext() : RefCountedContext("ConfigContext")
{
p = new Private;
}
@@ -310,7 +355,7 @@ class DoxygenContext::Private : public PropertyMapper
};
//%% }
-DoxygenContext::DoxygenContext()
+DoxygenContext::DoxygenContext() : RefCountedContext("DoxygenContext")
{
p = new Private;
}
@@ -453,6 +498,18 @@ class TranslateContext::Private : public PropertyMapper
}
return TemplateVariant();
}
+ TemplateVariant handleIncludeDependencyGraph(const QValueList<TemplateVariant> &args) const
+ {
+ if (args.count()==1)
+ {
+ return theTranslator->trInclDepGraph(args[0].toString());
+ }
+ else
+ {
+ err("tr.includeDependencyGraph should take one string argument, got %d\n",args.count());
+ }
+ return TemplateVariant();
+ }
@@ -483,11 +540,17 @@ class TranslateContext::Private : public PropertyMapper
TemplateVariant classes() const
{
return theTranslator->trClasses();
+ // TODO: VHDL: trVhdlType(VhdlDocGen::ENTITY,FALSE)
+ // TODO: Fortran: trDataTypes()
}
TemplateVariant classList() const
{
return theTranslator->trCompoundList();
}
+ TemplateVariant classListDescription() const
+ {
+ return theTranslator->trCompoundListDescription();
+ }
TemplateVariant classIndex() const
{
return theTranslator->trCompoundIndex();
@@ -669,6 +732,47 @@ class TranslateContext::Private : public PropertyMapper
{
return theTranslator->trAdditionalInheritedMembers();
}
+ TemplateVariant includeDependencyGraph() const
+ {
+ return TemplateVariant::Delegate::fromMethod<Private,&Private::handleIncludeDependencyGraph>(this);
+ }
+ TemplateVariant includedByDependencyGraph() const
+ {
+ return theTranslator->trInclByDepGraph();
+ }
+ TemplateVariant gotoSourceCode() const
+ {
+ return theTranslator->trGotoSourceCode();
+ }
+ TemplateVariant gotoDocumentation() const
+ {
+ return theTranslator->trGotoDocumentation();
+ }
+ TemplateVariant constantgroups() const
+ {
+ return theTranslator->trConstantGroups();
+ }
+ TemplateVariant classDocumentation() const
+ {
+ return theTranslator->trClassDocumentation();
+ }
+ TemplateVariant compoundMembers() const
+ {
+ return theTranslator->trCompoundMembers();
+ }
+ TemplateVariant detailLevel() const
+ {
+ return theTranslator->trDetailLevel();
+ }
+ TemplateVariant fileListDescription() const
+ {
+ bool extractAll = Config_getBool("EXTRACT_ALL");
+ return theTranslator->trFileListDescription(extractAll);
+ }
+ TemplateVariant directories() const
+ {
+ return theTranslator->trDirectories();
+ }
Private()
{
//%% string generatedBy
@@ -683,6 +787,8 @@ class TranslateContext::Private : public PropertyMapper
addProperty("classes", this,&Private::classes);
//%% string classList
addProperty("classList", this,&Private::classList);
+ //%% string classListDescription
+ addProperty("classListDescription", this,&Private::classListDescription);
//%% string classIndex
addProperty("classIndex", this,&Private::classIndex);
//%% string classHierarchy
@@ -761,6 +867,26 @@ class TranslateContext::Private : public PropertyMapper
addProperty("inheritedFrom", this,&Private::inheritedFrom);
//%% string addtionalInheritedMembers
addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers);
+ //%% string includeDependencyGraph:container_name
+ addProperty("includeDependencyGraph",this,&Private::includeDependencyGraph);
+ //%% string includedByDependencyGraph
+ addProperty("includedByDependencyGraph",this,&Private::includedByDependencyGraph);
+ //%% string gotoSourceCode
+ addProperty("gotoSourceCode", this,&Private::gotoSourceCode);
+ //%% string gotoDocumentation
+ addProperty("gotoDocumentation", this,&Private::gotoDocumentation);
+ //%% string constantgroups
+ addProperty("constantgroups", this,&Private::constantgroups);
+ //%% string classDocumentation
+ addProperty("classDocumentation", this,&Private::classDocumentation);
+ //%% string compoundMembers
+ addProperty("compoundMembers", this,&Private::compoundMembers);
+ //%% string detailLevel
+ addProperty("detailLevel", this,&Private::detailLevel);
+ //%% string fileListDescription
+ addProperty("fileListDescription",this,&Private::fileListDescription);
+ //%% string directories
+ addProperty("directories", this,&Private::directories);
m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
@@ -773,7 +899,7 @@ class TranslateContext::Private : public PropertyMapper
};
//%% }
-TranslateContext::TranslateContext()
+TranslateContext::TranslateContext() : RefCountedContext("TranslateContext")
{
p = new Private;
}
@@ -823,6 +949,31 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q
return TemplateVariant(s.data(),TRUE);
}
+static TemplateVariant parseCode(FileDef *fd,const QCString &relPath)
+{
+ static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
+ ParserInterface *pIntf = Doxygen::parserManager->getParser(fd->getDefFileExtension());
+ pIntf->resetCodeParserState();
+ QGString s;
+ FTextStream t(&s);
+ HtmlCodeGenerator codeGen(t,relPath);
+ pIntf->parseCode(codeGen,0,
+ fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources
+ fd->getLanguage(), // lang
+ FALSE, // isExampleBlock
+ 0, // exampleName
+ fd, // fileDef
+ -1, // startLine
+ -1, // endLine
+ FALSE, // inlineFragment
+ 0, // memberDef
+ TRUE, // showLineNumbers
+ 0, // searchCtx
+ TRUE // collectXRefs, TODO: should become FALSE
+ );
+ return TemplateVariant(s.data(),TRUE);
+}
+
//------------------------------------------------------------------------
//%% struct Symbol: shared info for all symbols
@@ -864,29 +1015,33 @@ class DefinitionContext : public PropertyMapper
//%% list[Definition] navigationPath: Breadcrumb navigation path to this item
addProperty("navigationPath",this,&DefinitionContext::navigationPath);
+ m_cache.sourceDef.reset(TemplateList::alloc());
+ m_cache.lineLink.reset(TemplateStruct::alloc());
+ m_cache.fileLink.reset(TemplateStruct::alloc());
+
if (m_def && !m_def->getSourceFileBase().isEmpty())
{
- m_sourceDef.append(&m_lineLink);
- m_sourceDef.append(&m_fileLink);
- m_lineLink.set("text",m_def->getStartBodyLine());
- m_lineLink.set("isLinkable",TRUE);
- m_lineLink.set("fileName",m_def->getSourceFileBase());
- m_lineLink.set("anchor",m_def->getSourceAnchor());
+ m_cache.lineLink->set("text",m_def->getStartBodyLine());
+ m_cache.lineLink->set("isLinkable",TRUE);
+ m_cache.lineLink->set("fileName",m_def->getSourceFileBase());
+ m_cache.lineLink->set("anchor",m_def->getSourceAnchor());
if (m_def->definitionType()==Definition::TypeFile)
{
- m_fileLink.set("text",m_def->name());
+ m_cache.fileLink->set("text",m_def->name());
}
else if (m_def->getBodyDef())
{
- m_fileLink.set("text",m_def->getBodyDef()->name());
+ m_cache.fileLink->set("text",m_def->getBodyDef()->name());
}
else
{
- m_fileLink.set("text",name());
+ m_cache.fileLink->set("text",name());
}
- m_fileLink.set("isLinkable",TRUE);
- m_fileLink.set("fileName",m_def->getSourceFileBase());
- m_fileLink.set("anchor",QCString());
+ m_cache.fileLink->set("isLinkable",TRUE);
+ m_cache.fileLink->set("fileName",m_def->getSourceFileBase());
+ m_cache.fileLink->set("anchor",QCString());
+ m_cache.sourceDef->append(m_cache.lineLink.get());
+ m_cache.sourceDef->append(m_cache.fileLink.get());
}
}
TemplateVariant fileName() const
@@ -997,9 +1152,9 @@ class DefinitionContext : public PropertyMapper
}
TemplateVariant sourceDef() const
{
- if (m_sourceDef.count()==2)
+ if (m_cache.sourceDef->count()==2)
{
- return &m_sourceDef;
+ return m_cache.sourceDef.get();
}
else
{
@@ -1018,16 +1173,21 @@ class DefinitionContext : public PropertyMapper
{
fillPath(((const FileDef*)def)->getDirDef(),list);
}
- NavPathElemContext *elem = new NavPathElemContext(def);
- list->append(elem);
- m_cache.navPathElems.append(elem);
+ list->append(NavPathElemContext::alloc(def));
}
TemplateVariant navigationPath() const
{
if (!m_cache.navPath)
{
- TemplateList *list = new TemplateList;
- fillPath(m_def,list);
+ TemplateList *list = TemplateList::alloc();
+ if (m_def->getOuterScope() && m_def->getOuterScope()!=Doxygen::globalScope)
+ {
+ fillPath(m_def->getOuterScope(),list);
+ }
+ else if (m_def->definitionType()==Definition::TypeFile && ((const FileDef *)m_def)->getDirDef())
+ {
+ fillPath(((const FileDef *)m_def)->getDirDef(),list);
+ }
m_cache.navPath.reset(list);
}
return m_cache.navPath.get();
@@ -1037,17 +1197,16 @@ class DefinitionContext : public PropertyMapper
Definition *m_def;
struct Cachable
{
- Cachable() { navPathElems.setAutoDelete(TRUE); }
+ Cachable() { }
ScopedPtr<TemplateVariant> details;
ScopedPtr<TemplateVariant> brief;
ScopedPtr<TemplateVariant> inbodyDocs;
- ScopedPtr<TemplateList> navPath;
- QList<NavPathElemContext> navPathElems;
+ SharedPtr<TemplateList> navPath;
+ SharedPtr<TemplateList> sourceDef;
+ SharedPtr<TemplateStruct> fileLink;
+ SharedPtr<TemplateStruct> lineLink;
};
mutable Cachable m_cache;
- TemplateList m_sourceDef;
- TemplateStruct m_fileLink;
- TemplateStruct m_lineLink;
};
//%% }
@@ -1058,9 +1217,8 @@ class DefinitionContext : public PropertyMapper
class IncludeInfoContext::Private : public PropertyMapper
{
public:
- Private(IncludeInfo *info,SrcLangExt lang) :
+ Private(const IncludeInfo *info,SrcLangExt lang) :
m_info(info),
- m_fileContext(info && info->fileDef ? info->fileDef : 0),
m_lang(lang)
{
if (m_info)
@@ -1082,9 +1240,13 @@ class IncludeInfoContext::Private : public PropertyMapper
}
TemplateVariant file() const
{
- if (m_info->fileDef)
+ if (!m_fileContext && m_info && m_info->fileDef)
{
- return &m_fileContext;
+ m_fileContext.reset(FileContext::alloc(m_info->fileDef));
+ }
+ if (m_fileContext)
+ {
+ return m_fileContext.get();
}
else
{
@@ -1096,12 +1258,12 @@ class IncludeInfoContext::Private : public PropertyMapper
return m_info->includeName;
}
private:
- IncludeInfo *m_info;
- FileContext m_fileContext;
+ const IncludeInfo *m_info;
+ mutable SharedPtr<FileContext> m_fileContext;
SrcLangExt m_lang;
};
-IncludeInfoContext::IncludeInfoContext(IncludeInfo *info,SrcLangExt lang)
+IncludeInfoContext::IncludeInfoContext(const IncludeInfo *info,SrcLangExt lang) : RefCountedContext("IncludeContext")
{
p = new Private(info,lang);
}
@@ -1119,14 +1281,59 @@ TemplateVariant IncludeInfoContext::get(const char *n) const
//------------------------------------------------------------------------
+//%% list IncludeInfoList[Class] : list of nested classes
+class IncludeInfoListContext::Private : public GenericNodeListContext
+{
+ public:
+ Private(const QList<IncludeInfo> &list,SrcLangExt lang)
+ {
+ QListIterator<IncludeInfo> li(list);
+ IncludeInfo *ii;
+ for (li.toFirst();(ii=li.current());++li)
+ {
+ if (!ii->indirect)
+ {
+ append(IncludeInfoContext::alloc(ii,lang));
+ }
+ }
+ }
+};
+
+IncludeInfoListContext::IncludeInfoListContext(const QList<IncludeInfo> &list,SrcLangExt lang) : RefCountedContext("IncludeListContext")
+{
+ p = new Private(list,lang);
+}
+
+IncludeInfoListContext::~IncludeInfoListContext()
+{
+ delete p;
+}
+
+// TemplateListIntf
+int IncludeInfoListContext::count() const
+{
+ return p->count();
+}
+
+TemplateVariant IncludeInfoListContext::at(int index) const
+{
+ return p->at(index);
+}
+
+TemplateListIntf::ConstIterator *IncludeInfoListContext::createIterator() const
+{
+ return p->createIterator();
+}
+
+//------------------------------------------------------------------------
+
//%% struct Class(Symbol): class information
//%% {
class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
public:
- Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd) ,
- m_classDef(cd), m_usedFiles(cd),
- m_includeInfo(cd ? cd->includeInfo() : 0, cd ? cd->getLanguage() : SrcLangExt_Unknown)
+ Private(ClassDef *cd) : DefinitionContext<ClassContext::Private>(cd),
+ m_classDef(cd)
{
addProperty("title", this,&Private::title);
addProperty("highlight", this,&Private::highlight);
@@ -1139,7 +1346,6 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
addProperty("hasCollaborationDiagram", this,&Private::hasCollaborationDiagram);
addProperty("collaborationDiagram", this,&Private::collaborationDiagram);
addProperty("includeInfo", this,&Private::includeInfo);
- addProperty("includeStatement", this,&Private::includeStatement);
addProperty("inherits", this,&Private::inherits);
addProperty("inheritedBy", this,&Private::inheritedBy);
addProperty("unoIDLServices", this,&Private::unoIDLServices);
@@ -1182,7 +1388,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
addProperty("detailedVariables", this,&Private::detailedVariables);
addProperty("detailedProperties", this,&Private::detailedProperties);
addProperty("detailedEvents", this,&Private::detailedEvents);
- addProperty("nestedClasses", this,&Private::nestedClasses);
+ addProperty("classes", this,&Private::classes);
addProperty("compoundType", this,&Private::compoundType);
addProperty("templateDecls", this,&Private::templateDecls);
addProperty("typeConstraints", this,&Private::typeConstraints);
@@ -1215,7 +1421,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
}
TemplateVariant usedFiles() const
{
- return TemplateVariant(&m_usedFiles);
+ if (!m_cache.usedFiles)
+ {
+ m_cache.usedFiles.reset(UsedFilesContext::alloc(m_classDef));
+ }
+ return m_cache.usedFiles.get();
}
DotClassGraph *getClassGraph() const
{
@@ -1317,24 +1527,24 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
TemplateVariant includeInfo() const
{
- if (m_classDef->includeInfo())
+ if (!m_cache.includeInfo && m_classDef->includeInfo())
+ {
+ m_cache.includeInfo.reset(IncludeInfoContext::alloc(m_classDef->includeInfo(),m_classDef->getLanguage()));
+ }
+ if (m_cache.includeInfo)
{
- return TemplateVariant(&m_includeInfo);
+ return m_cache.includeInfo.get();
}
else
{
return TemplateVariant(FALSE);
}
}
- TemplateVariant includeStatement() const
- {
- return m_classDef->includeStatement();
- }
TemplateVariant inherits() const
{
if (!m_cache.inheritsList)
{
- m_cache.inheritsList.reset(new InheritanceListContext(m_classDef->baseClasses(),TRUE));
+ m_cache.inheritsList.reset(InheritanceListContext::alloc(m_classDef->baseClasses(),TRUE));
}
return m_cache.inheritsList.get();
}
@@ -1342,11 +1552,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!m_cache.inheritedByList)
{
- m_cache.inheritedByList.reset(new InheritanceListContext(m_classDef->subClasses(),FALSE));
+ m_cache.inheritedByList.reset(InheritanceListContext::alloc(m_classDef->subClasses(),FALSE));
}
return m_cache.inheritedByList.get();
}
- TemplateVariant getMemberList(ScopedPtr<MemberListInfoContext> &list,
+ TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list,
MemberListType type,const char *title,bool detailed=FALSE) const
{
if (!list)
@@ -1354,7 +1564,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
MemberList *ml = m_classDef->getMemberList(type);
if (ml)
{
- list.reset(new MemberListInfoContext(m_classDef,relPathAsString(),ml,title,detailed));
+ list.reset(MemberListInfoContext::alloc(m_classDef,relPathAsString(),ml,title,detailed));
}
}
if (list)
@@ -1530,34 +1740,26 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE);
}
- TemplateVariant nestedClasses() const
+ TemplateVariant classes() const
{
- static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
- static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
- static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
- if (!m_cache.nestedClasses)
+ if (!m_cache.classes)
{
- NestedClassListContext *classList = new NestedClassListContext;
+ NestedClassListContext *classList = NestedClassListContext::alloc();
if (m_classDef->getClassSDict())
{
ClassSDict::Iterator sdi(*m_classDef->getClassSDict());
ClassDef *cd;
for (sdi.toFirst();(cd=sdi.current());++sdi)
{
- bool linkable = cd->isLinkable();
- if (cd->name().find('@')==-1 && !cd->isExtension() &&
- (cd->protection()!=::Private || extractPrivate) &&
- (linkable ||
- (!hideUndocClasses && (!cd->isLocal() || extractLocalClasses)))
- )
+ if (cd->visibleInParentsDeclList())
{
classList->append(cd);
}
}
}
- m_cache.nestedClasses.reset(classList);
+ m_cache.classes.reset(classList);
}
- return m_cache.nestedClasses.get();
+ return m_cache.classes.get();
}
TemplateVariant compoundType() const
{
@@ -1575,10 +1777,9 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
ClassDef *cd=(ClassDef *)d;
if (cd->templateArguments())
{
- ArgumentListContext *al = new ArgumentListContext(cd->templateArguments(),cd,relPathAsString());
+ ArgumentListContext *al = ArgumentListContext::alloc(cd->templateArguments(),cd,relPathAsString());
// since a TemplateVariant does take ownership of the object, we add it
// a separate list just to be able to delete it and avoid a memory leak
- m_cache.templateArgList.append(al);
tl->append(al);
}
}
@@ -1591,8 +1792,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
Example *ex;
for (it.toFirst();(ex=it.current());++it)
{
- TemplateStruct *s = new TemplateStruct;
- m_cache.exampleList.append(s);
+ TemplateStruct *s = TemplateStruct::alloc();
s->set("text",ex->name);
s->set("isLinkable",TRUE);
s->set("anchor",ex->anchor);
@@ -1605,7 +1805,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!m_cache.templateDecls)
{
- TemplateList *tl = new TemplateList;
+ TemplateList *tl = TemplateList::alloc();
addTemplateDecls(m_classDef,tl);
m_cache.templateDecls.reset(tl);
}
@@ -1615,11 +1815,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!m_cache.typeConstraints && m_classDef->typeConstraints())
{
- m_cache.typeConstraints.reset(new ArgumentListContext(m_classDef->typeConstraints(),m_classDef,relPathAsString()));
+ m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_classDef->typeConstraints(),m_classDef,relPathAsString()));
}
else
{
- m_cache.typeConstraints.reset(new ArgumentListContext);
+ m_cache.typeConstraints.reset(ArgumentListContext::alloc());
}
return m_cache.typeConstraints.get();
}
@@ -1627,7 +1827,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!m_cache.examples)
{
- TemplateList *exampleList = new TemplateList;
+ TemplateList *exampleList = TemplateList::alloc();
addExamples(exampleList);
m_cache.examples.reset(exampleList);
}
@@ -1682,20 +1882,23 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
addMembers(m_classDef,MemberListType_priAttribs);
addMembers(m_classDef,MemberListType_priStaticAttribs);
addMembers(m_classDef,MemberListType_related);
- m_cache.members.reset(new MemberListContext(&m_cache.allMembers));
+ m_cache.members.reset(MemberListContext::alloc(&m_cache.allMembers));
}
return m_cache.members.get();
}
TemplateVariant allMembersList() const
{
- if (!m_cache.allMembersList && m_classDef->memberNameInfoSDict())
+ if (!m_cache.allMembersList)
{
- AllMembersListContext *ml = new AllMembersListContext(m_classDef->memberNameInfoSDict());
- m_cache.allMembersList.reset(ml);
- }
- else
- {
- m_cache.allMembersList.reset(new AllMembersListContext);
+ if (m_classDef->memberNameInfoSDict())
+ {
+ AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoSDict());
+ m_cache.allMembersList.reset(ml);
+ }
+ else
+ {
+ m_cache.allMembersList.reset(AllMembersListContext::alloc());
+ }
}
return m_cache.allMembersList.get();
}
@@ -1709,11 +1912,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (m_classDef->getMemberGroupSDict())
{
- m_cache.memberGroups.reset(new MemberGroupListContext(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping()));
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping()));
}
else
{
- m_cache.memberGroups.reset(new MemberGroupListContext);
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc());
}
}
return m_cache.memberGroups.get();
@@ -1722,7 +1925,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!m_cache.additionalInheritedMembers)
{
- InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext;
+ InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc();
ctx->addMemberList(m_classDef,MemberListType_pubTypes,theTranslator->trPublicTypes());
ctx->addMemberList(m_classDef,MemberListType_services,theTranslator->trServices());
ctx->addMemberList(m_classDef,MemberListType_interfaces,theTranslator->trInterfaces());
@@ -1763,78 +1966,72 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
private:
ClassDef *m_classDef;
- UsedFilesContext m_usedFiles;
- IncludeInfoContext m_includeInfo;
struct Cachable
{
- Cachable() : inheritanceNodes(-1)
- {
- templateArgList.setAutoDelete(TRUE);
- exampleList.setAutoDelete(TRUE);
- allMembers.setAutoDelete(TRUE);
- }
- ScopedPtr<InheritanceListContext> inheritsList;
- ScopedPtr<InheritanceListContext> inheritedByList;
+ Cachable() : inheritanceNodes(-1) { }
+ SharedPtr<IncludeInfoContext> includeInfo;
+ SharedPtr<InheritanceListContext> inheritsList;
+ SharedPtr<InheritanceListContext> inheritedByList;
ScopedPtr<DotClassGraph> classGraph;
ScopedPtr<DotClassGraph> collaborationGraph;
- ScopedPtr<NestedClassListContext> nestedClasses;
- ScopedPtr<MemberListInfoContext> publicTypes;
- ScopedPtr<MemberListInfoContext> publicMethods;
- ScopedPtr<MemberListInfoContext> publicStaticMethods;
- ScopedPtr<MemberListInfoContext> publicAttributes;
- ScopedPtr<MemberListInfoContext> publicStaticAttributes;
- ScopedPtr<MemberListInfoContext> publicSlots;
- ScopedPtr<MemberListInfoContext> protectedTypes;
- ScopedPtr<MemberListInfoContext> protectedMethods;
- ScopedPtr<MemberListInfoContext> protectedStaticMethods;
- ScopedPtr<MemberListInfoContext> protectedAttributes;
- ScopedPtr<MemberListInfoContext> protectedStaticAttributes;
- ScopedPtr<MemberListInfoContext> protectedSlots;
- ScopedPtr<MemberListInfoContext> privateTypes;
- ScopedPtr<MemberListInfoContext> privateMethods;
- ScopedPtr<MemberListInfoContext> privateStaticMethods;
- ScopedPtr<MemberListInfoContext> privateAttributes;
- ScopedPtr<MemberListInfoContext> privateStaticAttributes;
- ScopedPtr<MemberListInfoContext> privateSlots;
- ScopedPtr<MemberListInfoContext> packageTypes;
- ScopedPtr<MemberListInfoContext> packageMethods;
- ScopedPtr<MemberListInfoContext> packageStaticMethods;
- ScopedPtr<MemberListInfoContext> packageAttributes;
- ScopedPtr<MemberListInfoContext> packageStaticAttributes;
- ScopedPtr<MemberListInfoContext> unoIDLServices;
- ScopedPtr<MemberListInfoContext> unoIDLInterfaces;
- ScopedPtr<MemberListInfoContext> signals;
- ScopedPtr<MemberListInfoContext> properties;
- ScopedPtr<MemberListInfoContext> events;
- ScopedPtr<MemberListInfoContext> friends;
- ScopedPtr<MemberListInfoContext> related;
- ScopedPtr<MemberListInfoContext> detailedTypedefs;
- ScopedPtr<MemberListInfoContext> detailedEnums;
- ScopedPtr<MemberListInfoContext> detailedServices;
- ScopedPtr<MemberListInfoContext> detailedInterfaces;
- ScopedPtr<MemberListInfoContext> detailedConstructors;
- ScopedPtr<MemberListInfoContext> detailedMethods;
- ScopedPtr<MemberListInfoContext> detailedRelated;
- ScopedPtr<MemberListInfoContext> detailedVariables;
- ScopedPtr<MemberListInfoContext> detailedProperties;
- ScopedPtr<MemberListInfoContext> detailedEvents;
- ScopedPtr<MemberGroupListContext> memberGroups;
- ScopedPtr<AllMembersListContext> allMembersList;
- ScopedPtr<ArgumentListContext> typeConstraints;
- ScopedPtr<TemplateList> examples;
- ScopedPtr<TemplateList> templateDecls;
- ScopedPtr<InheritedMemberInfoListContext> additionalInheritedMembers;
- ScopedPtr<MemberListContext> members;
- QList<ArgumentListContext> templateArgList;
- int inheritanceNodes;
- QList<TemplateStruct> exampleList;
- MemberList allMembers;
+ SharedPtr<NestedClassListContext> classes;
+ SharedPtr<MemberListInfoContext> publicTypes;
+ SharedPtr<MemberListInfoContext> publicMethods;
+ SharedPtr<MemberListInfoContext> publicStaticMethods;
+ SharedPtr<MemberListInfoContext> publicAttributes;
+ SharedPtr<MemberListInfoContext> publicStaticAttributes;
+ SharedPtr<MemberListInfoContext> publicSlots;
+ SharedPtr<MemberListInfoContext> protectedTypes;
+ SharedPtr<MemberListInfoContext> protectedMethods;
+ SharedPtr<MemberListInfoContext> protectedStaticMethods;
+ SharedPtr<MemberListInfoContext> protectedAttributes;
+ SharedPtr<MemberListInfoContext> protectedStaticAttributes;
+ SharedPtr<MemberListInfoContext> protectedSlots;
+ SharedPtr<MemberListInfoContext> privateTypes;
+ SharedPtr<MemberListInfoContext> privateMethods;
+ SharedPtr<MemberListInfoContext> privateStaticMethods;
+ SharedPtr<MemberListInfoContext> privateAttributes;
+ SharedPtr<MemberListInfoContext> privateStaticAttributes;
+ SharedPtr<MemberListInfoContext> privateSlots;
+ SharedPtr<MemberListInfoContext> packageTypes;
+ SharedPtr<MemberListInfoContext> packageMethods;
+ SharedPtr<MemberListInfoContext> packageStaticMethods;
+ SharedPtr<MemberListInfoContext> packageAttributes;
+ SharedPtr<MemberListInfoContext> packageStaticAttributes;
+ SharedPtr<MemberListInfoContext> unoIDLServices;
+ SharedPtr<MemberListInfoContext> unoIDLInterfaces;
+ SharedPtr<MemberListInfoContext> signals;
+ SharedPtr<MemberListInfoContext> properties;
+ SharedPtr<MemberListInfoContext> events;
+ SharedPtr<MemberListInfoContext> friends;
+ SharedPtr<MemberListInfoContext> related;
+ SharedPtr<MemberListInfoContext> detailedTypedefs;
+ SharedPtr<MemberListInfoContext> detailedEnums;
+ SharedPtr<MemberListInfoContext> detailedServices;
+ SharedPtr<MemberListInfoContext> detailedInterfaces;
+ SharedPtr<MemberListInfoContext> detailedConstructors;
+ SharedPtr<MemberListInfoContext> detailedMethods;
+ SharedPtr<MemberListInfoContext> detailedRelated;
+ SharedPtr<MemberListInfoContext> detailedVariables;
+ SharedPtr<MemberListInfoContext> detailedProperties;
+ SharedPtr<MemberListInfoContext> detailedEvents;
+ SharedPtr<MemberGroupListContext> memberGroups;
+ SharedPtr<AllMembersListContext> allMembersList;
+ SharedPtr<ArgumentListContext> typeConstraints;
+ SharedPtr<TemplateList> examples;
+ SharedPtr<TemplateList> templateDecls;
+ SharedPtr<InheritedMemberInfoListContext> additionalInheritedMembers;
+ SharedPtr<MemberListContext> members;
+ SharedPtr<UsedFilesContext> usedFiles;
+ SharedPtr<TemplateList> exampleList;
+ int inheritanceNodes;
+ MemberList allMembers;
};
mutable Cachable m_cache;
};
//%% }
-ClassContext::ClassContext(ClassDef *cd)
+ClassContext::ClassContext(ClassDef *cd) : RefCountedContext("ClassContext")
{
//printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():"<none>");
p = new Private(cd);
@@ -1862,6 +2059,8 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri
addProperty("title",this,&Private::title);
addProperty("highlight",this,&Private::highlight);
addProperty("subhighlight",this,&Private::subHighlight);
+ addProperty("compoundType",this,&Private::compoundType);
+ addProperty("hasDetails",this,&Private::hasDetails);
}
TemplateVariant title() const
{
@@ -1875,12 +2074,20 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri
{
return TemplateVariant("");
}
+ TemplateVariant compoundType() const
+ {
+ return m_namespaceDef->compoundTypeString();
+ }
+ TemplateVariant hasDetails() const
+ {
+ return m_namespaceDef->hasDetailedDescription();
+ }
private:
NamespaceDef *m_namespaceDef;
};
//%% }
-NamespaceContext::NamespaceContext(NamespaceDef *nd)
+NamespaceContext::NamespaceContext(NamespaceDef *nd) : RefCountedContext("NamespaceContext")
{
p = new Private(nd);
}
@@ -1904,10 +2111,36 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
public:
Private(FileDef *fd) : DefinitionContext<FileContext::Private>(fd) , m_fileDef(fd)
{
- addProperty("title",this,&Private::title);
- addProperty("highlight",this,&Private::highlight);
- addProperty("subhighlight",this,&Private::subHighlight);
- addProperty("versionInfo",this,&Private::versionInfo);
+ if (fd==0) abort();
+ addProperty("title", this,&Private::title);
+ addProperty("highlight", this,&Private::highlight);
+ addProperty("subhighlight", this,&Private::subHighlight);
+ addProperty("versionInfo", this,&Private::versionInfo);
+ addProperty("includeList", this,&Private::includeList);
+ addProperty("hasIncludeGraph", this,&Private::hasIncludeGraph);
+ addProperty("hasIncludedByGraph", this,&Private::hasIncludedByGraph);
+ addProperty("includeGraph", this,&Private::includeGraph);
+ addProperty("includedByGraph", this,&Private::includedByGraph);
+ addProperty("hasDetails", this,&Private::hasDetails);
+ addProperty("hasSourceFile", this,&Private::hasSourceFile);
+ addProperty("sources", this,&Private::sources);
+ addProperty("version", this,&Private::version);
+ addProperty("classes", this,&Private::classes);
+ addProperty("namespaces", this,&Private::namespaces);
+ addProperty("constantgroups", this,&Private::constantgroups);
+ addProperty("macros", this,&Private::macros);
+ addProperty("typedefs", this,&Private::typedefs);
+ addProperty("enums", this,&Private::enums);
+ addProperty("functions", this,&Private::functions);
+ addProperty("variables", this,&Private::variables);
+ addProperty("memberGroups", this,&Private::memberGroups);
+ addProperty("detailedMacros", this,&Private::detailedMacros);
+ addProperty("detailedTypedefs", this,&Private::detailedTypedefs);
+ addProperty("detailedEnums", this,&Private::detailedEnums);
+ addProperty("detailedFunctions", this,&Private::detailedFunctions);
+ addProperty("detailedVariables", this,&Private::detailedVariables);
+ addProperty("inlineClasses", this,&Private::inlineClasses);
+ addProperty("compoundType", this,&Private::compoundType);
}
TemplateVariant title() const
{
@@ -1925,12 +2158,310 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
{
return m_fileDef->getVersion();
}
+ TemplateVariant includeList() const
+ {
+ if (!m_cache.includeInfoList && m_fileDef->includeFileList())
+ {
+ m_cache.includeInfoList.reset(IncludeInfoListContext::alloc(
+ *m_fileDef->includeFileList(),m_fileDef->getLanguage()));
+ }
+ if (m_cache.includeInfoList)
+ {
+ return m_cache.includeInfoList.get();
+ }
+ else
+ {
+ return TemplateVariant(FALSE);
+ }
+ }
+ DotInclDepGraph *getIncludeGraph() const
+ {
+ if (!m_cache.includeGraph)
+ {
+ m_cache.includeGraph.reset(new DotInclDepGraph(m_fileDef,FALSE));
+ }
+ return m_cache.includeGraph.get();
+ }
+ TemplateVariant hasIncludeGraph() const
+ {
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ DotInclDepGraph *incGraph = getIncludeGraph();
+ return (haveDot && !incGraph->isTooBig() && !incGraph->isTrivial());
+ }
+ TemplateVariant includeGraph() const
+ {
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ QGString result;
+ if (haveDot)
+ {
+ DotInclDepGraph *cg = getIncludeGraph();
+ FTextStream t(&result);
+ cg->writeGraph(t,BITMAP,
+ g_globals.outputDir,
+ g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension,
+ relPathAsString(),TRUE,g_globals.dynSectionId
+ );
+ }
+ g_globals.dynSectionId++;
+ return TemplateVariant(result.data(),TRUE);
+ }
+ DotInclDepGraph *getIncludedByGraph() const
+ {
+ if (!m_cache.includedByGraph)
+ {
+ m_cache.includedByGraph.reset(new DotInclDepGraph(m_fileDef,TRUE));
+ }
+ return m_cache.includedByGraph.get();
+ }
+ TemplateVariant hasIncludedByGraph() const
+ {
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ DotInclDepGraph *incGraph = getIncludedByGraph();
+ return (haveDot && !incGraph->isTooBig() && !incGraph->isTrivial());
+ }
+ TemplateVariant includedByGraph() const
+ {
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ QGString result;
+ if (haveDot)
+ {
+ DotInclDepGraph *cg = getIncludedByGraph();
+ FTextStream t(&result);
+ cg->writeGraph(t,BITMAP,
+ g_globals.outputDir,
+ g_globals.outputDir+portable_pathSeparator()+m_fileDef->getOutputFileBase()+Doxygen::htmlFileExtension,
+ relPathAsString(),TRUE,g_globals.dynSectionId
+ );
+ }
+ g_globals.dynSectionId++;
+ return TemplateVariant(result.data(),TRUE);
+ }
+ TemplateVariant hasDetails() const
+ {
+ return m_fileDef->hasDetailedDescription();
+ }
+ TemplateVariant hasSourceFile() const
+ {
+ return m_fileDef->generateSourceFile();
+ }
+ TemplateVariant sources() const
+ {
+ if (!m_cache.sources)
+ {
+ if (m_fileDef->generateSourceFile())
+ {
+ m_cache.sources.reset(new TemplateVariant(parseCode(m_fileDef,relPathAsString())));
+ }
+ else
+ {
+ m_cache.sources.reset(new TemplateVariant(""));
+ }
+ }
+ return *m_cache.sources;
+ }
+ TemplateVariant version() const
+ {
+ return m_fileDef->fileVersion();
+ }
+ TemplateVariant classes() const
+ {
+ if (!m_cache.classes)
+ {
+ NestedClassListContext *classList = NestedClassListContext::alloc();
+ if (m_fileDef->getClassSDict())
+ {
+ ClassSDict::Iterator sdi(*m_fileDef->getClassSDict());
+ ClassDef *cd;
+ for (sdi.toFirst();(cd=sdi.current());++sdi)
+ {
+ if (cd->visibleInParentsDeclList())
+ {
+ classList->append(cd);
+ }
+ }
+ }
+ m_cache.classes.reset(classList);
+ }
+ return m_cache.classes.get();
+ }
+ TemplateVariant namespaces() const
+ {
+ if (!m_cache.namespaces)
+ {
+ NestedNamespaceListContext *namespaceList = NestedNamespaceListContext::alloc();
+ if (m_fileDef->getNamespaceSDict())
+ {
+ NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict());
+ NamespaceDef *nd;
+ for (sdi.toFirst();(nd=sdi.current());++sdi)
+ {
+ if (nd->isLinkable() && !nd->isConstantGroup())
+ {
+ namespaceList->append(nd);
+ }
+ }
+ }
+ m_cache.namespaces.reset(namespaceList);
+ }
+ return m_cache.namespaces.get();
+ }
+ TemplateVariant constantgroups() const
+ {
+ if (!m_cache.constantgroups)
+ {
+ NestedNamespaceListContext *namespaceList = NestedNamespaceListContext::alloc();
+ if (m_fileDef->getNamespaceSDict())
+ {
+ NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict());
+ NamespaceDef *nd;
+ for (sdi.toFirst();(nd=sdi.current());++sdi)
+ {
+ if (nd->isLinkable() && nd->isConstantGroup())
+ {
+ namespaceList->append(nd);
+ }
+ }
+ }
+ m_cache.constantgroups.reset(namespaceList);
+ }
+ return m_cache.constantgroups.get();
+ }
+ TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list,
+ MemberListType type,const char *title,bool detailed=FALSE) const
+ {
+ if (!list)
+ {
+ MemberList *ml = m_fileDef->getMemberList(type);
+ if (ml)
+ {
+ list.reset(MemberListInfoContext::alloc(m_fileDef,relPathAsString(),ml,title,detailed));
+ }
+ }
+ if (list)
+ {
+ return list.get();
+ }
+ else
+ {
+ return TemplateVariant(FALSE);
+ }
+ }
+ TemplateVariant macros() const
+ {
+ return getMemberList(m_cache.macros,MemberListType_decDefineMembers,theTranslator->trDefines());
+ }
+ TemplateVariant typedefs() const
+ {
+ return getMemberList(m_cache.typedefs,MemberListType_decTypedefMembers,theTranslator->trTypedefs());
+ }
+ TemplateVariant enums() const
+ {
+ return getMemberList(m_cache.enums,MemberListType_decEnumMembers,theTranslator->trEnumerations());
+ }
+ TemplateVariant functions() const
+ {
+ // TODO: Fortran: trSubprograms()
+ // TODO: VHDL: VhdlDocGen::trFunctionAndProc()
+ return getMemberList(m_cache.functions,MemberListType_decFuncMembers,theTranslator->trFunctions());
+ }
+ TemplateVariant variables() const
+ {
+ return getMemberList(m_cache.variables,MemberListType_decVarMembers,theTranslator->trVariables());
+ }
+ TemplateVariant memberGroups() const
+ {
+ if (!m_cache.memberGroups)
+ {
+ if (m_fileDef->getMemberGroupSDict())
+ {
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping()));
+ }
+ else
+ {
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc());
+ }
+ }
+ return m_cache.memberGroups.get();
+ }
+ TemplateVariant detailedMacros() const
+ {
+ return getMemberList(m_cache.detailedMacros,MemberListType_docDefineMembers,theTranslator->trDefineDocumentation());
+ }
+ TemplateVariant detailedTypedefs() const
+ {
+ return getMemberList(m_cache.detailedTypedefs,MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation());
+ }
+ TemplateVariant detailedEnums() const
+ {
+ return getMemberList(m_cache.detailedEnums,MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation());
+ }
+ TemplateVariant detailedFunctions() const
+ {
+ // TODO: Fortran: trSubprogramDocumentation()
+ return getMemberList(m_cache.detailedFunctions,MemberListType_docFuncMembers,theTranslator->trFunctionDocumentation());
+ }
+ TemplateVariant detailedVariables() const
+ {
+ return getMemberList(m_cache.detailedVariables,MemberListType_docVarMembers,theTranslator->trVariableDocumentation());
+ }
+ TemplateVariant inlineClasses() const
+ {
+ if (!m_cache.inlineClasses)
+ {
+ NestedClassListContext *classList = NestedClassListContext::alloc();
+ if (m_fileDef->getClassSDict())
+ {
+ ClassSDict::Iterator sdi(*m_fileDef->getClassSDict());
+ ClassDef *cd;
+ for (sdi.toFirst();(cd=sdi.current());++sdi)
+ {
+ if (cd->name().find('@')==-1 &&
+ cd->isLinkableInProject() &&
+ cd->isEmbeddedInOuterScope() &&
+ cd->partOfGroups()==0)
+ {
+ classList->append(cd);
+ }
+ }
+ }
+ m_cache.inlineClasses.reset(classList);
+ }
+ return m_cache.inlineClasses.get();
+ }
+ TemplateVariant compoundType() const
+ {
+ return theTranslator->trFile(FALSE,TRUE);
+ }
+
private:
FileDef *m_fileDef;
+ struct Cachable
+ {
+ SharedPtr<IncludeInfoListContext> includeInfoList;
+ ScopedPtr<DotInclDepGraph> includeGraph;
+ ScopedPtr<DotInclDepGraph> includedByGraph;
+ ScopedPtr<TemplateVariant> sources;
+ SharedPtr<NestedClassListContext> classes;
+ SharedPtr<NestedNamespaceListContext> namespaces;
+ SharedPtr<NestedNamespaceListContext> constantgroups;
+ SharedPtr<MemberListInfoContext> macros;
+ SharedPtr<MemberListInfoContext> typedefs;
+ SharedPtr<MemberListInfoContext> enums;
+ SharedPtr<MemberListInfoContext> functions;
+ SharedPtr<MemberListInfoContext> variables;
+ SharedPtr<MemberGroupListContext> memberGroups;
+ SharedPtr<MemberListInfoContext> detailedMacros;
+ SharedPtr<MemberListInfoContext> detailedTypedefs;
+ SharedPtr<MemberListInfoContext> detailedEnums;
+ SharedPtr<MemberListInfoContext> detailedFunctions;
+ SharedPtr<MemberListInfoContext> detailedVariables;
+ SharedPtr<NestedClassListContext> inlineClasses;
+ };
+ mutable Cachable m_cache;
};
//%% }
-FileContext::FileContext(FileDef *fd)
+FileContext::FileContext(FileDef *fd) : RefCountedContext("FileContext")
{
p = new Private(fd);
}
@@ -1954,10 +2485,14 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
public:
Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd)
{
- addProperty("title",this,&Private::title);
- addProperty("highlight",this,&Private::highlight);
- addProperty("subhighlight",this,&Private::subHighlight);
- addProperty("dirName",this,&Private::dirName);
+ addProperty("title", this,&Private::title);
+ addProperty("highlight", this,&Private::highlight);
+ addProperty("subhighlight", this,&Private::subHighlight);
+ addProperty("dirName", this,&Private::dirName);
+ addProperty("dirs", this,&Private::dirs);
+ addProperty("files", this,&Private::files);
+ addProperty("hasDetails", this,&Private::hasDetails);
+ addProperty("compoundType", this,&Private::compoundType);
}
TemplateVariant title() const
{
@@ -1975,12 +2510,64 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
{
return TemplateVariant(m_dirDef->shortName());
}
+ TemplateVariant dirs() const
+ {
+ if (!m_cache.dirs)
+ {
+ m_cache.dirs.reset(TemplateList::alloc());
+ const DirList &subDirs = m_dirDef->subDirs();
+ QListIterator<DirDef> it(subDirs);
+ DirDef *dd;
+ for (it.toFirst();(dd=it.current());++it)
+ {
+ DirContext *dc = new DirContext(dd);
+ m_cache.dirs->append(dc);
+ }
+ }
+ return m_cache.dirs.get();
+ }
+ TemplateVariant files() const
+ {
+ // FileList *list = m_dirDef->getFiles();
+ if (!m_cache.files)
+ {
+ m_cache.files.reset(TemplateList::alloc());
+ FileList *files = m_dirDef->getFiles();
+ if (files)
+ {
+ QListIterator<FileDef> it(*files);
+ FileDef *fd;
+ for (it.toFirst();(fd=it.current());++it)
+ {
+ FileContext *fc = FileContext::alloc(fd);
+ m_cache.files->append(fc);
+ }
+ }
+ }
+ return m_cache.files.get();
+ }
+ TemplateVariant hasDetails() const
+ {
+ return m_dirDef->hasDetailedDescription();
+ }
+ TemplateVariant compoundType() const
+ {
+ return theTranslator->trDir(FALSE,TRUE);
+ }
+
private:
DirDef *m_dirDef;
+ struct Cachable
+ {
+ Cachable() {}
+ SharedPtr<TemplateList> dirs;
+ SharedPtr<TemplateList> files;
+ };
+ mutable Cachable m_cache;
};
//%% }
-DirContext::DirContext(DirDef *fd)
+DirContext::DirContext(DirDef *fd) : RefCountedContext("DirContext")
{
p = new Private(fd);
}
@@ -1995,7 +2582,6 @@ TemplateVariant DirContext::get(const char *n) const
return p->get(n);
}
-
//------------------------------------------------------------------------
//%% struct Page(Symbol): page information
@@ -2026,7 +2612,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
};
//%% }
-PageContext::PageContext(PageDef *pd)
+PageContext::PageContext(PageDef *pd) : RefCountedContext("PageContext")
{
p = new Private(pd);
}
@@ -2077,7 +2663,7 @@ class TextGeneratorHtml : public TextGeneratorIntf
void writeBreak(int indent) const
{
- m_ts << "<br/>";
+ m_ts << "<br />";
for (int i=0;i<indent;i++)
{
m_ts << "&#160;";
@@ -2160,21 +2746,70 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
public:
Private(MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md)
{
- addProperty("declType", this,&Private::declType);
- addProperty("declArgs", this,&Private::declArgs);
+ addProperty("isSignal", this,&Private::isSignal);
+ addProperty("isSlot", this,&Private::isSlot);
+ addProperty("isVariable", this,&Private::isVariable);
+ addProperty("isEnumeration", this,&Private::isEnumeration);
+ addProperty("isEnumValue", this,&Private::isEnumValue);
+ addProperty("isTypedef", this,&Private::isTypedef);
+ addProperty("isFunction", this,&Private::isFunction);
+ addProperty("isFunctionPtr", this,&Private::isFunctionPtr);
+ addProperty("isDefine", this,&Private::isDefine);
+ addProperty("isFriend", this,&Private::isFriend);
+ addProperty("isProperty", this,&Private::isProperty);
+ addProperty("isEvent", this,&Private::isEvent);
+ addProperty("isRelated", this,&Private::isRelated);
+ addProperty("isForeign", this,&Private::isForeign);
addProperty("isStatic", this,&Private::isStatic);
+ addProperty("isInline", this,&Private::isInline);
+ addProperty("isExplicit", this,&Private::isExplicit);
+ addProperty("isMutable", this,&Private::isMutable);
+ addProperty("isGettable", this,&Private::isGettable);
+ addProperty("isSettable", this,&Private::isSettable);
+ addProperty("isReadable", this,&Private::isReadable);
+ addProperty("isWritable", this,&Private::isWritable);
+ addProperty("isAddable", this,&Private::isAddable);
+ addProperty("isRemovable", this,&Private::isRemovable);
+ addProperty("isRaisable", this,&Private::isRaisable);
+ addProperty("isFinal", this,&Private::isFinal);
+ addProperty("isAbstract", this,&Private::isAbstract);
+ addProperty("isOverride", this,&Private::isOverride);
+ addProperty("isInitonly", this,&Private::isInitonly);
+ addProperty("isOptional", this,&Private::isOptional);
+ addProperty("isRequired", this,&Private::isRequired);
+ addProperty("isNonAtomic", this,&Private::isNonAtomic);
+ addProperty("isCopy", this,&Private::isCopy);
+ addProperty("isAssign", this,&Private::isAssign);
+ addProperty("isRetain", this,&Private::isRetain);
+ addProperty("isWeak", this,&Private::isWeak);
+ addProperty("isStrong", this,&Private::isStrong);
+ addProperty("isUnretained", this,&Private::isUnretained);
+ addProperty("isNew", this,&Private::isNew);
+ addProperty("isSealed", this,&Private::isSealed);
+ addProperty("isImplementation", this,&Private::isImplementation);
+ addProperty("isExternal", this,&Private::isExternal);
+ addProperty("isAlias", this,&Private::isAlias);
+ addProperty("isDefault", this,&Private::isDefault);
+ addProperty("isDelete", this,&Private::isDelete);
+ addProperty("isNoExcept", this,&Private::isNoExcept);
+ addProperty("isAttribute", this,&Private::isAttribute);
+ addProperty("isUNOProperty", this,&Private::isUNOProperty);
+ addProperty("isReadonly", this,&Private::isReadonly);
+ addProperty("isBound", this,&Private::isBound);
+ addProperty("isConstrained", this,&Private::isConstrained);
+ addProperty("isTransient", this,&Private::isTransient);
+ addProperty("isMaybeVoid", this,&Private::isMaybeVoid);
+ addProperty("isMaybeDefault", this,&Private::isMaybeDefault);
+ addProperty("isMaybeAmbiguous", this,&Private::isMaybeAmbiguous);
+ addProperty("isPublished", this,&Private::isPublished);
+ addProperty("isTemplateSpecialization",this,&Private::isTemplateSpecialization);
addProperty("isObjCMethod", this,&Private::isObjCMethod);
addProperty("isObjCProperty", this,&Private::isObjCProperty);
- addProperty("isDefine", this,&Private::isDefine);
- addProperty("isImplementation", this,&Private::isImplementation);
- addProperty("isEvent", this,&Private::isEvent);
- addProperty("isProperty", this,&Private::isProperty);
- addProperty("isEnumeration", this,&Private::isEnumeration);
- addProperty("isEnumValue", this,&Private::isEnumValue);
addProperty("isAnonymous", this,&Private::isAnonymous);
+ addProperty("declType", this,&Private::declType);
+ addProperty("declArgs", this,&Private::declArgs);
addProperty("anonymousType", this,&Private::anonymousType);
addProperty("anonymousMember", this,&Private::anonymousMember);
- addProperty("isRelated", this,&Private::isRelated);
addProperty("hasDetails", this,&Private::hasDetails);
addProperty("exception", this,&Private::exception);
addProperty("bitfields", this,&Private::bitfields);
@@ -2214,19 +2849,26 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
addProperty("callGraph", this,&Private::callGraph);
addProperty("hasCallerGraph", this,&Private::hasCallerGraph);
addProperty("callerGraph", this,&Private::callerGraph);
+ addProperty("fieldType", this,&Private::fieldType);
+ m_cache.propertyAttrs.reset(TemplateList::alloc());
if (md && md->isProperty())
{
- if (md->isGettable()) m_propertyAttrs.append("get");
- if (md->isSettable()) m_propertyAttrs.append("set");
+ if (md->isGettable()) m_cache.propertyAttrs->append("get");
+ if (md->isSettable()) m_cache.propertyAttrs->append("set");
}
+ m_cache.eventAttrs.reset(TemplateList::alloc());
if (md && md->isEvent())
{
- if (md->isAddable()) m_eventAttrs.append("add");
- if (md->isRemovable()) m_eventAttrs.append("remove");
- if (md->isRaisable()) m_eventAttrs.append("raise");
+ if (md->isAddable()) m_cache.eventAttrs->append("add");
+ if (md->isRemovable()) m_cache.eventAttrs->append("remove");
+ if (md->isRaisable()) m_cache.eventAttrs->append("raise");
}
}
+ TemplateVariant fieldType() const
+ {
+ return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->fieldType());
+ }
TemplateVariant declType() const
{
return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType());
@@ -2259,10 +2901,202 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
return m_memberDef->isImplementation();
}
+ TemplateVariant isSignal() const
+ {
+ return m_memberDef->isSignal();
+ }
+ TemplateVariant isSlot() const
+ {
+ return m_memberDef->isSlot();
+ }
+ TemplateVariant isTypedef() const
+ {
+ return m_memberDef->isTypedef();
+ }
+ TemplateVariant isFunction() const
+ {
+ return m_memberDef->isFunction();
+ }
+ TemplateVariant isFunctionPtr() const
+ {
+ return m_memberDef->isFunctionPtr();
+ }
+ TemplateVariant isFriend() const
+ {
+ return m_memberDef->isFriend();
+ }
+ TemplateVariant isForeign() const
+ {
+ return m_memberDef->isForeign();
+ }
TemplateVariant isEvent() const
{
return m_memberDef->isEvent();
}
+ TemplateVariant isInline() const
+ {
+ return m_memberDef->isInline();
+ }
+ TemplateVariant isExplicit() const
+ {
+ return m_memberDef->isExplicit();
+ }
+ TemplateVariant isMutable() const
+ {
+ return m_memberDef->isMutable();
+ }
+ TemplateVariant isGettable() const
+ {
+ return m_memberDef->isSettable();
+ }
+ TemplateVariant isSettable() const
+ {
+ return m_memberDef->isSettable();
+ }
+ TemplateVariant isReadable() const
+ {
+ return m_memberDef->isReadable();
+ }
+ TemplateVariant isWritable() const
+ {
+ return m_memberDef->isWritable();
+ }
+ TemplateVariant isAddable() const
+ {
+ return m_memberDef->isAddable();
+ }
+ TemplateVariant isRemovable() const
+ {
+ return m_memberDef->isRemovable();
+ }
+ TemplateVariant isRaisable() const
+ {
+ return m_memberDef->isRaisable();
+ }
+ TemplateVariant isFinal() const
+ {
+ return m_memberDef->isFinal();
+ }
+ TemplateVariant isAbstract() const
+ {
+ return m_memberDef->isAbstract();
+ }
+ TemplateVariant isOverride() const
+ {
+ return m_memberDef->isOverride();
+ }
+ TemplateVariant isInitonly() const
+ {
+ return m_memberDef->isInitonly();
+ }
+ TemplateVariant isOptional() const
+ {
+ return m_memberDef->isOptional();
+ }
+ TemplateVariant isRequired() const
+ {
+ return m_memberDef->isRequired();
+ }
+ TemplateVariant isNonAtomic() const
+ {
+ return m_memberDef->isNonAtomic();
+ }
+ TemplateVariant isCopy() const
+ {
+ return m_memberDef->isCopy();
+ }
+ TemplateVariant isAssign() const
+ {
+ return m_memberDef->isAssign();
+ }
+ TemplateVariant isRetain() const
+ {
+ return m_memberDef->isRetain();
+ }
+ TemplateVariant isWeak() const
+ {
+ return m_memberDef->isWeak();
+ }
+ TemplateVariant isStrong() const
+ {
+ return m_memberDef->isStrong();
+ }
+ TemplateVariant isUnretained() const
+ {
+ return m_memberDef->isUnretained();
+ }
+ TemplateVariant isNew() const
+ {
+ return m_memberDef->isNew();
+ }
+ TemplateVariant isSealed() const
+ {
+ return m_memberDef->isSealed();
+ }
+ TemplateVariant isExternal() const
+ {
+ return m_memberDef->isExternal();
+ }
+ TemplateVariant isAlias() const
+ {
+ return m_memberDef->isAlias();
+ }
+ TemplateVariant isDefault() const
+ {
+ return m_memberDef->isDefault();
+ }
+ TemplateVariant isDelete() const
+ {
+ return m_memberDef->isDelete();
+ }
+ TemplateVariant isNoExcept() const
+ {
+ return m_memberDef->isNoExcept();
+ }
+ TemplateVariant isAttribute() const
+ {
+ return m_memberDef->isAttribute();
+ }
+ TemplateVariant isUNOProperty() const
+ {
+ return m_memberDef->isUNOProperty();
+ }
+ TemplateVariant isReadonly() const
+ {
+ return m_memberDef->isReadonly();
+ }
+ TemplateVariant isBound() const
+ {
+ return m_memberDef->isBound();
+ }
+ TemplateVariant isConstrained() const
+ {
+ return m_memberDef->isConstrained();
+ }
+ TemplateVariant isTransient() const
+ {
+ return m_memberDef->isTransient();
+ }
+ TemplateVariant isMaybeVoid() const
+ {
+ return m_memberDef->isMaybeVoid();
+ }
+ TemplateVariant isMaybeDefault() const
+ {
+ return m_memberDef->isMaybeDefault();
+ }
+ TemplateVariant isMaybeAmbiguous() const
+ {
+ return m_memberDef->isMaybeAmbiguous();
+ }
+ TemplateVariant isPublished() const
+ {
+ return m_memberDef->isPublished();
+ }
+ TemplateVariant isTemplateSpecialization() const
+ {
+ return m_memberDef->isTemplateSpecialization();
+ }
TemplateVariant isProperty() const
{
return m_memberDef->isProperty();
@@ -2271,6 +3105,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
return m_memberDef->isEnumValue();
}
+ TemplateVariant isVariable() const
+ {
+ return m_memberDef->isVariable();
+ }
TemplateVariant isEnumeration() const
{
return m_memberDef->isEnumerate();
@@ -2318,7 +3156,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
ClassDef *cd = m_memberDef->getClassDefOfAnonymousType();
if (cd)
{
- m_cache.anonymousType.reset(new ClassContext(cd));
+ m_cache.anonymousType.reset(ClassContext::alloc(cd));
}
}
if (m_cache.anonymousType)
@@ -2337,7 +3175,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
MemberDef *md = m_memberDef->fromAnonymousMember();
if (md)
{
- m_cache.anonymousMember.reset(new MemberContext(md));
+ m_cache.anonymousMember.reset(MemberContext::alloc(md));
}
}
if (m_cache.anonymousMember)
@@ -2372,11 +3210,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
MemberList *ml = m_memberDef->enumFieldList();
if (ml)
{
- m_cache.enumValues.reset(new MemberListContext(ml));
+ m_cache.enumValues.reset(MemberListContext::alloc(ml));
}
else
{
- m_cache.enumValues.reset(new MemberListContext);
+ m_cache.enumValues.reset(MemberListContext::alloc());
}
}
return m_cache.enumValues.get();
@@ -2385,7 +3223,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.templateArgs && m_memberDef->templateArguments())
{
- m_cache.templateArgs.reset(new ArgumentListContext(m_memberDef->templateArguments(),m_memberDef,relPathAsString()));
+ m_cache.templateArgs.reset(ArgumentListContext::alloc(m_memberDef->templateArguments(),m_memberDef,relPathAsString()));
}
if (m_cache.templateArgs)
{
@@ -2407,17 +3245,17 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
}
TemplateVariant propertyAttrs() const
{
- return &m_propertyAttrs;
+ return m_cache.propertyAttrs.get();
}
TemplateVariant eventAttrs() const
{
- return &m_eventAttrs;
+ return m_cache.eventAttrs.get();
}
TemplateVariant getClass() const
{
if (!m_cache.classDef && m_memberDef->getClassDef())
{
- m_cache.classDef.reset(new ClassContext(m_memberDef->getClassDef()));
+ m_cache.classDef.reset(ClassContext::alloc(m_memberDef->getClassDef()));
}
if (m_cache.classDef)
{
@@ -2445,11 +3283,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
ArgumentList *defArgList = getDefArgList();
if (defArgList && !m_memberDef->isProperty())
{
- m_cache.arguments.reset(new ArgumentListContext(defArgList,m_memberDef,relPathAsString()));
+ m_cache.arguments.reset(ArgumentListContext::alloc(defArgList,m_memberDef,relPathAsString()));
}
else
{
- m_cache.arguments.reset(new ArgumentListContext);
+ m_cache.arguments.reset(ArgumentListContext::alloc());
}
}
return m_cache.arguments.get();
@@ -2496,8 +3334,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (tal->count()>0)
{
- ArgumentListContext *al = new ArgumentListContext(tal,m_memberDef,relPathAsString());
- m_cache.templateArgList.append(al);
+ ArgumentListContext *al = ArgumentListContext::alloc(tal,m_memberDef,relPathAsString());
tl->append(al);
}
}
@@ -2515,17 +3352,15 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (tal->count()>0)
{
- ArgumentListContext *al = new ArgumentListContext(tal,m_memberDef,relPathAsString());
- m_cache.templateArgList.append(al);
+ ArgumentListContext *al = ArgumentListContext::alloc(tal,m_memberDef,relPathAsString());
tl->append(al);
}
}
}
if (m_memberDef->templateArguments()) // function template prefix
{
- ArgumentListContext *al = new ArgumentListContext(
+ ArgumentListContext *al = ArgumentListContext::alloc(
m_memberDef->templateArguments(),m_memberDef,relPathAsString());
- m_cache.templateArgList.append(al);
tl->append(al);
}
}
@@ -2534,7 +3369,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.templateDecls)
{
- TemplateList *tl = new TemplateList;
+ TemplateList *tl = TemplateList::alloc();
addTemplateDecls(tl);
m_cache.templateDecls.reset(tl);
}
@@ -2546,7 +3381,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
QStrList sl;
m_memberDef->getLabels(sl,m_memberDef->getOuterScope());
- TemplateList *tl = new TemplateList;
+ TemplateList *tl = TemplateList::alloc();
if (sl.count()>0)
{
QStrListIterator it(sl);
@@ -2593,14 +3428,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (!m_cache.implements)
{
MemberDef *md = m_memberDef->reimplements();
- m_cache.implements.reset(new TemplateList);
+ m_cache.implements.reset(TemplateList::alloc());
if (md)
{
ClassDef *cd = md->getClassDef();
if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface))
{
- MemberContext *mc = new MemberContext(md);
- m_cache.implementsMember.reset(mc);
+ MemberContext *mc = MemberContext::alloc(md);
m_cache.implements->append(mc);
}
}
@@ -2612,14 +3446,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (!m_cache.reimplements)
{
MemberDef *md = m_memberDef->reimplements();
- m_cache.reimplements.reset(new TemplateList);
+ m_cache.reimplements.reset(TemplateList::alloc());
if (md)
{
ClassDef *cd = md->getClassDef();
if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface)
{
- MemberContext *mc = new MemberContext(md);
- m_cache.reimplementsMember.reset(mc);
+ MemberContext *mc = MemberContext::alloc(md);
m_cache.reimplements->append(mc);
}
}
@@ -2631,7 +3464,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (!m_cache.implementedBy)
{
MemberList *ml = m_memberDef->reimplementedBy();
- m_cache.implementedBy.reset(new TemplateList);
+ m_cache.implementedBy.reset(TemplateList::alloc());
if (ml)
{
MemberListIterator mli(*ml);
@@ -2642,7 +3475,6 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface))
{
MemberContext *mc = new MemberContext(md);
- m_cache.implementedByMembers.append(mc);
m_cache.implementedBy->append(mc);
}
}
@@ -2654,7 +3486,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.reimplementedBy)
{
- m_cache.reimplementedBy.reset(new TemplateList);
+ m_cache.reimplementedBy.reset(TemplateList::alloc());
MemberList *ml = m_memberDef->reimplementedBy();
if (ml)
{
@@ -2666,7 +3498,6 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface)
{
MemberContext *mc = new MemberContext(md);
- m_cache.reimplementedByMembers.append(mc);
m_cache.reimplementedBy->append(mc);
}
}
@@ -2682,8 +3513,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
Example *ex;
for (it.toFirst();(ex=it.current());++it)
{
- TemplateStruct *s = new TemplateStruct;
- m_cache.exampleList.append(s);
+ TemplateStruct *s = TemplateStruct::alloc();
s->set("text",ex->name);
s->set("isLinkable",TRUE);
s->set("anchor",ex->anchor);
@@ -2696,7 +3526,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.examples)
{
- TemplateList *exampleList = new TemplateList;
+ TemplateList *exampleList = TemplateList::alloc();
addExamples(exampleList);
m_cache.examples.reset(exampleList);
}
@@ -2706,21 +3536,21 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.typeConstraints && m_memberDef->typeConstraints())
{
- m_cache.typeConstraints.reset(new ArgumentListContext(m_memberDef->typeConstraints(),m_memberDef,relPathAsString()));
+ m_cache.typeConstraints.reset(ArgumentListContext::alloc(m_memberDef->typeConstraints(),m_memberDef,relPathAsString()));
}
else
{
- m_cache.typeConstraints.reset(new ArgumentListContext);
+ m_cache.typeConstraints.reset(ArgumentListContext::alloc());
}
return m_cache.typeConstraints.get();
}
TemplateVariant functionQualifier() const
{
if (!m_memberDef->isObjCMethod() &&
- (m_memberDef->isFunction() || m_memberDef->isSlot() ||
+ (m_memberDef->isFunction() || m_memberDef->isSlot() ||
m_memberDef->isPrototype() || m_memberDef->isSignal()
)
- )
+ )
{
return "()";
}
@@ -2733,7 +3563,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.sourceRefs)
{
- m_cache.sourceRefs.reset(new MemberListContext(m_memberDef->getReferencesMembers(),TRUE));
+ m_cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE));
}
return m_cache.sourceRefs.get();
}
@@ -2741,7 +3571,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
if (!m_cache.sourceRefBys)
{
- m_cache.sourceRefBys.reset(new MemberListContext(m_memberDef->getReferencedByMembers(),TRUE));
+ m_cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE));
}
return m_cache.sourceRefBys.get();
}
@@ -2862,48 +3692,39 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
{
Cachable() : initializerParsed(FALSE), sourceCodeParsed(FALSE)
{
- implementedByMembers.setAutoDelete(TRUE);
- reimplementedByMembers.setAutoDelete(TRUE);
- templateArgList.setAutoDelete(TRUE);
- exampleList.setAutoDelete(TRUE);
- }
- ScopedPtr<ArgumentListContext> templateArgs;
- ScopedPtr<ArgumentListContext> arguments;
- ScopedPtr<MemberListContext> enumValues;
- ScopedPtr<ClassContext> classDef;
- ScopedPtr<ClassContext> anonymousType;
- ScopedPtr<TemplateList> templateDecls;
+ }
+ SharedPtr<ArgumentListContext> templateArgs;
+ SharedPtr<ArgumentListContext> arguments;
+ SharedPtr<MemberListContext> enumValues;
+ SharedPtr<ClassContext> classDef;
+ SharedPtr<ClassContext> anonymousType;
+ SharedPtr<TemplateList> templateDecls;
ScopedPtr<TemplateVariant> paramDocs;
- ScopedPtr<TemplateList> implements;
- ScopedPtr<MemberContext> implementsMember;
- ScopedPtr<TemplateList> reimplements;
- ScopedPtr<MemberContext> reimplementsMember;
- ScopedPtr<TemplateList> implementedBy;
- ScopedPtr<MemberListContext> sourceRefs;
- ScopedPtr<MemberListContext> sourceRefBys;
+ SharedPtr<TemplateList> implements;
+ SharedPtr<TemplateList> reimplements;
+ SharedPtr<TemplateList> implementedBy;
+ SharedPtr<MemberListContext> sourceRefs;
+ SharedPtr<MemberListContext> sourceRefBys;
ScopedPtr<DotCallGraph> callGraph;
ScopedPtr<DotCallGraph> callerGraph;
- ScopedPtr<MemberContext> anonymousMember;
- QList<MemberContext> implementedByMembers;
- ScopedPtr<TemplateList> reimplementedBy;
- QList<MemberContext> reimplementedByMembers;
- QList<ArgumentListContext> templateArgList;
- ScopedPtr<TemplateList> labels;
+ SharedPtr<MemberContext> anonymousMember;
+ SharedPtr<TemplateList> reimplementedBy;
+ SharedPtr<TemplateList> labels;
TemplateVariant initializer;
bool initializerParsed;
TemplateVariant sourceCode;
bool sourceCodeParsed;
- ScopedPtr<TemplateList> examples;
- QList<TemplateStruct> exampleList;
- ScopedPtr<ArgumentListContext> typeConstraints;
+ SharedPtr<TemplateList> examples;
+ SharedPtr<TemplateList> exampleList;
+ SharedPtr<ArgumentListContext> typeConstraints;
+ SharedPtr<TemplateList> propertyAttrs;
+ SharedPtr<TemplateList> eventAttrs;
};
mutable Cachable m_cache;
- TemplateList m_propertyAttrs;
- TemplateList m_eventAttrs;
};
//%% }
-MemberContext::MemberContext(MemberDef *md)
+MemberContext::MemberContext(MemberDef *md) : RefCountedContext("MemberContext")
{
p = new Private(md);
}
@@ -2949,7 +3770,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
};
//%% }
-ModuleContext::ModuleContext(GroupDef *gd)
+ModuleContext::ModuleContext(GroupDef *gd) : RefCountedContext("ModuleContext")
{
p = new Private(gd);
}
@@ -2967,11 +3788,11 @@ TemplateVariant ModuleContext::get(const char *n) const
//------------------------------------------------------------------------
//%% list NestedClassList[Class] : list of nested classes
-class NestedClassListContext::Private : public GenericNodeListContext<ClassContext>
+class NestedClassListContext::Private : public GenericNodeListContext
{
};
-NestedClassListContext::NestedClassListContext()
+NestedClassListContext::NestedClassListContext() : RefCountedContext("NestedClassListContext")
{
p = new Private;
}
@@ -3001,14 +3822,55 @@ void NestedClassListContext::append(ClassDef *cd)
{
if (cd)
{
- p->append(new ClassContext(cd));
+ p->append(ClassContext::alloc(cd));
+ }
+}
+
+//------------------------------------------------------------------------
+
+//%% list NestedClassList[Class] : list of nested namespaces
+class NestedNamespaceListContext::Private : public GenericNodeListContext
+{
+};
+
+NestedNamespaceListContext::NestedNamespaceListContext() : RefCountedContext("NestedNamespaceListContext")
+{
+ p = new Private;
+}
+
+NestedNamespaceListContext::~NestedNamespaceListContext()
+{
+ delete p;
+}
+
+// TemplateListIntf
+int NestedNamespaceListContext::count() const
+{
+ return p->count();
+}
+
+TemplateVariant NestedNamespaceListContext::at(int index) const
+{
+ return p->at(index);
+}
+
+TemplateListIntf::ConstIterator *NestedNamespaceListContext::createIterator() const
+{
+ return p->createIterator();
+}
+
+void NestedNamespaceListContext::append(NamespaceDef *cd)
+{
+ if (cd)
+ {
+ p->append(NamespaceContext::alloc(cd));
}
}
//------------------------------------------------------------------------
//%% list ClassList[Class] : list of classes
-class ClassListContext::Private : public GenericNodeListContext<ClassContext>
+class ClassListContext::Private : public GenericNodeListContext
{
public:
void addClasses(const ClassSDict &classSDict)
@@ -3026,13 +3888,13 @@ class ClassListContext::Private : public GenericNodeListContext<ClassContext>
}
if (cd->isLinkableInProject() && cd->templateMaster()==0)
{
- append(new ClassContext(cd));
+ append(ClassContext::alloc(cd));
}
}
}
};
-ClassListContext::ClassListContext()
+ClassListContext::ClassListContext() : RefCountedContext("ClassListContext")
{
p = new Private;
p->addClasses(*Doxygen::classSDict);
@@ -3067,7 +3929,7 @@ TemplateListIntf::ConstIterator *ClassListContext::createIterator() const
class ClassInheritanceNodeContext::Private : public PropertyMapper
{
public:
- Private(ClassDef *cd) : m_classContext(cd)
+ Private(ClassDef *cd) : m_classDef(cd)
{
//%% bool is_leaf_node: true if this node does not have any children
addProperty("is_leaf_node",this,&Private::isLeafNode);
@@ -3131,15 +3993,24 @@ class ClassInheritanceNodeContext::Private : public PropertyMapper
}
TemplateVariant getClass() const
{
- return TemplateVariant(&m_classContext);
+ if (!m_cache.classContext)
+ {
+ m_cache.classContext.reset(ClassContext::alloc(m_classDef));
+ }
+ return m_cache.classContext.get();
}
private:
- GenericNodeListContext<ClassInheritanceNodeContext> m_children;
- ClassContext m_classContext;
+ ClassDef *m_classDef;
+ GenericNodeListContext m_children;
+ struct Cachable
+ {
+ SharedPtr<ClassContext> classContext;
+ };
+ mutable Cachable m_cache;
};
//%% }
-ClassInheritanceNodeContext::ClassInheritanceNodeContext(ClassDef *cd)
+ClassInheritanceNodeContext::ClassInheritanceNodeContext(ClassDef *cd) : RefCountedContext("ClassInheritanceNodeContext")
{
p = new Private(cd);
}
@@ -3162,8 +4033,7 @@ void ClassInheritanceNodeContext::addChildren(const BaseClassList *bcl,bool hide
//------------------------------------------------------------------------
//%% list ClassInheritance[ClassInheritanceNode]: list of classes
-class ClassInheritanceContext::Private : public
- GenericNodeListContext<ClassInheritanceNodeContext>
+class ClassInheritanceContext::Private : public GenericNodeListContext
{
public:
void addClasses(const ClassSDict &classSDict)
@@ -3175,7 +4045,7 @@ class ClassInheritanceContext::Private : public
bool b;
if (cd->getLanguage()==SrcLangExt_VHDL)
{
- if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS)
+ if ((VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS)
{
continue;
}
@@ -3190,7 +4060,7 @@ class ClassInheritanceContext::Private : public
if (cd->isVisibleInHierarchy()) // should it be visible
{
// new root level class
- ClassInheritanceNodeContext *tnc = new ClassInheritanceNodeContext(cd);
+ ClassInheritanceNodeContext *tnc = ClassInheritanceNodeContext::alloc(cd);
append(tnc);
bool hasChildren = !cd->visited && classHasVisibleChildren(cd);
if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren)
@@ -3209,7 +4079,7 @@ class ClassInheritanceContext::Private : public
}
};
-ClassInheritanceContext::ClassInheritanceContext()
+ClassInheritanceContext::ClassInheritanceContext() : RefCountedContext("ClassInheritanceContext")
{
p = new Private;
initClassHierarchy(Doxygen::classSDict);
@@ -3253,7 +4123,11 @@ class ClassHierarchyContext::Private : public PropertyMapper
public:
TemplateVariant tree() const
{
- return TemplateVariant(&m_classTree);
+ if (!m_cache.classTree)
+ {
+ m_cache.classTree.reset(ClassInheritanceContext::alloc());
+ }
+ return m_cache.classTree.get();
}
TemplateVariant fileName() const
{
@@ -3294,11 +4168,15 @@ class ClassHierarchyContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- ClassInheritanceContext m_classTree;
+ struct Cachable
+ {
+ SharedPtr<ClassInheritanceContext> classTree;
+ };
+ mutable Cachable m_cache;
};
//%% }
-ClassHierarchyContext::ClassHierarchyContext()
+ClassHierarchyContext::ClassHierarchyContext() : RefCountedContext("ClassHierarchyContext")
{
p = new Private;
}
@@ -3320,10 +4198,11 @@ TemplateVariant ClassHierarchyContext::get(const char *name) const
class NestingNodeContext::Private : public PropertyMapper
{
public:
- Private(Definition *d,bool addCls) : m_def(d),
- m_classContext(m_def->definitionType()==Definition::TypeClass?(ClassDef*)d:0),
- m_namespaceContext(m_def->definitionType()==Definition::TypeNamespace?(NamespaceDef*)d:0)
+ Private(const NestingNodeContext *parent,const NestingNodeContext *thisNode,
+ Definition *d,int index,int level,bool addCls)
+ : m_parent(parent), m_def(d), m_level(level), m_index(index)
{
+ m_children.reset(NestingContext::alloc(thisNode,level+1));
//%% bool is_leaf_node: true if this node does not have any children
addProperty("is_leaf_node",this,&Private::isLeafNode);
//%% Nesting children: list of nested classes/namespaces
@@ -3332,22 +4211,44 @@ class NestingNodeContext::Private : public PropertyMapper
addProperty("class",this,&Private::getClass);
//%% [optional] Namespace namespace: namespace info (if this node represents a namespace)
addProperty("namespace",this,&Private::getNamespace);
+ //%% [optional] File file: file info (if this node represents a file)
+ addProperty("file",this,&Private::getFile);
+ //%% [optional] Dir dir: directory info (if this node represents a directory)
+ addProperty("dir",this,&Private::getDir);
+ //%% int id
+ addProperty("id",this,&Private::id);
+ //%% string level
+ addProperty("level",this,&Private::level);
+ //%% string name
+ addProperty("name",this,&Private::name);
+ //%% string brief
+ addProperty("brief",this,&Private::brief);
+ //%% bool isLinkable
+ addProperty("isLinkable",this,&Private::isLinkable);
+ addProperty("anchor",this,&Private::anchor);
+ addProperty("fileName",this,&Private::fileName);
+
addNamespaces(addCls);
addClasses();
+ addDirFiles();
}
TemplateVariant isLeafNode() const
{
- return m_children.count()==0;
+ return m_children->count()==0;
}
TemplateVariant children() const
{
- return TemplateVariant(&m_children);
+ return m_children.get();
}
TemplateVariant getClass() const
{
- if (m_def->definitionType()==Definition::TypeClass)
+ if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass)
{
- return TemplateVariant(&m_classContext);
+ m_cache.classContext.reset(ClassContext::alloc((ClassDef*)m_def));
+ }
+ if (m_cache.classContext)
+ {
+ return m_cache.classContext.get();
}
else
{
@@ -3356,21 +4257,104 @@ class NestingNodeContext::Private : public PropertyMapper
}
TemplateVariant getNamespace() const
{
- if (m_def->definitionType()==Definition::TypeNamespace)
+ if (!m_cache.namespaceContext && m_def->definitionType()==Definition::TypeNamespace)
+ {
+ m_cache.namespaceContext.reset(NamespaceContext::alloc((NamespaceDef*)m_def));
+ }
+ if (m_cache.namespaceContext)
+ {
+ return m_cache.namespaceContext.get();
+ }
+ else
+ {
+ return TemplateVariant(FALSE);
+ }
+ }
+ TemplateVariant getDir() const
+ {
+ if (!m_cache.dirContext && m_def->definitionType()==Definition::TypeDir)
+ {
+ m_cache.dirContext.reset(DirContext::alloc((DirDef*)m_def));
+ }
+ if (m_cache.dirContext)
{
- return TemplateVariant(&m_namespaceContext);
+ return m_cache.dirContext.get();
}
else
{
return TemplateVariant(FALSE);
}
}
+ TemplateVariant getFile() const
+ {
+ if (!m_cache.fileContext && m_def->definitionType()==Definition::TypeFile)
+ {
+ m_cache.fileContext.reset(FileContext::alloc((FileDef*)m_def));
+ }
+ if (m_cache.fileContext)
+ {
+ return m_cache.fileContext.get();
+ }
+ else
+ {
+ return TemplateVariant(FALSE);
+ }
+ }
+ TemplateVariant level() const
+ {
+ return m_level;
+ }
+ TemplateVariant id() const
+ {
+ QCString result;
+ if (m_parent) result=m_parent->id();
+ result+=QCString().setNum(m_index)+"_";
+ return result;
+ }
+ TemplateVariant name() const
+ {
+ return m_def->displayName(FALSE);
+ }
+ QCString relPathAsString() const
+ {
+ static bool createSubdirs = Config_getBool("CREATE_SUBDIRS");
+ return createSubdirs ? QCString("../../") : QCString("");
+ }
+ TemplateVariant brief() const
+ {
+ if (!m_cache.brief)
+ {
+ if (m_def->hasBriefDescription())
+ {
+ m_cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(),
+ "",m_def->briefDescription(),TRUE)));
+ }
+ else
+ {
+ m_cache.brief.reset(new TemplateVariant(""));
+ }
+ }
+ return *m_cache.brief;
+ }
+ TemplateVariant isLinkable() const
+ {
+ return m_def->isLinkable();
+ }
+ TemplateVariant anchor() const
+ {
+ return m_def->anchor();
+ }
+ TemplateVariant fileName() const
+ {
+ return m_def->getOutputFileBase();
+ }
+
void addClasses()
{
ClassDef *cd = m_def->definitionType()==Definition::TypeClass ? (ClassDef*)m_def : 0;
if (cd && cd->getClassSDict())
{
- m_children.addClasses(*cd->getClassSDict(),FALSE);
+ m_children->addClasses(*cd->getClassSDict(),FALSE);
}
}
void addNamespaces(bool addClasses)
@@ -3378,24 +4362,47 @@ class NestingNodeContext::Private : public PropertyMapper
NamespaceDef *nd = m_def->definitionType()==Definition::TypeNamespace ? (NamespaceDef*)m_def : 0;
if (nd && nd->getNamespaceSDict())
{
- m_children.addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses);
+ m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses);
}
if (addClasses && nd && nd->getClassSDict())
{
- m_children.addClasses(*nd->getClassSDict(),FALSE);
+ m_children->addClasses(*nd->getClassSDict(),FALSE);
+ }
+ }
+ void addDirFiles()
+ {
+ DirDef *dd = m_def->definitionType()==Definition::TypeDir ? (DirDef*)m_def : 0;
+ if (dd)
+ {
+ m_children->addDirs(dd->subDirs());
+ if (dd && dd->getFiles())
+ {
+ m_children->addFiles(*dd->getFiles());
+ }
}
}
- Definition *m_def;
private:
- NestingContext m_children;
- ClassContext m_classContext;
- NamespaceContext m_namespaceContext;
+ const NestingNodeContext *m_parent;
+ Definition *m_def;
+ SharedPtr<NestingContext> m_children;
+ int m_level;
+ int m_index;
+ struct Cachable
+ {
+ SharedPtr<ClassContext> classContext;
+ SharedPtr<NamespaceContext> namespaceContext;
+ SharedPtr<DirContext> dirContext;
+ SharedPtr<FileContext> fileContext;
+ ScopedPtr<TemplateVariant> brief;
+ };
+ mutable Cachable m_cache;
};
//%% }
-NestingNodeContext::NestingNodeContext(Definition *d,bool addClass)
+NestingNodeContext::NestingNodeContext(const NestingNodeContext *parent,
+ Definition *d,int index,int level,bool addClass) : RefCountedContext("NestingNodeContext")
{
- p = new Private(d,addClass);
+ p = new Private(parent,this,d,index,level,addClass);
}
NestingNodeContext::~NestingNodeContext()
@@ -3408,12 +4415,20 @@ TemplateVariant NestingNodeContext::get(const char *n) const
return p->get(n);
}
+QCString NestingNodeContext::id() const
+{
+ return p->id().toString();
+}
+
//------------------------------------------------------------------------
//%% list Nesting[NestingNode]: namespace and class nesting relations
-class NestingContext::Private : public GenericNodeListContext<NestingNodeContext>
+class NestingContext::Private : public GenericNodeListContext
{
public:
+ Private(const NestingNodeContext *parent,int level)
+ : m_parent(parent), m_level(level), m_index(0) {}
+
void addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses)
{
NamespaceSDict::Iterator nli(nsDict);
@@ -3427,8 +4442,9 @@ class NestingContext::Private : public GenericNodeListContext<NestingNodeContext
bool isLinkable = nd->isLinkableInProject();
if (isLinkable || hasChildren)
{
- NestingNodeContext *nnc = new NestingNodeContext(nd,addClasses);
+ NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses);
append(nnc);
+ m_index++;
}
}
}
@@ -3455,17 +4471,73 @@ class NestingContext::Private : public GenericNodeListContext<NestingNodeContext
{
if (classVisibleInIndex(cd) && cd->templateMaster()==0)
{
- NestingNodeContext *nnc = new NestingNodeContext(cd,TRUE);
+ NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE);
append(nnc);
+ m_index++;
}
}
}
}
+ void addDirs(const DirSDict &dirDict)
+ {
+ SDict<DirDef>::Iterator dli(dirDict);
+ DirDef *dd;
+ for (dli.toFirst();(dd=dli.current());++dli)
+ {
+ if (dd->getOuterScope()==Doxygen::globalScope)
+ {
+ append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE));
+ m_index++;
+ }
+ }
+ }
+ void addDirs(const DirList &dirList)
+ {
+ QListIterator<DirDef> li(dirList);
+ DirDef *dd;
+ for (li.toFirst();(dd=li.current());++li)
+ {
+ append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE));
+ m_index++;
+ }
+ }
+ void addFiles(const FileNameList &fnList)
+ {
+ FileNameListIterator fnli(fnList);
+ FileName *fn;
+ for (fnli.toFirst();(fn=fnli.current());++fnli)
+ {
+ FileNameIterator fni(*fn);
+ FileDef *fd;
+ for (;(fd=fni.current());++fni)
+ {
+ if (fd->getDirDef()==0) // top level file
+ {
+ append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE));
+ m_index++;
+ }
+ }
+ }
+ }
+ void addFiles(const FileList &fList)
+ {
+ QListIterator<FileDef> li(fList);
+ FileDef *fd;
+ for (li.toFirst();(fd=li.current());++li)
+ {
+ append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE));
+ m_index++;
+ }
+ }
+ private:
+ const NestingNodeContext *m_parent;
+ int m_level;
+ int m_index;
};
-NestingContext::NestingContext()
+NestingContext::NestingContext(const NestingNodeContext *parent,int level) : RefCountedContext("NestingContext")
{
- p = new Private;
+ p = new Private(parent,level);
}
NestingContext::~NestingContext()
@@ -3499,16 +4571,129 @@ void NestingContext::addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bo
p->addNamespaces(nsDict,rootOnly,addClasses);
}
+void NestingContext::addDirs(const DirSDict &dirs)
+{
+ p->addDirs(dirs);
+}
+
+void NestingContext::addDirs(const DirList &dirs)
+{
+ p->addDirs(dirs);
+}
+
+void NestingContext::addFiles(const FileNameList &files)
+{
+ p->addFiles(files);
+}
+
+void NestingContext::addFiles(const FileList &files)
+{
+ p->addFiles(files);
+}
+
+
//------------------------------------------------------------------------
+static int computeMaxDepth(const TemplateListIntf *list)
+{
+ int maxDepth=0;
+ if (list)
+ {
+ TemplateListIntf::ConstIterator *it = list->createIterator();
+ TemplateVariant v;
+ for (it->toFirst();it->current(v);it->toNext())
+ {
+ const TemplateStructIntf *s = v.toStruct();
+ TemplateVariant child = s->get("children");
+ int d = computeMaxDepth(child.toList())+1;
+ if (d>maxDepth) maxDepth=d;
+ }
+ delete it;
+ }
+ return maxDepth;
+}
+
+static int computeNumNodesAtLevel(const TemplateStructIntf *s,int level,int maxLevel)
+{
+ int num=0;
+ if (level<maxLevel)
+ {
+ num++;
+ TemplateVariant child = s->get("children");
+ if (child.toList())
+ {
+ TemplateListIntf::ConstIterator *it = child.toList()->createIterator();
+ TemplateVariant v;
+ for (it->toFirst();it->current(v);it->toNext())
+ {
+ num+=computeNumNodesAtLevel(v.toStruct(),level+1,maxLevel);
+ }
+ delete it;
+ }
+ }
+ return num;
+}
+
+static int computePreferredDepth(const TemplateListIntf *list,int maxDepth)
+{
+ int preferredNumEntries = Config_getInt("HTML_INDEX_NUM_ENTRIES");
+ int preferredDepth=1;
+ if (preferredNumEntries>0)
+ {
+ int depth = maxDepth;
+ for (int i=1;i<=depth;i++)
+ {
+ int num=0;
+ TemplateListIntf::ConstIterator *it = list->createIterator();
+ TemplateVariant v;
+ for (it->toFirst();it->current(v);it->toNext())
+ {
+ num+=computeNumNodesAtLevel(v.toStruct(),0,i);
+ }
+ delete it;
+ if (num<=preferredNumEntries)
+ {
+ preferredDepth=i;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return preferredDepth;
+}
+
+
//%% struct ClassTree: Class nesting relations
//%% {
class ClassTreeContext::Private : public PropertyMapper
{
public:
+ Private()
+ {
+ m_classTree.reset(NestingContext::alloc(0,0));
+ if (Doxygen::namespaceSDict)
+ {
+ m_classTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,TRUE);
+ }
+ if (Doxygen::classSDict)
+ {
+ m_classTree->addClasses(*Doxygen::classSDict,TRUE);
+ }
+ //%% Nesting tree
+ addProperty("tree",this,&Private::tree);
+ addProperty("fileName",this,&Private::fileName);
+ addProperty("relPath",this,&Private::relPath);
+ addProperty("highlight",this,&Private::highlight);
+ addProperty("subhighlight",this,&Private::subhighlight);
+ addProperty("title",this,&Private::title);
+ addProperty("preferredDepth",this,&Private::preferredDepth);
+ addProperty("maxDepth",this,&Private::maxDepth);
+ }
TemplateVariant tree() const
{
- return TemplateVariant(&m_classTree);
+ return m_classTree.get();
}
TemplateVariant fileName() const
{
@@ -3543,30 +4728,39 @@ class ClassTreeContext::Private : public PropertyMapper
return theTranslator->trClasses();
}
}
- Private()
+ TemplateVariant maxDepth() const
{
- if (Doxygen::namespaceSDict)
+ if (!m_cache.maxDepthComputed)
{
- m_classTree.addNamespaces(*Doxygen::namespaceSDict,TRUE,TRUE);
+ m_cache.maxDepth = computeMaxDepth(m_classTree.get());
+ m_cache.maxDepthComputed=TRUE;
}
- if (Doxygen::classSDict)
+ return m_cache.maxDepth;
+ }
+ TemplateVariant preferredDepth() const
+ {
+ if (!m_cache.preferredDepthComputed)
{
- m_classTree.addClasses(*Doxygen::classSDict,TRUE);
+ m_cache.preferredDepth = computePreferredDepth(m_classTree.get(),maxDepth().toInt());
+ m_cache.preferredDepthComputed=TRUE;
}
- //%% Nesting tree
- addProperty("tree",this,&Private::tree);
- addProperty("fileName",this,&Private::fileName);
- addProperty("relPath",this,&Private::relPath);
- addProperty("highlight",this,&Private::highlight);
- addProperty("subhighlight",this,&Private::subhighlight);
- addProperty("title",this,&Private::title);
+ return m_cache.preferredDepth;
}
private:
- NestingContext m_classTree;
+ SharedPtr<NestingContext> m_classTree;
+ struct Cachable
+ {
+ Cachable() : maxDepthComputed(FALSE), preferredDepthComputed(FALSE) {}
+ int maxDepth;
+ bool maxDepthComputed;
+ int preferredDepth;
+ bool preferredDepthComputed;
+ };
+ mutable Cachable m_cache;
};
//%% }
-ClassTreeContext::ClassTreeContext()
+ClassTreeContext::ClassTreeContext() : RefCountedContext("ClassTreeContext")
{
p = new Private;
}
@@ -3584,7 +4778,7 @@ TemplateVariant ClassTreeContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list NamespaceList[Namespace] : list of namespaces
-class NamespaceListContext::Private : public GenericNodeListContext<NamespaceContext>
+class NamespaceListContext::Private : public GenericNodeListContext
{
public:
void addNamespaces(const NamespaceSDict &nsDict)
@@ -3595,13 +4789,13 @@ class NamespaceListContext::Private : public GenericNodeListContext<NamespaceCon
{
if (nd->isLinkableInProject())
{
- append(new NamespaceContext(nd));
+ append(NamespaceContext::alloc(nd));
}
}
}
};
-NamespaceListContext::NamespaceListContext()
+NamespaceListContext::NamespaceListContext() : RefCountedContext("NamespaceListContext")
{
p = new Private;
p->addNamespaces(*Doxygen::namespaceSDict);
@@ -3675,9 +4869,10 @@ class NamespaceTreeContext::Private : public PropertyMapper
}
Private()
{
+ m_namespaceTree.reset(NestingContext::alloc(0,0));
if (Doxygen::namespaceSDict)
{
- m_namespaceTree.addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE);
+ m_namespaceTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE);
}
//%% Nesting tree
addProperty("tree",this,&Private::tree);
@@ -3688,11 +4883,11 @@ class NamespaceTreeContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- NestingContext m_namespaceTree;
+ SharedPtr<NestingContext> m_namespaceTree;
};
//%% }
-NamespaceTreeContext::NamespaceTreeContext()
+NamespaceTreeContext::NamespaceTreeContext() : RefCountedContext("NamespaceTreeContext")
{
p = new Private;
}
@@ -3710,7 +4905,7 @@ TemplateVariant NamespaceTreeContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list FileList[File] : list of files
-class FileListContext::Private : public GenericNodeListContext<FileContext>
+class FileListContext::Private : public GenericNodeListContext
{
public:
void addFiles(const FileNameList &fnList)
@@ -3729,14 +4924,14 @@ class FileListContext::Private : public GenericNodeListContext<FileContext>
bool nameOk = !fd->isDocumentationFile();
if (nameOk && (doc || src) && !fd->isReference())
{
- append(new FileContext(fd));
+ append(FileContext::alloc(fd));
}
}
}
}
};
-FileListContext::FileListContext()
+FileListContext::FileListContext() : RefCountedContext("FileListContext")
{
p = new Private;
if (Doxygen::inputNameList) p->addFiles(*Doxygen::inputNameList);
@@ -3765,246 +4960,100 @@ TemplateListIntf::ConstIterator *FileListContext::createIterator() const
//------------------------------------------------------------------------
-//%% list UsedFiles[File] : list of files
-class UsedFilesContext::Private : public GenericNodeListContext<FileContext>
+//%% list DirList[Dir] : list of files
+class DirListContext::Private : public GenericNodeListContext
{
public:
- void addFile(FileDef *fd)
+ Private()
{
- append(new FileContext(fd));
+ DirDef *dir;
+ DirSDict::Iterator sdi(*Doxygen::directories);
+ for (sdi.toFirst();(dir=sdi.current());++sdi)
+ {
+ append(DirContext::alloc(dir));
+ }
}
};
-UsedFilesContext::UsedFilesContext(ClassDef *cd)
+DirListContext::DirListContext() : RefCountedContext("DirListContext")
{
p = new Private;
- if (cd)
- {
- QListIterator<FileDef> li(cd->usedFiles());
- FileDef *fd;
- for (li.toFirst();(fd=li.current());++li)
- {
- p->addFile(fd);
- }
- }
}
-UsedFilesContext::~UsedFilesContext()
+DirListContext::~DirListContext()
{
delete p;
}
// TemplateListIntf
-int UsedFilesContext::count() const
+int DirListContext::count() const
{
return p->count();
}
-TemplateVariant UsedFilesContext::at(int index) const
+TemplateVariant DirListContext::at(int index) const
{
return p->at(index);
}
-TemplateListIntf::ConstIterator *UsedFilesContext::createIterator() const
+TemplateListIntf::ConstIterator *DirListContext::createIterator() const
{
return p->createIterator();
}
-void UsedFilesContext::addFile(FileDef *fd)
-{
- p->addFile(fd);
-}
//------------------------------------------------------------------------
-
-//%% struct DirFileNode: node is a directory hierarchy
-//%% {
-class DirFileNodeContext::Private : public PropertyMapper
+//%% list UsedFiles[File] : list of files
+class UsedFilesContext::Private : public GenericNodeListContext
{
public:
- Private(Definition *d) : m_def(d),
- m_dirContext (m_def->definitionType()==Definition::TypeDir ? (DirDef*)d : 0),
- m_fileContext(m_def->definitionType()==Definition::TypeFile ? (FileDef*)d : 0)
- {
- //%% bool is_leaf_node: true if this node does not have any children
- addProperty("is_leaf_node",this,&Private::isLeafNode);
- //%% DirFile children: list of nested classes/namespaces
- addProperty("children",this,&Private::children);
- //%% [optional] Dir dir: directory info (if this node represents a directory)
- addProperty("dir",this,&Private::getDir);
- //%% [optional] File file: file info (if this node represents a file)
- addProperty("file",this,&Private::getFile);
- addDirFiles();
- }
- TemplateVariant isLeafNode() const
- {
- return m_children.count()==0;
- }
- TemplateVariant children() const
- {
- return TemplateVariant(&m_children);
- }
- TemplateVariant getDir() const
- {
- if (m_def->definitionType()==Definition::TypeDir)
- {
- return TemplateVariant(&m_dirContext);
- }
- else
- {
- return TemplateVariant(FALSE);
- }
- }
- TemplateVariant getFile() const
- {
- if (m_def->definitionType()==Definition::TypeFile)
- {
- return TemplateVariant(&m_fileContext);
- }
- else
- {
- return TemplateVariant(FALSE);
- }
- }
- void addDirFiles()
+ void addFile(FileDef *fd)
{
- DirDef *dd = m_def->definitionType()==Definition::TypeDir ? (DirDef*)m_def : 0;
- if (dd)
- {
- m_children.addDirs(dd->subDirs());
- if (dd && dd->getFiles())
- {
- m_children.addFiles(*dd->getFiles());
- }
- }
+ append(FileContext::alloc(fd));
}
- private:
- Definition *m_def;
- DirFileContext m_children;
- DirContext m_dirContext;
- FileContext m_fileContext;
};
-//%% }
-
-DirFileNodeContext::DirFileNodeContext(Definition *d)
-{
- p = new Private(d);
-}
-
-DirFileNodeContext::~DirFileNodeContext()
-{
- delete p;
-}
-
-TemplateVariant DirFileNodeContext::get(const char *n) const
-{
- return p->get(n);
-}
-
-//------------------------------------------------------------------------
-
-//%% list DirFile[DirFileNode]: list of directories and/or files
-class DirFileContext::Private : public GenericNodeListContext<DirFileNodeContext>
+UsedFilesContext::UsedFilesContext(ClassDef *cd) : RefCountedContext("UsedFilesContext")
{
- public:
- void addDirs(const DirSDict &dirDict)
- {
- SDict<DirDef>::Iterator dli(dirDict);
- DirDef *dd;
- for (dli.toFirst();(dd=dli.current());++dli)
- {
- if (dd->getOuterScope()==Doxygen::globalScope)
- {
- append(new DirFileNodeContext(dd));
- }
- }
- }
- void addDirs(const DirList &dirList)
- {
- QListIterator<DirDef> li(dirList);
- DirDef *dd;
- for (li.toFirst();(dd=li.current());++li)
- {
- append(new DirFileNodeContext(dd));
- }
- }
- void addFiles(const FileNameList &fnList)
- {
- FileNameListIterator fnli(fnList);
- FileName *fn;
- for (fnli.toFirst();(fn=fnli.current());++fnli)
- {
- FileNameIterator fni(*fn);
- FileDef *fd;
- for (;(fd=fni.current());++fni)
- {
- if (fd->getDirDef()==0) // top level file
- {
- append(new DirFileNodeContext(fd));
- }
- }
- }
- }
- void addFiles(const FileList &fList)
+ p = new Private;
+ if (cd)
+ {
+ QListIterator<FileDef> li(cd->usedFiles());
+ FileDef *fd;
+ for (li.toFirst();(fd=li.current());++li)
{
- QListIterator<FileDef> li(fList);
- FileDef *fd;
- for (li.toFirst();(fd=li.current());++li)
- {
- append(new DirFileNodeContext(fd));
- }
+ p->addFile(fd);
}
-};
-
-DirFileContext::DirFileContext()
-{
- p = new Private;
+ }
}
-DirFileContext::~DirFileContext()
+UsedFilesContext::~UsedFilesContext()
{
delete p;
}
// TemplateListIntf
-int DirFileContext::count() const
+int UsedFilesContext::count() const
{
return p->count();
}
-TemplateVariant DirFileContext::at(int index) const
+TemplateVariant UsedFilesContext::at(int index) const
{
return p->at(index);
}
-TemplateListIntf::ConstIterator *DirFileContext::createIterator() const
+TemplateListIntf::ConstIterator *UsedFilesContext::createIterator() const
{
return p->createIterator();
}
-void DirFileContext::addDirs(const DirSDict &dirs)
-{
- p->addDirs(dirs);
-}
-
-void DirFileContext::addDirs(const DirList &dirs)
-{
- p->addDirs(dirs);
-}
-
-void DirFileContext::addFiles(const FileNameList &files)
-{
- p->addFiles(files);
-}
-
-void DirFileContext::addFiles(const FileList &files)
+void UsedFilesContext::addFile(FileDef *fd)
{
- p->addFiles(files);
+ p->addFile(fd);
}
-
//------------------------------------------------------------------------
//%% struct FileTree: tree of directories and files
@@ -4012,6 +5061,28 @@ void DirFileContext::addFiles(const FileList &files)
class FileTreeContext::Private : public PropertyMapper
{
public:
+ Private()
+ {
+ // Add dirs tree
+ m_dirFileTree.reset(NestingContext::alloc(0,0));
+ if (Doxygen::directories)
+ {
+ m_dirFileTree->addDirs(*Doxygen::directories);
+ }
+ if (Doxygen::inputNameList)
+ {
+ m_dirFileTree->addFiles(*Doxygen::inputNameList);
+ }
+ //%% DirFile tree:
+ addProperty("tree",this,&Private::tree);
+ addProperty("fileName",this,&Private::fileName);
+ addProperty("relPath",this,&Private::relPath);
+ addProperty("highlight",this,&Private::highlight);
+ addProperty("subhighlight",this,&Private::subhighlight);
+ addProperty("title",this,&Private::title);
+ addProperty("preferredDepth",this,&Private::preferredDepth);
+ addProperty("maxDepth",this,&Private::maxDepth);
+ }
TemplateVariant tree() const
{
return TemplateVariant(&m_dirFileTree);
@@ -4036,31 +5107,39 @@ class FileTreeContext::Private : public PropertyMapper
{
return theTranslator->trFileList();
}
- Private()
+ TemplateVariant maxDepth() const
{
- // Add dirs tree
- if (Doxygen::directories)
+ if (!m_cache.maxDepthComputed)
{
- m_dirFileTree.addDirs(*Doxygen::directories);
+ m_cache.maxDepth = computeMaxDepth(m_dirFileTree.get());
+ m_cache.maxDepthComputed=TRUE;
}
- if (Doxygen::inputNameList)
+ return m_cache.maxDepth;
+ }
+ TemplateVariant preferredDepth() const
+ {
+ if (!m_cache.preferredDepthComputed)
{
- m_dirFileTree.addFiles(*Doxygen::inputNameList);
+ m_cache.preferredDepth = computePreferredDepth(m_dirFileTree.get(),maxDepth().toInt());
+ m_cache.preferredDepthComputed=TRUE;
}
- //%% DirFile tree:
- addProperty("tree",this,&Private::tree);
- addProperty("fileName",this,&Private::fileName);
- addProperty("relPath",this,&Private::relPath);
- addProperty("highlight",this,&Private::highlight);
- addProperty("subhighlight",this,&Private::subhighlight);
- addProperty("title",this,&Private::title);
+ return m_cache.preferredDepth;
}
private:
- DirFileContext m_dirFileTree;
+ SharedPtr<NestingContext> m_dirFileTree;
+ struct Cachable
+ {
+ Cachable() : maxDepthComputed(FALSE), preferredDepthComputed(FALSE) {}
+ int maxDepth;
+ bool maxDepthComputed;
+ int preferredDepth;
+ bool preferredDepthComputed;
+ };
+ mutable Cachable m_cache;
};
//%% }
-FileTreeContext::FileTreeContext()
+FileTreeContext::FileTreeContext() : RefCountedContext("FileTreeContext")
{
p = new Private;
}
@@ -4082,8 +5161,10 @@ TemplateVariant FileTreeContext::get(const char *name) const
class PageNodeContext::Private : public PropertyMapper
{
public:
- Private(PageDef *pd) : m_pageDef(pd), m_pageContext(pd)
+ Private(PageDef *pd) : m_pageDef(pd)
{
+ m_children.reset(PageNodeListContext::alloc());
+ m_pageContext.reset(PageContext::alloc(pd));
//%% bool is_leaf_node: true if this node does not have any children
addProperty("is_leaf_node",this,&Private::isLeafNode);
//%% PageList children: list of nested classes/namespaces
@@ -4094,31 +5175,31 @@ class PageNodeContext::Private : public PropertyMapper
}
TemplateVariant isLeafNode() const
{
- return m_children.count()==0;
+ return m_children->count()==0;
}
TemplateVariant children() const
{
- return TemplateVariant(&m_children);
+ return m_children.get();
}
TemplateVariant getPage() const
{
- return TemplateVariant(&m_pageContext);
+ return m_pageContext.get();
}
void addPages()
{
if (m_pageDef->getSubPages())
{
- m_children.addPages(*m_pageDef->getSubPages(),FALSE);
+ m_children->addPages(*m_pageDef->getSubPages(),FALSE);
}
}
private:
- PageDef *m_pageDef;
- PageNodeListContext m_children;
- PageContext m_pageContext;
+ PageDef *m_pageDef;
+ SharedPtr<PageNodeListContext> m_children;
+ SharedPtr<PageContext> m_pageContext;
};
//%% }
-PageNodeContext::PageNodeContext(PageDef *pd)
+PageNodeContext::PageNodeContext(PageDef *pd) : RefCountedContext("PageNodeContext")
{
p = new Private(pd);
}
@@ -4136,7 +5217,7 @@ TemplateVariant PageNodeContext::get(const char *n) const
//------------------------------------------------------------------------
//%% list PageList[PageNode]: list of directories and/or files
-class PageNodeListContext::Private : public GenericNodeListContext<PageNodeContext>
+class PageNodeListContext::Private : public GenericNodeListContext
{
public:
void addPages(const PageSDict &pages,bool rootOnly)
@@ -4149,13 +5230,13 @@ class PageNodeListContext::Private : public GenericNodeListContext<PageNodeConte
pd->getOuterScope()==0 ||
pd->getOuterScope()->definitionType()!=Definition::TypePage)
{
- append(new PageNodeContext(pd));
+ append(PageNodeContext::alloc(pd));
}
}
}
};
-PageNodeListContext::PageNodeListContext()
+PageNodeListContext::PageNodeListContext() : RefCountedContext("PageNodeListContext")
{
p = new Private;
}
@@ -4195,7 +5276,7 @@ class PageTreeContext::Private : public PropertyMapper
public:
TemplateVariant tree() const
{
- return TemplateVariant(&m_pageList);
+ return m_pageList.get();
}
TemplateVariant fileName() const
{
@@ -4219,10 +5300,11 @@ class PageTreeContext::Private : public PropertyMapper
}
Private()
{
+ m_pageList.reset(PageNodeListContext::alloc());
// Add pages
if (Doxygen::pageSDict)
{
- m_pageList.addPages(*Doxygen::pageSDict,TRUE);
+ m_pageList->addPages(*Doxygen::pageSDict,TRUE);
}
//%% PageNodeList tree:
@@ -4234,11 +5316,11 @@ class PageTreeContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- PageNodeListContext m_pageList;
+ SharedPtr<PageNodeListContext> m_pageList;
};
//%% }
-PageTreeContext::PageTreeContext()
+PageTreeContext::PageTreeContext() : RefCountedContext("PageTreeContext")
{
p = new Private;
}
@@ -4262,7 +5344,7 @@ class PageListContext::Private : public PropertyMapper
public:
TemplateVariant items() const
{
- return TemplateVariant(&m_pageList);
+ return m_pageList.get();
}
TemplateVariant fileName() const
{
@@ -4286,6 +5368,7 @@ class PageListContext::Private : public PropertyMapper
}
Private()
{
+ m_pageList.reset(new GenericNodeListContext);
// Add pages
PageSDict::Iterator pdi(*Doxygen::pageSDict);
PageDef *pd=0;
@@ -4293,7 +5376,7 @@ class PageListContext::Private : public PropertyMapper
{
if (!pd->getGroupDef() && !pd->isReference())
{
- m_pageList.append(new PageContext(pd));
+ m_pageList->append(PageContext::alloc(pd));
}
}
@@ -4306,11 +5389,11 @@ class PageListContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- GenericNodeListContext<PageContext> m_pageList;
+ SharedPtr<GenericNodeListContext> m_pageList;
};
//%% }
-PageListContext::PageListContext()
+PageListContext::PageListContext() : RefCountedContext("PageListContext")
{
p = new Private;
}
@@ -4333,8 +5416,10 @@ TemplateVariant PageListContext::get(const char *name) const
class ModuleNodeContext::Private : public PropertyMapper
{
public:
- Private(GroupDef *gd) : m_groupDef(gd), m_moduleContext(gd)
+ Private(GroupDef *gd) : m_groupDef(gd)
{
+ m_children.reset(ModuleListContext::alloc());
+ m_moduleContext.reset(ModuleContext::alloc(gd));
//%% bool is_leaf_node: true if this node does not have any children
addProperty("is_leaf_node",this,&Private::isLeafNode);
//%% ModuleList children: list of submodules
@@ -4345,31 +5430,31 @@ class ModuleNodeContext::Private : public PropertyMapper
}
TemplateVariant isLeafNode() const
{
- return m_children.count()==0;
+ return m_children->count()==0;
}
TemplateVariant children() const
{
- return TemplateVariant(&m_children);
+ return m_children.get();
}
TemplateVariant getModule() const
{
- return TemplateVariant(&m_moduleContext);
+ return m_moduleContext.get();
}
void addModules()
{
if (m_groupDef->getSubGroups())
{
- m_children.addModules(*m_groupDef->getSubGroups());
+ m_children->addModules(*m_groupDef->getSubGroups());
}
}
private:
- GroupDef *m_groupDef;
- ModuleListContext m_children;
- ModuleContext m_moduleContext;
+ GroupDef *m_groupDef;
+ SharedPtr<ModuleListContext> m_children;
+ SharedPtr<ModuleContext> m_moduleContext;
};
//%% }
-ModuleNodeContext::ModuleNodeContext(GroupDef *gd)
+ModuleNodeContext::ModuleNodeContext(GroupDef *gd) : RefCountedContext("ModuleNodeContext")
{
p = new Private(gd);
}
@@ -4387,7 +5472,7 @@ TemplateVariant ModuleNodeContext::get(const char *n) const
//------------------------------------------------------------------------
//%% list ModuleList[ModuleNode]: list of directories and/or files
-class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeContext>
+class ModuleListContext::Private : public GenericNodeListContext
{
public:
void addModules(const GroupSDict &modules)
@@ -4399,7 +5484,7 @@ class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeConte
{
if (!gd->isASubGroup() && gd->isVisible() && (!gd->isReference() || externalGroups))
{
- append(new ModuleNodeContext(gd));
+ append(ModuleNodeContext::alloc(gd));
}
}
}
@@ -4409,12 +5494,12 @@ class ModuleListContext::Private : public GenericNodeListContext<ModuleNodeConte
GroupDef *gd;
for (gli.toFirst();(gd=gli.current());++gli)
{
- append(new ModuleNodeContext(gd));
+ append(ModuleNodeContext::alloc(gd));
}
}
};
-ModuleListContext::ModuleListContext()
+ModuleListContext::ModuleListContext() : RefCountedContext("ModuleListContext")
{
p = new Private;
}
@@ -4484,10 +5569,11 @@ class ModuleTreeContext::Private : public PropertyMapper
}
Private()
{
+ m_moduleList.reset(ModuleListContext::alloc());
// Add modules
if (Doxygen::groupSDict)
{
- m_moduleList.addModules(*Doxygen::groupSDict);
+ m_moduleList->addModules(*Doxygen::groupSDict);
}
//%% ModuleList tree:
@@ -4499,11 +5585,11 @@ class ModuleTreeContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- ModuleListContext m_moduleList;
+ SharedPtr<ModuleListContext> m_moduleList;
};
//%% }
-ModuleTreeContext::ModuleTreeContext()
+ModuleTreeContext::ModuleTreeContext() : RefCountedContext("ModuleTreeContext")
{
p = new Private;
}
@@ -4570,7 +5656,7 @@ class NavPathElemContext::Private : public PropertyMapper
};
//%% }
-NavPathElemContext::NavPathElemContext(Definition *def)
+NavPathElemContext::NavPathElemContext(Definition *def) : RefCountedContext("NavPathElemContext")
{
p = new Private(def);
}
@@ -4619,10 +5705,11 @@ class ExampleListContext::Private : public PropertyMapper
}
Private()
{
+ m_pageList.reset(PageNodeListContext::alloc());
// Add pages
if (Doxygen::exampleSDict)
{
- m_pageList.addPages(*Doxygen::exampleSDict,FALSE);
+ m_pageList->addPages(*Doxygen::exampleSDict,FALSE);
}
//%% PageNodeList items:
@@ -4634,11 +5721,11 @@ class ExampleListContext::Private : public PropertyMapper
addProperty("title",this,&Private::title);
}
private:
- PageNodeListContext m_pageList;
+ SharedPtr<PageNodeListContext> m_pageList;
};
//%% }
-ExampleListContext::ExampleListContext()
+ExampleListContext::ExampleListContext() : RefCountedContext("ExampleListContext")
{
p = new Private;
}
@@ -4661,26 +5748,31 @@ TemplateVariant ExampleListContext::get(const char *name) const
class InheritanceNodeContext::Private : public PropertyMapper
{
public:
- Private(ClassDef *cd,const QCString &name) : m_classContext(cd), m_name(name)
+ Private(ClassDef *cd,const QCString &name) : m_classDef(cd), m_name(name)
{
addProperty("class",this,&Private::getClass);
addProperty("name",this,&Private::name);
}
TemplateVariant getClass() const
{
- return &m_classContext;
+ if (!m_classContext)
+ {
+ m_classContext.reset(ClassContext::alloc(m_classDef));
+ }
+ return m_classContext.get();
}
TemplateVariant name() const
{
return m_name;
}
private:
- ClassContext m_classContext;
+ ClassDef *m_classDef;
+ mutable SharedPtr<ClassContext> m_classContext;
QCString m_name;
};
//%% }
-InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name)
+InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) : RefCountedContext("InheritanceNodeContext")
{
p = new Private(cd,name);
}
@@ -4698,16 +5790,16 @@ TemplateVariant InheritanceNodeContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list InheritanceList[InheritanceNode] : list of inherited classes
-class InheritanceListContext::Private : public GenericNodeListContext<InheritanceNodeContext>
+class InheritanceListContext::Private : public GenericNodeListContext
{
public:
void addClass(ClassDef *cd,const QCString &name)
{
- append(new InheritanceNodeContext(cd,name));
+ append(InheritanceNodeContext::alloc(cd,name));
}
};
-InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses)
+InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses) : RefCountedContext("InheritanceListContext")
{
p = new Private;
if (list)
@@ -4757,21 +5849,21 @@ TemplateListIntf::ConstIterator *InheritanceListContext::createIterator() const
//------------------------------------------------------------------------
//%% list MemberList[Member] : list of inherited classes
-class MemberListContext::Private : public GenericNodeListContext<MemberContext>
+class MemberListContext::Private : public GenericNodeListContext
{
public:
void addMember(MemberDef *md)
{
- append(new MemberContext(md));
+ append(MemberContext::alloc(md));
}
};
-MemberListContext::MemberListContext()
+MemberListContext::MemberListContext() : RefCountedContext("MemberListContext")
{
p = new Private;
}
-MemberListContext::MemberListContext(const MemberList *list)
+MemberListContext::MemberListContext(const MemberList *list) : RefCountedContext("MemberListContext")
{
p = new Private;
if (list)
@@ -4791,7 +5883,7 @@ MemberListContext::MemberListContext(const MemberList *list)
}
}
-MemberListContext::MemberListContext(MemberSDict *list,bool doSort)
+MemberListContext::MemberListContext(MemberSDict *list,bool doSort) : RefCountedContext("MemberListContext")
{
p = new Private;
if (list)
@@ -4877,7 +5969,7 @@ class MemberInfoContext::Private : public PropertyMapper
{
if (!m_member && m_memberInfo->memberDef)
{
- m_member.reset(new MemberContext(m_memberInfo->memberDef));
+ m_member.reset(MemberContext::alloc(m_memberInfo->memberDef));
}
if (m_member)
{
@@ -4890,11 +5982,11 @@ class MemberInfoContext::Private : public PropertyMapper
}
private:
const MemberInfo *m_memberInfo;
- mutable ScopedPtr<MemberContext> m_member;
+ mutable SharedPtr<MemberContext> m_member;
};
//%% }
-MemberInfoContext::MemberInfoContext(const MemberInfo *mi)
+MemberInfoContext::MemberInfoContext(const MemberInfo *mi) : RefCountedContext("MemberInfoContext")
{
p = new Private(mi);
}
@@ -4913,7 +6005,7 @@ TemplateVariant MemberInfoContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list AllMembersList[MemberList] : list of inherited classes
-class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoContext>
+class AllMembersListContext::Private : public GenericNodeListContext
{
public:
Private(const MemberNameInfoSDict *ml)
@@ -4939,7 +6031,7 @@ class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoC
)
)
{
- append(new MemberInfoContext(mi));
+ append(MemberInfoContext::alloc(mi));
}
}
}
@@ -4948,12 +6040,12 @@ class AllMembersListContext::Private : public GenericNodeListContext<MemberInfoC
}
};
-AllMembersListContext::AllMembersListContext()
+AllMembersListContext::AllMembersListContext() : RefCountedContext("AllMembersListContext")
{
p = new Private(0);
}
-AllMembersListContext::AllMembersListContext(const MemberNameInfoSDict *ml)
+AllMembersListContext::AllMembersListContext(const MemberNameInfoSDict *ml) : RefCountedContext("AllMembersListContext")
{
p = new Private(ml);
}
@@ -4989,8 +6081,7 @@ class MemberGroupInfoContext::Private : public PropertyMapper
Private(Definition *def,const QCString &relPath,const MemberGroup *mg) :
m_def(def),
m_relPath(relPath),
- m_memberListContext(mg->members()),
- m_memberGroups(def,relPath,0), m_memberGroup(mg)
+ m_memberGroup(mg)
{
addProperty("members", this,&Private::members);
addProperty("title", this,&Private::groupTitle);
@@ -5002,7 +6093,11 @@ class MemberGroupInfoContext::Private : public PropertyMapper
}
TemplateVariant members() const
{
- return &m_memberListContext;
+ if (!m_cache.memberListContext)
+ {
+ m_cache.memberListContext.reset(MemberListContext::alloc(m_memberGroup->members()));
+ }
+ return m_cache.memberListContext.get();
}
TemplateVariant groupTitle() const
{
@@ -5018,26 +6113,30 @@ class MemberGroupInfoContext::Private : public PropertyMapper
}
TemplateVariant memberGroups() const
{
- return &m_memberGroups;
+ if (!m_cache.memberGroups)
+ {
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_def,m_relPath,0));
+ }
+ return m_cache.memberGroups.get();
}
TemplateVariant docs() const
{
- if (!m_docs)
+ if (!m_cache.docs)
{
QCString docs = m_memberGroup->documentation();
if (!docs.isEmpty())
{
- m_docs.reset(new TemplateVariant(
+ m_cache.docs.reset(new TemplateVariant(
parseDoc(m_def,"[@name docs]",-1, // TODO store file & line
m_relPath,
m_memberGroup->documentation()+"\n",FALSE)));
}
else
{
- m_docs.reset(new TemplateVariant(""));
+ m_cache.docs.reset(new TemplateVariant(""));
}
}
- return *m_docs;
+ return *m_cache.docs;
}
TemplateVariant inherited() const
{
@@ -5046,15 +6145,19 @@ class MemberGroupInfoContext::Private : public PropertyMapper
private:
Definition *m_def;
QCString m_relPath;
- MemberListContext m_memberListContext;
- MemberGroupListContext m_memberGroups;
const MemberGroup *m_memberGroup;
- mutable ScopedPtr<TemplateVariant> m_docs;
+ struct Cachable
+ {
+ SharedPtr<MemberListContext> memberListContext;
+ SharedPtr<MemberGroupListContext> memberGroups;
+ ScopedPtr<TemplateVariant> docs;
+ };
+ mutable Cachable m_cache;
};
//%% }
MemberGroupInfoContext::MemberGroupInfoContext(Definition *def,
- const QCString &relPath,const MemberGroup *mg)
+ const QCString &relPath,const MemberGroup *mg) : RefCountedContext("MemberGroupInfoContext")
{
p = new Private(def,relPath,mg);
}
@@ -5072,21 +6175,21 @@ TemplateVariant MemberGroupInfoContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list MemberGroupList[MemberGroupInfo] : list of member groups
-class MemberGroupListContext::Private : public GenericNodeListContext<MemberGroupInfoContext>
+class MemberGroupListContext::Private : public GenericNodeListContext
{
public:
void addMemberGroup(Definition *def,const QCString &relPath,const MemberGroup *mg)
{
- append(new MemberGroupInfoContext(def,relPath,mg));
+ append(MemberGroupInfoContext::alloc(def,relPath,mg));
}
};
-MemberGroupListContext::MemberGroupListContext()
+MemberGroupListContext::MemberGroupListContext() : RefCountedContext("MemberGroupListContext")
{
p = new Private;
}
-MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list)
+MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupList *list) : RefCountedContext("MemberGroupListContext")
{
p = new Private;
if (list)
@@ -5100,7 +6203,7 @@ MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &r
}
}
-MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping)
+MemberGroupListContext::MemberGroupListContext(Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping) : RefCountedContext("MemberGroupListContext")
{
p = new Private;
if (dict)
@@ -5148,9 +6251,8 @@ class MemberListInfoContext::Private : public PropertyMapper
public:
Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) :
m_def(def),
- m_memberListContext(ml),
- m_memberGroups(def,relPath,ml ? ml->getMemberGroupList() : 0),
m_memberList(ml),
+ m_relPath(relPath),
m_title(title),
m_subtitle(subtitle)
{
@@ -5163,7 +6265,11 @@ class MemberListInfoContext::Private : public PropertyMapper
}
TemplateVariant members() const
{
- return &m_memberListContext;
+ if (!m_cache.memberListContext)
+ {
+ m_cache.memberListContext.reset(MemberListContext::alloc(m_memberList));
+ }
+ return m_cache.memberListContext.get();
}
TemplateVariant title() const
{
@@ -5179,20 +6285,24 @@ class MemberListInfoContext::Private : public PropertyMapper
}
TemplateVariant memberGroups() const
{
- return &m_memberGroups;
+ if (!m_cache.memberGroups)
+ {
+ m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_def,m_relPath,m_memberList->getMemberGroupList()));
+ }
+ return m_cache.memberGroups.get();
}
TemplateVariant inherited() const
{
- if (!m_inherited && (m_memberList->listType()&MemberListType_detailedLists)==0 &&
+ if (!m_cache.inherited && (m_memberList->listType()&MemberListType_detailedLists)==0 &&
m_def->definitionType()==Definition::TypeClass)
{
- InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext;
+ InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc();
ctx->addMemberList((ClassDef*)m_def,m_memberList->listType(),m_title,FALSE);
- m_inherited.reset(ctx);
+ m_cache.inherited.reset(ctx);
}
- if (m_inherited)
+ if (m_cache.inherited)
{
- return m_inherited.get();
+ return m_cache.inherited.get();
}
else
{
@@ -5201,18 +6311,23 @@ class MemberListInfoContext::Private : public PropertyMapper
}
private:
Definition *m_def;
- MemberListContext m_memberListContext;
- MemberGroupListContext m_memberGroups;
const MemberList *m_memberList;
+ QCString m_relPath;
QCString m_title;
QCString m_subtitle;
- mutable ScopedPtr<InheritedMemberInfoListContext> m_inherited;
+ struct Cachable
+ {
+ SharedPtr<MemberListContext> memberListContext;
+ SharedPtr<MemberGroupListContext> memberGroups;
+ SharedPtr<InheritedMemberInfoListContext> inherited;
+ };
+ mutable Cachable m_cache;
};
//%% }
MemberListInfoContext::MemberListInfoContext(
Definition *def,const QCString &relPath,const MemberList *ml,
- const QCString &title,const QCString &subtitle)
+ const QCString &title,const QCString &subtitle) : RefCountedContext("MemberListInfoContext")
{
p = new Private(def,relPath,ml,title,subtitle);
}
@@ -5251,7 +6366,7 @@ class InheritedMemberInfoContext::Private : public PropertyMapper
{
if (!m_classCtx)
{
- m_classCtx.reset(new ClassContext(m_class));
+ m_classCtx.reset(ClassContext::alloc(m_class));
}
return m_classCtx.get();
}
@@ -5263,7 +6378,7 @@ class InheritedMemberInfoContext::Private : public PropertyMapper
{
if (!m_memberListCtx)
{
- m_memberListCtx.reset(new MemberListContext(m_memberList));
+ m_memberListCtx.reset(MemberListContext::alloc(m_memberList));
}
return m_memberListCtx.get();
}
@@ -5274,26 +6389,27 @@ class InheritedMemberInfoContext::Private : public PropertyMapper
}
TemplateVariant inheritedFrom() const
{
- if (m_inheritedFrom.count()==0)
+ if (!m_inheritedFrom)
{
- m_inheritedFrom.append(title());
- m_inheritedFrom.append(getClass());
+ m_inheritedFrom.reset(TemplateList::alloc());
+ m_inheritedFrom->append(title());
+ m_inheritedFrom->append(getClass());
}
- return &m_inheritedFrom;
+ return m_inheritedFrom.get();
}
private:
ClassDef * m_class;
MemberList *m_memberList;
QCString m_title;
- mutable ScopedPtr<ClassContext> m_classCtx;
- mutable ScopedPtr<MemberListContext> m_memberListCtx;
- mutable TemplateList m_inheritedFrom;
+ mutable SharedPtr<ClassContext> m_classCtx;
+ mutable SharedPtr<MemberListContext> m_memberListCtx;
+ mutable SharedPtr<TemplateList> m_inheritedFrom;
};
//%% }
InheritedMemberInfoContext::InheritedMemberInfoContext(ClassDef *cd,MemberList *ml,
- const QCString &title)
+ const QCString &title) : RefCountedContext("InheritedMemberInfoContext")
{
p = new Private(cd,ml,title);
}
@@ -5311,7 +6427,7 @@ TemplateVariant InheritedMemberInfoContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list InheritedMemberList[InheritedMemberInfo] : list of inherited classes
-class InheritedMemberInfoListContext::Private : public GenericNodeListContext<InheritedMemberInfoContext>
+class InheritedMemberInfoListContext::Private : public GenericNodeListContext
{
public:
void addMemberList(ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList)
@@ -5385,7 +6501,7 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext<In
addMemberListIncludingGrouped(inheritedFrom,ml2,combinedList);
addMemberGroupsOfClass(inheritedFrom,cd,lt,combinedList);
if (lt2!=-1) addMemberGroupsOfClass(inheritedFrom,cd,(MemberListType)lt2,combinedList);
- append(new InheritedMemberInfoContext(cd,combinedList,title));
+ append(InheritedMemberInfoContext::alloc(cd,combinedList,title));
}
}
void findInheritedMembers(ClassDef *inheritedFrom,ClassDef *cd,MemberListType lt,
@@ -5424,7 +6540,7 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext<In
}
};
-InheritedMemberInfoListContext::InheritedMemberInfoListContext()
+InheritedMemberInfoListContext::InheritedMemberInfoListContext() : RefCountedContext("InheritedMemberInfoListContext")
{
p = new Private;
}
@@ -5433,7 +6549,7 @@ void InheritedMemberInfoListContext::addMemberList(
ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList)
{
QPtrDict<void> visited(17);
- bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE);
+ bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE)>0;
bool show = (additionalList && !memberInSection) || // inherited member to show in the additional inherited members list
(!additionalList && memberInSection); // inherited member to show in a member list of the class
//printf("%s:%s show=%d\n",cd->name().data(),MemberList::listTypeAsString(lt).data(),show);
@@ -5542,7 +6658,7 @@ class ArgumentContext::Private : public PropertyMapper
};
//%% }
-ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath)
+ArgumentContext::ArgumentContext(const Argument *al,Definition *def,const QCString &relPath) : RefCountedContext("ArgumentContext")
{
p = new Private(al,def,relPath);
}
@@ -5560,22 +6676,22 @@ TemplateVariant ArgumentContext::get(const char *name) const
//------------------------------------------------------------------------
//%% list ArgumentList[Argument] : list of inherited classes
-class ArgumentListContext::Private : public GenericNodeListContext<ArgumentContext>
+class ArgumentListContext::Private : public GenericNodeListContext
{
public:
void addArgument(const Argument *arg,Definition *def,const QCString &relPath)
{
- append(new ArgumentContext(arg,def,relPath));
+ append(ArgumentContext::alloc(arg,def,relPath));
}
};
-ArgumentListContext::ArgumentListContext()
+ArgumentListContext::ArgumentListContext() : RefCountedContext("ArgumentListContext")
{
p = new Private;
}
ArgumentListContext::ArgumentListContext(const ArgumentList *list,
- Definition *def,const QCString &relPath)
+ Definition *def,const QCString &relPath) : RefCountedContext("ArgumentListContext")
{
p = new Private;
if (list)
@@ -5692,74 +6808,88 @@ class HtmlSpaceless : public TemplateSpacelessIntf
//------------------------------------------------------------------------
+#if DEBUG_REF
+int RefCountedContext::s_totalCount;
+#endif
+
void generateOutputViaTemplate()
{
+ {
TemplateEngine e;
TemplateContext *ctx = e.createContext();
if (ctx)
{
- DoxygenContext doxygen;
- ConfigContext config;
- TranslateContext tr;
- ClassListContext classList;
- ClassTreeContext classTree;
- ClassHierarchyContext classHierarchy;
- NamespaceListContext namespaceList;
- NamespaceTreeContext namespaceTree;
- FileListContext fileList;
- FileTreeContext fileTree;
- PageTreeContext pageTree;
- PageListContext pageList;
- ModuleTreeContext moduleTree;
- ExampleListContext exampleList;
+ SharedPtr<DoxygenContext> doxygen (DoxygenContext::alloc());
+ SharedPtr<ConfigContext> config (ConfigContext::alloc());
+ SharedPtr<TranslateContext> tr (TranslateContext::alloc());
+ SharedPtr<ClassListContext> classList (ClassListContext::alloc());
+ SharedPtr<ClassTreeContext> classTree (ClassTreeContext::alloc());
+ SharedPtr<ClassHierarchyContext> classHierarchy (ClassHierarchyContext::alloc());
+ SharedPtr<NamespaceListContext> namespaceList (NamespaceListContext::alloc());
+ SharedPtr<NamespaceTreeContext> namespaceTree (NamespaceTreeContext::alloc());
+ SharedPtr<DirListContext> dirList (DirListContext::alloc());
+ SharedPtr<FileListContext> fileList (FileListContext::alloc());
+ SharedPtr<FileTreeContext> fileTree (FileTreeContext::alloc());
+ SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc());
+ SharedPtr<PageListContext> pageList (PageListContext::alloc());
+ SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc());
+ SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc());
//%% Doxygen doxygen:
- ctx->set("doxygen",&doxygen);
+ ctx->set("doxygen",doxygen.get());
//%% Translator tr:
- ctx->set("tr",&tr);
+ ctx->set("tr",tr.get());
//%% Config config:
- ctx->set("config",&config);
+ ctx->set("config",config.get());
//%% ClassList classList:
- ctx->set("classList",&classList); // not used for standard HTML
+ ctx->set("classList",classList.get()); // not used for standard HTML
//%% ClassTree classTree:
- ctx->set("classTree",&classTree);
+ ctx->set("classTree",classTree.get());
// classIndex
//%% ClassHierarchy classHierarchy:
- ctx->set("classHierarchy",&classHierarchy);
+ ctx->set("classHierarchy",classHierarchy.get());
//%% NamespaceList namespaceList:
- ctx->set("namespaceList",&namespaceList);
+ ctx->set("namespaceList",namespaceList.get());
//%% NamespaceTree namespaceTree:
- ctx->set("namespaceTree",&namespaceTree);
+ ctx->set("namespaceTree",namespaceTree.get());
//%% FileList fileList:
- ctx->set("fileList",&fileList);
+ ctx->set("fileList",fileList.get());
//%% FileTree fileTree:
- ctx->set("fileTree",&fileTree);
+ ctx->set("fileTree",fileTree.get());
//%% PageList pageList
- ctx->set("pageList",&pageList);
+ ctx->set("pageList",pageList.get());
//%% PageTree pageTree
- ctx->set("pageTree",&pageTree);
+ ctx->set("pageTree",pageTree.get());
//%% ModuleTree moduleTree
- ctx->set("moduleTree",&moduleTree);
+ ctx->set("moduleTree",moduleTree.get());
//%% ExampleList exampleList
- ctx->set("exampleList",&exampleList);
+ ctx->set("exampleList",exampleList.get());
+ //%% DirList dirList
+ ctx->set("dirList",dirList.get());
// render HTML output
- Template *tpl = e.loadByName("htmllayout.tpl");
+ Template *tpl = e.loadByName("htmllayout.tpl",1);
if (tpl)
{
g_globals.outputFormat = ContextGlobals::Html;
g_globals.dynSectionId = 0;
g_globals.outputDir = Config_getString("HTML_OUTPUT");
- HtmlEscaper esc;
- ctx->setEscapeIntf(&esc);
+ HtmlEscaper htmlEsc;
+ ctx->setEscapeIntf(Config_getString("HTML_FILE_EXTENSION"),&htmlEsc);
HtmlSpaceless spl;
ctx->setSpacelessIntf(&spl);
ctx->setOutputDirectory(g_globals.outputDir);
FTextStream ts;
tpl->render(ts,ctx);
}
+ e.unload(tpl);
// TODO: render other outputs
}
+ delete ctx;
+ }
+#if DEBUG_REF
+ printf("==== total ref count %d\n",RefCountedContext::s_totalCount);
+#endif
}