summaryrefslogtreecommitdiffstats
path: root/tdeabc/plugins/evolution/dbwrapper.h
blob: e5e0a2c3304a80582dd047334f7a14d7774a0edf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef KABC_EVOLUTION_DB_WRAPPER
#define KABC_EVOLUTION_DB_WRAPPER

#include <db.h>

#include <tqstring.h>
#include <tqpair.h>

namespace Evolution {

    class DBWrapper;
    class DBIterator {
        friend class DBWrapper;
    public:
        DBIterator( DBWrapper* = 0l );
        ~DBIterator();

        DBIterator( const DBIterator& );
        DBIterator &operator=( const DBIterator& );

        TQString key()const;
        TQString value()const;

        TQString operator*();

        DBIterator &operator++();
        DBIterator &operator--();

        bool operator==( const DBIterator& );
        bool operator!=( const DBIterator& );
    private:
        struct Data;
        Data* data;
    };
    class DBWrapper {
    public:
        DBWrapper();
        ~DBWrapper();

        TQString lastError()const;

        bool open( const TQString& file, bool readOnly = false);
        bool save();
        DBIterator begin();
        DBIterator end();

        bool find( const TQString& key, TQString& value );
        bool add( const TQString& key,  const TQString& val );
        bool remove( const TQString& key );
    private:
        //  DBT element( const TQString& );
        struct Data;
        Data* data;

    };

}


#endif