You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.2 KiB
61 lines
1.2 KiB
15 years ago
|
#ifndef KABC_EVOLUTION_DB_WRAPPER
|
||
|
#define KABC_EVOLUTION_DB_WRAPPER
|
||
|
|
||
|
#include <db.h>
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqpair.h>
|
||
15 years ago
|
|
||
|
namespace Evolution {
|
||
|
|
||
|
class DBWrapper;
|
||
|
class DBIterator {
|
||
|
friend class DBWrapper;
|
||
|
public:
|
||
|
DBIterator( DBWrapper* = 0l );
|
||
|
~DBIterator();
|
||
|
|
||
|
DBIterator( const DBIterator& );
|
||
|
DBIterator &operator=( const DBIterator& );
|
||
|
|
||
15 years ago
|
TQString key()const;
|
||
|
TQString value()const;
|
||
15 years ago
|
|
||
15 years ago
|
TQString operator*();
|
||
15 years ago
|
|
||
|
DBIterator &operator++();
|
||
|
DBIterator &operator--();
|
||
|
|
||
|
bool operator==( const DBIterator& );
|
||
|
bool operator!=( const DBIterator& );
|
||
|
private:
|
||
|
struct Data;
|
||
|
Data* data;
|
||
|
};
|
||
|
class DBWrapper {
|
||
|
public:
|
||
|
DBWrapper();
|
||
|
~DBWrapper();
|
||
|
|
||
15 years ago
|
TQString lastError()const;
|
||
15 years ago
|
|
||
15 years ago
|
bool open( const TQString& file, bool readOnly = false);
|
||
15 years ago
|
bool save();
|
||
|
DBIterator begin();
|
||
|
DBIterator end();
|
||
|
|
||
14 years ago
|
bool find( const TQString& key, TQString& value );
|
||
15 years ago
|
bool add( const TQString& key, const TQString& val );
|
||
|
bool remove( const TQString& key );
|
||
15 years ago
|
private:
|
||
15 years ago
|
// DBT element( const TQString& );
|
||
15 years ago
|
struct Data;
|
||
|
Data* data;
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif
|