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

Internal class representing the implementation of a template. More...

Inheritance diagram for TemplateImpl:
TemplateNode Template

Public Member Functions

 TemplateImpl (TemplateEngine *e, const QCString &name, const QCString &data, const QCString &extension)
 
 ~TemplateImpl ()
 
void render (FTextStream &ts, TemplateContext *c)
 
TemplateEngineengine () const
 
TemplateBlockContextblockContext ()
 
- Public Member Functions inherited from TemplateNode
 TemplateNode (TemplateNode *parent)
 
virtual ~TemplateNode ()
 
TemplateNodeparent ()
 
- Public Member Functions inherited from Template
virtual ~Template ()
 

Private Attributes

TemplateEnginem_engine
 
QCString m_name
 
TemplateNodeList m_nodes
 
TemplateBlockContext m_blockContext
 

Detailed Description

Internal class representing the implementation of a template.

Definition at line 2330 of file template.cpp.

Constructor & Destructor Documentation

TemplateImpl::TemplateImpl ( TemplateEngine e,
const QCString &  name,
const QCString &  data,
const QCString &  extension 
)

Definition at line 5008 of file template.cpp.

References engine(), m_engine, m_name, m_nodes, TemplateParser::parse(), TemplateLexer::setOpenCloseCharacters(), and TemplateLexer::tokenize().

{
TemplateLexer lexer(engine,name,data);
if (extension=="tex")
{
lexer.setOpenCloseCharacters('<','>');
}
QList<TemplateToken> tokens;
tokens.setAutoDelete(TRUE);
lexer.tokenize(tokens);
TemplateParser parser(engine,name,tokens);
parser.parse(this,1,QStrList(),m_nodes);
}
TemplateImpl::~TemplateImpl ( )

Definition at line 5026 of file template.cpp.

{
//printf("deleting template %s\n",m_name.data());
}

Member Function Documentation

TemplateBlockContext* TemplateImpl::blockContext ( )
inline

Definition at line 2339 of file template.cpp.

References m_blockContext.

{ return &m_blockContext; }
TemplateEngine* TemplateImpl::engine ( ) const
inline
void TemplateImpl::render ( FTextStream ts,
TemplateContext c 
)
virtual

Implements TemplateNode.

Definition at line 5031 of file template.cpp.

References TemplateBlockContext::add(), TemplateContextImpl::blockContext(), m_nodes, and TemplateNodeList::render().

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

{
TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c);
if (ci==0) return; // should not happen
if (!m_nodes.isEmpty())
{
TemplateNodeExtend *ne = dynamic_cast<TemplateNodeExtend*>(m_nodes.getFirst());
if (ne==0) // normal template, add blocks to block context
{
QListIterator<TemplateNode> li(m_nodes);
for (li.toFirst();(n=li.current());++li)
{
TemplateNodeBlock *nb = dynamic_cast<TemplateNodeBlock*>(n);
if (nb)
{
bc->add(nb);
}
}
}
m_nodes.render(ts,c);
}
}

Member Data Documentation

TemplateBlockContext TemplateImpl::m_blockContext
private

Definition at line 2345 of file template.cpp.

Referenced by blockContext().

TemplateEngine* TemplateImpl::m_engine
private

Definition at line 2342 of file template.cpp.

Referenced by engine(), and TemplateImpl().

QCString TemplateImpl::m_name
private

Definition at line 2343 of file template.cpp.

Referenced by TemplateImpl().

TemplateNodeList TemplateImpl::m_nodes
private

Definition at line 2344 of file template.cpp.

Referenced by render(), and TemplateImpl().


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