Skip to content

Commit

Permalink
Added member indexes to template context
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Aug 2, 2014
1 parent e0c3517 commit b850eb4
Show file tree
Hide file tree
Showing 2 changed files with 271 additions and 21 deletions.
235 changes: 214 additions & 21 deletions src/context.cpp
Expand Up @@ -6393,7 +6393,6 @@ class ExampleListContext::Private : public PropertyMapper
{
m_pageList.reset(PageListContext::alloc(Doxygen::exampleSDict));

//%% PageNodeList items:
addProperty("items",this,&Private::items);
addProperty("fileName",this,&Private::fileName);
addProperty("relPath",this,&Private::relPath);
Expand Down Expand Up @@ -6421,6 +6420,193 @@ TemplateVariant ExampleListContext::get(const char *name) const
return p->get(name);
}

//------------------------------------------------------------------------

//%% struct GlobalsIndex: list of examples page
//%% {
class GlobalsIndexContext::Private : public PropertyMapper
{
public:
//TemplateVariant items() const
//{
// return m_pageList.get();
//}
TemplateVariant fileName() const
{
return "globals";
}
TemplateVariant relPath() const
{
return "";
}
TemplateVariant highlight() const
{
return "files";
}
TemplateVariant subhighlight() const
{
return "globals";
}
TemplateVariant title() const
{
return theTranslator->trFileMembers();
}
Private()
{
//m_pageList.reset(PageListContext::alloc(Doxygen::exampleSDict));

//addProperty("items",this,&Private::items);
addProperty("fileName",this,&Private::fileName);
addProperty("relPath",this,&Private::relPath);
addProperty("highlight",this,&Private::highlight);
addProperty("subhighlight",this,&Private::subhighlight);
addProperty("title",this,&Private::title);
}
private:
//SharedPtr<PageListContext> m_pageList;
};
//%% }

GlobalsIndexContext::GlobalsIndexContext() : RefCountedContext("GlobalsIndexContext")
{
p = new Private;
}

GlobalsIndexContext::~GlobalsIndexContext()
{
delete p;
}

TemplateVariant GlobalsIndexContext::get(const char *name) const
{
return p->get(name);
}

//------------------------------------------------------------------------

//%% struct ClassMembersIndex: list of examples page
//%% {
class ClassMembersIndexContext::Private : public PropertyMapper
{
public:
//TemplateVariant items() const
//{
// return m_pageList.get();
//}
TemplateVariant fileName() const
{
return "functions";
}
TemplateVariant relPath() const
{
return "";
}
TemplateVariant highlight() const
{
return "classes";
}
TemplateVariant subhighlight() const
{
return "classmembers";
}
TemplateVariant title() const
{
return theTranslator->trCompoundMembers();
}
Private()
{
//m_pageList.reset(PageListContext::alloc(Doxygen::exampleSDict));

//addProperty("items",this,&Private::items);
addProperty("fileName",this,&Private::fileName);
addProperty("relPath",this,&Private::relPath);
addProperty("highlight",this,&Private::highlight);
addProperty("subhighlight",this,&Private::subhighlight);
addProperty("title",this,&Private::title);
}
private:
//SharedPtr<PageListContext> m_pageList;
};
//%% }

ClassMembersIndexContext::ClassMembersIndexContext() : RefCountedContext("ClassMembersIndexContext")
{
p = new Private;
}

ClassMembersIndexContext::~ClassMembersIndexContext()
{
delete p;
}

TemplateVariant ClassMembersIndexContext::get(const char *name) const
{
return p->get(name);
}

//------------------------------------------------------------------------

//%% struct NamespaceMembersIndex: list of examples page
//%% {
class NamespaceMembersIndexContext::Private : public PropertyMapper
{
public:
//TemplateVariant items() const
//{
// return m_pageList.get();
//}
TemplateVariant fileName() const
{
return "namespacemembers";
}
TemplateVariant relPath() const
{
return "";
}
TemplateVariant highlight() const
{
return "namespaces";
}
TemplateVariant subhighlight() const
{
return "namespacemembers";
}
TemplateVariant title() const
{
return theTranslator->trNamespaceMembers();
}
Private()
{
//m_pageList.reset(PageListContext::alloc(Doxygen::exampleSDict));

//%% PageNodeList items:
//addProperty("items",this,&Private::items);
addProperty("fileName",this,&Private::fileName);
addProperty("relPath",this,&Private::relPath);
addProperty("highlight",this,&Private::highlight);
addProperty("subhighlight",this,&Private::subhighlight);
addProperty("title",this,&Private::title);
}
private:
//SharedPtr<PageListContext> m_pageList;
};
//%% }

