Enumerations | |
enum | KeyType { KEY_TYPE_UNDEFINED = 0, KEY_TYPE_DIR = 1, KEY_TYPE_LINK = 2, KEY_TYPE_BINARY = 20, KEY_TYPE_STRING = 40 } |
Key data types. More... | |
enum | KeyNamespace { KEY_NS_SYSTEM = 1, KEY_NS_USER = 2 } |
Elektra currently supported Key namespaces. More... | |
enum | KeySwitch { KEY_SWITCH_TYPE = 1, KEY_SWITCH_NAME = 1<<1, KEY_SWITCH_VALUE = 1<<2, KEY_SWITCH_OWNER = 1<<5, KEY_SWITCH_DOMAIN = KEY_SWITCH_OWNER, KEY_SWITCH_COMMENT = 1<<6, KEY_SWITCH_UID = 1<<7, KEY_SWITCH_GID = 1<<8, KEY_SWITCH_MODE = 1<<10, KEY_SWITCH_TIME = 1<<11, KEY_SWITCH_NEEDSYNC = 1<<12 , KEY_SWITCH_ISSYSTEM = 1<<23, KEY_SWITCH_ISUSER = 1<<24, KEY_SWITCH_FLAG = 1<<31, KEY_SWITCH_END = 0 } |
Switches to denote the various Key attributes in methods throughout this library. More... | |
Functions | |
Key * | keyNew (const char *keyName,...) |
A practical way to fully create a Key object in one step. | |
int | keyDel (Key *key) |
A destructor for Key objects. | |
int | keyDup (const Key *source, Key *dest) |
Duplicate memory of keys. | |
int | keyInit (Key *key) |
Initializes the Key object with some default values. | |
int | keyClose (Key *key) |
Finishes the usage of a Key object. |
To use them:
#include <kdb.h>
A Key is the essential class that encapsulates key name , value and metainfo . Key properties are:
Described here the methods to allocate and free the key.
|
Key data types. Key type values grow from the semantically poor to the semantically rich. The gaps between them is for user-defined types.
If your application needs value types with more semantics, like
The type number is a value between 0 and 255. If your user-defined type >=
|
|
Elektra currently supported Key namespaces.
|
|
Switches to denote the various Key attributes in methods throughout this library.
|
|
A practical way to fully create a Key object in one step. This function tries to mimic the C++ way for constructors.
Due to ABI compatibility, the You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as the KeySwitch values, and tell keyNew() which Key attribute comes next. The simplest way to call it is with no tags, only a key name. See example bellow. keyNew() allocates memory for a key object and then calls keyInit(). After that it processes the given argument list. The Key attribute tags are the following:
Definition at line 340 of file key.c. References _Key::flags, kdbGetKey(), KEY_SWITCH_COMMENT, KEY_SWITCH_DOMAIN, KEY_SWITCH_GID, KEY_SWITCH_MODE, KEY_SWITCH_NEEDSYNC, KEY_SWITCH_TYPE, KEY_SWITCH_UID, KEY_SWITCH_VALUE, KEY_TYPE_BINARY, keyInit(), keySetAccess(), keySetComment(), keySetGID(), keySetName(), keySetOwner(), keySetRaw(), keySetString(), keySetType(), and keySetUID(). Referenced by commandEdit(), commandGet(), commandList(), commandMonitor(), commandMove(), commandSet(), kdbGetChildKeys(), kdbGetRootKeys(), kdbGetValue(), kdbLink(), kdbMonitorKey_default(), kdbRemove(), and kdbSetValue(). |
|
A destructor for Key objects.
Every key created by keyNew() must be deleted with keyDel(). It will keyClose() and free() the
There is the
Definition at line 443 of file key.c. References keyClose(). Referenced by commandEdit(), commandGet(), commandList(), commandMonitor(), commandMove(), commandSet(), kdbGetChildKeys(), kdbGetRootKeys(), kdbGetValue(), kdbLink(), kdbMonitorKey_default(), kdbRemove(), kdbSetValue(), ksClose(), and ksCompare(). |
|
Duplicate memory of keys. Both keys have to be initialized with keyInit(). If you have set any dynamic allocated memory for dest, make sure that you keyClose() it. All private attributes of the source key will be copied, including its context on a KeySet, and nothing will be shared between both keys.
Definition at line 2248 of file key.c. References _Key::comment, _Key::data, _Key::dataSize, _Key::flags, _Key::key, keySetComment(), keySetName(), keySetOwner(), keySetRaw(), and _Key::userDomain. Referenced by kdbMonitorKey_default(). |
|
Initializes the Key object with some default values. This function should not be used by backends or applications, use keyNew() instead. keyInit() sets the key to a clear state. It uses memset to clear the memory. The type of the key is KeyType::KEY_TYPE_UNDEFINED afterwards. uid, gid and access masks are set with the current values of your system. keyNew() and keyDel() are better ways to deal with initialization than keyInit() and keyClose()
Definition at line 2973 of file key.c. References _Key::access, _Key::flags, _Key::gid, _Key::type, and _Key::uid. Referenced by keyNew(). |
|
Finishes the usage of a Key object. The key must be keyInit() before any attempt to close it. Frees all internally allocated memory like value, comment, and leave the Key object ready to be keyInit()ed to reuse, or deallocated. All internal states of the key will be NULL. After this process there is no information inside the key. keyNew() and keyDel() are better ways to deal with initialization than keyInit() and keyClose()
Definition at line 3015 of file key.c. References _Key::comment, _Key::data, _Key::key, and _Key::userDomain. Referenced by keyDel(). |