Classes | Macros | Enumerations | Functions | Variables
context.cpp File Reference
#include <assert.h>
#include <qdir.h>
#include "context.h"
#include "config.h"
#include "index.h"
#include "classlist.h"
#include "doxygen.h"
#include "namespacedef.h"
#include "filedef.h"
#include "pagedef.h"
#include "groupdef.h"
#include "util.h"
#include "version.h"
#include "language.h"
#include "message.h"
#include "vhdldocgen.h"
#include "filename.h"
#include "dirdef.h"
#include "docparser.h"
#include "htmlgen.h"
#include "htmldocvisitor.h"
#include "latexgen.h"
#include "latexdocvisitor.h"
#include "dot.h"
#include "diagram.h"
#include "example.h"
#include "membername.h"
#include "parserintf.h"
#include "portable.h"
#include "arguments.h"
#include "searchindex.h"

Go to the source code of this file.

Classes

struct  ContextGlobals
 
class  ScopedPtr< T >
 Scoped smart pointer. More...
 
class  SharedPtr< T >
 Reference counting smart pointer. More...
 
class  GenericConstIterator
 Template List iterator support. More...
 
class  GenericNodeListContext
 standard template list implementation More...
 
class  PropertyMapper< T >
 Helper class to map a property name to a handler member function. More...
 
struct  PropertyMapper< T >::PropertyFuncIntf
 
struct  PropertyMapper< T >::PropertyFunc
 
class  ConfigContext::Private
 
class  DoxygenContext::Private
 
struct  DoxygenContext::Private::Cachable
 
class  TranslateContext::Private
 
class  DefinitionContext< T >
 
struct  DefinitionContext< T >::Cachable
 
class  IncludeInfoContext::Private
 
class  IncludeInfoListContext::Private
 
class  ClassContext::Private
 
struct  ClassContext::Private::Cachable
 
class  NamespaceContext::Private
 
struct  NamespaceContext::Private::Cachable
 
class  FileContext::Private
 
struct  FileContext::Private::Cachable
 
class  DirContext::Private
 
struct  DirContext::Private::Cachable
 
class  PageContext::Private
 
struct  PageContext::Private::Cachable
 
class  TextGeneratorHtml
 
class  TextGeneratorLatex
 
class  TextGeneratorFactory
 
class  MemberContext::Private
 
struct  MemberContext::Private::Cachable
 
class  ModuleContext::Private
 
struct  ModuleContext::Private::Cachable
 
class  ClassListContext::Private
 
class  ClassIndexContext::Private
 
struct  ClassIndexContext::Private::Cachable
 
class  ClassHierarchyContext::Private
 
struct  ClassHierarchyContext::Private::Cachable
 
class  NestingNodeContext::Private
 
struct  NestingNodeContext::Private::Cachable
 
class  NestingContext::Private
 
class  ClassTreeContext::Private
 
struct  ClassTreeContext::Private::Cachable
 
class  NamespaceListContext::Private
 
class  NamespaceTreeContext::Private
 
struct  NamespaceTreeContext::Private::Cachable
 
class  FileListContext::Private
 
class  DirListContext::Private
 
class  UsedFilesContext::Private
 
class  FileTreeContext::Private
 
struct  FileTreeContext::Private::Cachable
 
class  PageTreeContext::Private
 
struct  PageTreeContext::Private::Cachable
 
class  PageListContext::Private
 
class  ExampleListContext::Private
 
class  ModuleListContext::Private
 
class  ModuleTreeContext::Private
 
struct  ModuleTreeContext::Private::Cachable
 
class  NavPathElemContext::Private
 
class  ExampleTreeContext::Private
 
struct  ExampleTreeContext::Private::Cachable
 
class  GlobalsIndexContext::Private
 
struct  GlobalsIndexContext::Private::Cachable
 
class  ClassMembersIndexContext::Private
 
struct  ClassMembersIndexContext::Private::Cachable
 
class  NamespaceMembersIndexContext::Private
 
struct  NamespaceMembersIndexContext::Private::Cachable
 
class  InheritanceGraphContext::Private
 
class  InheritanceNodeContext::Private
 
class  InheritanceListContext::Private
 
class  MemberListContext::Private
 
class  MemberInfoContext::Private
 
class  AllMembersListContext::Private
 
class  MemberGroupInfoContext::Private
 
struct  MemberGroupInfoContext::Private::Cachable
 
class  MemberGroupListContext::Private
 
class  MemberListInfoContext::Private
 
struct  MemberListInfoContext::Private::Cachable
 
class  InheritedMemberInfoContext::Private
 
class  InheritedMemberInfoListContext::Private
 
