Elektra
0.8.25
|
Methods for Key manipulation. More...
Functions | |
Key * | keyNew (const char *name,...) |
A practical way to fully create a Key object in one step. More... | |
Key * | keyVNew (const char *name, va_list va) |
A practical way to fully create a Key object in one step. More... | |
Key * | keyDup (const Key *source) |
Return a duplicate of a key. More... | |
int | keyCopy (Key *dest, const Key *source) |
Copy or Clear a key. More... | |
int | keyDel (Key *key) |
A destructor for Key objects. More... | |
int | keyClear (Key *key) |
Key Object Cleaner. More... | |
ssize_t | keyIncRef (Key *key) |
Increment the viability of a key object. More... | |
ssize_t | keyDecRef (Key *key) |
Decrement the viability of a key object. More... | |
ssize_t | keyGetRef (const Key *key) |
Return how many references the key has. More... | |
Methods for Key manipulation.
Key* keyVNew | ( | const char * | name, |
va_list | va | ||
) |
A practical way to fully create a Key object in one step.
To just get a key object, simple do:
If you want the key object to contain a name, value, comment and other meta info read on.
You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as keyswitch_t values, and tell keyNew() which Key attribute comes next.
We can also give an empty key name and a KEY_END tag with the same effect as before:
But we can also give the key a proper name right from the start:
So, keyNew() allocates memory for a key object and keyDel() cleans everything up.
keyNew() processes the given argument list even further. The Key attribute tags are the following:
keyName
is 0.name | a valid name to the key, or NULL to get a simple initialized, but really empty, object |
NULL | on allocation error or if an invalid name was passed (see keySetName()). |
va | the variadic argument list |