My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions
context.h File Reference
#include "types.h"
#include "template.h"
#include <qlist.h>
#include <stdio.h>

Go to the source code of this file.

Classes

class  RefCountedContext
 Helper class to support reference counting. More...
 
class  ConfigContext
 
class  DoxygenContext
 
class  TranslateContext
 
class  UsedFilesContext
 
class  IncludeInfoContext
 
class  IncludeInfoListContext
 
class  ClassContext
 
class  NamespaceContext
 
class  FileContext
 
class  DirContext
 
class  PageContext
 
class  MemberContext
 
class  ModuleContext
 
class  ClassListContext
 
class  ClassIndexContext
 
class  InheritanceGraphContext
 
class  ClassInheritanceNodeContext
 
class  ClassInheritanceContext
 
class  ClassHierarchyContext
 
class  NestingNodeContext
 
class  NestingContext
 
class  ClassTreeContext
 
class  NamespaceListContext
 
class  NamespaceTreeContext
 
class  DirListContext
 
class  FileListContext
 
class  FileTreeContext
 
class  PageListContext
 
class  PageTreeContext
 
class  ModuleNodeContext
 
class  ModuleListContext
 
class  ModuleTreeContext
 
class  ExampleListContext
 
class  ExampleTreeContext
 
class  GlobalsIndexContext
 
class  ClassMembersIndexContext
 
class  NamespaceMembersIndexContext
 
class  NavPathElemContext
 
class  InheritanceNodeContext
 
class  InheritanceListContext
 
class  MemberListContext
 
class  MemberGroupInfoContext
 
class  MemberGroupListContext
 
class  MemberListInfoContext
 
class  MemberInfoContext
 
class  InheritedMemberInfoContext
 
class  InheritedMemberInfoListContext
 
class  AllMembersListContext
 
class  ArgumentContext
 
class  ArgumentListContext
 
class  SymbolContext
 
class  SymbolListContext
 
class  SymbolGroupContext
 
class  SymbolGroupListContext
 
class  SymbolIndexContext
 
class  SymbolIndicesContext
 
class  SearchIndexContext
 
class  SearchIndicesContext
 

Macros

#define DEBUG_REF   0
 

Functions

void generateOutputViaTemplate ()
 
void generateTemplateFiles (const char *templateDir)
 

Macro Definition Documentation

#define DEBUG_REF   0

Definition at line 62 of file context.h.

Function Documentation

void generateOutputViaTemplate ( )

Definition at line 10083 of file context.cpp.

References ConfigContext::alloc(), DoxygenContext::alloc(), TranslateContext::alloc(), PageContext::alloc(), ClassListContext::alloc(), ClassIndexContext::alloc(), ClassHierarchyContext::alloc(), ClassTreeContext::alloc(), NamespaceListContext::alloc(), NamespaceTreeContext::alloc(), DirListContext::alloc(), FileListContext::alloc(), FileTreeContext::alloc(), PageListContext::alloc(), PageTreeContext::alloc(), ModuleListContext::alloc(), ModuleTreeContext::alloc(), ExampleListContext::alloc(), ExampleTreeContext::alloc(), GlobalsIndexContext::alloc(), ClassMembersIndexContext::alloc(), NamespaceMembersIndexContext::alloc(), SearchIndicesContext::alloc(), Config_getString, ContextOutputFormat_Html, ContextOutputFormat_Latex, TemplateEngine::createContext(), createSubDirs(), DefinitionIntf::definitionType(), TemplateEngine::destroyContext(), ContextGlobals::dynSectionId, g_globals, SharedPtr< T >::get(), TemplateEngine::loadByName(), Doxygen::mainPage, msg(), ContextGlobals::outputDir, ContextGlobals::outputFormat, Doxygen::pageSDict, Template::render(), TemplateContext::set(), Definition::setCookie(), TemplateContext::setEscapeIntf(), PageDef::setFileName(), TemplateContext::setOutputDirectory(), TemplateContext::setSpacelessIntf(), TemplateEngine::setTemplateDir(), Doxygen::symbolMap, theTranslator, Translator::trMainPage(), DefinitionIntf::TypeSymbolList, and TemplateEngine::unload().

Referenced by generateOutput().