class  ArgumentContext::Private
 
struct  ArgumentContext::Private::Cachable
 
class  ArgumentListContext::Private
 
class  SymbolContext::Private
 
class  SymbolListContext::Private
 
class  SymbolGroupContext::Private
 
struct  SymbolGroupContext::Private::Cachable
 
class  SymbolGroupListContext::Private
 
class  SymbolIndexContext::Private
 
struct  SymbolIndexContext::Private::Cachable
 
class  SymbolIndicesContext::Private
 
class  SearchIndexContext::Private
 
struct  SearchIndexContext::Private::Cachable
 
class  SearchIndicesContext::Private
 
class  HtmlEscaper
 
class  LatexSpaceless
 
class  HtmlSpaceless
 
class  LatexEscaper
 

Macros

#define ADD_PROPERTY(name)   addProperty(#name,this,&Private::name);
 

Enumerations

enum  ContextOutputFormat {
  ContextOutputFormat_Unspecified =0, ContextOutputFormat_Html, ContextOutputFormat_Latex, ContextOutputFormat_Rtf,
  ContextOutputFormat_ManPage, ContextOutputFormat_DocBook, ContextOutputFormat_Xml, ContextOutputFormat_TagFile
}
 

Functions

static TemplateVariant parseDoc (Definition *def, const QCString &file, int line, const QCString &relPath, const QCString &docStr, bool isBrief)
 
static TemplateVariant parseCode (MemberDef *md, const QCString &scopeName, const QCString &relPath, const QCString &code, int startLine=-1, int endLine=-1, bool showLineNumbers=FALSE)
 
static TemplateVariant parseCode (FileDef *fd, const QCString &relPath)
 
TemplateVariant createLinkedText (Definition *def, const QCString &relPath, const QCString &text)
 
static int computeMaxDepth (const TemplateListIntf *list)
 
static int computeNumNodesAtLevel (const TemplateStructIntf *s, int level, int maxLevel)
 
static int computePreferredDepth (const TemplateListIntf *list, int maxDepth)
 
void generateOutputViaTemplate ()
 

Variables

struct ContextGlobals g_globals
 

Macro Definition Documentation

#define ADD_PROPERTY (   name)    addProperty(#name,this,&Private::name);

Definition at line 53 of file context.cpp.

Enumeration Type Documentation

Enumerator
ContextOutputFormat_Unspecified 
ContextOutputFormat_Html 
ContextOutputFormat_Latex 
ContextOutputFormat_Rtf 
ContextOutputFormat_ManPage 
ContextOutputFormat_DocBook 
ContextOutputFormat_Xml 
ContextOutputFormat_TagFile 

Definition at line 55 of file context.cpp.

Function Documentation

static int computeMaxDepth ( const TemplateListIntf list)
static

Definition at line 5840 of file context.cpp.

5841 {
5842  int maxDepth=0;
5843  if (list)
5844  {
5846  TemplateVariant v;
5847  for (it->toFirst();it->current(v);it->toNext())
5848  {
5849  const TemplateStructIntf *s = v.toStruct();
5850  TemplateVariant child = s->get("children");
5851  int d = computeMaxDepth(child.toList())+1;
5852  if (d>maxDepth) maxDepth=d;
5853  }
5854  delete it;
5855  }
5856  return maxDepth;
5857 }
virtual bool current(TemplateVariant &v) const =0
virtual TemplateVariant get(const char *name) const =0
TemplateListIntf * toList() const
Definition: template.h:256
Abstract interface for a context value of type struct.
Definition: template.h:406
static int computeMaxDepth(const TemplateListIntf *list)
Definition: context.cpp:5840
Abstract interface for a iterator of a list.
Definition: template.h:333
virtual TemplateListIntf::ConstIterator * createIterator() const =0
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
TemplateStructIntf * toStruct() const
Definition: template.h:264
static QCString * s
Definition: config.cpp:1042
static int computeNumNodesAtLevel ( const TemplateStructIntf s,
int  level,
int  maxLevel 
)
static

Definition at line 5859 of file context.cpp.

5860 {
5861  int num=0;
5862  if (level<maxLevel)
5863  {
5864  num++;
5865  TemplateVariant child = s->get("children");
5866  if (child.toList())
5867  {
5869  TemplateVariant v;
5870  for (it->toFirst();it->current(v);it->toNext())
5871  {
5872  num+=computeNumNodesAtLevel(v.toStruct(),level+1,maxLevel);
5873  }
5874  delete it;
5875  }
5876  }
5877  return num;
5878 }
virtual bool current(TemplateVariant &v) const =0
virtual TemplateVariant get(const char *name) const =0
TemplateListIntf * toList() const
Definition: template.h:256
static int computeNumNodesAtLevel(const TemplateStructIntf *s, int level, int maxLevel)
Definition: context.cpp:5859
Abstract interface for a iterator of a list.
Definition: template.h:333
virtual TemplateListIntf::ConstIterator * createIterator() const =0
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
TemplateStructIntf * toStruct() const
Definition: template.h:264
static int computePreferredDepth ( const TemplateListIntf list,
int  maxDepth 
)
static

