<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /builddir/build/BUILD/libqxt/src/core/qxtlinkedtree.cpp --> <head> <title>QxtLinkedTree Class Reference</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="classes.html"><font color="#004faf">Classes</font></a> · <a href="namespaces.html"><font color="#004faf">Namespaces</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtLinkedTree Class Reference<br /><span class="small-subtitle">[<a href="qxtcore.html">QxtCore</a> module]</span> </h1> <p>The QxtLinkedTree class is a fast container for tree structured data <a href="#details">More...</a></p> <pre> #include <QxtLinkedTree></pre><ul> <li><a href="qxtlinkedtree-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"></div><b><a href="qxtlinkedtree.html#QxtLinkedTree">QxtLinkedTree</a></b> ()</li> <li><div class="fn"></div><b><a href="qxtlinkedtree.html#QxtLinkedTree-2">QxtLinkedTree</a></b> ( T <i>t</i> )</li> <li><div class="fn"></div><b><a href="qxtlinkedtree.html#dtor.QxtLinkedTree">~QxtLinkedTree</a></b> ()</li> <li><div class="fn"></div>void <b><a href="qxtlinkedtree.html#clear">clear</a></b> ()</li> <li><div class="fn"></div>QxtLinkedTreeIterator<T> <b><a href="qxtlinkedtree.html#root">root</a></b> ()</li> </ul> <a name="static-public-members"></a> <h3>Static Public Members</h3> <ul> <li><div class="fn"></div>QxtLinkedTreeIterator<T> <b><a href="qxtlinkedtree.html#fromVoid">fromVoid</a></b> ( void * )</li> <li><div class="fn"></div>void * <b><a href="qxtlinkedtree.html#toVoid">toVoid</a></b> ( QxtLinkedTreeIterator<T> )</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtLinkedTree class is a fast container for tree structured data</p> <p>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.</p> <p>There are no random access functions, you have to use QxtLinkedTree::iterator to access the data. This is very fast and efficient.</p> <pre> QxtLinkedTree<int> tree(1); QxtLinkedTreeIterator<int> it= tree.root(); it.append(34); qDebug()<<it<<it.child(); <span class="comment">//returns "1 34"</span></pre> <p>In order to be able to store an iterator into other data structures (eg. for <a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a> or <a href="http://doc.qtsoftware.com/4.5/qabstractxmlnodemodel.html">QAbstractXmlNodeModel</a>) functions are provided to create and store a linked item from and into a void pointer.</p> <pre> void * root= tree.toVoid(tree.root()); QxtLinkedTreeIterator<int> it= tree.fromVoid(root);</pre> <p>TODO: {implicitshared}</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtLinkedTree"></a>QxtLinkedTree::QxtLinkedTree ()</h3> <p>constructs a <a href="qxtlinkedtree.html">QxtLinkedTree</a> with a default constructed root node.</p> <h3 class="fn"><a name="QxtLinkedTree-2"></a>QxtLinkedTree::QxtLinkedTree ( T <i>t</i> )</h3> <p>constructs a <a href="qxtlinkedtree.html">QxtLinkedTree</a>. sets the rootnode to <i>t</i></p> <h3 class="fn"><a name="dtor.QxtLinkedTree"></a>QxtLinkedTree::~QxtLinkedTree ()</h3> <p>the destructor deletes all items, when they are no longer referenced by any other instance.</p> <h3 class="fn"><a name="clear"></a>void QxtLinkedTree::clear ()</h3> <p>deletes all nodes recursively. this might take forever depending on the size of your tree.</p> <h3 class="fn"><a name="fromVoid"></a><a href="qxtlinkedtreeiterator.html">QxtLinkedTreeIterator</a><T> QxtLinkedTree::fromVoid ( void * ) <tt> [static]</tt></h3> <p>returns an iterator pre positioned on the item specified with toVoid. passing anything that has not being created by <a href="qxtlinkedtree.html#toVoid">toVoid</a>() will crash. also note that passing invalidated nodes will crash too. Be extremly carefull. It is easy to currupt your data with this!</p> <h3 class="fn"><a name="root"></a><a href="qxtlinkedtreeiterator.html">QxtLinkedTreeIterator</a><T> QxtLinkedTree::root ()</h3> <p>returns an iterator on the root node</p> <h3 class="fn"><a name="toVoid"></a>void * QxtLinkedTree::toVoid ( <a href="qxtlinkedtreeiterator.html">QxtLinkedTreeIterator</a><T> ) <tt> [static]</tt></h3> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2010 <a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td> <td align="right"><div align="right"> <a href="http://libqxt.org">Qxt</a> 0.6.0</div></td> </tr></table></div></address></body> </html>