Elektra
0.8.21
|
for kdb.h. More...
Functions | |
ssize_t | keySetStringF (Key *key, const char *format,...) |
Set a formatted string. More... | |
int | elektraKsToMemArray (KeySet *ks, Key **buffer) |
Builds an array of pointers to the keys in the supplied keyset. More... | |
KeySet * | ksRenameKeys (KeySet *config, const Key *name) |
Takes the first key and cuts off this common part for all other keys, instead name will be prepended. More... | |
int | keyLock (Key *key, option_t what) |
Permanently locks a part of the key. More... | |
KeySet * | elektraKeyGetMetaKeySet (const Key *key) |
Return metadata as keyset. More... | |
Key * | ksPrev (KeySet *ks) |
Returns the previous Key in a KeySet. More... | |
Key * | ksPopAtCursor (KeySet *ks, cursor_t pos) |
Pop key at given cursor position. More... | |
Key * | keyAsCascading (const Key *key) |
keyRel replacement | |
int | keyRel2 (const Key *key, const Key *check, KeyRelType which) |
Replacement proposal for keyRel. More... | |
for kdb.h.
These methods are a technical preview of what might be added in future Elektra releases. It is a requirement that methods are first added here, before they are added to the public API.
Usually, names in proposal stage should be prefixed with elektra to clearly mark that the signature is likely to be changed and not yet ABI compatible.
KeySet* elektraKeyGetMetaKeySet | ( | const Key * | key | ) |
Return metadata as keyset.
key | the key object to work with |
int elektraKsToMemArray | ( | KeySet * | ks, |
Key ** | buffer | ||
) |
Builds an array of pointers to the keys in the supplied keyset.
The keys are not copied, calling keyDel may remove them from the keyset.
The size of the buffer can be easily allocated via ksGetSize. Example:
ks | the keyset object to work with |
buffer | the buffer to put the result into |
int keyLock | ( | Key * | key, |
option_t | what | ||
) |
Permanently locks a part of the key.
This can be:
To unlock the key, duplicate it.
It is also possible to lock when the key is created with keyNew().
Some data structures need to lock the key (most likely its name), so that the ordering does not get confused.
key | which name should be locked |
>0 | the bits that were successfully locked |
0 | if everything was locked before |
-1 | if it could not be locked (nullpointer) |
int keyRel2 | ( | const Key * | key, |
const Key * | check, | ||
KeyRelType | which | ||
) |
Replacement proposal for keyRel.
-1 | usage error |
0 | test failed |
>1 | true for binary tests, number of levels below for other relation tests |
key | the key object to work with |
check | the second key object to check the relation with |
which | what kind of relationship test should be done |
ssize_t keySetStringF | ( | Key * | key, |
const char * | format, | ||
... | |||
) |
Set a formatted string.
key | the key to set the string value |
format | NULL-terminated text format string |
... | more arguments |
Key* ksPopAtCursor | ( | KeySet * | ks, |
cursor_t | pos | ||
) |
Pop key at given cursor position.
ks | the keyset to pop key from |
c | where to pop |
The internal cursor will be rewinded using ksRewind(). You can use ksGetCursor() and ksSetCursor() jump back to the previous position. e.g. to pop at current position within ksNext() loop:
0 | if ks is 0 |
Key* ksPrev | ( | KeySet * | ks | ) |
Returns the previous Key in a KeySet.
KeySets have an internal cursor that can be reset with ksRewind(). Every time ksPrev() is called the cursor is decremented and the new current Key is returned.
You'll get a NULL pointer if the key before begin of the KeySet was reached.
Don't delete the key, use ksPop() if you want to delete it.
KeySet* ksRenameKeys | ( | KeySet * | config, |
const Key * | name | ||
) |
Takes the first key and cuts off this common part for all other keys, instead name will be prepended.
The first key is removed in the resulting keyset.