libamxc  1.10.3
C Generic Data Containers
amxc_variant.h File Reference

Ambiorix variant API header file. More...

#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <amxc/amxc_htable.h>
#include <amxc/amxc_llist.h>
#include <amxc/amxc_string.h>
#include <amxc/amxc_timestamp.h>
#include <amxc/amxc_common.h>

Go to the source code of this file.

Data Structures

struct  _amxc_var
 The variant struct definition. More...
 

Macros

#define AMXC_VAR_ID_INVALID   UINT32_MAX
 Invalid variant type id. More...
 
#define AMXC_VAR_ID_NULL   0
 Null variant type id (aka void) More...
 
#define AMXC_VAR_ID_CSTRING   1
 C-string variant id (aka char *), null terminated string. More...
 
#define AMXC_VAR_ID_INT8   2
 Signed 8 bit integer variant id. More...
 
#define AMXC_VAR_ID_INT16   3
 Signed 16 bit integer variant id. More...
 
#define AMXC_VAR_ID_INT32   4
 Signed 32 bit integer variant id. More...
 
#define AMXC_VAR_ID_INT64   5
 Signed 64 bit integer variant id. More...
 
#define AMXC_VAR_ID_UINT8   6
 Unsigned 8 bit integer variant id. More...
 
#define AMXC_VAR_ID_UINT16   7
 Unsigned 16 bit integer variant id. More...
 
#define AMXC_VAR_ID_UINT32   8
 Unsigned 32 bit integer variant id. More...
 
#define AMXC_VAR_ID_UINT64   9
 Unsigned 64 bit integer variant id. More...
 
#define AMXC_VAR_ID_FLOAT   10
 Float variant id. More...
 
#define AMXC_VAR_ID_DOUBLE   11
 Double variant id. More...
 
#define AMXC_VAR_ID_BOOL   12
 Boolean variant id. More...
 
#define AMXC_VAR_ID_LIST   13
 Ambiorix Linked List variant id. More...
 
#define AMXC_VAR_ID_HTABLE   14
 Ambiorix Hash Table variant id. More...
 
#define AMXC_VAR_ID_FD   15
 File descriptor variant id. More...
 
#define AMXC_VAR_ID_TIMESTAMP   16
 Ambiorix timestamp variant id. More...
 
#define AMXC_VAR_ID_CSV_STRING   17
 Comma Separated Values string variant id. More...
 
#define AMXC_VAR_ID_SSV_STRING   18
 Space Separated Values string variant id. More...
 
#define AMXC_VAR_ID_ANY   19
 Special variant id, typically used in cast or conversion functions. More...
 
#define AMXC_VAR_ID_CUSTOM_BASE   20
 Base variant id for custom variants. More...
 
#define AMXC_VAR_ID_MAX   UINT32_MAX
 Same as AMXC_VAR_ID_INVALID. More...
 
#define AMXC_VAR_NAME_NULL   "null"
 Provides a name for variant id AMXC_VAR_ID_NULL. More...
 
#define AMXC_VAR_NAME_CSTRING   "cstring_t"
 Provides a name for variant id AMXC_VAR_ID_CSTRING. More...
 
#define AMXC_VAR_NAME_INT8   "int8_t"
 Provides a name for variant id AMXC_VAR_ID_INT8. More...
 
#define AMXC_VAR_NAME_INT16   "int16_t"
 Provides a name for variant id AMXC_VAR_ID_INT16. More...
 
#define AMXC_VAR_NAME_INT32   "int32_t"
 Provides a name for variant id AMXC_VAR_ID_INT32. More...
 
#define AMXC_VAR_NAME_INT64   "int64_t"
 Provides a name for variant id AMXC_VAR_ID_INT64. More...
 
#define AMXC_VAR_NAME_UINT8   "uint8_t"
 Provides a name for variant id AMXC_VAR_ID_UINT8. More...
 
#define AMXC_VAR_NAME_UINT16   "uint16_t"
 Provides a name for variant id AMXC_VAR_ID_UINT16. More...
 
#define AMXC_VAR_NAME_UINT32   "uint32_t"
 Provides a name for variant id AMXC_VAR_ID_UINT32. More...
 
#define AMXC_VAR_NAME_UINT64   "uint64_t"
 Provides a name for variant id AMXC_VAR_ID_UINT64. More...
 
