Home · Modules · Classes · Namespaces · Functions

QxtLinkedTree Class Reference
[QxtCore module]

The QxtLinkedTree class is a fast container for tree structured data More...

    #include <QxtLinkedTree>

Public Functions

Static Public Members


Detailed Description

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}


Member Function Documentation

QxtLinkedTree::QxtLinkedTree ()

constructs a QxtLinkedTree with a default constructed root node.

QxtLinkedTree::QxtLinkedTree ( T t )

constructs a QxtLinkedTree. sets the rootnode to t

QxtLinkedTree::~QxtLinkedTree ()

the destructor deletes all items, when they are no longer referenced by any other instance.

void QxtLinkedTree::clear ()

deletes all nodes recursively. this might take forever depending on the size of your tree.

QxtLinkedTreeIterator<T> QxtLinkedTree::fromVoid ( void * )   [static]

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!

QxtLinkedTreeIterator<T> QxtLinkedTree::root ()

returns an iterator on the root node

void * QxtLinkedTree::toVoid ( QxtLinkedTreeIterator<T> )   [static]


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1