#ifndef CPP_KDB_H
#define CPP_KDB_H

#include <string>
#include <key>
#include <keyset>

#include <kdb.h>


namespace kdb {

class KDBException : public std::exception
{
	const char* what() {return "KDB Exception";}
};

class KDB
{
public:
	KDB ();
	~KDB ();

	size_t get (KeySet & returned, const Key &parentKey, option_t options = KDB_O_NONE);
	size_t get (KeySet & returned, const std::string &parentName, option_t options = KDB_O_NONE);
	size_t get (KeySet & returned, const char * parentName, option_t options = KDB_O_NONE);

	size_t set (KeySet & returned, const Key &parentKey, option_t options = KDB_O_NONE);

	void get (Key & toGet);
	void set (const Key & toSet);

	void getString (const std::string &keyname, std::string value, size_t maxSize);
	void setString (const std::string &keyname, const std::string &value);
	void remove (const std::string &keyname);

protected:
	/**You may use the KDB in an inherited class*/
	ckdb::KDB* handle;
};

} // end of namespace kdb

#endif

