node: Neighbors |
Top Previous Next |
Scripts > Class elements and c++ instructions > Interpreted C++ instructions > node / dnode > node: Neighbors
By the following functions you can get nodes, which are in certain positions relatively to another node:
node root() const node parent() const
node firstChild() const node lastChild() const
node nextSibling() const node prevSibling() const node firstSibling() const node lastSibling() const
node bottomFirstChild() const node bottomLastChild() const
node next() const node follow() const node prev() const
If you know the names and relations of the nodes as explained in the glossary, the names of most of these functions are self-explanatory. Each function returns the neighbor node according the name of the function.
Example:
{{ node root("label_00", "value_00"); root.add("label_11", "value_11"); root.add("label_12", "value_12");
node pos = root.firstChild(); while(pos != node::npos) { out << "label: " << pos.label() << ", " << "value: " << pos.value() << endl; pos = pos.nextSibling(); } }}
results in:
label: label_11, value: value_11 label: label_12, value: value_12
After the execution of this assignment nChild is equal to the first child node of the node nParent. If nParent has no child, the following is valid
nChild == node::npos
Further explanation is needed for:
node bottomFirstChild() const
First child of the first child ...
node bottomLastChild() const
Bottom last child of the last child
node next() const node prev() const
next returns the next node in descending direction. prev teturns the next node in ascending direction.
node follow() const
follow returns the next node in descending direction, which follows on the last child node. This is either the nextSibling of the actual node or the nextSibling of the first of the parent nodes, which has a nextSibling or node::npos.
|
This page belongs to the TextTransformer Documentation |
Home Content German |