Git init
[pkgs/e/elektra.git] / src / bindings / cpp / include / kdb
1 #ifndef CPP_KDB_H
2 #define CPP_KDB_H
3
4 #include <string>
5 #include <key>
6 #include <keyset>
7
8 #include <kdb.h>
9
10
11 namespace kdb {
12
13 class KDBException : public std::exception
14 {
15         const char* what() {return "KDB Exception";}
16 };
17
18 class KDB
19 {
20 public:
21         KDB ();
22         ~KDB ();
23
24         size_t get (KeySet & returned, const Key &parentKey, option_t options = KDB_O_NONE);
25         size_t get (KeySet & returned, const std::string &parentName, option_t options = KDB_O_NONE);
26         size_t get (KeySet & returned, const char * parentName, option_t options = KDB_O_NONE);
27
28         size_t set (KeySet & returned, const Key &parentKey, option_t options = KDB_O_NONE);
29
30         void get (Key & toGet);
31         void set (const Key & toSet);
32
33         void getString (const std::string &keyname, std::string value, size_t maxSize);
34         void setString (const std::string &keyname, const std::string &value);
35         void remove (const std::string &keyname);
36
37 protected:
38         /**You may use the KDB in an inherited class*/
39         ckdb::KDB* handle;
40 };
41
42 } // end of namespace kdb
43
44 #endif
45