Elektra
0.8.7
|
A Key is the essential class that encapsulates key name , value and metainfo . More...
#include <key.hpp>
Public Member Functions | |
Key () | |
Key (ckdb::Key *k) | |
Key (Key &k) | |
Key (Key const &k) | |
Key (const char *keyName,...) | |
| |
Key (const std::string keyName,...) | |
| |
Key (const char *keyName, va_list ap) | |
| |
void | operator++ (int) const |
| |
void | operator++ () const |
| |
void | operator-- (int) const |
| |
void | operator-- () const |
| |
ssize_t | getReferenceCounter () const |
| |
Key & | operator= (ckdb::Key *k) |
Key & | operator= (const Key &k) |
void | copy (const Key &other) |
| |
void | clear () |
| |
Key * | operator-> () |
ckdb::Key * | getKey () const |
ckdb::Key * | operator* () const |
| |
ckdb::Key * | release () |
ckdb::Key * | dup () const |
| |
~Key () | |
| |
std::string | getName () const |
| |
ssize_t | getNameSize () const |
| |
std::string | getBaseName () const |
| |
ssize_t | getBaseNameSize () const |
| |
std::string | getDirName () const |
void | setName (const std::string &newName) |
| |
void | setBaseName (const std::string &baseName) |
| |
void | addBaseName (const std::string &baseName) |
| |
ssize_t | getFullNameSize () const |
| |
std::string | getFullName () const |
| |
Key & | operator= (const std::string &newName) |
Key & | operator+= (const std::string &baseName) |
Key & | operator-= (const std::string &baseName) |
Key & | operator= (const char *newName) |
(const std::string &newName) | |
Key & | operator+= (const char *baseName) |
(const std::string &) | |
Key & | operator-= (const char *baseName) |
(const std::string &) | |
bool | operator== (const Key &k) const |
| |
bool | operator!= (const Key &k) const |
| |
bool | operator< (const Key &other) const |
| |
bool | operator<= (const Key &other) const |
| |
bool | operator> (const Key &other) const |
| |
bool | operator>= (const Key &other) const |
| |
operator bool () const | |
template<class T > | |
T | get () const |
| |
template<class T > | |
void | set (T x) |
| |
std::string | getString () const |
void | setString (std::string newString) |
| |
ssize_t | getStringSize () const |
| |
func_t | getFunc () const |
const void * | getValue () const |
| |
std::string | getBinary () const |
| |
ssize_t | getBinarySize () const |
| |
ssize_t | setBinary (const void *newBinary, size_t dataSize) |
| |
bool | hasMeta (const std::string &metaName) const |
template<class T > | |
T | getMeta (const std::string &metaName) const |
| |
template<class T > | |
void | setMeta (const std::string &metaName, T x) |
| |
void | delMeta (const std::string &metaName) |
void | copyMeta (const Key &other, const std::string &metaName) |
| |
void | copyAllMeta (const Key &other) |
| |
void | rewindMeta () const |
| |
const Key | nextMeta () |
| |
const Key | currentMeta () const |
| |
bool | isValid () const |
bool | isSystem () const |
bool | isUser () const |
bool | isString () const |
| |
bool | isBinary () const |
| |
bool | isInactive () const |
| |
bool | isBelow (const Key &k) const |
| |
bool | isBelowOrSame (const Key &k) const |
| |
bool | isDirectBelow (const Key &k) const |
|
A Key is the essential class that encapsulates key name , value and metainfo .
This class is an wrapper for an optional, refcounted ckdb::Key. It is like an shared_ptr<ckdb::Key>, but the shared_ptr functionality is already within the Key and exposed with this wrapper.
|
inline |
Constructs an empty, invalid key.
|
inline |
Constructs a key out of a C key.
k | the key to work with |
|
inline |
Takes a reference of another key.
The key will not be copied, but the reference counter will be increased.
k | the key to work with |
|
inline |
Takes a reference of another key.
The key will not be copied, but the reference counter will be increased.
k | the key to work with |
|
inlineexplicit |
A practical way to fully create a Key object in one step.This function tries to mimic the C++ way for constructors.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.Due to ABI compatibility, the Key
structure is not defined in kdb.h, only declared. So you can only declare pointers
to Keys
in your program, and allocate and free memory for them with keyNew() and keyDel() respectively. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN135You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as the keyswitch_t values, and tell keyNew() which Key attribute comes next.The simplest and minimum way to use it is with no tags, only a key name:
keyswitch_t::KEY_GID
keyName
is 0.The reference counter (see keyGetRef()) will be initialized with 0, that means a subsequent call of keyDel() will delete the key. If you append the key to a keyset the reference counter will be incremented by one (see keyInc()) and the key can't be be deleted by a keyDel().
If you increment only by one with keyInc() the same as said above is valid:name | a valid name to the key, or NULL to get a simple initialized, but really empty, object |
NULL | on malloc error or if an invalid name was passed (see keySetName()). |
KeyInvalidName | if key could not be constructed (typically name wrong or at runtime on allocation problems) |
keyName | the name of the new key |
|
inlineexplicit |
A practical way to fully create a Key object in one step.This function tries to mimic the C++ way for constructors.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.Due to ABI compatibility, the Key
structure is not defined in kdb.h, only declared. So you can only declare pointers
to Keys
in your program, and allocate and free memory for them with keyNew() and keyDel() respectively. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN135You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as the keyswitch_t values, and tell keyNew() which Key attribute comes next.The simplest and minimum way to use it is with no tags, only a key name:
keyswitch_t::KEY_GID
keyName
is 0.The reference counter (see keyGetRef()) will be initialized with 0, that means a subsequent call of keyDel() will delete the key. If you append the key to a keyset the reference counter will be incremented by one (see keyInc()) and the key can't be be deleted by a keyDel().
If you increment only by one with keyInc() the same as said above is valid:name | a valid name to the key, or NULL to get a simple initialized, but really empty, object |
NULL | on malloc error or if an invalid name was passed (see keySetName()). |
KeyInvalidName | if key could not be constructed (typically name wrong or at runtime on allocation problems) |
keyName | the name of the new key |
|
inlineexplicit |
A practical way to fully create a Key object in one step.This function tries to mimic the C++ way for constructors.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.Due to ABI compatibility, the Key
structure is not defined in kdb.h, only declared. So you can only declare pointers
to Keys
in your program, and allocate and free memory for them with keyNew() and keyDel() respectively. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN135You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as the keyswitch_t values, and tell keyNew() which Key attribute comes next.The simplest and minimum way to use it is with no tags, only a key name:
keyswitch_t::KEY_GID
keyName
is 0.The reference counter (see keyGetRef()) will be initialized with 0, that means a subsequent call of keyDel() will delete the key. If you append the key to a keyset the reference counter will be incremented by one (see keyInc()) and the key can't be be deleted by a keyDel().
If you increment only by one with keyInc() the same as said above is valid:name | a valid name to the key, or NULL to get a simple initialized, but really empty, object |
NULL | on malloc error or if an invalid name was passed (see keySetName()). |
KeyInvalidName | if key could not be constructed (typically name wrong or at runtime on allocation problems) |
keyName | the name of the new key |
ap | the variable argument list pointer |
|
inline |
Destructs the key.
|
inline |
Adds a base name for a key
Adds baseName
to the current key name.Assumes that key
is a directory. baseName
is appended to it. The function adds '/'
if needed while concatenating.So if key
has name "system/dir1/dir2"
and this method is called with baseName
"mykey"
, the resulting key will have name "system/dir1/dir2/mykey"
.When baseName is 0 or "" nothing will happen and the size of the name is returned.
TODO: does not recognice .. and . in the string!
key | the key object to work with |
baseName | the string to append to the name |
KeyInvalidName | if the name is not valid |
|
inline |
Clears/Invalidates a key.
Afterwards the object is empty again.
Key Object Cleaner.Will reset all internal data.After this call you will receive a fresh key.The reference counter will stay unmodified.
key | the key object to work with |
|
inline |
Copy or Clear a key.Most often you may prefer keyDup() which allocates a new key and returns a duplication of another key.But when you need to copy into an existing key, e.g. because it was passed by a pointer in a function you can do so:
The reference counter will not be changed for both keys. Affiliation to keysets are also not affected.When you pass a NULL-pointer as source the data of dest will be cleaned completely (except reference counter, see keyClear()) and you get a fresh dest key.The meta data will be duplicated for the destination key. So it will not take much additional space, even with lots of metadata.If you want to copy all metadata, but keep the old value you can use keyCopy() too.dest | the key which will be written to |
source | the key which should be copied or NULL to clean the destination key |
|
inline |
Do a shallow copy of all meta data from source to dest.The key dest will additionally have all meta data source had. Meta data not present in source will not be changed. Meta data which was present in source and dest will be overwritten.For example the meta data type is copied into the Key k.
dest | the destination where the meta data should be copied too |
source | the key where the meta data should be copied from |
|
inline |
Do a shallow copy of meta data from source to dest.The key dest will have the same meta data referred with metaName afterwards then source.For example the meta data type is copied into the Key k.
dest | the destination where the meta data should be copied too |
source | the key where the meta data should be copied from |
metaName | the name of the meta data which should be copied |
|
inline |
Returns the Value of a Meta-Information which is current.The pointer is NULL if you reached the end or after ksRewind().
key | the key object to work with |
key's
cursor
|
inline |
Delete metadata for key.
|
inline |
Return a duplicate of a key.Memory will be allocated as needed for dynamic properties.The new key will not be member of any KeySet and will start with a new reference counter at 0. A subsequent keyDel() will delete the key.
source | has to be an initializised source Key |
|
inline |
Get a key value.
You can write your own template specialication, e.g.:
It should be the same as get().
KeyException | on null key or not a valid size |
KeyTypeMismatch | if key holds binary data and not a string |
This method tries to serialise the string to the given type.
|
inline |
Returns a pointer to the real internal key name where the basename
starts.This is a much more efficient version of keyGetBaseName() and you should use it if you are responsible enough to not mess up things. The name might change or even point to a wrong place after a keySetName(). If you need a copy of the basename consider to use keyGetBaseName().keyBaseName() returns "" when there is no keyBaseName. The reason is
key | the object to obtain the basename from |
|
inline |
Calculates number of bytes needed to store basename of key
.Key names that have only root names (e.g. "system"
or "user"
or "user:domain"
) does not have basenames, thus the function will return 1 bytes to store "".Basenames are denoted as:
system/some/thing/basename
-> basename
user:domain/some/thing/base\/name
> base\/name
key | the key object to work with |
key's
basename including ending NULL
|
inline |
"" | on null pointers (size == 0) and on data only containing \0 |
KeyException | on invalid binary size |
KeyTypeMismatch | if key is string and not a binary |
Get the value of a key as a binary.If the type is not binary -1 will be returned.When the binary data is empty (this is not the same as ""!) 0 will be returned and the returnedBinary will not be changed.For string values see keyGetString() and keyIsString().When the returnedBinary is to small to hold the data (its maximum size is given by maxSize), the returnedBinary will not be changed and -1 is returned.
key | the object to gather the value from |
returnedBinary | pre-allocated memory to store a copy of the key value |
maxSize | number of bytes of pre-allocated memory in returnedBinary |
returnedBinary
0 | if the binary is empty |
-1 | on NULL pointers |
-1 | if maxSize is 0 |
-1 | if maxSize is too small for string |
-1 | if maxSize is larger than SSIZE_MAX |
-1 | on type mismatch: binary expected, but found string |
|
inline |
Returns the number of bytes needed to store the key value, including the NULL terminator.It returns the correct size, independent of the Key Type. If it is a binary there might be '\0' values in it.For an empty string you need one byte to store the ending NULL. For that reason 1 is returned. This is not true for binary data, so there might be returned 0 too.A binary key has no '\0' termination. String types have it, so to there length will be added 1 to have enough space to store it.This method can be used with malloc() before keyGetString() or keyGetBinary() is called.
key | the key object to work with |
|
inline |
e.g. system/sw/dir/key will return system/sw/dir
|
inline |
Get key full name, including the user domain name.
key | the key object |
returnedName | pre-allocated memory to write the key name |
maxSize | maximum number of bytes that will fit in returnedName, including the final NULL |
KeyException | if key is null |
|
inline |
Bytes needed to store the key name including user domain and ending NULL.
key | the key object to work with |
|
inline |
Elektra can store function pointers as binary. This function returns such a function pointer.
KeyTypeMismatch | if no binary data found, or binary data has not correct length |
|
inline |
Passes out the raw key pointer.
This pointer can be used to directly change the underlying key object.
|
inline |
Returns the Value of a Meta-Information given by name.This is a much more efficient version of keyGetMeta(). But unlike with keyGetMeta you are not allowed to modify the resulting string.
key | the key object to work with |
metaName | the name of the meta information you want the value from |
You can specify your own template specialisation:
KeyTypeConversion | if meta data could not be parsed |
If no meta is available:
|
inline |
Returns a pointer to the abbreviated real internal key
name.This is a much more efficient version of keyGetName() and can use it if you are responsible enough to not mess up things. You are not allowed to change anything in the returned array. The content of that string may change after keySetName() and similar functions. If you need a copy of the name, consider using keyGetName().The name will be without owner, see keyGetFullName() if you need the name with its owner.keyName() returns "" when there is no keyName. The reason is
key | the key object to work with |
|
inline |
Bytes needed to store the key name without owner.For an empty key name you need one byte to store the ending NULL. For that reason 1 is returned.
key | the key object to work with |
|
inline |
Return how many references the key has.The references will be incremented on successful calls to ksAppendKey() or ksAppend().
For your own applications you can use keyIncRef() and keyDecRef() for reference counting. Keys with zero references will be deleted when using keyDel().
key | the key object to work with |
|
inline |
It should be the same as get().
KeyException | on null key or not a valid size |
KeyTypeMismatch | if key holds binary data and not a string |
|
inline |
Returns the number of bytes needed to store the key value, including the NULL terminator.It returns the correct size, independent of the Key Type. If it is a binary there might be '\0' values in it.For an empty string you need one byte to store the ending NULL. For that reason 1 is returned. This is not true for binary data, so there might be returned 0 too.A binary key has no '\0' termination. String types have it, so to there length will be added 1 to have enough space to store it.This method can be used with malloc() before keyGetString() or keyGetBinary() is called.
key | the key object to work with |
|
inline |
Return a pointer to the real internal key
value.This is a much more efficient version of keyGetString() keyGetBinary(), and you should use it if you are responsible enough to not mess up things. You are not allowed to modify anything in the returned string. If you need a copy of the Value, consider to use keyGetString() or keyGetBinary() instead.
|
inline |
true | if there is a metadata with given name |
false | if no such metadata exists |
|
inline |
k | the other key |
Check if the key check is below the key key or not.Example:
key user/sw/app check user/sw/app/keyreturns true because check is below keyExample:
key user/sw/app check user/sw/app/folder/keyreturns also true because check is indirect below key
key | the key object to work with |
check | the key to find the relative position of |
|
inline |
k | the other key |
|
inline |
Check if a key is binary type.The function checks if the key is a binary. Opposed to string values binary values can have '\0' inside the value and may not be terminated by a null character. Their disadvantage is that you need to pass their size.Make sure to use this function and don't test the binary type another way to ensure compatibility and to write less error prone programs.
key | the key to check |
|
inline |
k | the other key |
Check if the key check is direct below the key key or not.
Example: key user/sw/app check user/sw/app/key returns true because check is below key Example: key user/sw/app check user/sw/app/folder/key does not return true, because there is only a indirect relation
key | the key object to work with |
check | the key to find the relative position of |
|
inline |
Check whether a key is inactive or not.In elektra terminology any key is inactive if the it's basename starts with '.'. Inactive keys must not have any meaning to applications, they are reserved for users and administrators.To remove a whole hierarchy in elektra, don't forget to pass option_t::KDB_O_INACTIVE to kdbGet() to receive the inactive keys in order to remove them.Otherwise you should not fetch these keys.
key | the key object to work with |
|
inline |
Check if a key is string type.String values are null terminated and are not allowed to have any '\0' characters inside the string.Make sure to use this function and don't test the string type another way to ensure compatibility and to write less error prone programs.
key | the key to check |
|
inline |
Name starts with "system".
true | if it is a system key |
false | otherwise |
|
inline |
Name starts with "user".
true | if it is a user key |
false | otherwise |
|
inline |
An invalid key has no name. The name of valid keys either start with user or system.
true | if the key has a valid name |
false | if the key has an invalid name |
|
inline |
Iterate to the next meta information.Keys have an internal cursor that can be reset with keyRewindMeta(). Every time keyNextMeta() is called the cursor is incremented and the new current Name of Meta Information is returned.You'll get a NULL pointer if the meta information after the end of the Key was reached. On subsequent calls of keyNextMeta() it will still return the NULL pointer.The key
internal cursor will be changed, so it is not const.
key | the key object to work with |
|
inline |
This is for loops and lookups only.
For loops it checks if there are still more keys. For lookups it checks if a key could be found.
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | != 0 |
|
inline |
Is a abbreviation for getKey.
Passes out the raw key pointer.This pointer can be used to directly change the underlying key object.
|
inline |
Increment the viability of a key object.This function is intended for applications using their own reference counter for key objects. With it you can increment the reference and thus avoid destruction of the object in a subsequent keyDel().
The reference counter can't be incremented once it reached SSIZE_MAX. In that situation nothing will happen and SSIZE_MAX will be returned.key | the key object to work with |
|
inline |
Increment the viability of a key object.This function is intended for applications using their own reference counter for key objects. With it you can increment the reference and thus avoid destruction of the object in a subsequent keyDel().
The reference counter can't be incremented once it reached SSIZE_MAX. In that situation nothing will happen and SSIZE_MAX will be returned.key | the key object to work with |
|
inline |
Add a new basename.
|
inline |
|
inline |
Decrement the viability of a key object.The references will be decremented for ksPop() or successful calls of ksLookup() with the option KDB_O_POP. It will also be decremented with an following keyDel() in the case that an old key is replaced with another key with the same name.The reference counter can't be decremented once it reached 0. In that situation nothing will happen and 0 will be returned.
key | the key object to work with |
|
inline |
Decrement the viability of a key object.The references will be decremented for ksPop() or successful calls of ksLookup() with the option KDB_O_POP. It will also be decremented with an following keyDel() in the case that an old key is replaced with another key with the same name.The reference counter can't be decremented once it reached 0. In that situation nothing will happen and 0 will be returned.
key | the key object to work with |
|
inline |
Set a new basename.
|
inline |
|
inline |
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | < 0 |
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | <= 0 |
|
inline |
Assign a C key.
Will call del() on the old key.
|
inline |
Assign the name of a key.
|
inline |
(const std::string &newName)
Assign a C key.Will call del() on the old key. (const std::string &newName)
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | == 0 |
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | > 0 |
|
inline |
Compare the name of two keys.
The comparison is based on a strcmp of the keynames, and iff they match a strcmp of the owner will be used to distuingish. If even this matches the keys are found to be exactly the same and 0 is returned. These two keys can't be used in the same KeySet.keyCmp() defines the sorting order for a KeySet.The following 3 points are the rules for null values. They only take account when none of the preceding rules matched.
Often is enough to know if the other key is less then or greater then the other one. But Sometimes you need more precise information, see keyRel().Given any Keys k1 and k2 constructed with keyNew(), following equation hold true:
k1 | the first key object to compare with |
k2 | the second key object to compare with |
true | >= 0 |
|
inline |
Passes out the raw key pointer.
The key will stay empty.
|
inline |
Rewind the internal iterator to first meta data.Use it to set the cursor to the beginning of the Key Meta Infos. keyCurrentMeta() will then always return NULL afterwards. So you want to keyNextMeta() first.
key | the key object to work with |
|
inline |
Set a key value.
Set the value for key
as newStringValue
.The function will allocate and save a private copy of newStringValue
, so the parameter can be freed after the call.String values will be saved in backend storage, when kdbSetKey() will be called, in UTF-8 universal encoding, regardless of the program's current encoding, when iconv plugin is present.
key | the key to set the string value |
newStringValue | NULL-terminated text string to be set as key's value |
1 | if newStringValue is a NULL pointer, this will make the string empty (string only containing null termination) |
-1 | if key is a NULL pointer |
This method tries to deserialise the string to the given type.
|
inline |
Sets a base name for a key.
Sets baseName
as the new basename for key
.All text after the last '/'
in the key
keyname is erased and baseName
is appended.So lets suppose key
has name "system/dir1/dir2/key1"
. If baseName
is "key2"
, the resulting key name will be "system/dir1/dir2/key2"
. If baseName
is empty or NULL, the resulting key name will be "system/dir1/dir2"
.
TODO: does not work with .. and .
key | the key object to work with |
baseName | the string used to overwrite the basename of the key |
KeyInvalidName | if the name is not valid |
|
inline |
Set the value of a key as a binary.A private copy of newBinary
will allocated and saved inside key
, so the parameter can be deallocated after the call.Binary values might be encoded in another way then string values depending on the plugin. Typically character encodings should not take place on binary data. Consider using a string key instead.When newBinary is a NULL pointer the binary will be freed and 0 will be returned.
key | the object on which to set the value |
newBinary | is a pointer to any binary data or NULL to free the previous set data |
dataSize | number of bytes to copy from newBinary |
|
inline |
Set metadata for key.
Set a new Meta-Information.Will set a new Meta-Information pair consisting of metaName and newMetaString.Will add a new Pair for Meta-Information if metaName was not added up to now.It will modify a existing Pair of Meta-Information if the the metaName was inserted already.It will remove a meta information if newMetaString is 0.
key | the key object to work with |
metaName | the name of the meta information where you want to change the value |
newMetaString | the new value for the meta information |
Use delMeta() to avoid these issues.
|
inline |
Set a new name to a key.A valid name is of the forms:
system/something
user/something
user:username/something
newName
parameter can be freed after this call..., . and / will be handled correctly. A valid name will be build out of the (valid) name what you pass, e.g. user///sw/../sw//././MyApp -> user/sw/MyAppOn invalid names, NULL or "" the name will be "" afterwards.size | in bytes of this new key name including ending NULL |
0 | if newName is an empty string or a NULL pointer (name will be empty afterwards) |
-1 | if newName is invalid (name will be empty afterwards) |
key | the key object to work with |
newName | the new key name |
KeyInvalidName | if the name is not valid |
|
inline |
Set the value for key
as newStringValue
.The function will allocate and save a private copy of newStringValue
, so the parameter can be freed after the call.String values will be saved in backend storage, when kdbSetKey() will be called, in UTF-8 universal encoding, regardless of the program's current encoding, when iconv plugin is present.
key | the key to set the string value |
newStringValue | NULL-terminated text string to be set as key's value |
1 | if newStringValue is a NULL pointer, this will make the string empty (string only containing null termination) |
-1 | if key is a NULL pointer |