![]() |
Home · Modules · Classes · Namespaces · Functions |
The QxtBdbHash class is a template class that provides key/value access to a berkeley db file. More...
#include <QxtBdbHash>
The QxtBdbHash class is a template class that provides key/value access to a berkeley db file.
Both value and key must be registered with the qt meta system. You may not touch the file while a QxtBdbHash instance is running on it.
examples usage:
QxtBdbHash<qreal,QStringList> db("test.db"); db.insert(344.4,QStringList<<"HI"<<":)"); qDebug()<<db[344.4];
There is an extensive example in /examples/berkeley/adressbook.
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 QxtBdbHashIterator.
Constructs an invalid QxtBdbHash
Constructs a QxtBdbHash, and opens the file specified as its database.
Returns an iterator to the first key,value pair.
See also QxtBdbHashIterator.
Erase all records. This does not delete the underlying file.
Returns true if there is a record for the specified key.
Return an iterator to the last key,value pair
See also QxtBdbHashIterator.
Returns an iterator to the position of the pair identified by key
See also QxtBdbHashIterator.
Flushes the underlying DB file. All changes are synced to disk.
Inserts a record with the specified key / value combination. Replaces any record with the same key. Note: When working with iterators, keep in mind that inserting pairs, works reverse to the iteration.
Opens the specified file.
Returns true on success and false on failure. Note: A sanity check is performed before opening the file.
Removes all records with the specified key. Returns true on success and false on failure.
Returns the value associated with the specified key, or a default contructed value, if no such key exists.
Same as value()
Copyright © 2007-2011 Qxt Foundation |
Qxt 0.6.2 |