Grantlee  5.1.0
Classes | Enumerations | Functions
Grantlee Namespace Reference

The Grantlee namespace holds all public Grantlee API.


class  AbstractLocalizer
 Interface for implementing an internationalization system. More...
class  AbstractMarkupBuilder
 The AbstractMarkupBuilder class serves as a base class for creating marked up plain text output. More...
class  AbstractNodeFactory
 Base class for all NodeFactories. More...
class  AbstractTemplateLoader
 An retrieval interface to a storage location for Template objects. More...
class  BBCodeBuilder
 Builder to create BBCode from a QTextDocument. More...
class  CachingLoaderDecorator
 Implements a loader decorator which caches compiled Template objects. More...
class  Context
 The Context class holds the context to render a template with. More...
class  Engine
 Grantlee::Engine is the main entry point for creating Grantlee Templates. More...
class  Exception
 An exception for use when implementing template tags. More...
class  FileSystemTemplateLoader
 The FileSystemTemplateLoader loads Templates from the file system. More...
class  Filter
 Base class for all filters. More...
class  FilterExpression
 A FilterExpression object represents a filter expression in a template. More...
class  InMemoryTemplateLoader
 The InMemoryTemplateLoader loads Templates set dynamically in memory. More...
class  MarkupDirector
 The MarkupDirector class controls and instructs a builder object to create markup output. More...
class  MediaWikiMarkupBuilder
 Creates MediaWiki markup from a QTextDocument. More...
class  Node
 Base class for all nodes. More...
class  NodeList
 A list of Nodes with some convenience API for rendering them. More...
class  OutputStream
 The OutputStream class is used to render templates to a QTextStream. More...
class  Parser
 The Parser class processes a string template into a tree of nodes. More...
class  PlainTextMarkupBuilder
 The PlainTextHTMLMarkupBuilder creates a simple marked up plain text document. More...
class  QtLocalizer
 Provides internationalization based on QLocale and QTranslator. More...
class  RenderContext
 Provides storage facility for state while rendering a template. More...
class  SafeString
 A QString wrapper class for containing whether a string is safe or needs to be escaped. More...
class  TagLibraryInterface
 The TagLibraryInterface returns available tags and filters from libraries. More...
class  Template
 The Template class is a tree of nodes which may be rendered. More...
class  TextHTMLBuilder
 The TextHTMLBuilder creates a clean html markup output. More...
struct  Token
class  Variable
 A container for static variables defined in Templates. More...


enum  Error {
  NoError, EmptyVariableError, EmptyBlockTagError, InvalidBlockTagError,
  UnclosedBlockTagError, UnknownFilterError, TagSyntaxError, VariableNotInContext,
  ObjectReturnTypeInvalid, CompileFunctionError
enum  TokenType { TextToken, VariableToken, BlockToken, CommentToken }


bool equals (const QVariant &lhs, const QVariant &rhs)
Grantlee::SafeString getSafeString (const QVariant &input)
bool isSafeString (const QVariant &input)
Grantlee::SafeString markForEscaping (const Grantlee::SafeString &input)
Grantlee::SafeString markSafe (const Grantlee::SafeString &input)
template<typename RealType , typename HandleAs >
int registerMetaType ()
 Registers the type RealType with the metatype system. More...
bool supportedOutputType (const QVariant &input)
QString unescapeStringLiteral (const QString &input)
bool variantIsTrue (const QVariant &variant)

Enumeration Type Documentation

Types of errors that can occur while using Grantlee

Definition at line 36 of file exception.h.

The available token types.


The Token is a text fragment.


The Token is a variable node.


The Token is a block, ie, part of a tag.


The Token is a comment node.

Definition at line 34 of file token.h.

Function Documentation

bool Grantlee::equals ( const QVariant lhs,
const QVariant rhs 

Compares lhs and rhs for equality. SafeStrings are compared as raw QStrings. Their safeness is not part of the comparison.

See also
Grantlee::SafeString Grantlee::getSafeString ( const QVariant input)

Retrieves and returns a SafeString from the input.

bool Grantlee::isSafeString ( const QVariant input)

Returns whether input contains a SafeString.

Grantlee::SafeString Grantlee::markForEscaping ( const Grantlee::SafeString input)

Marks the input as requiring escaping.

Grantlee::SafeString Grantlee::markSafe ( const Grantlee::SafeString input)

Marks the input as safe.

template<typename RealType , typename HandleAs >
int Grantlee::registerMetaType ( )

This method can take a second template parameter to specify a cast that should be invoked during registration. This is useful if a base type is already supported.

class SomeType
QString someProp() const;
// define some introspectable API for SomeType
if (property == "someProp")
return object.someProp();
class OtherType : public SomeType
// ...
// Only the introspectable API from SomeType is needed, so we can reuse that
registerMetaType<OtherType, SomeType>();
See also
Generic type and template support

Definition at line 184 of file metatype.h.

bool Grantlee::supportedOutputType ( const QVariant input)

Returns true if the type of input can be inserted into a rendered template directly. Not that lists, hashes and QObject*s can not be.

QString Grantlee::unescapeStringLiteral ( const QString input)

Converts the input into its unescaped form.

Double slashes are converted to single slashes, \&quot is converted to &quot etc.

bool Grantlee::variantIsTrue ( const QVariant variant)

Returns whether the variant is evaluated to true.

See also