Doxygen
TemplateContext类 参考abstract

Abstract interface for a template context. 更多...

#include <template.h>

+ 类 TemplateContext 继承关系图:

Public 成员函数

virtual ~TemplateContext ()
 
virtual void push ()=0
 Push a new scope on the stack. 更多...
 
virtual void pop ()=0
 Pop the current scope from the stack. 更多...
 
virtual void set (const QCString &name, const TemplateVariant &v)=0
 Sets a value in the current scope. 更多...
 
virtual TemplateVariant get (const QCString &name) const =0
 Gets the value for a given key 更多...
 
virtual const TemplateVariantgetRef (const QCString &name) const =0
 Returns a pointer to the value corresponding to a given key. 更多...
 
virtual void setOutputDirectory (const QCString &dir)=0
 When files are created (i.e. 更多...
 
virtual void setEscapeIntf (const QCString &extension, std::unique_ptr< TemplateEscapeIntf > intf)=0
 Sets the interface that will be used for escaping the result of variable expansion before writing it to the output. 更多...
 
virtual void setSpacelessIntf (std::unique_ptr< TemplateSpacelessIntf > intf)=0
 Sets the interface that will be used inside a spaceless block to remove any redundant whitespace. 更多...
 

详细描述

Abstract interface for a template context.

A Context consists of a stack of dictionaries. A dictionary consists of a mapping of string keys onto TemplateVariant values. A key is searched starting with the dictionary at the top of the stack and searching downwards until it is found. The stack is used to create local scopes.

注解
This object must be created by TemplateEngine::createContext()

在文件 template.h422 行定义.

构造及析构函数说明

◆ ~TemplateContext()

virtual TemplateContext::~TemplateContext ( )
inlinevirtual

在文件 template.h425 行定义.

425 {}

成员函数说明

◆ get()

virtual TemplateVariant TemplateContext::get ( const QCString name) const
pure virtual

Gets the value for a given key

参数
[in]nameThe name of key.
返回
The value, which can be an invalid variant in case the key was not found.

TemplateContextImpl 内被实现.

被这些函数引用 ExprAstVariable::resolve().

◆ getRef()

virtual const TemplateVariant* TemplateContext::getRef ( const QCString name) const
pure virtual

Returns a pointer to the value corresponding to a given key.

参数
[in]nameThe name of key.
返回
A pointer to the value, or 0 in case the key was not found.

TemplateContextImpl 内被实现.

被这些函数引用 TemplateNodeRange::render() , 以及 TemplateNodeFor::render().

◆ pop()

virtual void TemplateContext::pop ( )
pure virtual

◆ push()

virtual void TemplateContext::push ( )
pure virtual

◆ set()

virtual void TemplateContext::set ( const QCString name,
const TemplateVariant v 
)
pure virtual

Sets a value in the current scope.

参数
[in]nameThe name of the value; the key in the dictionary.
[in]vThe value associated with the key.
注解
When a given key is already present, its value will be replaced by v

TemplateContextImpl 内被实现.

被这些函数引用 TemplateNodeRepeat::render(), TemplateNodeRange::render(), TemplateNodeFor::render(), TemplateNodeMarkers::render() , 以及 TemplateNodeTree::renderChildren().

◆ setEscapeIntf()

virtual void TemplateContext::setEscapeIntf ( const QCString extension,
std::unique_ptr< TemplateEscapeIntf intf 
)
pure virtual

Sets the interface that will be used for escaping the result of variable expansion before writing it to the output.

TemplateContextImpl 内被实现.

◆ setOutputDirectory()

virtual void TemplateContext::setOutputDirectory ( const QCString dir)
pure virtual

When files are created (i.e.

by {% create ... %}) they written to the directory dir.

TemplateContextImpl 内被实现.

◆ setSpacelessIntf()

virtual void TemplateContext::setSpacelessIntf ( std::unique_ptr< TemplateSpacelessIntf intf)
pure virtual

Sets the interface that will be used inside a spaceless block to remove any redundant whitespace.

TemplateContextImpl 内被实现.


该类的文档由以下文件生成: