$darkmode
Elektra 0.11.0
Functions
conversion.c File Reference

Elektra High Level API. More...

#include "kdbease.h"
#include "kdbhelper.h"
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "macros/type_create_to_value.h"
Include dependency graph for conversion.c:

Functions

int elektraKeyToString (const Key *key, const char **variable)
 Converts a Key to string. More...
 
int elektraKeyToBoolean (const Key *key, kdb_boolean_t *variable)
 Converts a Key to boolean. More...
 
int elektraKeyToChar (const Key *key, kdb_char_t *variable)
 Converts a Key to char. More...
 
int elektraKeyToOctet (const Key *key, kdb_octet_t *variable)
 Converts a Key to octet. More...
 
int elektraKeyToShort (const Key *key, kdb_short_t *variable)
 Converts a Key to short. More...
 
int elektraKeyToUnsignedShort (const Key *key, kdb_unsigned_short_t *variable)
 Converts a Key to unsigned_short. More...
 
int elektraKeyToLong (const Key *key, kdb_long_t *variable)
 Converts a Key to long. More...
 
int elektraKeyToUnsignedLong (const Key *key, kdb_unsigned_long_t *variable)
 Converts a Key to unsigned_long. More...
 
int elektraKeyToLongLong (const Key *key, kdb_long_long_t *variable)
 Converts a Key to long_long. More...
 
int elektraKeyToUnsignedLongLong (const Key *key, kdb_unsigned_long_long_t *variable)
 Converts a Key to unsigned_long_long. More...
 
int elektraKeyToFloat (const Key *key, kdb_float_t *variable)
 Converts a Key to float. More...
 
int elektraKeyToDouble (const Key *key, kdb_double_t *variable)
 Converts a Key to double. More...
 
char * elektraBooleanToString (kdb_boolean_t value)
 Converts a boolean to string. More...
 
char * elektraCharToString (kdb_char_t value)
 Converts a char to string. More...
 
char * elektraOctetToString (kdb_octet_t value)
 Converts an octet to string. More...
 
char * elektraShortToString (kdb_short_t value)
 Converts a short to string. More...
 
char * elektraUnsignedShortToString (kdb_unsigned_short_t value)
 Converts an unsigned short to string. More...
 
char * elektraLongToString (kdb_long_t value)
 Converts a long to string. More...
 
char * elektraUnsignedLongToString (kdb_unsigned_long_t value)
 Converts an unsigned long to string. More...
 
char * elektraLongLongToString (kdb_long_long_t value)
 Converts a long long to string. More...
 
char * elektraUnsignedLongLongToString (kdb_unsigned_long_long_t value)
 Converts an unsigned long long to string. More...
 
char * elektraFloatToString (kdb_float_t value)
 Converts a float to string. More...
 
char * elektraDoubleToString (kdb_double_t value)
 Converts a double to string. More...
 

Detailed Description

Elektra High Level API.

Function Documentation

◆ elektraBooleanToString()

char* elektraBooleanToString ( kdb_boolean_t  value)

Converts a boolean to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe boolean to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraCharToString()

char* elektraCharToString ( kdb_char_t  value)

Converts a char to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraDoubleToString()

char* elektraDoubleToString ( kdb_double_t  value)

Converts a double to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraFloatToString()

char* elektraFloatToString ( kdb_float_t  value)

Converts a float to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraKeyToBoolean()

int elektraKeyToBoolean ( const Key *  key,
kdb_boolean_t *  variable 
)

Converts a Key to boolean.

The value "1" is regarded as true, anything is as false.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToChar()

int elektraKeyToChar ( const Key *  key,
kdb_char_t *  variable 
)

Converts a Key to char.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToDouble()

int elektraKeyToDouble ( const Key *  key,
kdb_double_t *  variable 
)

Converts a Key to double.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToFloat()

int elektraKeyToFloat ( const Key *  key,
kdb_float_t *  variable 
)

Converts a Key to float.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToLong()

int elektraKeyToLong ( const Key *  key,
kdb_long_t *  variable 
)

Converts a Key to long.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToLongLong()

int elektraKeyToLongLong ( const Key *  key,
kdb_long_long_t *  variable 
)

Converts a Key to long_long.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToOctet()

int elektraKeyToOctet ( const Key *  key,
kdb_octet_t *  variable 
)

Converts a Key to octet.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToShort()

int elektraKeyToShort ( const Key *  key,
kdb_short_t *  variable 
)

Converts a Key to short.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToString()

int elektraKeyToString ( const Key *  key,
const char **  variable 
)

Converts a Key to string.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToUnsignedLong()

int elektraKeyToUnsignedLong ( const Key *  key,
kdb_unsigned_long_t *  variable 
)

Converts a Key to unsigned_long.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToUnsignedLongLong()

int elektraKeyToUnsignedLongLong ( const Key *  key,
kdb_unsigned_long_long_t *  variable 
)

Converts a Key to unsigned_long_long.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraKeyToUnsignedShort()

int elektraKeyToUnsignedShort ( const Key *  key,
kdb_unsigned_short_t *  variable 
)

Converts a Key to unsigned_short.

The variable pointed to by variable is unchanged, if an error occurs.

Parameters
keythe key to convert
variablepointer to the output variable
Return values
1on success
0otherwise

◆ elektraLongLongToString()

char* elektraLongLongToString ( kdb_long_long_t  value)

Converts a long long to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraLongToString()

char* elektraLongToString ( kdb_long_t  value)

Converts a long to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraOctetToString()

char* elektraOctetToString ( kdb_octet_t  value)

Converts an octet to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraShortToString()

char* elektraShortToString ( kdb_short_t  value)

Converts a short to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraUnsignedLongLongToString()

char* elektraUnsignedLongLongToString ( kdb_unsigned_long_long_t  value)

Converts an unsigned long long to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraUnsignedLongToString()

char* elektraUnsignedLongToString ( kdb_unsigned_long_t  value)

Converts an unsigned long to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error

◆ elektraUnsignedShortToString()

char* elektraUnsignedShortToString ( kdb_unsigned_short_t  value)

Converts an unsigned short to string.

The string is allocated with elektraMalloc() and must be disposed of with elektraFree().

Parameters
valuethe value to convert
Returns
a new string allocated with elektraMalloc, or 0 on error