Definition at line 5880 of file context.cpp.

5881 {
5882  int preferredNumEntries = Config_getInt("HTML_INDEX_NUM_ENTRIES");
5883  int preferredDepth=1;
5884  if (preferredNumEntries>0)
5885  {
5886  int depth = maxDepth;
5887  for (int i=1;i<=depth;i++)
5888  {
5889  int num=0;
5891  TemplateVariant v;
5892  for (it->toFirst();it->current(v);it->toNext())
5893  {
5894  num+=computeNumNodesAtLevel(v.toStruct(),0,i);
5895  }
5896  delete it;
5897  if (num<=preferredNumEntries)
5898  {
5899  preferredDepth=i;
5900  }
5901  else
5902  {
5903  break;
5904  }
5905  }
5906  }
5907  return preferredDepth;
5908 }
virtual bool current(TemplateVariant &v) const =0
#define Config_getInt(val)
Definition: config.cpp:661
static int computeNumNodesAtLevel(const TemplateStructIntf *s, int level, int maxLevel)
Definition: context.cpp:5859
Abstract interface for a iterator of a list.
Definition: template.h:333
virtual TemplateListIntf::ConstIterator * createIterator() const =0
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
TemplateStructIntf * toStruct() const
Definition: template.h:264
TemplateVariant createLinkedText ( Definition def,
const QCString relPath,
const QCString text 
)

Definition at line 3840 of file context.cpp.

3841 {
3842  QGString s;
3843  FTextStream ts(&s);
3845  if (tg)
3846  {
3847  linkifyText(*tg,def->getOuterScope(),def->getBodyDef(),def,text);
3848  delete tg;
3849  return TemplateVariant(s.data(),TRUE);
3850  }
3851  else
3852  {
3853  return text;
3854  }
3855 }
char * data() const
Definition: qgstring.h:42
FileDef * getBodyDef() const
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
TextGeneratorIntf * create(FTextStream &ts, const QCString &relPath)
Definition: context.cpp:3822
static TextGeneratorFactory * instance()
Definition: context.cpp:3816
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
virtual Definition * getOuterScope() const
void linkifyText(const TextGeneratorIntf &out, Definition *scope, FileDef *fileScope, Definition *self, const char *text, bool autoBreak, bool external, bool keepSpaces, int indentLevel)
Definition: util.cpp:1916
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
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
static TemplateVariant parseCode ( MemberDef md,
const QCString scopeName,
const QCString relPath,
const QCString code,
int  startLine = -1,
int  endLine = -1,
bool  showLineNumbers = FALSE 
)
static

Definition at line 1266 of file context.cpp.

1268 {
1270  pIntf->resetCodeParserState();
1271  QGString s;
1272  FTextStream t(&s);
1273  switch (g_globals.outputFormat)
1274  {
1276  {
1277  HtmlCodeGenerator codeGen(t,relPath);
1278  pIntf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
1279  startLine,endLine,TRUE,md,showLineNumbers,md);
1280  }
1281  break;
1283  {
1284  LatexCodeGenerator codeGen(t,relPath,md->docFile());
1285  pIntf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
1286  startLine,endLine,TRUE,md,showLineNumbers,md);
1287  }
1288  break;
1289  // TODO: support other generators
1290  default:
1291  err("context.cpp: output format not yet supported");
1292  break;
1293  }
1294  return TemplateVariant(s.data(),TRUE);
1295 }
QCString docFile() const
ParserInterface * getParser(const char *extension)
Definition: parserintf.h:191
char * data() const
Definition: qgstring.h:42
Abstract interface for programming language parsers.
Definition: parserintf.h:38
FileDef * getBodyDef() const
const bool FALSE
Definition: qglobal.h:370
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
QCString getDefFileExtension() const
static ParserManager * parserManager
Definition: doxygen.h:141
SrcLangExt getLanguage() const
void err(const char *fmt,...)
Definition: message.cpp:226
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
struct ContextGlobals g_globals
virtual void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)=0
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
virtual void resetCodeParserState()=0
static TemplateVariant parseCode ( FileDef fd,
const QCString relPath 
)
static

