| Elektra 0.11.0

Functions
keyset.c File Reference

Methods for key sets. More...

`#include "kdbprivate.h"`
`#include <kdb.h>`
`#include <stdio.h>`
`#include <kdbtypes.h>`
`#include "kdbinternal.h"`
`#include <kdbassert.h>`
`#include <kdbrand.h>`

## Functions
KeySet * | ksNew (size_t alloc,...)
| Allocate, initialize and return a new KeySet object.
KeySet * | ksVNew (size_t alloc, va_list va)
| Allocate, initialize and return a new KeySet object.
KeySet * | ksDup (const KeySet *source)
| Return a duplicate of a KeySet.
int | ksCopy (KeySet *dest, const KeySet *source)
| Replace the content of a KeySet with another one.
int | ksDel (KeySet *ks)
| A destructor for KeySet objects.
int | ksClear (KeySet *ks)
| Empties a KeySet.
uint16_t | ksIncRef (KeySet *ks)
| Increment the reference counter of a KeySet object.
uint16_t | ksDecRef (KeySet *ks)
| Decrement the reference counter of a KeySet object.
uint16_t | ksGetRef (const KeySet *ks)
| Return the current reference counter value of a KeySet object.
int | keyCmp (const Key *k1, const Key *k2)
| Compare the name of two Keys.
ssize_t | ksGetSize (const KeySet *ks)
| Return the number of Keys that `ks` contains.
ssize_t | ksSearch (const KeySet *ks, const Key *key)
| Search in a key set, either yielding the actual index of the key, if the key has been found within the key set, or a negative value indicating the insertion index of the key, if the key would be inserted.
ssize_t | ksAppendKey (KeySet *ks, Key *toAppend)
| Appends a Key to the end of `ks`.
ssize_t | ksAppend (KeySet *ks, const KeySet *toAppend)
| Append all Keys in `toAppend` to the end of the KeySet `ks`.
ssize_t | ksRename (KeySet *ks, const Key *root, const Key *newRoot)
| Moves all keys below `root` to below `newRoot`.
elektraCursor | ksFindHierarchy (const KeySet *ks, const Key *root, elektraCursor *end)
| Searches for the start and optionally end of the key hierarchy rooted at `root` in `ks`.
KeySet * | ksBelow (const KeySet *ks, const Key *root)
| Retrieves all Keys from KeySet `ks` that are below or at `root`.
KeySet * | ksCut (KeySet *ks, const Key *cutpoint)
| Cuts out all Keys from KeySet `ks` that are below or at `cutpoint`.
Key * | ksPop (KeySet *ks)
| Remove and return the last Key of `ks`.
int | ksRewind (KeySet *ks)
| Rewinds the KeySet internal cursor.
Key * | ksNext (KeySet *ks)
| Returns the next Key in a KeySet.
Key * | ksCurrent (const KeySet *ks)
| Return the current Key.
elektraCursor | ksGetCursor (const KeySet *ks)
| Get the internal cursor of the KeySet.
Key * | ksAtCursor (const KeySet *ks, elektraCursor pos)
| Return Key at given position `pos`.
int | ksSetCursor (KeySet *ks, elektraCursor cursor)
| Set the KeySet internal cursor to `cursor`.
Key * | ksLookup (KeySet *ks, Key *key, elektraLookupFlags options)
| Look for a Key contained in `ks` that matches the name of the `key`.
Key * | ksLookupByName (KeySet *ks, const char *name, elektraLookupFlags options)
| Convenience method to look for a Key contained in `ks` with name `name`.
ssize_t | ksSubtract (KeySet *total, const KeySet *sub)
| Remove all the keys in `sub` from `total`.

## Detailed Description

Methods for key sets.

Copyright
  BSD License (see LICENSE.md or https://www.libelektra.org)