FactDev
0.1
|
#include <mustache.h>
Public Types | |
typedef QString(* | fn_t )(const QString &, Mustache::Renderer *, Mustache::Context *) |
Public Member Functions | |
QtVariantContext (const QVariant &root, PartialResolver *resolver=0) | |
virtual QString | stringValue (const QString &key) const |
virtual bool | isFalse (const QString &key) const |
virtual int | listCount (const QString &key) const |
virtual void | push (const QString &key, int index=-1) |
virtual void | pop () |
virtual bool | canEval (const QString &key) const |
virtual QString | eval (const QString &key, const QString &_template, Mustache::Renderer *renderer) |
Public Member Functions inherited from Mustache::Context | |
Context (PartialResolver *resolver=0) | |
QString | partialValue (const QString &key) const |
PartialResolver * | partialResolver () const |
A context implementation which wraps a QVariantHash or QVariantMap.
typedef QString(* Mustache::QtVariantContext::fn_t)(const QString &, Mustache::Renderer *, Mustache::Context *) |
Construct a QtVariantContext which wraps a dictionary in a QVariantHash or a QVariantMap.
|
virtual |
Returns true if eval() should be used to render section tags using key
. If canEval() returns true for a key, the renderer will pass the literal, unrendered block of text for the section to eval() and replace the section with the result.
canEval() and eval() are equivalents for callable objects (eg. lambdas) in other Mustache implementations.
The default implementation always returns false.
Reimplemented from Mustache::Context.
Reimplemented in CounterContext, and CounterContext.
|
virtual |
Callback used to render a template section with the given key
. renderer
will substitute the original section tag with the result of eval().
The default implementation returns an empty string.
Reimplemented from Mustache::Context.
Reimplemented in CounterContext, and CounterContext.
|
virtual |
Returns true if the value for key
is 'false' or an empty list. 'False' values typically include empty strings, the boolean value false etc.
When processing a section Mustache tag, the section is not rendered if the key is false, or for an inverted section tag, the section is only rendered if the key is false.
Implements Mustache::Context.
|
virtual |
Returns the number of items in the list value for key
or 0 if the value for key
is not a list.
Implements Mustache::Context.
|
virtual |
Exit the current context.
Implements Mustache::Context.
|
virtual |
Set the current context to the value for key
. If index is >= 0, set the current context to the index'th
value in the list value for key
.
Implements Mustache::Context.
|
virtual |
Returns a string representation of the value for key
in the current context. This is used to replace a Mustache value tag.
Implements Mustache::Context.
Reimplemented in CounterContext, and CounterContext.