Grantlee  5.1.0
Public Member Functions | Protected Member Functions | List of all members
Grantlee::Node Class Referenceabstract

Base class for all nodes. More...

#include <grantlee/node.h>

Inheritance diagram for Grantlee::Node:
Inheritance graph

Public Member Functions

 Node (QObject *parent=0)
 ~Node () override
virtual void render (OutputStream *stream, Context *c) const =0
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent)
 QObject (QObject *parent, const char *name)
bool blockSignals (bool block)
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
const QObjectList & children () const
const char * className () const
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
void deleteLater ()
void destroyed (QObject *obj)
bool disconnect (const QObject *receiver, const char *method)
bool disconnect (const char *signal, const QObject *receiver, const char *method)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool event (QEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *event)
findChild (const QString &name) const
QList< T > findChildren (const QRegExp &regExp) const
QList< T > findChildren (const QString &name) const
bool inherits (const char *className) const
void insertChild (QObject *object)
void installEventFilter (QObject *filterObj)
bool isA (const char *className) const
bool isWidgetType () const
void killTimer (int id)
virtual const QMetaObjectmetaObject () const
void moveToThread (QThread *targetThread)
const char * name () const
const char * name (const char *defaultName) const
QString objectName () const
QObjectparent () const
QVariant property (const char *name) const
void removeChild (QObject *object)
void removeEventFilter (QObject *obj)
void setName (const char *name)
void setObjectName (const QString &name)
void setParent (QObject *parent)
bool setProperty (const char *name, const QVariant &value)
bool signalsBlocked () const
int startTimer (int interval)
QThreadthread () const

Protected Member Functions

TemplateImpl * containerTemplate () const
void streamValueInContext (OutputStream *stream, const QVariant &input, Grantlee::Context *c) const
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const char *signal)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *event)

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QString tr (const char *sourceText, const char *disambiguation, int n)
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
- Properties inherited from QObject

Detailed Description

The Node class can be implemented to make additional functionality available to Templates.

A node is represented in template markup as content surrounded by percent signed tokens.

text content
{% some_tag arg1 arg2 %}
text content
{% some_other_tag arg1 arg2 %}
text content
{% end_some_other_tag %}
text content

This is parsed into a tree of Node objects by an implementation of AbstractNodeFactory. The Node objects can then later be rendered by their render method.

Rendering a Node will usually mean writing some output to the stream. The content written to the stream could be determined by the arguments to the tag, or by the content of child nodes between a start and end tag, or both.

See also
Stephen Kelly

Definition at line 82 of file node.h.

Constructor & Destructor Documentation

Grantlee::Node::Node ( QObject parent = 0)


parentThe parent QObject
Grantlee::Node::~Node ( )


Member Function Documentation

TemplateImpl* Grantlee::Node::containerTemplate ( ) const

Returns a raw pointer to the Template this Node is in.

virtual void Grantlee::Node::render ( OutputStream stream,
Context c 
) const
pure virtual

Reimplement this to render the template in the Context c.

This will also involve calling render on and child nodes.

void Grantlee::Node::streamValueInContext ( OutputStream stream,
const QVariant input,
Grantlee::Context c 
) const

Renders the value input in the Context c. This will involve escaping input if necessary.

This is only relevant to developing template tags.