Public Member Functions |
| KDB () |
| Opens the session with the Key database.
|
| KDB (Key &errorKey) |
| Opens the session with the Key database.
|
| ~KDB () throw () |
|
|
void | open (Key &errorKey) |
| Opens the session with the Key database.
|
void | close (Key &errorKey) throw () |
|
|
int | get (KeySet &returned, std::string const &keyname) |
| Retrieve keys in an atomic and universal way, all other kdbGet() Functions rely on that one.
|
int | get (KeySet &returned, Key &parentKey) |
| Retrieve keys in an atomic and universal way, all other kdbGet() Functions rely on that one.
|
int | set (KeySet &returned, std::string const &keyname) |
|
|
int | set (KeySet &returned, Key &parentKey) |
|
|
Opens the session with the Key database.
Constructs a class KDB.
- Exceptions
-
KDBException | if database could not be opened |
The first step is to open the default backend. With it system/elektra/mountpoints will be loaded and all needed libraries and mountpoints will be determined. These libraries for backends will be loaded and with it the KDB
datastructure will be initialized.You must always call this method before retrieving or committing any keys to the database. In the end of the program, after using the key database, you must not forget to kdbClose(). You can use the atexit () handler for it.The pointer to the KDB
structure returned will be initialized like described above, and it must be passed along on any kdb*() method your application calls.Get a KDB
handle for every thread using elektra. Don't share the handle across threads, and also not the pointer accessing it:
You don't need to use the
kdbOpen() if you only want to manipulate plain in-memory
Key or
KeySet objects without any affairs with the backend key database or when your application loads plugins directly.
- Parameters
-
errorKey | the key which holds errors and warnings which were issued must be given |
- See Also
- kdbClose() to end all affairs to the Key database.
- Returns
- a KDB pointer on success
-
NULL on failure
Access to the key database.
- Invariant
- the object holds an valid connection to the key database or is empty
Opens the session with the Key database.
Constructs a class KDB.
- Exceptions
-
KDBException | if database could not be opened |
The first step is to open the default backend. With it system/elektra/mountpoints will be loaded and all needed libraries and mountpoints will be determined. These libraries for backends will be loaded and with it the KDB
datastructure will be initialized.You must always call this method before retrieving or committing any keys to the database. In the end of the program, after using the key database, you must not forget to kdbClose(). You can use the atexit () handler for it.The pointer to the KDB
structure returned will be initialized like described above, and it must be passed along on any kdb*() method your application calls.Get a KDB
handle for every thread using elektra. Don't share the handle across threads, and also not the pointer accessing it:
You don't need to use the
kdbOpen() if you only want to manipulate plain in-memory
Key or
KeySet objects without any affairs with the backend key database or when your application loads plugins directly.
- Parameters
-
errorKey | the key which holds errors and warnings which were issued must be given |
- See Also
- kdbClose() to end all affairs to the Key database.
- Returns
- a KDB pointer on success
-
NULL on failure
kdb::KDB::KDB |
( |
Key & |
errorKey | ) |
|
|
inline |
Opens the session with the Key database.
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 |
The first step is to open the default backend. With it system/elektra/mountpoints will be loaded and all needed libraries and mountpoints will be determined. These libraries for backends will be loaded and with it the KDB
datastructure will be initialized.You must always call this method before retrieving or committing any keys to the database. In the end of the program, after using the key database, you must not forget to kdbClose(). You can use the atexit () handler for it.The pointer to the KDB
structure returned will be initialized like described above, and it must be passed along on any kdb*() method your application calls.Get a KDB
handle for every thread using elektra. Don't share the handle across threads, and also not the pointer accessing it:
You don't need to use the
kdbOpen() if you only want to manipulate plain in-memory
Key or
KeySet objects without any affairs with the backend key database or when your application loads plugins directly.
- Parameters
-
errorKey | the key which holds errors and warnings which were issued must be given |
- See Also
- kdbClose() to end all affairs to the Key database.
- Returns
- a KDB pointer on success
-
NULL on failure
int kdb::KDB::get |
( |
KeySet & |
returned, |
|
|
std::string const & |
keyname |
|
) |
| |
|
inline |
Retrieve keys in an atomic and universal way, all other kdbGet() Functions rely on that one.
Get all keys below keyname inside returned.
The returned
KeySet must be initialized. The returned
KeySet may already contain some keys. The new retrieved keys will be appended using ksAppendKey().It will fully retrieve all keys under the parentKey
folder, with all subfolders and their children.
#include <kdb.hpp>
#include <keyio.hpp>
using namespace kdb;
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 |
Retrieve keys in an atomic and universal way, all other kdbGet() Functions rely on that one.
Get all keys below parentKey inside returned.
The returned
KeySet must be initialized. The returned
KeySet may already contain some keys. The new retrieved keys will be appended using ksAppendKey().It will fully retrieve all keys under the parentKey
folder, with all subfolders and their children.
- 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 |
Opens the session with the Key database.
Open the database
- Parameters
-
errorKey | is useful if you want to get the warnings in the successful case, when no exception is thrown. |
The first step is to open the default backend. With it system/elektra/mountpoints will be loaded and all needed libraries and mountpoints will be determined. These libraries for backends will be loaded and with it the KDB
datastructure will be initialized.You must always call this method before retrieving or committing any keys to the database. In the end of the program, after using the key database, you must not forget to kdbClose(). You can use the atexit () handler for it.The pointer to the KDB
structure returned will be initialized like described above, and it must be passed along on any kdb*() method your application calls.Get a KDB
handle for every thread using elektra. Don't share the handle across threads, and also not the pointer accessing it:
You don't need to use the
kdbOpen() if you only want to manipulate plain in-memory
Key or
KeySet objects without any affairs with the backend key database or when your application loads plugins directly.
- Parameters
-
errorKey | the key which holds errors and warnings which were issued must be given |
- See Also
- kdbClose() to end all affairs to the Key database.
- Returns
- a KDB pointer on success
-
NULL on failure