Elektra
0.9.4
|
Methods for Key manipulation. More...
#include "kdblogger.h"
#include <stdio.h>
#include "kdb.h"
#include "kdbprivate.h"
#include <kdbassert.h>
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... | |
int | keyLock (Key *key, elektraLockFlags what) |
Permanently locks a part of the key. More... | |
int | keyIsLocked (const Key *key, elektraLockFlags what) |
Tests if a part of a key is locked. 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:
keyNew() allocates memory for a key object and keyDel() cleans everything up.
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:
If you want the key object to contain a name, value, comment and other meta info read on.
You can call keyNew() in many different ways depending on the attribute tags you pass as parameters. Tags are represented as elektraKeyFlags values, and tell keyNew() which Key attribute comes next. 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 |