Public Member Functions | List of all members
TemplateContext Class Referenceabstract

Abstract interface for a template context. More...

#include <template.h>

Inheritance diagram for TemplateContext:
TemplateContextImpl

Public Member Functions

virtual ~TemplateContext ()
 
virtual void push ()=0
 
virtual void pop ()=0
 
virtual void set (const char *name, const TemplateVariant &v)=0
 
virtual TemplateVariant get (const QCString &name) const =0
 
virtual const TemplateVariantgetRef (const QCString &name) const =0
 
virtual void setOutputDirectory (const QCString &dir)=0
 
virtual void setEscapeIntf (const QCString &extension, TemplateEscapeIntf *intf)=0
 
virtual void setSpacelessIntf (TemplateSpacelessIntf *intf)=0
 

Detailed Description

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.

Note
This object must be created by TemplateEngine::createContext()

Definition at line 489 of file template.h.

Constructor & Destructor Documentation

virtual TemplateContext::~TemplateContext ( )
inlinevirtual

Definition at line 492 of file template.h.

492 {}

Member Function Documentation

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

Gets the value for a given key

Parameters
[in]nameThe name of key.
Returns
The value, which can be an invalid variant in case the key was not found.

Implemented in TemplateContextImpl.

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

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

Parameters
[in]nameThe name of key.
Returns
A pointer to the value, or 0 in case the key was not found.

Implemented in TemplateContextImpl.

virtual void TemplateContext::pop ( )
pure virtual

Pop the current scope from the stack.

Implemented in TemplateContextImpl.

virtual void TemplateContext::push ( )
pure virtual

Push a new scope on the stack.

Implemented in TemplateContextImpl.

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

Sets a value in the current scope.

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

Implemented in TemplateContextImpl.

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

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

Implemented in TemplateContextImpl.

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

When files are created (i.e. by {% create ... %}) they written to the directory dir.

Implemented in TemplateContextImpl.

virtual void TemplateContext::setSpacelessIntf ( TemplateSpacelessIntf intf)
pure virtual

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

Implemented in TemplateContextImpl.


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