Grantlee: Grantlee::NodeList Class Reference

Grantlee 5.3.0

Public Member Functions | List of all members
Grantlee::NodeList Class Reference

A list of Nodes with some convenience API for rendering them. More...

`#include <grantlee/node.h>`

Inheritance diagram for Grantlee::NodeList:
[legend]

## Public Member Functions
| NodeList ()
| NodeList (const NodeList &list)
| NodeList (const QList< Grantlee::Node * > &list)
| ~NodeList ()
void | append (Grantlee::Node *node)
void | append (QList< Grantlee::Node * > nodeList)
bool | containsNonText () const
template<typename T >
QList< T > | findChildren ()
NodeList & | operator= (const NodeList &list)
void | render (OutputStream *stream, Context *c) const

## Detailed Description

Typically, tags which have an end tag will create and later render a list of child nodes.

This class contains API such as append and render to make creating such list easily.

The findChildren method behaves similarly to the QObject::findChildren method, returning a list of nodes of a particular type from the Node objects contained in the list (and their children).

See also
  Tags with end tags

Definition at line 152 of file node.h.

## Constructor & Destructor Documentation

## ◆ NodeList() [1/3]

Grantlee::NodeList::NodeList | ( |  | ) |

Creates an empty NodeList.

## ◆ NodeList() [2/3]

Grantlee::NodeList::NodeList | ( | const NodeList & | list | ) |

Copy constructor.

## ◆ NodeList() [3/3]

Grantlee::NodeList::NodeList | ( | const QList< Grantlee::Node * > & | list | ) |

Convenience constructor

## ◆ ~NodeList()

Grantlee::NodeList::~NodeList | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ append() [1/2]

void Grantlee::NodeList::append | ( | Grantlee::Node * | node | ) |

Appends `node` to the end of this NodeList.

## ◆ append() [2/2]

void Grantlee::NodeList::append | ( | QList< Grantlee::Node * > | nodeList | ) |

Appends `nodeList` to the end of this NodeList.

## ◆ containsNonText()

bool Grantlee::NodeList::containsNonText | ( |  | ) | const

Returns true if this NodeList contains non-text nodes.

## ◆ findChildren()

template<typename T >

QList< T > Grantlee::NodeList::findChildren | ( |  | ) |
| inline

A recursive listing of nodes in this tree of type `T`.

Definition at line 195 of file node.h.

## ◆ render()

void Grantlee::NodeList::render | ( | OutputStream * | stream,
|  | Context * | c
| ) |  | const

Renders the list of Nodes in the Context `c`.