#define AMXC_VAR_NAME_FLOAT   "float"
 Provides a name for variant id AMXC_VAR_ID_FLOAT. More...
 
#define AMXC_VAR_NAME_DOUBLE   "double"
 Provides a name for variant id AMXC_VAR_ID_DOUBLE. More...
 
#define AMXC_VAR_NAME_BOOL   "bool"
 Provides a name for variant id AMXC_VAR_ID_BOOL. More...
 
#define AMXC_VAR_NAME_LIST   "amxc_llist_t"
 Provides a name for variant id AMXC_VAR_ID_LIST. More...
 
#define AMXC_VAR_NAME_HTABLE   "amxc_htable_t"
 Provides a name for variant id AMXC_VAR_ID_HTABLE. More...
 
#define AMXC_VAR_NAME_FD   "fd_t"
 Provides a name for variant id AMXC_VAR_ID_FD. More...
 
#define AMXC_VAR_NAME_TIMESTAMP   "amxc_ts_t"
 Provides a name for variant id AMXC_VAR_ID_TIMESTAMP. More...
 
#define AMXC_VAR_NAME_CSV_STRING   "csv_string_t"
 Provides a name for variant id AMXC_VAR_ID_CSV_STRING. More...
 
#define AMXC_VAR_NAME_SSV_STRING   "ssv_string_t"
 Provides a name for variant id AMXC_VAR_ID_SSV_STRING. More...
 
#define AMXC_VAR_FLAG_DEFAULT   0x00
 The default flag, do not copy, use variant as is. More...
 
#define AMXC_VAR_FLAG_COPY   0x01
 Copy the variant, creates a new variant, leaves the source variant untouched. More...
 
#define AMXC_VAR_FLAG_UPDATE   0x02
 Replaces the value of the variant, leaves the source variant untouched. More...
 
#define AMXC_VAR_FLAG_NO_INDEX   0x04
 Only search by key and not by index. This flag can be used with amxc_var_get_path function. More...
 
#define AMXC_VAR_FLAG_AUTO_ADD   0x08
 Add none existing variants to composite variants. This flag can be used with amxc_var_set_path and amxc_var_set_pathf functions. More...
 
#define GET_ARG(a, n)   amxc_var_get_key(a, n, AMXC_VAR_FLAG_DEFAULT)
 Convenience macro for getting variant out of a composite variant by key. More...
 
#define GET_BOOL(a, n)   amxc_var_dyncast(bool, n == NULL ? a : GET_ARG(a, n))
 Convenience macro for getting a bool out of a composite variant by key. More...
 
#define GET_CHAR(a, n)   amxc_var_constcast(cstring_t, n == NULL ? a : GET_ARG(a, n))
 Convenience macro for getting a char* out of a composite variant by key. More...
 
#define GET_UINT32(a, n)   amxc_var_dyncast(uint32_t, n == NULL ? a : GET_ARG(a, n))
 Convenience macro for getting a uint32_t out of a composite variant by key. More...
 
#define GET_INT32(a, n)   amxc_var_dyncast(int32_t, n == NULL ? a : GET_ARG(a, n))
 Convenience macro for getting a int32_t out of a composite variant by key. More...
 
#define GETI_ARG(a, i)   amxc_var_get_index(a, i, AMXC_VAR_FLAG_DEFAULT)
 Convenience macro for getting variant out of a composite variant by index. More...
 
#define GETI_BOOL(a, i)   amxc_var_dyncast(bool, GETI_ARG(a, i))
 Convenience macro for getting a bool out of a composite variant by index. More...
 
#define GETI_CHAR(a, i)   amxc_var_constcast(cstring_t, GETI_ARG(a, i))
 Convenience macro for getting a char* out of a composite variant by index. More...
 
#define GETI_UINT32(a, i)   amxc_var_dyncast(uint32_t, GETI_ARG(a, i))
 Convenience macro for getting a uint32_t out of a composite variant by index. More...
 
#define GETI_INT32(a, i)   amxc_var_dyncast(int32_t, GETI_ARG(a, i))
 Convenience macro for getting a int32_t out of a composite variant by index. More...
 
