My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TemplateEngine Class Reference

Engine to create templates and template contexts. More...

#include <template.h>

Classes

class  Private
 Private data of the template engine. More...
 

Public Member Functions

 TemplateEngine ()
 
 ~TemplateEngine ()
 
TemplateContextcreateContext () const
 
void destroyContext (TemplateContext *ctx)
 
TemplateloadByName (const QCString &fileName, int fromLine)
 
void unload (Template *t)
 
void printIncludeContext (const char *fileName, int line) const
 
void setTemplateDir (const char *dirName)
 

Private Member Functions

void enterBlock (const QCString &fileName, const QCString &blockName, int line)
 
void leaveBlock ()
 
void setOutputExtension (const char *extension)
 
QCString outputExtension () const
 

Private Attributes

Privatep
 

Friends

class TemplateNodeBlock
 
class TemplateNodeCreate
 

Detailed Description

Engine to create templates and template contexts.

Definition at line 559 of file template.h.

Constructor & Destructor Documentation

TemplateEngine::TemplateEngine ( )

Create a template engine.

Definition at line 5194 of file template.cpp.

References p, and Private.

{
p = new Private(this);
}
TemplateEngine::~TemplateEngine ( )

Destroys the template engine.

Definition at line 5199 of file template.cpp.

References p.

{
delete p;
}

Member Function Documentation

TemplateContext * TemplateEngine::createContext ( ) const

Creates a new context that can be using to render a template.

See Also
Template::render()

Definition at line 5204 of file template.cpp.

Referenced by generateOutputViaTemplate().

{
return new TemplateContextImpl(this);
}
void TemplateEngine::destroyContext ( TemplateContext ctx)

Destroys a context created via createContext().

Parameters
[in]ctxThe context.

Definition at line 5209 of file template.cpp.

Referenced by generateOutputViaTemplate().

{
delete ctx;
}
void TemplateEngine::enterBlock ( const QCString &  fileName,
const QCString &  blockName,
int  line 
)
private

Definition at line 5224 of file template.cpp.

References TemplateEngine::Private::enterBlock(), and p.

Referenced by TemplateNodeBlock::render().

{
p->enterBlock(fileName,blockName,line);
}
void TemplateEngine::leaveBlock ( )
private

Definition at line 5229 of file template.cpp.

References TemplateEngine::Private::leaveBlock(), and p.

Referenced by TemplateNodeBlock::render().

{
}
Template * TemplateEngine::loadByName ( const QCString &  fileName,
int  fromLine 
)

Creates a new template whose contents are in a file.

Parameters
[in]fileNameThe name of the file containing the template data
[in]fromLineThe line number of the statement that triggered the load
Returns
the new template, the engine will keep ownership of the object.

Definition at line 5214 of file template.cpp.

References TemplateEngine::Private::loadByName(), and p.

Referenced by generateOutputViaTemplate(), TemplateNodeExtend::render(), TemplateNodeInclude::render(), and TemplateNodeCreate::render().

{
return p->loadByName(fileName,line);
}
QCString TemplateEngine::outputExtension ( ) const
private

Returns the output extension, set via setOutputExtension()

Definition at line 5244 of file template.cpp.

References TemplateEngine::Private::outputExtension(), and p.

{
return p->outputExtension();
}
void TemplateEngine::printIncludeContext ( const char *  fileName,
int  line 
) const

Prints the current template file include stack

Definition at line 5234 of file template.cpp.

References p, and TemplateEngine::Private::printIncludeContext().

Referenced by TemplateLexer::tokenize(), TemplateContextImpl::warn(), and TemplateParser::warn().

{
p->printIncludeContext(fileName,line);
}
void TemplateEngine::setOutputExtension ( const char *  extension)
private

Sets the extension of the output file. This is used to control the format of 'special' tags in the template

Definition at line 5239 of file template.cpp.

References p, and TemplateEngine::Private::setOutputExtension().

Referenced by TemplateNodeCreate::render().

{
p->setOutputExtension(extension);
}
void TemplateEngine::setTemplateDir ( const char *  dirName)

Sets the search directory where to look for template files

Definition at line 5249 of file template.cpp.

References p, and TemplateEngine::Private::setTemplateDir().

Referenced by generateOutputViaTemplate().

{
p->setTemplateDir(dirName);
}
void TemplateEngine::unload ( Template t)

Indicates that template t is no longer needed. The engine may decide to delete it.

Definition at line 5219 of file template.cpp.

References p, and TemplateEngine::Private::unload().

Referenced by generateOutputViaTemplate(), TemplateNodeExtend::render(), TemplateNodeInclude::render(), and TemplateNodeCreate::render().

{
p->unload(t);
}

Friends And Related Function Documentation

friend class TemplateNodeBlock
friend

Definition at line 597 of file template.h.

friend class TemplateNodeCreate
friend

Definition at line 598 of file template.h.

Member Data Documentation

Private* TemplateEngine::p
private

The documentation for this class was generated from the following files: