Elektra  0.9.9
Functions
proposal.c File Reference

Implementation of proposed API enhancements. More...

#include <string.h>
#include <kdbprivate.h>
Include dependency graph for proposal.c:

Functions

Key * elektraKsPopAtCursor (KeySet *ks, elektraCursor pos)
 Pop key at given cursor position. More...
 

Detailed Description

Implementation of proposed API enhancements.

Function Documentation

◆ elektraKsPopAtCursor()

Key* elektraKsPopAtCursor ( KeySet *  ks,
elektraCursor  pos 
)

Pop key at given cursor position.

Parameters
ksthe keyset to pop key from
cwhere to pop

The internal cursor will be rewinded using ksRewind(). You can use ksGetCursor() and ksSetCursor() jump back to the previous position. e.g. to pop at current position within ksNext() loop:

cursor_t c = ksGetCursor(ks);
ksSetCursor(ks, c);
ksPrev(ks); // to have correct key after next ksNext()
int keyDel(Key *key)
A destructor for Key objects.
Definition: key.c:482
int ksSetCursor(KeySet *ks, elektraCursor cursor)
Set the KeySet internal cursor to cursor.
Definition: keyset.c:1862
elektraCursor ksGetCursor(const KeySet *ks)
Get the internal cursor of the KeySet.
Definition: keyset.c:1791
Key * elektraKsPopAtCursor(KeySet *ks, elektraCursor pos)
Pop key at given cursor position.
Definition: proposal.c:35
Warning
do not use, will be superseded by external iterator API
Returns
the popped key
Return values
0if ks is 0