table of contents
| api(3elektra) | Elektra | api(3elektra) |
NAME¶
api - for kdb.h.
SYNOPSIS¶
Functions¶
ssize_t keySetStringF (Key *key, const char *format,...)
Set a formatted string. int elektraKsToMemArray (KeySet *ks, Key
**buffer)
Builds an array of pointers to the keys in the supplied keyset. 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. int keyLock (Key *key, option_t what)
Permanently locks a part of the key. KeySet * elektraKeyGetMetaKeySet
(const Key *key)
Return metadata as keyset. Key * ksPrev (KeySet *ks)
Returns the previous Key in a KeySet. Key * ksPopAtCursor (KeySet *ks,
cursor_t pos)
Pop key at given cursor position. Key * keyAsCascading (const Key *key)
keyRel replacement int keyRel2 (const Key *key, const Key *check,
KeyRelType which)
Replacement proposal for keyRel.
Detailed Description¶
for kdb.h.
Warning:
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.
Function Documentation¶
KeySet* elektraKeyGetMetaKeySet (const Key * key)¶
Return metadata as keyset.
Parameters:
Returns:
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:
KeySet *ks = somekeyset; Key **keyArray = calloc (ksGetSize(ks), sizeof (Key *)); elektraKsToMemArray (ks, keyArray); ... work with the array ... elektraFree (keyArray);
Parameters:
buffer the buffer to put the result into
Returns:
a negative number on null pointers or if an error occurred
int keyLock (Key * key, option_t what)¶
Permanently locks a part of the key. This can be:
- KEY_FLAG_LOCK_NAME to lock the name
- KEY_FLAG_LOCK_VALUE to lock the value
- KEY_FLAG_LOCK_META to lock the metadata
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.
Parameters:
See also:
Return values:
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.
Returns:
Return values:
0 test failed
>1 true for binary tests, number of levels below for other relation tests
Parameters:
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.
Parameters:
format NULL-terminated text format string
... more arguments
Returns:
Key* ksPopAtCursor (KeySet * ks, cursor_t pos)¶
Pop key at given cursor position.
Parameters:
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:
cursor_t c = ksGetCursor(ks); keyDel (ksPopAtCursor(ks, c)); ksSetCursor(ks, c); ksPrev(ks); // to have correct key after next ksNext()
Warning:
Returns:
Return values:
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.
Returns:
See also:
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.
Returns:
The first key is removed in the resulting keyset.
Author¶
Generated automatically by Doxygen for Elektra from the source code.
| Mon Jan 15 2018 | Version 0.8.20 |