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 2262 of file template.cpp.

Constructor & Destructor Documentation

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

Definition at line 4786 of file template.cpp.

4788  : TemplateNode(0)
4789 {
4790  m_name = name;
4791  m_engine = engine;
4792  TemplateLexer lexer(engine,name,data);
4793  if (extension=="tex")
4794  {
4795  lexer.setOpenCloseCharacters('<','>');
4796  }
4797  QList<TemplateToken> tokens;
4798  tokens.setAutoDelete(TRUE);
4799  lexer.tokenize(tokens);
4800  TemplateParser parser(engine,name,tokens);
4801  parser.parse(this,1,QStrList(),m_nodes);
4802 }
static QCString name
Definition: declinfo.cpp:673
QCString m_name
Definition: template.cpp:2275
TemplateNode(TemplateNode *parent)
Definition: template.cpp:1642
TemplateEngine * m_engine
Definition: template.cpp:2274
Parser for templates.
Definition: template.cpp:1656
TemplateEngine * engine() const
Definition: template.cpp:2270
Lexer class for turning a template into a list of tokens.
Definition: template.cpp:4415
TemplateNodeList m_nodes
Definition: template.cpp:2276
void setAutoDelete(bool enable)
Definition: qlist.h:99
const bool TRUE
Definition: qglobal.h:371
TemplateImpl::~TemplateImpl ( )

Definition at line 4804 of file template.cpp.

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

Member Function Documentation

TemplateBlockContext* TemplateImpl::blockContext ( )
inline

Definition at line 2271 of file template.cpp.

2271 { return &m_blockContext; }
TemplateBlockContext m_blockContext
Definition: template.cpp:2277
TemplateEngine* TemplateImpl::engine ( ) const
inline

Definition at line 2270 of file template.cpp.

2270 { return m_engine; }
TemplateEngine * m_engine
Definition: template.cpp:2274
void TemplateImpl::render ( FTextStream ts,
TemplateContext c 
)
virtual

Implements TemplateNode.

Definition at line 4809 of file template.cpp.

4810 {
4811  TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c);
4812  if (ci==0) return; // should not happen
4813  if (!m_nodes.isEmpty())
4814  {
4815  TemplateNodeExtend *ne = dynamic_cast<TemplateNodeExtend*>(m_nodes.getFirst());
4816  if (ne==0) // normal template, add blocks to block context
4817  {
4818  TemplateBlockContext *bc = ci->blockContext();
4820  TemplateNode *n;
4821  for (li.toFirst();(n=li.current());++li)
4822  {
4823  TemplateNodeBlock *nb = dynamic_cast<TemplateNodeBlock*>(n);
4824  if (nb)
4825  {
4826  bc->add(nb);
4827  }
4828  }
4829  }
4830  m_nodes.render(ts,c);
4831  }
4832 }
void render(FTextStream &ts, TemplateContext *c)
Definition: template.cpp:2246
static constexpr double nb
Definition: Units.h:81
Internal class representing the implementation of a template context.
Definition: template.cpp:511
Class representing a &#39;block&#39; tag in a template.
Definition: template.cpp:3241
Class representing a &#39;extend&#39; tag in a template.
Definition: template.cpp:3319
bool isEmpty() const
Definition: qlist.h:67
std::void_t< T > n
TemplateBlockContext * blockContext()
Definition: template.cpp:2426
type * getFirst() const
Definition: qlist.h:95
Class holding stacks of blocks available in the context.
Definition: template.cpp:486
void add(TemplateNodeBlock *block)
Definition: template.cpp:4369
Base class of all nodes in a template&#39;s AST.
Definition: template.cpp:1639
TemplateNodeList m_nodes
Definition: template.cpp:2276

Member Data Documentation

TemplateBlockContext TemplateImpl::m_blockContext
private

Definition at line 2277 of file template.cpp.

TemplateEngine* TemplateImpl::m_engine
private

Definition at line 2274 of file template.cpp.

QCString TemplateImpl::m_name
private

Definition at line 2275 of file template.cpp.

TemplateNodeList TemplateImpl::m_nodes
private

Definition at line 2276 of file template.cpp.


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