Constructs a class KDB.
More...
#include <kdb.hpp>
Constructs a class KDB.
- Exceptions
-
KDBException | if database could not be opened |
Access to the key database.
- Invariant
- the object holds an valid connection to the key database or is empty
Constructs a class KDB.
- Exceptions
-
KDBException | if database could not be opened |
kdb::KDB::KDB |
( |
Key & |
errorKey | ) |
|
|
inline |
Constructs a class KDB.
- Parameters
-
errorKey | is useful if you want to get the warnings in the successful case, when no exception is thrown. |
- Exceptions
-
KDBException | if database could not be opened |
kdb::KDB::~KDB |
( |
| ) |
|
throw | ( | |
| ) | | |
|
inline |
The destructor closes the database.
void kdb::KDB::close |
( |
Key & |
errorKey | ) |
|
throw | ( | |
| ) | | |
|
inline |
Open the database.
The return value does not matter because its only a null pointer check.
- Parameters
-
errorKey | is useful if you want to get the warnings |
int kdb::KDB::get |
( |
KeySet & |
returned, |
|
|
std::string const & |
keyname |
|
) |
| |
|
inline |
Get all keys below keyname inside returned.
int main()
{
kdb.
get(config,
"/sw/MyApp");
if (k)
{
std::cout << k <<
" is " << k.
get<
int>() << std::endl;
}
else
{
std::cerr << "No key found" << std::endl;
return 1;
}
}
- Parameters
-
returned | the keyset where the keys will be in |
keyname | the root keyname which should be used to get keys below it |
- Return values
-
0 | if no key was updated |
1 | if user or system keys were updated |
2 | if user and system keys were updated |
- Exceptions
-
KDBException | if there were problems with the database |
- See also
- KDB::get (KeySet & returned, Key & parentKey)
int kdb::KDB::get |
( |
KeySet & |
returned, |
|
|
Key & |
parentKey |
|
) |
| |
|
inline |
Get all keys below parentKey inside returned.
- Parameters
-
returned | the keyset where the keys will be in |
parentKey | the parentKey of returned |
- Return values
-
0 | if no key was updated |
1 | if user or system keys were updated |
2 | if user and system keys were updated |
- Exceptions
-
KDBException | if there were problems with the database |
void kdb::KDB::open |
( |
Key & |
errorKey | ) |
|
|
inline |
Open the database.
- Parameters
-
errorKey | is useful if you want to get the warnings in the successful case, when no exception is thrown. |
int kdb::KDB::set |
( |
KeySet & |
returned, |
|
|
std::string const & |
keyname |
|
) |
| |
|
inline |
Set all keys below keyname.
If the keyname of the parentKey is invalid (e.g. empty) all keys will be set.
- Return values
-
0 | if no key was updated |
1 | if user or system keys were updated |
2 | if user and system keys were updated |
- Parameters
-
returned | the keyset where the keys will be in |
keyname | the keyname below the names should be set |
- Exceptions
-
KDBException | if there were problems with the database |
int kdb::KDB::set |
( |
KeySet & |
returned, |
|
|
Key & |
parentKey |
|
) |
| |
|
inline |
Set all keys below parentKey.
If the keyname of the parentKey is invalid (e.g. empty) all keys will be set.
- Return values
-
0 | if no key was updated |
1 | if user or system keys were updated |
2 | if user and system keys were updated |
- Parameters
-
returned | the keyset where the keys are passed to the user |
parentKey | the parentKey of returned |
- Exceptions
-
KDBException | if there were problems with the database |
The documentation for this class was generated from the following file: