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 ()
 

Macro Definition Documentation

#define DEBUG_REF   0

Definition at line 62 of file context.h.

Function Documentation

void generateOutputViaTemplate ( )

Definition at line 10068 of file context.cpp.

10069 {
10070  msg("Generating output via template engine...\n");
10071  {
10072  TemplateEngine e;
10073  TemplateContext *ctx = e.createContext();
10074  if (ctx)
10075  {
10098 
10099  //%% Doxygen doxygen:
10100  ctx->set("doxygen",doxygen.get());
10101  //%% Translator tr:
10102  ctx->set("tr",tr.get());
10103  //%% Config config:
10104  ctx->set("config",config.get());
10105  //%% ClassList classList:
10106  ctx->set("classList",classList.get()); // not used for standard HTML
10107  //%% ClassTree classTree:
10108  ctx->set("classTree",classTree.get());
10109  //%% ClassIndex classIndex:
10110  ctx->set("classIndex",classIndex.get());
10111  //%% ClassHierarchy classHierarchy:
10112  ctx->set("classHierarchy",classHierarchy.get());
10113  //%% NamespaceList namespaceList:
10114  ctx->set("namespaceList",namespaceList.get());
10115  //%% NamespaceTree namespaceTree:
10116  ctx->set("namespaceTree",namespaceTree.get());
10117  //%% FileList fileList:
10118  ctx->set("fileList",fileList.get());
10119  //%% FileTree fileTree:
10120  ctx->set("fileTree",fileTree.get());
10121  //%% PageList pageList
10122  ctx->set("pageList",pageList.get());
10123  //%% PageTree pageTree
10124  ctx->set("pageTree",pageTree.get());
10125  //%% ExampleTree exampleTree
10126  ctx->set("exampleTree",exampleTree.get());
10127  //%% ExampleList exampleList
10128  ctx->set("exampleList",exampleList.get());
10129  //%% ModuleTree moduleTree
10130  ctx->set("moduleTree",moduleTree.get());
10131  //%% ModuleList moduleList
10132  ctx->set("moduleList",moduleList.get());
10133  //%% DirList dirList
10134  ctx->set("dirList",dirList.get());
10135  //%% Page mainPage
10136  if (Doxygen::mainPage)
10137  {
10139  ctx->set("mainPage",mainPage.get());
10140  }
10141  else
10142  {
10143  // TODO: for LaTeX output index should be main... => solve in template
10144  Doxygen::mainPage = new PageDef("[generated]",1,"index","",theTranslator->trMainPage());
10145  Doxygen::mainPage->setFileName("index");
10147  ctx->set("mainPage",mainPage.get());
10148  }
10149  //%% GlobalsIndex globalsIndex:
10150  ctx->set("globalsIndex",globalsIndex.get());
10151  //%% ClassMembersIndex classMembersIndex:
10152  ctx->set("classMembersIndex",classMembersIndex.get());
10153  //%% NamespaceMembersIndex namespaceMembersIndex:
10154  ctx->set("namespaceMembersIndex",namespaceMembersIndex.get());
10155  //%% SearchIndicaes searchindicaes
10156  ctx->set("searchIndices",searchIndices.get());
10157  //%% string space
10158  ctx->set("space"," ");
10159 
10160  //if (Config_getBool("GENERATE_HTML"))
10161  { // render HTML output
10162  Template *tpl = e.loadByName("htmllayout.tpl",1);
10163  if (tpl)
10164  {
10166  g_globals.dynSectionId = 0;
10167  g_globals.outputDir = Config_getString("HTML_OUTPUT");
10169  createSubDirs(dir);
10170  HtmlEscaper htmlEsc;
10171  ctx->setEscapeIntf(Config_getString("HTML_FILE_EXTENSION"),&htmlEsc);
10172  HtmlSpaceless spl;
10173  ctx->setSpacelessIntf(&spl);
10175  FTextStream ts;
10176  tpl->render(ts,ctx);
10177  e.unload(tpl);
10178  }
10179  }
10180 
10181  // TODO: clean index before each run...
10182 
10183  //if (Config_getBool("GENERATE_LATEX"))
10184  if (0)
10185  { // render LaTeX output
10186  Template *tpl = e.loadByName("latexlayout.tpl",1);
10187  if (tpl)
10188  {
10190  g_globals.dynSectionId = 0;
10191  g_globals.outputDir = Config_getString("LATEX_OUTPUT");
10193  createSubDirs(dir);
10194  LatexEscaper latexEsc;
10195  ctx->setEscapeIntf(".tex",&latexEsc);
10196  LatexSpaceless spl;
10197  ctx->setSpacelessIntf(&spl);
10199  FTextStream ts;
10200  tpl->render(ts,ctx);
10201  e.unload(tpl);
10202  }
10203  }
10204 
10205  // clear all cached data in Definition objects.
10206  QDictIterator<DefinitionIntf> di(*Doxygen::symbolMap);
10207  DefinitionIntf *intf;
10208  for (;(intf=di.current());++di)
10209  {
10210  if (intf->definitionType()==DefinitionIntf::TypeSymbolList) // list of symbols
10211  {
10213  Definition *d;
10214  // for each symbol
10215  for (dli.toFirst();(d=dli.current());++dli)
10216  {
10217  d->setCookie(0);
10218  }
10219  }
10220  else // single symbol
10221  {
10222  Definition *d = (Definition *)intf;
10223  d->setCookie(0);
10224  }
10225  }
10226 
10227  e.destroyContext(ctx);
10228  }
10229  }
10230 #if DEBUG_REF // should be 0, i.e. all objects are deleted
10231  printf("==== total ref count %d\n",RefCountedContext::s_totalCount);
10232 #endif
10233 }
Reference counting smart pointer.
Definition: context.cpp:96
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
Abstract interface for a template context.
Definition: template.h:489
static ExampleTreeContext * alloc()
Definition: context.h:816
static PageContext * alloc(PageDef *pd, bool isMainPage, bool isExample)
Definition: context.h:332
Abstract interface for a template.
Definition: template.h:542
void msg(const char *fmt,...)
Definition: message.cpp:107
int dynSectionId
Definition: context.cpp:69
static PageListContext * alloc(const PageSDict *pages)
Definition: context.h:690
const bool FALSE
Definition: qglobal.h:370
static ClassHierarchyContext * alloc()
Definition: context.h:493
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
string dir
static PageTreeContext * alloc(const PageSDict *pages)
Definition: context.h:713
static ConfigContext * alloc()
Definition: context.h:132
static NamespaceListContext * alloc()
Definition: context.h:589
QCString outputDir
Definition: context.cpp:70
void setFileName(const char *name)
Definition: pagedef.cpp:66
static ModuleTreeContext * alloc()
Definition: context.h:775
static DoxygenContext * alloc()
Definition: context.h:151
TemplateContext * createContext() const
Definition: template.cpp:4961
virtual DefType definitionType() const =0
virtual QCString trMainPage()=0
virtual void set(const char *name, const TemplateVariant &v)=0
const double e
void setCookie(Cookie *cookie)
Definition: definition.h:351
virtual void setEscapeIntf(const QCString &extension, TemplateEscapeIntf *intf)=0
static Config * config
Definition: config.cpp:1054
virtual void setOutputDirectory(const QCString &dir)=0
void unload(Template *t)
Definition: template.cpp:4976
virtual void render(FTextStream &ts, TemplateContext *c)=0
static FileListContext * alloc()
Definition: context.h:650
static QDict< DefinitionIntf > * symbolMap
Definition: doxygen.h:134
static TranslateContext * alloc()
Definition: context.h:170
virtual void setSpacelessIntf(TemplateSpacelessIntf *intf)=0
static PageSDict * pageSDict
Definition: doxygen.h:102
#define Config_getString(val)
Definition: config.cpp:660
static ExampleListContext * alloc()
Definition: context.h:794
static ModuleListContext * alloc()
Definition: context.h:751
static GlobalsIndexContext * alloc()
Definition: context.h:835
static NamespaceTreeContext * alloc()
Definition: context.h:610
void destroyContext(TemplateContext *ctx)
Definition: template.cpp:4966
Template * loadByName(const QCString &fileName, int fromLine)
Definition: template.cpp:4971
Engine to create templates and template contexts.
Definition: template.h:559
static SearchIndicesContext * alloc()
Definition: context.h:1331
ContextOutputFormat outputFormat
Definition: context.cpp:71
A model of a page symbol.
Definition: pagedef.h:29
static ClassMembersIndexContext * alloc()
Definition: context.h:854
static ClassTreeContext * alloc()
Definition: context.h:570
static DirListContext * alloc()
Definition: context.h:629
Translator * theTranslator
Definition: language.cpp:157
void createSubDirs(QDir &d)
Definition: util.cpp:5458
struct ContextGlobals g_globals
static ClassIndexContext * alloc()
Definition: context.h:411
static ClassListContext * alloc()
Definition: context.h:390
static NamespaceMembersIndexContext * alloc()
Definition: context.h:873
static PageDef * mainPage
Definition: doxygen.h:103
static FileTreeContext * alloc()
Definition: context.h:671
const bool TRUE
Definition: qglobal.h:371