#define GETP_ARG(a, p)   amxc_var_get_path(a, p, AMXC_VAR_FLAG_DEFAULT)
 Convenience macro for getting variant out of a composite variant by path. More...
 
#define GETP_BOOL(a, p)   amxc_var_dyncast(bool, p == NULL ? a : GETP_ARG(a, p))
 Convenience macro for getting a bool out of a composite variant by path. More...
 
#define GETP_CHAR(a, p)   amxc_var_constcast(cstring_t, p == NULL ? a : GETP_ARG(a, p))
 Convenience macro for getting a string out of a composite variant by path. More...
 
#define GETP_UINT32(a, p)   amxc_var_dyncast(uint32_t, p == NULL ? a : GETP_ARG(a, p))
 Convenience macro for getting a uint32 out of a composite variant by path. More...
 
#define GETP_INT32(a, p)   amxc_var_dyncast(int32_t, p == NULL ? a : GETP_ARG(a, p))
 Convenience macro for getting a int32 out of a composite variant by path. More...
 
#define cstring_t   char*
 Convenience macro. More...
 
#define csv_string_t   char*
 Convenience macro. More...
 
#define ssv_string_t   char*
 Convenience macro. More...
 
#define fd_t   int
 Convenience macro. More...
 
#define amxc_var_set(type, var, data)   amxc_var_set_ ## type(var, data)
 Convenience macro for setting a value in a variant. More...
 
#define amxc_var_add(type, var, data)   amxc_var_add_new_ ## type(var, data)
 Convenience macro for adding a variant to composite variant type. More...
 
#define amxc_var_add_key(type, var, key, data)   amxc_var_add_new_key_ ## type(var, key, data)
 Convenience macro for adding a variant to composite variant type. More...
 
#define amxc_var_dyncast(type, var)   amxc_var_get_ ## type(var)
 Dynamic cast a variant to a certain type. More...
 
#define amxc_var_constcast(type, var)   amxc_var_get_const_ ## type(var)
 Takes the content from a variant. More...
 
#define amxc_var_take(type, var)   amxc_var_take_ ## type(var)
 Takes the content from a variant. More...
 
#define amxc_var_push(type, var, val)   amxc_var_push_ ## type(var, val)
 Pushes a value into the variant. More...
 
#define amxc_var_from_htable_it(ht_it)    ((amxc_var_t*) (((char*) ht_it) - offsetof(amxc_var_t, hit)))
 Get the variant pointer from an amxc htable iterator. More...
 
#define amxc_var_from_llist_it(ll_it)    ((amxc_var_t*) (((char*) ll_it) - offsetof(amxc_var_t, lit)))
 Get the variant pointer from an amxc linked list iterator. More...
 
#define amxc_var_for_each(var, var_list)
 When the variant is a htable or list variant, iterates over the variants in the htable or list. More...
 
#define amxc_var_for_each_reverse(var, var_list)
 When the variant is a htable or list variant, iterates over the variants in reverse order. More...
 

Typedefs

typedef struct _amxc_var amxc_var_t
 The variant struct definition. More...
 

Functions

int amxc_var_new (amxc_var_t **var)
 Allocates a variant and initializes it to the null variant type. More...
 
void amxc_var_delete (amxc_var_t **var)
 Frees the previously allocated variant. More...
 
int amxc_var_init (amxc_var_t *const var)
 Initializes a variant. More...
 
void amxc_var_clean (amxc_var_t *const var)
 Clean-up and reset variant. More...
 
int amxc_var_set_type (amxc_var_t *const var, const uint32_t type)
 Change the variant data type. More...
 
int amxc_var_copy (amxc_var_t *const dest, const amxc_var_t *const src)
 Copy the type and data from one variant (source) in another variant (destination). More...
 
int amxc_var_move (amxc_var_t *const dest, amxc_var_t *const src)
 Moves the type and data from one variant (source) in another variant (destination). More...
 
int amxc_var_convert (amxc_var_t *const dest, const amxc_var_t *src, const uint32_t type_id)
 Converts one variant (source) to another variant(destination) using the specified variant type id. More...
 
int amxc_var_cast (amxc_var_t *const var, const uint32_t type_id)
 Casts the variant to another variant type id. More...
 
int amxc_var_compare (const amxc_var_t *const var1, const amxc_var_t *const var2, int *const result)
 Compares two variants. More...
 
