#include <NTree.hpp>
Public Types | |
| typedef PrivateChildIterator< T > | ChildIterator |
| typedef PrivateIterator< T > | Iterator |
Public Member Functions | |
| void | appendChild (PrivateNode *node) throw () |
| Append a child at end of child list. | |
| template<typename Obj, typename Process> | |
| bool | applyOnChildrenData (const Obj &instance, const Process &method, bool applyInChildren) throw () |
| Apply a method on all sub nodes in from this node. | |
| template<typename Obj, typename Process> | |
| bool | applyOnChildrenDataLevel (const Obj &instance, const Process &method, const uint32 startLevel=0) throw () |
| Apply a method on all sub nodes in from this node. | |
| template<typename Obj, typename Process> | |
| bool | applyOnChildrenNode (const Obj &instance, const Process &method, bool applyInChildren) throw () |
| Apply a method on all sub nodes in from this node. | |
| PrivateNode * | childAtIndex (uint32 index) const throw () |
| Get the child at the given 0-based index. | |
| bool | deleteChildAtIndex (uint32 index) throw () |
| Delete the child at the given 0-based index. | |
| void | deleteChildren () throw () |
| Delete all children. | |
| template<typename Obj, typename Process> | |
| PrivateNode * | findChild (const Obj &instance, const Process &method, bool searchInChildren) const throw () |
| Find a child given the comparison object. | |
| const uint32 | findChildIndex (const T lookFor) const throw () |
| Find the child's index for the given data (data must support == operator). | |
| PrivateNode * | firstChild () const throw () |
| Get the first child. | |
| PrivateNode * | forgetChildAtIndex (uint32 index) throw () |
| Forget a child (this is long operation that mutate many children). | |
| Iterator | getAllIterator () const |
| Get an iterator that doesn't enter children. | |
| ChildIterator | getChildIterator (const uint32 startLevel=0) const |
| Get an iterator entering children. | |
| const uint32 | getChildrenCount () const throw () |
| Get the current children count. | |
| const T & | getData () const throw () |
| Get the node's internal data. | |
| T & | getData () throw () |
| Get the node's internal data. | |
| void | insertChildBefore (PrivateNode *node, uint32 index=0) throw () |
| Insert a child just before the given position. | |
| PrivateNode * | lastChild () const throw () |
| Get the last child in the list This method iterate over all child, so it is better if the result is cached. | |
| PrivateNode * | nextNode () const throw () |
| Get the next node at same level. | |
| PrivateNode * | parentNode () const throw () |
| Get the parent node. | |
| PrivateNode (const T &_data, PrivateNode *root=0, const DeleterObject< T > &xDO=getDefaultDeleterInstance()) | |
| Constructor. | |
| void | Suicide () |
| Allow deletion using our own deleter. | |
| ~PrivateNode () | |
| Destructor. | |
Friends | |
| class | NTree< T > |
| class | PrivateChildIterator< T > |
| class | PrivateIterator< T > |
| typedef PrivateChildIterator<T> Tree::PrivateNode< T >::ChildIterator |
| typedef PrivateIterator<T> Tree::PrivateNode< T >::Iterator |
| Tree::PrivateNode< T >::PrivateNode | ( | const T & | _data, | |
| PrivateNode< T > * | root = 0, |
|||
| const DeleterObject< T > & | xDO = getDefaultDeleterInstance() | |||
| ) | [inline] |
Constructor.
| Tree::PrivateNode< T >::~PrivateNode | ( | ) | [inline] |
Destructor.
| void Tree::PrivateNode< T >::appendChild | ( | PrivateNode< T > * | node | ) | throw () [inline] |
| bool Tree::PrivateNode< T >::applyOnChildrenData | ( | const Obj & | instance, | |
| const Process & | method, | |||
| bool | applyInChildren | |||
| ) | throw () [inline] |
Apply a method on all sub nodes in from this node.
| instance | The instance of the function object to apply | |
| method | The method of the function object to call. This method mustn't throw and return 0 on error. Its signature must be int (T ). | |
| applyInChildren | Does the function should go inside children too ? |
// If you have struct A { int DoSomeWork(T & node); }; // You can call the findChild like this A a; rootNode->applyOnChildrenData(a, &A::DoSomeWork, true);
| bool Tree::PrivateNode< T >::applyOnChildrenDataLevel | ( | const Obj & | instance, | |
| const Process & | method, | |||
| const uint32 | startLevel = 0 | |||
| ) | throw () [inline] |
Apply a method on all sub nodes in from this node.
| instance | The instance of the function object to apply | |
| method | The method of the function object to call. This method mustn't throw and return 0 on error. Its signature must be int (T, int). | |
| startLevel | The offset to add to the level number while calling the method |
// If you have struct A { int DoSomeWork(T & node, int Level); }; // You can call the findChild like this A a; rootNode->applyOnChildrenDataLevel(a, &A::DoSomeWork);
| bool Tree::PrivateNode< T >::applyOnChildrenNode | ( | const Obj & | instance, | |
| const Process & | method, | |||
| bool | applyInChildren | |||
| ) | throw () [inline] |
Apply a method on all sub nodes in from this node.
| instance | The instance of the function object to apply | |
| method | The method of the function object to call. This method mustn't throw and return 0 on error. Its signature must be int (const PrivateNode *). | |
| applyInChildren | Does the function should go inside children too ? |
// If you have struct A { int DoSomeWork(const Tree::NTree<Type>::PrivateNode * node); }; // You can call the findChild like this A a; rootNode->applyOnChildrenNode(a, &A::DoSomeWork, true);
| PrivateNode* Tree::PrivateNode< T >::childAtIndex | ( | uint32 | index | ) | const throw () [inline] |
Get the child at the given 0-based index.
| index | the child's index |
| bool Tree::PrivateNode< T >::deleteChildAtIndex | ( | uint32 | index | ) | throw () [inline] |
Delete the child at the given 0-based index.
| index | the child's index |
| void Tree::PrivateNode< T >::deleteChildren | ( | ) | throw () [inline] |
Delete all children.
| PrivateNode* Tree::PrivateNode< T >::findChild | ( | const Obj & | instance, | |
| const Process & | method, | |||
| bool | searchInChildren | |||
| ) | const throw () [inline] |
Find a child given the comparison object.
| instance | The instance of the comparison object to apply | |
| method | The method of the comparison object to call. This method must return 1 if found, 0 otherwise. Its signature must be "int (const T &)". | |
| searchInChildren | Does the search should go inside children too ? |
// If you have struct A { int TestIfOk(const Type & data); }; // You can call the findChild like this A a; Tree::NTree<Type>::PrivateNode * node = rootNode->findChild(a, &A::TestIfOk, true);
| const uint32 Tree::PrivateNode< T >::findChildIndex | ( | const T | lookFor | ) | const throw () [inline] |
Find the child's index for the given data (data must support == operator).
| lookFor | the data to search |
| PrivateNode* Tree::PrivateNode< T >::firstChild | ( | ) | const throw () [inline] |
Get the first child.
| PrivateNode* Tree::PrivateNode< T >::forgetChildAtIndex | ( | uint32 | index | ) | throw () [inline] |
Forget a child (this is long operation that mutate many children).
| index | the child index to forget // If the child list is like A B C D E F G // And forget child is called like node->forgetChildAtIndex(2); // Then the output child list will be A B D E F G |
| Iterator Tree::PrivateNode< T >::getAllIterator | ( | ) | const [inline] |
Get an iterator that doesn't enter children.
| ChildIterator Tree::PrivateNode< T >::getChildIterator | ( | const uint32 | startLevel = 0 |
) | const [inline] |
Get an iterator entering children.
| const uint32 Tree::PrivateNode< T >::getChildrenCount | ( | ) | const throw () [inline] |
Get the current children count.
| const T& Tree::PrivateNode< T >::getData | ( | ) | const throw () [inline] |
| T& Tree::PrivateNode< T >::getData | ( | ) | throw () [inline] |
| void Tree::PrivateNode< T >::insertChildBefore | ( | PrivateNode< T > * | node, | |
| uint32 | index = 0 | |||
| ) | throw () [inline] |
Insert a child just before the given position.
| index | the index to insert before (if not present, insert at first) | |
| node | the PrivateNode to add |
| PrivateNode* Tree::PrivateNode< T >::lastChild | ( | ) | const throw () [inline] |
Get the last child in the list This method iterate over all child, so it is better if the result is cached.
| PrivateNode* Tree::PrivateNode< T >::nextNode | ( | ) | const throw () [inline] |
Get the next node at same level.
| PrivateNode* Tree::PrivateNode< T >::parentNode | ( | ) | const throw () [inline] |
Get the parent node.
| void Tree::PrivateNode< T >::Suicide | ( | ) | [inline] |
Allow deletion using our own deleter.
friend class NTree< T > [friend] |
friend class PrivateChildIterator< T > [friend] |
friend class PrivateIterator< T > [friend] |
