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

Class representing an 'include' tag in a template. More...

Inheritance diagram for TemplateNodeInclude:
TemplateNodeCreator< TemplateNodeInclude > TemplateNode

Public Member Functions

 TemplateNodeInclude (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
 ~TemplateNodeInclude ()
 
void render (FTextStream &ts, TemplateContext *c)
 
- Public Member Functions inherited from TemplateNodeCreator< TemplateNodeInclude >
 TemplateNodeCreator (TemplateParser *parser, TemplateNode *parent, int line)
 
TemplateImplgetTemplate ()
 
- Public Member Functions inherited from TemplateNode
 TemplateNode (TemplateNode *parent)
 
virtual ~TemplateNode ()
 
TemplateNodeparent ()
 

Private Attributes

ExprAstm_includeExpr
 

Additional Inherited Members

- Static Public Member Functions inherited from TemplateNodeCreator< TemplateNodeInclude >
static TemplateNodecreateInstance (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
- Protected Member Functions inherited from TemplateNodeCreator< TemplateNodeInclude >
void mkpath (TemplateContextImpl *ci, const QCString &fileName)
 
- Protected Attributes inherited from TemplateNodeCreator< TemplateNodeInclude >
QCString m_templateName
 
int m_line
 

Detailed Description

Class representing an 'include' tag in a template.

Definition at line 3542 of file template.cpp.

Constructor & Destructor Documentation

TemplateNodeInclude::TemplateNodeInclude ( TemplateParser parser,
TemplateNode parent,
int  line,
const QCString &  data 
)
inline

Definition at line 3545 of file template.cpp.

References m_includeExpr, TemplateNodeCreator< TemplateNodeInclude >::m_templateName, ExpressionParser::parse(), TRACE, and TemplateParser::warn().

{
TRACE(("TemplateNodeInclude(%s)\n",data.data()));
ExpressionParser ep(parser,line);
if (data.isEmpty())
{
parser->warn(m_templateName,line,"include tag is missing template file argument");
}
m_includeExpr = ep.parse(data);
}
TemplateNodeInclude::~TemplateNodeInclude ( )
inline

Definition at line 3556 of file template.cpp.

References m_includeExpr.

{
delete m_includeExpr;
}

Member Function Documentation

void TemplateNodeInclude::render ( FTextStream ts,
TemplateContext c 
)
inlinevirtual

Implements TemplateNode.

Definition at line 3560 of file template.cpp.

References TemplateImpl::engine(), TemplateNodeCreator< TemplateNodeInclude >::getTemplate(), TemplateEngine::loadByName(), m_includeExpr, TemplateNodeCreator< TemplateNodeInclude >::m_line, TemplateNodeCreator< TemplateNodeInclude >::m_templateName, TemplateImpl::render(), ExprAst::resolve(), TemplateContextImpl::setLocation(), TemplateVariant::toString(), TemplateEngine::unload(), and TemplateContextImpl::warn().

{
TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c);
if (ci==0) return; // should not happen
{
QCString includeFile = m_includeExpr->resolve(c).toString();
if (includeFile.isEmpty())
{
ci->warn(m_templateName,m_line,"invalid parameter for include command\n");
}
else
{
if (t)
{
Template *it = t->engine()->loadByName(includeFile,m_line);
TemplateImpl *incTemplate = it ? dynamic_cast<TemplateImpl*>(it) : 0;
if (incTemplate)
{
incTemplate->render(ts,c);
t->engine()->unload(t);
}
else
{
ci->warn(m_templateName,m_line,"failed to load template '%s' for include",includeFile.data()?includeFile.data():"");
}
}
}
}
}

Member Data Documentation

ExprAst* TemplateNodeInclude::m_includeExpr
private

Definition at line 3594 of file template.cpp.

Referenced by render(), TemplateNodeInclude(), and ~TemplateNodeInclude().


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