Elektra
0.9.7
|
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 * | keyCopy (Key *dest, const Key *source, elektraCopyFlags flags) |
Copy or clear a key. More... | |
int | keyDel (Key *key) |
A destructor for Key objects. More... | |
int | keyClear (Key *key) |
Will clear all internal data of a Key. More... | |
ssize_t | keyIncRef (Key *key) |
Increment the reference counter of a Key object. More... | |
ssize_t | keyDecRef (Key *key) |
Decrement the reference counter 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 lock parts of a Key. More... | |
int | keyIsLocked (const Key *key, elektraLockFlags what) |
Checks which parts of a Key are 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.
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.KEY_BINARY
Allows one to change the key to a binary key. Make sure that you also pass KEY_SIZE before you set the value. Otherwise it will be cut off with first \0 in the string. So this flag toggle from keySetString() to keySetBinary(). If no value (nor size) is given, it will be a NULL key.
name | a valid name to the key (see keySetName()) |
NULL | on allocation error or if an invalid name was passed (see keySetName()). |
va | the variadic argument list |