{
msg("Generating output via template engine...\n");
{
if (ctx)
{
//%% Doxygen doxygen:
ctx->set("doxygen",doxygen.get());
//%% Translator tr:
ctx->set("tr",tr.get());
//%% Config config:
ctx->set("config",config.get());
//%% ClassList classList:
ctx->set("classList",classList.get()); // not used for standard HTML
//%% ClassTree classTree:
ctx->set("classTree",classTree.get());
//%% ClassIndex classIndex:
ctx->set("classIndex",classIndex.get());
//%% ClassHierarchy classHierarchy:
ctx->set("classHierarchy",classHierarchy.get());
//%% NamespaceList namespaceList:
ctx->set("namespaceList",namespaceList.get());
//%% NamespaceTree namespaceTree:
ctx->set("namespaceTree",namespaceTree.get());
//%% FileList fileList:
ctx->set("fileList",fileList.get());
//%% FileTree fileTree:
ctx->set("fileTree",fileTree.get());
//%% PageList pageList
ctx->set("pageList",pageList.get());
//%% PageTree pageTree
ctx->set("pageTree",pageTree.get());
//%% ExampleTree exampleTree
ctx->set("exampleTree",exampleTree.get());
//%% ExampleList exampleList
ctx->set("exampleList",exampleList.get());
//%% ModuleTree moduleTree
ctx->set("moduleTree",moduleTree.get());
//%% ModuleList moduleList
ctx->set("moduleList",moduleList.get());
//%% DirList dirList
ctx->set("dirList",dirList.get());
//%% Page mainPage
{
ctx->set("mainPage",mainPage.get());
}
else
{
// TODO: for LaTeX output index should be main... => solve in template
Doxygen::mainPage = new PageDef("[generated]",1,"index","",theTranslator->trMainPage());
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());
//%% SearchIndicaes searchindicaes
ctx->set("searchIndices",searchIndices.get());
//%% string space
ctx->set("space"," ");
//if (Config_getBool(GENERATE_HTML))
{ // render HTML output
e.setTemplateDir("templates/html"); // TODO: make template part user configurable
Template *tpl = e.loadByName("htmllayout.tpl",1);
if (tpl)
{
QDir dir(g_globals.outputDir);
HtmlEscaper htmlEsc;
ctx->setEscapeIntf(Config_getString(HTML_FILE_EXTENSION),&htmlEsc);
ctx->setSpacelessIntf(&spl);
tpl->render(ts,ctx);
e.unload(tpl);
}
}
// TODO: clean index before each run...
//if (Config_getBool(GENERATE_LATEX))
if (0)
{ // render LaTeX output
e.setTemplateDir("templates/latex"); // TODO: make template part user configurable
Template *tpl = e.loadByName("latexlayout.tpl",1);
if (tpl)
{
QDir dir(g_globals.outputDir);
LatexEscaper latexEsc;
ctx->setEscapeIntf(".tex",&latexEsc);
ctx->setSpacelessIntf(&spl);
tpl->render(ts,ctx);
e.unload(tpl);
}
}
// clear all cached data in Definition objects.
QDictIterator<DefinitionIntf> di(*Doxygen::symbolMap);
for (;(intf=di.current());++di)
{
if (intf->definitionType()==DefinitionIntf::TypeSymbolList) // list of symbols
{
// for each symbol
for (dli.toFirst();(d=dli.current());++dli)
{
d->setCookie(0);
}
}
else // single symbol
{
Definition *d = (Definition *)intf;
d->setCookie(0);
}
}
}
}
#if DEBUG_REF // should be 0, i.e. all objects are deleted
printf("==== total ref count %d\n",RefCountedContext::s_totalCount);
#endif
}
void generateTemplateFiles ( const char *  templateDir)

Definition at line 10252 of file context.cpp.

References err(), ResourceMgr::instance(), and ResourceMgr::writeCategory().

Referenced by readConfiguration().

{
if (!templateDir) return;
QDir thisDir;
if (!thisDir.exists(templateDir) && !thisDir.mkdir(templateDir))
{
err("Failed to create output directory '%s'\n",templateDir);
return;
}
QCString outDir = QCString(templateDir)+"/html";
if (!thisDir.exists(outDir) && !thisDir.mkdir(outDir))
{
err("Failed to create output directory '%s'\n",templateDir);
return;
}
}