Home · Modules · Classes · Namespaces · Functions

QxtBdbTree Class Reference
[QxtBerkeley module]

The QxtBdbTree class is a template berkeley container for tree structured data More...

    #include <QxtBdbTree>

Public Functions


Detailed Description

The QxtBdbTree class is a template berkeley container for tree structured data

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.

Example usage:

    QxtBdbTree<QString> db("test.db");
    db.root().append("fooooo").append("bla");
    db.dumpTree(); //try this if you are unsure, how the data will look like

There is an extensive example in /examples/berkeley/xmlstorage

All functions of this class are thread safe. Calling open() multiple times is undefined. An iterator may only be used from one thread at once, but you can have multiple iterators.

TODO: {implicitshared}

See also QxtBdbTreeIterator.


Member Function Documentation

QxtBdbTree::QxtBdbTree ()

Constructs an invalid QxtBdbTree

QxtBdbTree::QxtBdbTree ( QString file )

Constructs a QxtBdbTree, and opens the file specified as its database.

void QxtBdbTree::clear ()

Erase all records. This does not delete the underlying file.

void QxtBdbTree::dumpTree () const

Outputs the contents of the database as flat file, and as iterateable tree onto qDebug(). This function assumes, the class used for template initialisation implements the QDebug<< operator

bool QxtBdbTree::flush ()

Flushes the underlying DB file. All changes are synced to disk.

bool QxtBdbTree::open ( QString file )

Opens the specified file.

Returns true on success and false on failure. Note: a sanity check is performed before opening the file.

QxtBdbTreeIterator<T> QxtBdbTree::root () const

Returns the rootnode, which is, similar to QAbstractItemModel, invalid and has no data itself.


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1