AMXC_INLINE void amxc_var_take_it (amxc_var_t *const var)
 Removes the variant for a llist and/or a htable. More...
 
amxc_var_tamxc_var_get_key (const amxc_var_t *const var, const char *const key, const int flags)
 Get a reference to a part of composed variant using a key. More...
 
int amxc_var_set_key (amxc_var_t *const var, const char *const key, amxc_var_t *data, const int flags)
 Sets a part of composed variant using a key. More...
 
AMXC_INLINE amxc_var_tamxc_var_take_key (amxc_var_t *const var, const char *const key)
 Get a reference to a part of composed variant using a key and removes it from the composed variant. More...
 
amxc_var_tamxc_var_get_index (const amxc_var_t *const var, const int64_t index, const int flags)
 Get a reference to a part of composed variant using an index. More...
 
int amxc_var_set_index (amxc_var_t *const var, const int64_t index, amxc_var_t *data, const int flags)
 Set a part of composed variant using an index. More...
 
AMXC_INLINE amxc_var_tamxc_var_take_index (amxc_var_t *const var, const int64_t index)
 Get a reference to a part of composed variant using an index and removes it from the composed variant. More...
 
amxc_var_tamxc_var_add_new_key (amxc_var_t *const var, const char *key)
 Adds a new variant with a key to a composite variant. More...
 
amxc_var_tamxc_var_add_new (amxc_var_t *const var)
 Adds a new variant to a composite variant. More...
 
amxc_var_tamxc_var_get_path (const amxc_var_t *const var, const char *const path, const int flags)
 Retrieves the variant at the given path of a composite variant. More...
 