Definition at line 1297 of file context.cpp.

1298 {
1299  static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
1301  pIntf->resetCodeParserState();
1302  QGString s;
1303  FTextStream t(&s);
1304  switch (g_globals.outputFormat)
1305  {
1307  {
1308  HtmlCodeGenerator codeGen(t,relPath);
1309  pIntf->parseCode(codeGen,0,
1310  fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources
1311  fd->getLanguage(), // lang
1312  FALSE, // isExampleBlock
1313  0, // exampleName
1314  fd, // fileDef
1315  -1, // startLine
1316  -1, // endLine
1317  FALSE, // inlineFragment
1318  0, // memberDef
1319  TRUE, // showLineNumbers
1320  0, // searchCtx
1321  TRUE // collectXRefs, TODO: should become FALSE
1322  );
1323  }
1324  break;
1326  {
1327  LatexCodeGenerator codeGen(t,relPath,fd->docFile());
1328  pIntf->parseCode(codeGen,0,
1329  fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources
1330  fd->getLanguage(), // lang
1331  FALSE, // isExampleBlock
1332  0, // exampleName
1333  fd, // fileDef
1334  -1, // startLine
1335  -1, // endLine
1336  FALSE, // inlineFragment
1337  0, // memberDef
1338  TRUE, // showLineNumbers
1339  0, // searchCtx
1340  TRUE // collectXRefs, TODO: should become FALSE
1341  );
1342  }
1343  break;
1344  // TODO: support other generators
1345  default:
1346  err("context.cpp: output format not yet supported");
1347  break;
1348  }
1349  return TemplateVariant(s.data(),TRUE);
1350 }
QCString docFile() const
ParserInterface * getParser(const char *extension)
Definition: parserintf.h:191
QCString fileToString(const char *name, bool filter, bool isSourceCode)
Definition: util.cpp:2418
char * data() const
Definition: qgstring.h:42
Abstract interface for programming language parsers.
Definition: parserintf.h:38
const bool FALSE
Definition: qglobal.h:370
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
QCString getDefFileExtension() const
static ParserManager * parserManager
Definition: doxygen.h:141
SrcLangExt getLanguage() const
#define Config_getBool(val)
Definition: config.cpp:664
void err(const char *fmt,...)
Definition: message.cpp:226
QCString absFilePath() const
Definition: filedef.h:96
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
struct ContextGlobals g_globals
virtual void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)=0
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
virtual void resetCodeParserState()=0
static TemplateVariant parseDoc ( Definition def,
const QCString file,
int  line,
const QCString relPath,
const QCString docStr,
bool  isBrief 
)
static

Definition at line 1227 of file context.cpp.

1229 {
1231  DocRoot *root = validatingParseDoc(file,line,def,0,docStr,TRUE,FALSE,0,isBrief,FALSE);
1232  QGString docs;
1233  {
1234  FTextStream ts(&docs);
1235  switch (g_globals.outputFormat)
1236  {
1238  {
1239  HtmlCodeGenerator codeGen(ts,relPath);
1240  HtmlDocVisitor visitor(ts,codeGen,def);
1241  root->accept(&visitor);
1242  }
1243  break;
1245  {
1246  LatexCodeGenerator codeGen(ts,relPath,file);
1247  LatexDocVisitor visitor(ts,codeGen,def->getDefFileExtension(),FALSE);
1248  root->accept(&visitor);
1249  }
1250  break;
1251  // TODO: support other generators
1252  default:
1253  err("context.cpp: output format not yet supported");
1254  break;
1255  }
1256  }
1257  bool isEmpty = root->isEmpty();
1258  if (isEmpty)
1259  result = "";
1260  else
1261  result = TemplateVariant(docs,TRUE);
1262  delete root;
1263  return result;
1264 }
static QCString result
void accept(DocVisitor *v)
Definition: docparser.h:1405
Concrete visitor implementation for HTML output.
const bool FALSE
Definition: qglobal.h:370
DocRoot * validatingParseDoc(const char *fileName, int startLine, Definition *ctx, MemberDef *md, const char *input, bool indexWords, bool isExample, const char *exampleName, bool singleLine, bool linkFromIndex)
Definition: docparser.cpp:7179
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
Concrete visitor implementation for LaTeX output.
QCString getDefFileExtension() const
void err(const char *fmt,...)
Definition: message.cpp:226
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
void line(double t, double *p, double &x, double &y, double &z)
bool isEmpty() const
Definition: docparser.h:1409
struct ContextGlobals g_globals
const bool TRUE
Definition: qglobal.h:371

Variable Documentation

struct ContextGlobals g_globals