Main Page | Modules | Data Structures | File List | Data Fields

Key :: Miscelaneous

Methods to do various things. More...

Functions

KeykeyNext (Key *key)
 Return a pointer to the next key, if key is member of a KeySet.
ssize_t keyToStream (const Key *key, FILE *stream, unsigned long options)
 Prints an XML representation of the key.
ssize_t keyToStreamBasename (const Key *key, FILE *stream, const char *parent, const size_t parentSize, unsigned long options)
 Same as keyToStream() but tries to strip parentSize bytes from key name if it matches parent .

Detailed Description

Methods to do various things.

To use them:

#include <kdb.h>

Function Documentation

Key* keyNext Key key  ) 
 

Return a pointer to the next key, if key is member of a KeySet.

Different from ksNext(), this call does not affect the KeySet internal cursor.

Definition at line 2221 of file key.c.

References _Key::next.

ssize_t keyToStream const Key key,
FILE *  stream,
unsigned long  options
 

Prints an XML representation of the key.

String generated is of the form:

	<key name="system/sw/XFree/Monitor/Monitor0/Name"
		type="string" uid="root" gid="root" mode="0660">

		<value>Samsung TFT panel</value>
		<comment>My monitor</comment>
	</key>

	<key parent="system/sw/XFree/Monitor/Monitor0" basename="Name"
		type="string" uid="root" gid="root" mode="0660">

		<value>Samsung TFT panel</value>
		<comment>My monitor</comment>
	</key>

Accepted options that can be ORed:

Parameters:
stream where to write output: a file or stdout
options Some KDBOptions ORed:
See also:
ksToStream()
Returns:
number of bytes written to output

Definition at line 2603 of file key.c.

References keyToStreamBasename().

Referenced by ksToStream().

ssize_t keyToStreamBasename const Key key,
FILE *  stream,
const char *  parent,
const size_t  parentSize,
unsigned long  options
 

Same as keyToStream() but tries to strip parentSize bytes from key name if it matches parent .

Taking the example from keyToStream(), if parent contains "system/sw/XFree", the generated string is of the form:

	<key basename="Monitor/Monitor0/Name"
		type="string" uid="root" gid="root" mode="0660">

		<value>Samsung TFT panel</value>
		<comment>My monitor</comment>
	</key>

This method is used when ksToStream() is called with KDBOption::KDB_O_HIER option.

Parameters:
parentSize the maximum size of parent that will be used. If 0, the entire parent will be used.
Returns:
number of bytes written to output

Definition at line 2633 of file key.c.

References _Key::access, _Key::comment, _Key::data, _Key::dataSize, encode(), _Key::gid, _Key::key, KEY_TYPE_BINARY, KEY_TYPE_DIR, KEY_TYPE_LINK, KEY_TYPE_STRING, KEY_TYPE_UNDEFINED, keyGetFullName(), keyIsUser(), strblen(), _Key::type, _Key::uid, and _Key::userDomain.

Referenced by keyToStream(), and ksToStream().


Generated on Sun Feb 19 10:05:37 2006 for Elektra Project by  doxygen 1.3.9.1