node: Searching

Top  Previous  Next

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

 

Starting from a node other nodes with certain data can be searched:

 

node                findNextLabel(const str& xsLabel) const

node                findNextLabel(const str& xsLabel, const node& xnLast) const

node                findNextValue(const str& xsValue) const

node                findNextValue(const str& xsValue, const node& xnLast) const

node                findPrevLabel(const str& xsLabel) const

node                findPrevLabel(const str& xsLabel, const node& xnLast) const

node                  findPrevValue(const str& xsValue) const

node                  findPrevValue(const str& xsValue, const node& xnLast) const

node                findChildLabel(const str& xsLabel)

node                findChildValue(const str& xsValue)

node                findParentLabel(const str& xsLabel)

node                findParentValue(const str& xsValue)

 

Under reservation of future change:

node                findNextId(unsigned int xuiId) const

node                findNextId(unsigned int xuiId, const node& xnLast) const

node                findPrevId(unsigned int xuiId) const

node                findPrevId(unsigned int xuiId, const node& xnLast) const

 

 

node findNextLabel(const str& xsLabel) const

node findNextLabel(const str& xsLabel, const node& xnLast) const

 

Returns the next node in descending direction, of which the label is equal to the passed string xsLabel. If no such node exists, the function returns node::npos.

With the second optional parameter xnLast a tree node can be chosen at which the search is finished.

 

Example:

 

node pos = xn.findNextLabel( "parameter" );

 

while( pos != node::npos )

{

  out << "parameter: "  << pos.value() << endl;

  pos = pos.findNextLabel( "parameter" );

}

This function outputs all parameters of all possible parameter lists which follow on xn.

If only the parameters of a current list shall be written, the code can be changed to:

 

node last = xn.bottomLastChild();

node pos = xn.findNextLabel( "parameter" , last);

 

while( pos != node::npos )

{

  out << "parameter: "  << pos.value() << endl;

  pos = pos.findNextLabel( "parameter", last );

}

 

 

node findNextValue(const str& xsValue) const

node findNextValue(const str& xsValue, const node& xnLast) const

 

Returns the next node in descending direction, of which the value is equal to the passed string xsValue. If no such node exists, the function returns node::npos.

With the second optional parameter xnLast a tree node can be chosen at which the search is finished.

 

node findPrevLabel(const str& xsLabel) const

node findPrevLabel(const str& xsLabel, const node& xnLast) const

 

Returns the next node in ascending direction, of which the label is equal to the passed string xsLabel. If no such node exists, the function returns node::npos.

With the second optional parameter xnLast a tree node can be chosen at which the search is finished.

 

node findPrevValue(const str& xsValue) const

node findPrevValue(const str& xsValue, const node& xnLast) const

 

Returns the next node in ascending direction, of which the value is equal to the passed string xsValue. If no such node exists, the function returns node::npos.

With the second optional parameter xnLast a tree node can be chosen at which the search is finished.

node findChildLabel(const str& xsLabel)

 

Looks for the next node in the set of the child and child child nodes, the label which of is xsLabel. If such a node exists it is returned, otherwise node::npos is returned.

 

node findChildValue(const str& xsValue)

 

Looks for the next node in the set of the child and child child nodes, the value which of is xsValue. If such a node exists it is returned, otherwise node::npos is returned.

 

node findParentLabel(const str& xsLabel)

 

Looks for the next node in the set of parent nodes, the label which of is xsLabel. If such a node exists it is returned, otherwise node::npos is returned.

 

node findParentValue(const str& xsValue)

 

Looks for the next node in the set of parent nodes, the value which of is xsValue. If such a node exists it is returned, otherwise node::npos is returned.



This page belongs to the TextTransformer Documentation

Home  Content  German