node::npos

Top  Previous  Next

Scripts > Class elements and c++ instructions > Interpreted C++ instructions > node / dnode > node::npos

 

A special node is: node::npos. It is similar to str::npos or to a NULL-pointer in c++. All functions, which return a node object, will return node::npos, if the node doesn't exist. For example a just created node will neither have child nodes nor a parent:

 

node nNew;

node nPos = nNew.firstChild();

// now is: nPos == node::npos

 

Before you do something with a node, which is the result of a neighbor- or search-function, you should always compare it first with node::npos:

 

if(nPos != node::npos)

{

// do something with nPos

}

else

// do nothing with nPos

 

All node functions, which return a different node, applied to node::npos, will return node::npos again. node::npos cannot be inserted into a tree.

 



This page belongs to the TextTransformer Documentation

Home  Content  German