NamespaceMembersIndexContext::NamespaceMembersIndexContext() : RefCountedContext("NamespaceMembersIndexContext")
{
p = new Private;
}

NamespaceMembersIndexContext::~NamespaceMembersIndexContext()
{
delete p;
}

TemplateVariant NamespaceMembersIndexContext::get(const char *name) const
{
return p->get(name);
}


//------------------------------------------------------------------------

Expand Down Expand Up @@ -7500,24 +7686,27 @@ void generateOutputViaTemplate()
TemplateContext *ctx = e.createContext();
if (ctx)
{
SharedPtr<DoxygenContext> doxygen (DoxygenContext::alloc());
SharedPtr<ConfigContext> config (ConfigContext::alloc());
SharedPtr<TranslateContext> tr (TranslateContext::alloc());
SharedPtr<ClassListContext> classList (ClassListContext::alloc());
SharedPtr<ClassIndexContext> classIndex (ClassIndexContext::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(Doxygen::pageSDict));
SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc());
SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc());
SharedPtr<ModuleListContext> moduleList (ModuleListContext::alloc());
SharedPtr<PageContext> mainPage (PageContext::alloc(Doxygen::mainPage,TRUE));
SharedPtr<DoxygenContext> doxygen (DoxygenContext::alloc());
SharedPtr<ConfigContext> config (ConfigContext::alloc());
SharedPtr<TranslateContext> tr (TranslateContext::alloc());
SharedPtr<ClassListContext> classList (ClassListContext::alloc());
SharedPtr<ClassIndexContext> classIndex (ClassIndexContext::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(Doxygen::pageSDict));
SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc());
SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc());
SharedPtr<ModuleListContext> moduleList (ModuleListContext::alloc());
SharedPtr<PageContext> mainPage (PageContext::alloc(Doxygen::mainPage,TRUE));
SharedPtr<GlobalsIndexContext> globalsIndex (GlobalsIndexContext::alloc());
SharedPtr<ClassMembersIndexContext> classMembersIndex (ClassMembersIndexContext::alloc());
SharedPtr<NamespaceMembersIndexContext> namespaceMembersIndex(NamespaceMembersIndexContext::alloc());

//%% Doxygen doxygen:
ctx->set("doxygen",doxygen.get());
Expand All @@ -7531,8 +7720,6 @@ void generateOutputViaTemplate()
ctx->set("classTree",classTree.get());
//%% ClassIndex classIndex:
ctx->set("classIndex",classIndex.get());
// globals
// members
//%% ClassHierarchy classHierarchy:
ctx->set("classHierarchy",classHierarchy.get());
//%% NamespaceList namespaceList:
Expand All @@ -7557,6 +7744,12 @@ void generateOutputViaTemplate()
ctx->set("dirList",dirList.get());
//%% Page mainPage
ctx->set("mainPage",mainPage.get());
//%% GlobalsIndex globalsIndex:
ctx->set("globalsIndex",globalsIndex.get());
//%% ClassMembersIndex classMembersIndex:
ctx->set("classMembersIndex",classMembersIndex.get());
//%% NamespaceMembersIndex namespaceMembersIndex:
ctx->set("namespaceMembersIndex",namespaceMembersIndex.get());

// render HTML output
Template *tpl = e.loadByName("htmllayout.tpl",1);
Expand Down
57 changes: 57 additions & 0 deletions src/context.h
Expand Up @@ -780,6 +780,63 @@ class ExampleListContext : public RefCountedContext, public TemplateStructIntf

//----------------------------------------------------

class GlobalsIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
static GlobalsIndexContext *alloc() { return new GlobalsIndexContext(); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
GlobalsIndexContext();
~GlobalsIndexContext();
class Private;
Private *p;
};

//----------------------------------------------------

class ClassMembersIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
static ClassMembersIndexContext *alloc() { return new ClassMembersIndexContext(); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
ClassMembersIndexContext();
~ClassMembersIndexContext();
class Private;
Private *p;
};

//----------------------------------------------------

class NamespaceMembersIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
static NamespaceMembersIndexContext *alloc() { return new NamespaceMembersIndexContext(); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
NamespaceMembersIndexContext();
~NamespaceMembersIndexContext();
class Private;
Private *p;
};

//----------------------------------------------------

class NavPathElemContext : public RefCountedContext, public TemplateStructIntf
{
public:
Expand Down

0 comments on commit b850eb4

Please sign in to comment.