amxc_var_tamxc_var_get_pathf (const amxc_var_t *const var, const int flags, const char *const fmt,...) __attribute__((format(printf
 Retrieves the variant at the given path of a composite variant. More...
 
amxc_var_t int amxc_var_set_path (amxc_var_t *const var, const char *const path, amxc_var_t *data, const int flags)
 Sets the variant at the given path of a composite variant. More...
 
int amxc_var_set_pathf (amxc_var_t *const var, amxc_var_t *data, const int flags, const char *const fmt,...) __attribute__((format(printf
 Sets the variant at the given path of a composite variant. More...
 
int amxc_var_tamxc_var_get_first (const amxc_var_t *const var)
 Gets the first variant in a htable or list variant. More...
 
amxc_var_tamxc_var_get_last (const amxc_var_t *const var)
 Gets the last variant in a htable or list variant. More...
 
amxc_var_tamxc_var_get_next (const amxc_var_t *const var)
 Gets the next variant. More...
 
amxc_var_tamxc_var_get_previous (const amxc_var_t *const var)
 Gets the previous variant. More...
 
amxc_var_tamxc_var_get_parent (const amxc_var_t *const var)
 Gets the containing variant. More...
 
const char * amxc_var_key (const amxc_var_t *const var)
 Gets the key, with which the variant is stored in a htable variant. More...
 
uint32_t amxc_var_type_of (const amxc_var_t *const var)
 Gets the variant type id of a variant. More...
 
const char * amxc_var_type_name_of (const amxc_var_t *const var)
 Gets the variant type name of a variant. More...
 
AMXC_INLINE bool amxc_var_is_null (const amxc_var_t *const var)
 Checks if the given variant is of the "null" type. More...
 
void variant_list_it_free (amxc_llist_it_t *it)
 Helper functions, can be used as delete function for linked lists. More...
 
void variant_htable_it_free (const char *key, amxc_htable_it_t *it)
 Helper functions, can be used as delete function for htable. More...
 
int amxc_var_dump (const amxc_var_t *const var, int fd)
 Dumps the content of the variant in a human readable manner. More...
 
int amxc_var_dump_stream (const amxc_var_t *const var, FILE *stream)
 Dumps the content of the variant in a human readable manner. More...
 
int amxc_var_log (const amxc_var_t *const var)
 Logs the content of the variant in a human readable manner to syslog. More...
 
int amxc_var_set_bool (amxc_var_t *const var, bool boolean)
 Setter helper function. More...
 
int amxc_var_set_int8_t (amxc_var_t *const var, int8_t val)
 Setter helper function. More...
 
int amxc_var_set_uint8_t (amxc_var_t *const var, uint8_t val)
 Setter helper function. More...
 
int amxc_var_set_int16_t (amxc_var_t *const var, int16_t val)
 Setter helper function. More...
 
int amxc_var_set_uint16_t (amxc_var_t *const var, uint16_t val)
 Setter helper function. More...
 
int amxc_var_set_int32_t (amxc_var_t *const var, int32_t val)
 Setter helper function. More...
 
int amxc_var_set_uint32_t (amxc_var_t *const var, uint32_t val)
 Setter helper function. More...
 
int amxc_var_set_int64_t (amxc_var_t *const var, int64_t val)
 Setter helper function. More...
 
int amxc_var_set_uint64_t (amxc_var_t *const var, uint64_t val)
 Setter helper function. More...
 
int amxc_var_set_cstring_t (amxc_var_t *const var, const char *const val)
 Setter helper function. More...
 
int amxc_var_set_csv_string_t (amxc_var_t *const var, const char *const val)
 Setter helper function. More...
 
int amxc_var_set_ssv_string_t (amxc_var_t *const var, const char *const val)
 Setter helper function. More...
 
int amxc_var_set_double (amxc_var_t *var, double val)
 Setter helper function. More...
 
int amxc_var_set_fd_t (amxc_var_t *var, int val)
 Setter helper function. More...
 
int amxc_var_set_amxc_ts_t (amxc_var_t *var, amxc_ts_t *val)
 Setter helper function. More...
 
bool amxc_var_get_bool (const amxc_var_t *const var)
 Conversion helper function. More...
 
int8_t amxc_var_get_int8_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint8_t amxc_var_get_uint8_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
int16_t amxc_var_get_int16_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint16_t amxc_var_get_uint16_t (const amxc_var_t *var)
 Conversion helper function. More...
 
int32_t amxc_var_get_int32_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint32_t amxc_var_get_uint32_t (const amxc_var_t *var)
 Conversion helper function. More...
 
int64_t amxc_var_get_int64_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint64_t amxc_var_get_uint64_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
char * amxc_var_get_cstring_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
amxc_htable_tamxc_var_get_amxc_htable_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
amxc_llist_tamxc_var_get_amxc_llist_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
double amxc_var_get_double (const amxc_var_t *var)
 Conversion helper function. More...
 
int amxc_var_get_fd_t (const amxc_var_t *var)
 Conversion helper function. More...
 
amxc_ts_tamxc_var_get_amxc_ts_t (const amxc_var_t *var)
 Conversion helper function. More...
 
AMXC_INLINE char * amxc_var_get_csv_string_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
AMXC_INLINE char * amxc_var_get_ssv_string_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
const char * amxc_var_get_const_cstring_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
const amxc_htable_tamxc_var_get_const_amxc_htable_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
const amxc_llist_tamxc_var_get_const_amxc_llist_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
bool amxc_var_get_const_bool (const amxc_var_t *const var)
 Conversion helper function. More...
 
int8_t amxc_var_get_const_int8_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
int16_t amxc_var_get_const_int16_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
int32_t amxc_var_get_const_int32_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
int64_t amxc_var_get_const_int64_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint8_t amxc_var_get_const_uint8_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint16_t amxc_var_get_const_uint16_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint32_t amxc_var_get_const_uint32_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
uint64_t amxc_var_get_const_uint64_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
double amxc_var_get_const_double (const amxc_var_t *const var)
 Conversion helper function. More...
 
int amxc_var_get_const_fd_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
const amxc_ts_tamxc_var_get_const_amxc_ts_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
AMXC_INLINE const char * amxc_var_get_const_csv_string_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
AMXC_INLINE const char * amxc_var_get_const_ssv_string_t (const amxc_var_t *const var)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_bool (amxc_var_t *const var, bool boolean)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_int8_t (amxc_var_t *const var, int8_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_uint8_t (amxc_var_t *const var, uint8_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_int16_t (amxc_var_t *const var, int16_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_uint16_t (amxc_var_t *const var, uint16_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_int32_t (amxc_var_t *const var, int32_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_uint32_t (amxc_var_t *const var, uint32_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_int64_t (amxc_var_t *const var, int64_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_uint64_t (amxc_var_t *const var, uint64_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_cstring_t (amxc_var_t *const var, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_csv_string_t (amxc_var_t *const var, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_ssv_string_t (amxc_var_t *const var, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_double (amxc_var_t *const var, double val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_fd_t (amxc_var_t *const var, int val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_amxc_ts_t (amxc_var_t *const var, amxc_ts_t *ts)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_amxc_llist_t (amxc_var_t *const var, const amxc_llist_t *list)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_amxc_htable_t (amxc_var_t *const var, const amxc_htable_t *htable)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_bool (amxc_var_t *const var, const char *key, bool boolean)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_int8_t (amxc_var_t *const var, const char *key, int8_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_uint8_t (amxc_var_t *const var, const char *key, uint8_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_int16_t (amxc_var_t *const var, const char *key, int16_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_uint16_t (amxc_var_t *const var, const char *key, uint16_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_int32_t (amxc_var_t *const var, const char *key, int32_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_uint32_t (amxc_var_t *const var, const char *key, uint32_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_int64_t (amxc_var_t *const var, const char *key, int64_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_uint64_t (amxc_var_t *const var, const char *key, uint64_t val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_cstring_t (amxc_var_t *const var, const char *key, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_csv_string_t (amxc_var_t *const var, const char *key, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_ssv_string_t (amxc_var_t *const var, const char *key, const char *const val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_double (amxc_var_t *const var, const char *key, double val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_fd_t (amxc_var_t *const var, const char *key, int val)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_amxc_ts_t (amxc_var_t *const var, const char *key, amxc_ts_t *ts)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_amxc_llist_t (amxc_var_t *const var, const char *key, const amxc_llist_t *list)
 Conversion helper function. More...
 
amxc_var_tamxc_var_add_new_key_amxc_htable_t (amxc_var_t *const var, const char *key, const amxc_htable_t *htable)
 Conversion helper function. More...
 
char * amxc_var_take_cstring_t (amxc_var_t *const var)
 Takes a value from a variant. More...
 
amxc_string_tamxc_var_take_amxc_string_t (amxc_var_t *const var)
 Takes a value from a variant. More...
 
AMXC_INLINE char * amxc_var_take_csv_string_t (amxc_var_t *const var)
 Takes a value from a variant. More...
 
AMXC_INLINE char * amxc_var_take_ssv_string_t (amxc_var_t *const var)
 Takes a value from a variant. More...
 
int amxc_var_push_cstring_t (amxc_var_t *const var, char *val)
 Pushes a value in a variant. More...
 
int amxc_var_push_csv_string_t (amxc_var_t *const var, char *val)
 Pushes a value in a variant. More...
 
int amxc_var_push_ssv_string_t (amxc_var_t *const var, char *val)
 Pushes a value in a variant. More...
 
int amxc_var_push_amxc_string_t (amxc_var_t *const var, amxc_string_t *val)
 Pushes a value in a variant. More...
 

Detailed Description

Ambiorix variant API header file.

Definition in file amxc_variant.h.

Macro Definition Documentation

◆ amxc_var_from_htable_it

#define amxc_var_from_htable_it (   ht_it)     ((amxc_var_t*) (((char*) ht_it) - offsetof(amxc_var_t, hit)))

Get the variant pointer from an amxc htable iterator.

The htable iterator given, must be an amxc htable iterator of a variant.

Gives the pointer to the variant.

Definition at line 790 of file amxc_variant.h.

◆ amxc_var_from_llist_it

#define amxc_var_from_llist_it (   ll_it)     ((amxc_var_t*) (((char*) ll_it) - offsetof(amxc_var_t, lit)))

Get the variant pointer from an amxc linked list iterator.

The linked list iterator given, must be a linked list iterator of a variant.

Definition at line 799 of file amxc_variant.h.

◆ cstring_t

#define cstring_t   char*

Convenience macro.

Definition at line 584 of file amxc_variant.h.

◆ csv_string_t

#define csv_string_t   char*

Convenience macro.

Definition at line 589 of file amxc_variant.h.

◆ fd_t

#define fd_t   int

Convenience macro.

Definition at line 600 of file amxc_variant.h.

◆ ssv_string_t

#define ssv_string_t   char*

Convenience macro.

Definition at line 594 of file amxc_variant.h.