![]() |
Home · Modules · Classes · Namespaces · Functions |
The QxtLinkedTree class is a fast container for tree structured data More...
#include <QxtLinkedTree>
The QxtLinkedTree class is a fast container for tree structured data
this template class can be used to store data easily in a tree structure. Internally it uses the doublelinked list scheme, but adds client/parent links.
There are no random access functions, you have to use QxtLinkedTree::iterator to access the data. This is very fast and efficient.
QxtLinkedTree<int> tree(1);
QxtLinkedTreeIterator<int> it= tree.root();
it.append(34);
qDebug()<<it<<it.child(); //returns "1 34"
In order to be able to store an iterator into other data structures (eg. for QAbstractItemModel or QAbstractXmlNodeModel) functions are provided to create and store a linked item from and into a void pointer.
void * root= tree.toVoid(tree.root()); QxtLinkedTreeIterator<int> it= tree.fromVoid(root);
TODO: {implicitshared}
constructs a QxtLinkedTree with a default constructed root node.
constructs a QxtLinkedTree. sets the rootnode to t
the destructor deletes all items, when they are no longer referenced by any other instance.
deletes all nodes recursively. this might take forever depending on the size of your tree.
returns an iterator pre positioned on the item specified with toVoid. passing anything that has not being created by toVoid() will crash. also note that passing invalidated nodes will crash too. Be extremly carefull. It is easy to currupt your data with this!
returns an iterator on the root node
Copyright © 2007-2011 Qxt Foundation |
Qxt 0.6.2 |