/*
* databasewrapper.h
*
* Copyright (c) 2002, 2003 Frerich Raabe <raabe@kde.org>
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
* accompanying file 'COPYING'.
*/
#ifndef DATABASEWRAPPER_H
#define DATABASEWRAPPER_H
#include <db.h>
#include <fcntl.h>
#include <qstringlist.h>
namespace Barry
{
class DatabaseWrapper
{
public:
enum Flags {
Create = O_CREAT, CreateWithError = O_EXCL,
ExclusiveLock = O_EXLOCK, SharedLock = O_SHLOCK,
NonBlocking = O_NONBLOCK,
ReadOnly = O_RDONLY, ReadWrite = O_RDWR,
Truncate = O_TRUNC
};
enum Format {
BinaryTree = DB_BTREE, Hashed = DB_HASH, Record = DB_RECNO
};
DatabaseWrapper( const QString &filename );
~DatabaseWrapper();
bool open( Flags flags = ReadOnly, Format format = BinaryTree );
QString getEntry( const QString &key );
QStringList getAllKeys();
private:
DatabaseWrapper( const DatabaseWrapper &rhs );
DatabaseWrapper &operator=( const DatabaseWrapper &rhs );
DB *m_database;
QString m_filename;
};
}
#endif // DATABASEWRAPPER_H
// vim:ts=4:sw=4:noet:list
syntax highlighted by Code2HTML, v. 0.9.1