Doxygen
TemplateNodeInclude类 参考

Class representing an 'include' tag in a template 更多...

+ 类 TemplateNodeInclude 继承关系图:
+ TemplateNodeInclude 的协作图:

Public 成员函数

 TemplateNodeInclude (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
void render (TextStream &ts, TemplateContext *c)
 
- Public 成员函数 继承自 TemplateNodeCreator< TemplateNodeInclude >
 TemplateNodeCreator (TemplateParser *parser, TemplateNode *parent, int line)
 
TemplateImplgetTemplate ()
 
- Public 成员函数 继承自 TemplateNode
 TemplateNode (TemplateNode *parent)
 
virtual ~TemplateNode ()
 
TemplateNodeparent ()
 

Private 属性

ExprAstPtr m_includeExpr
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 TemplateNodeCreator< TemplateNodeInclude >
static TemplateNodePtr createInstance (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
- Protected 成员函数 继承自 TemplateNodeCreator< TemplateNodeInclude >
void mkpath (const TemplateContextImpl *ci, const std::string &fileName)
 
- Protected 属性 继承自 TemplateNodeCreator< TemplateNodeInclude >
QCString m_templateName
 
int m_line
 

详细描述

Class representing an 'include' tag in a template

在文件 template.cpp3754 行定义.

构造及析构函数说明

◆ TemplateNodeInclude()

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

在文件 template.cpp3757 行定义.

3759  {
3760  TRACE(("TemplateNodeInclude(%s)\n",qPrint(data)));
3761  ExpressionParser ep(parser,line);
3762  if (data.isEmpty())
3763  {
3764  parser->warn(m_templateName,line,"include tag is missing template file argument");
3765  }
3766  m_includeExpr = ep.parse(data);
3767  }

引用了 QCString::isEmpty(), m_includeExpr, TemplateNodeCreator< TemplateNodeInclude >::m_templateName, ExpressionParser::parse(), qPrint(), TRACE , 以及 TemplateParser::warn().

成员函数说明

◆ render()

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

实现了 TemplateNode.

在文件 template.cpp3768 行定义.

3769  {
3770  TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c);
3771  if (ci==0) return; // should not happen
3773  if (m_includeExpr)
3774  {
3775  QCString includeFile = m_includeExpr->resolve(c).toString();
3776  if (includeFile.isEmpty())
3777  {
3778  ci->warn(m_templateName,m_line,"invalid parameter for include command\n");
3779  }
3780  else
3781  {
3782  TemplateImpl *t = getTemplate();
3783  if (t)
3784  {
3785  Template *it = t->engine()->loadByName(includeFile,m_line);
3786  TemplateImpl *incTemplate = it ? dynamic_cast<TemplateImpl*>(it) : 0;
3787  if (incTemplate)
3788  {
3789  incTemplate->render(ts,c);
3790  }
3791  else
3792  {
3793  ci->warn(m_templateName,m_line,"failed to load template '%s' for include",qPrint(includeFile));
3794  }
3795  t->engine()->unload(it);
3796  }
3797  }
3798  }
3799  }

引用了 TemplateImpl::engine(), TemplateNodeCreator< TemplateNodeInclude >::getTemplate(), QCString::isEmpty(), TemplateEngine::loadByName(), m_includeExpr, TemplateNodeCreator< TemplateNodeInclude >::m_line, TemplateNodeCreator< TemplateNodeInclude >::m_templateName, qPrint(), TemplateImpl::render(), TemplateContextImpl::setLocation(), TemplateEngine::unload() , 以及 TemplateContextImpl::warn().

类成员变量说明

◆ m_includeExpr

ExprAstPtr TemplateNodeInclude::m_includeExpr
private

在文件 template.cpp3802 行定义.

被这些函数引用 render() , 以及 TemplateNodeInclude().


该类的文档由以下文件生成:
TemplateContextImpl::warn
void warn(const QCString &fileName, int line, const char *fmt,...) const
Definition: template.cpp:2773
TemplateContextImpl::setLocation
void setLocation(const QCString &templateName, int line)
Definition: template.cpp:682
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
TemplateNodeCreator< TemplateNodeInclude >
TemplateEngine::loadByName
Template * loadByName(const QCString &fileName, int fromLine)
Creates a new template whose contents are in a file.
Definition: template.cpp:5381
Template
Abstract interface for a template.
Definition: template.h:475
TemplateNodeInclude::m_includeExpr
ExprAstPtr m_includeExpr
Definition: template.cpp:3802
TemplateImpl::engine
TemplateEngine * engine() const
Definition: template.cpp:2562
TemplateImpl
Internal class representing the implementation of a template
Definition: template.cpp:2554
ExpressionParser
Recursive decent parser for Django style template expressions.
Definition: template.cpp:2010
TemplateParser::warn
void warn(const QCString &fileName, int line, const char *fmt,...) const
Definition: template.cpp:5163
TRACE
#define TRACE(x)
Definition: template.cpp:40
TemplateNodeCreator< TemplateNodeInclude >::getTemplate
TemplateImpl * getTemplate()
Definition: template.cpp:3051
TemplateNodeCreator< TemplateNodeInclude >::m_templateName
QCString m_templateName
Definition: template.cpp:3095
TemplateNode::parent
TemplateNode * parent()
Definition: template.cpp:1941
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
TemplateContextImpl
Internal class representing the implementation of a template context
Definition: template.cpp:640
TemplateEngine::unload
void unload(Template *t)
Indicates that template t is no longer needed.
Definition: template.cpp:5386
TemplateNodeCreator< TemplateNodeInclude >::m_line
int m_line
Definition: template.cpp:3096
TemplateImpl::render
void render(TextStream &ts, TemplateContext *c)
Definition: template.cpp:5200
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108