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

Class representing a variable in a template. More...

Inheritance diagram for TemplateNodeVariable:
TemplateNode

Public Member Functions

 TemplateNodeVariable (TemplateParser *parser, TemplateNode *parent, int line, const QCString &var)
 
 ~TemplateNodeVariable ()
 
void render (FTextStream &ts, TemplateContext *c)
 
- Public Member Functions inherited from TemplateNode
 TemplateNode (TemplateNode *parent)
 
virtual ~TemplateNode ()
 
TemplateNodeparent ()
 

Private Attributes

QCString m_templateName
 
int m_line
 
ExprAstm_var
 
QList< ExprAstm_args
 

Detailed Description

Class representing a variable in a template.

Definition at line 2734 of file template.cpp.

Constructor & Destructor Documentation

TemplateNodeVariable::TemplateNodeVariable ( TemplateParser parser,
TemplateNode parent,
int  line,
const QCString &  var 
)
inline

Definition at line 2737 of file template.cpp.

References m_templateName, m_var, ExpressionParser::parse(), TRACE, and TemplateParser::warn().

: TemplateNode(parent), m_templateName(parser->templateName()), m_line(line)
{
TRACE(("TemplateNodeVariable(%s)\n",var.data()));
ExpressionParser expParser(parser,line);
m_var = expParser.parse(var);
if (m_var==0)
{
parser->warn(m_templateName,line,"invalid expression '%s' for variable",var.data());
}
}
TemplateNodeVariable::~TemplateNodeVariable ( )
inline

Definition at line 2748 of file template.cpp.

References m_var.

{
delete m_var;
}

Member Function Documentation

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

Implements TemplateNode.

Definition at line 2753 of file template.cpp.

References TemplateVariant::call(), TemplateEscapeIntf::escape(), TemplateContextImpl::escapeIntf(), TemplateVariant::Function, m_line, m_templateName, m_var, TemplateContextImpl::needsRecoding(), TemplateVariant::raw(), TemplateContextImpl::recode(), ExprAst::resolve(), TemplateContextImpl::setLocation(), TemplateVariant::toString(), and TemplateVariant::type().

{
TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c);
if (ci==0) return; // should not happen
if (m_var)
{
{
v = v.call(QValueList<TemplateVariant>());
}
if (ci->escapeIntf() && !v.raw())
{
if (ci->needsRecoding())
{
ts << ci->recode(ci->escapeIntf()->escape(v.toString()));
}
else
{
ts << ci->escapeIntf()->escape(v.toString());
}
}
else
{
if (ci->needsRecoding())
{
ts << ci->recode(v.toString());
}
else
{
ts << v.toString();
}
}
}
}

Member Data Documentation

QList<ExprAst> TemplateNodeVariable::m_args
private

Definition at line 2794 of file template.cpp.

int TemplateNodeVariable::m_line
private

Definition at line 2792 of file template.cpp.

Referenced by render().

QCString TemplateNodeVariable::m_templateName
private

Definition at line 2791 of file template.cpp.

Referenced by render(), and TemplateNodeVariable().

ExprAst* TemplateNodeVariable::m_var
private

Definition at line 2793 of file template.cpp.

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


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