<?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-libqxt-v0.6.2/src/berkeley/qxtbdbtree.cpp --> <head> <title>QxtBdbTree 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">QxtBdbTree Class Reference<br /><span class="small-subtitle">[<a href="qxtberkeley.html">QxtBerkeley</a> module]</span> </h1> <p>The QxtBdbTree class is a template berkeley container for tree structured data <a href="#details">More...</a></p> <pre> #include <QxtBdbTree></pre><ul> <li><a href="qxtbdbtree-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="qxtbdbtree.html#QxtBdbTree">QxtBdbTree</a></b> ()</li> <li><div class="fn"></div><b><a href="qxtbdbtree.html#QxtBdbTree-2">QxtBdbTree</a></b> ( QString <i>file</i> )</li> <li><div class="fn"></div>void <b><a href="qxtbdbtree.html#clear">clear</a></b> ()</li> <li><div class="fn"></div>void <b><a href="qxtbdbtree.html#dumpTree">dumpTree</a></b> () const</li> <li><div class="fn"></div>bool <b><a href="qxtbdbtree.html#flush">flush</a></b> ()</li> <li><div class="fn"></div>bool <b><a href="qxtbdbtree.html#open">open</a></b> ( QString <i>file</i> )</li> <li><div class="fn"></div>QxtBdbTreeIterator<T> <b><a href="qxtbdbtree.html#root">root</a></b> () const</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtBdbTree class is a template berkeley container for tree structured data</p> <p>The template argument must be registered with the Qt meta system. You may not touch the file while a QxtBdbTree instance is running on it.</p> <p>Example usage:</p> <pre> QxtBdbTree<QString> db("test.db"); db.root().append("fooooo").append("bla"); db.dumpTree(); <span class="comment">//try this if you are unsure, how the data will look like</span></pre> <p>There is an extensive example in /examples/berkeley/xmlstorage</p> <p>All functions of this class are thread safe. Calling <a href="qxtbdbtree.html#open">open</a>() multiple times is undefined. An iterator may only be used from one thread at once, but you can have multiple iterators.</p> <p>TODO: {implicitshared}</p> <p>See also <a href="qxtbdbtreeiterator.html">QxtBdbTreeIterator</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtBdbTree"></a>QxtBdbTree::QxtBdbTree ()</h3> <p>Constructs an invalid <a href="qxtbdbtree.html">QxtBdbTree</a></p> <h3 class="fn"><a name="QxtBdbTree-2"></a>QxtBdbTree::QxtBdbTree ( <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> <i>file</i> )</h3> <p>Constructs a <a href="qxtbdbtree.html">QxtBdbTree</a>, and opens the <i>file</i> specified as its database.</p> <h3 class="fn"><a name="clear"></a>void QxtBdbTree::clear ()</h3> <p>Erase all records. This does not delete the underlying file.</p> <h3 class="fn"><a name="dumpTree"></a>void QxtBdbTree::dumpTree () const</h3> <p>Outputs the contents of the database as flat file, and as iterateable tree onto <a href="http://doc.qtsoftware.com/4.5/qtglobal.html#qDebug">qDebug</a>(). This function assumes, the class used for template initialisation implements the <a href="http://doc.qtsoftware.com/4.5/qdebug.html">QDebug</a><< operator</p> <h3 class="fn"><a name="flush"></a>bool QxtBdbTree::flush ()</h3> <p>Flushes the underlying DB file. All changes are synced to disk.</p> <h3 class="fn"><a name="open"></a>bool QxtBdbTree::open ( <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> <i>file</i> )</h3> <p>Opens the specified <i>file</i>.</p> <p>Returns <tt>true</tt> on success and <tt>false</tt> on failure. <b>Note:</b> a sanity check is performed before opening the file.</p> <h3 class="fn"><a name="root"></a><a href="qxtbdbtreeiterator.html">QxtBdbTreeIterator</a><T> QxtBdbTree::root () const</h3> <p>Returns the rootnode, which is, similar to <a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a>, invalid and has no data itself.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2011 <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.2</div></td> </tr></table></div></address></body> </html>