11 class KeySetException : public std::exception
13 const char* what() {return "Key Exception";}
16 class KeySetOutOfRange : public KeySetException
18 const char* what() {return "Out of range in KeySet";}
21 class KeySetNotFound : public KeySetException
23 const char* what() {return "Could not find Key in KeySet";}
26 /**Key represents an elektra key.*/
30 KeySet () :ks (ckdb::ksNew(0)) {}
31 KeySet (ckdb::KeySet *k) :ks(k) {}
32 KeySet (const KeySet &other);
33 KeySet (size_t alloc, va_list ap);
34 KeySet (size_t alloc, ...);
37 ckdb::KeySet * getKeySet () const { return ks; }
38 void setKeySet (ckdb::KeySet * k) { ks = k; }
40 ckdb::KeySet* dup () const { return ckdb::ksDup(ks); }
42 void copy (const KeySet &other) { ckdb::ksCopy(ks,other.ks); }
43 void clear () { ckdb::ksCopy(ks,0); }
49 size_t append (const Key &toAppend);
50 size_t append (const KeySet &toAppend);
61 void setCursor(cursor_t cursor);
62 cursor_t getCursor() const;
64 Key lookup (const Key &k, const option_t options = KDB_O_NONE) const;
65 Key lookup (const std::string &name, const option_t options = KDB_O_NONE) const;
66 Key lookup (const char *name, const option_t options = KDB_O_NONE) const;
69 ssize_t toStream(FILE* stream = stdout, option_t options = (option_t)0) const;
70 ssize_t output(FILE* stream = stdout, option_t options = 0) const;
71 ssize_t generate(FILE* stream = stdout, option_t options = 0) const;
74 friend std::ostream & operator << (std::ostream & os, const KeySet &d);
75 friend std::istream & operator >> (std::istream & os, KeySet &d);
79 KeySet (KeySet &k) :ks (k.ks) { }
80 KeySet (const KeySet &k) :ks (k.ks) { }
84 ckdb::KeySet * ks; // holds elektra keyset struct
87 } // end of namespace kdb