Data Structures | Macros | Functions
Generic Value Type management

Data Structures

struct  _Eina_Value_Type
 API to access values. More...
 

Macros

#define EINA_VALUE_TYPE_VERSION   (1)
 Current API version, used to validate type.
 

Functions

EINA_API const char * eina_value_type_name_get (const Eina_Value_Type *type)
 Queries type name. More...
 
EINA_API Eina_Bool eina_value_type_check (const Eina_Value_Type *type)
 Checks if type is valid. More...
 
static Eina_Bool eina_value_type_setup (const Eina_Value_Type *type, void *mem)
 Initializes memory using type descriptor. More...
 
static Eina_Bool eina_value_type_flush (const Eina_Value_Type *type, void *mem)
 Flushes (clears) memory using type descriptor. More...
 
static Eina_Bool eina_value_type_copy (const Eina_Value_Type *type, const void *src, void *dst)
 Copies memory using type descriptor. More...
 
static int eina_value_type_compare (const Eina_Value_Type *type, const void *a, const void *b)
 Compares memory using type descriptor. More...
 
static Eina_Bool eina_value_type_convert_to (const Eina_Value_Type *type, const Eina_Value_Type *convert, const void *type_mem, void *convert_mem)
 Converts memory using type descriptor. More...
 
static Eina_Bool eina_value_type_convert_from (const Eina_Value_Type *type, const Eina_Value_Type *convert, void *type_mem, const void *convert_mem)
 Converts memory using type descriptor. More...
 
static Eina_Bool eina_value_type_vset (const Eina_Value_Type *type, void *mem, va_list args)
 Sets memory using type descriptor and variable argument. More...
 
static Eina_Bool eina_value_type_pset (const Eina_Value_Type *type, void *mem, const void *ptr)
 Sets memory using type descriptor and pointer. More...
 
static Eina_Bool eina_value_type_pget (const Eina_Value_Type *type, const void *mem, void *ptr)
 Gets memory using type descriptor. More...
 

Detailed Description

Function Documentation

◆ eina_value_type_name_get()

EINA_API const char * eina_value_type_name_get ( const Eina_Value_Type type)

Queries type name.

Parameters
[in]typetype reference.
Returns
string or NULL if type is invalid.
Since
1.2

References EINA_SAFETY_ON_FALSE_RETURN_VAL, and eina_value_type_check().

◆ eina_value_type_check()

EINA_API Eina_Bool eina_value_type_check ( const Eina_Value_Type type)

Checks if type is valid.

Parameters
[in]typeType reference.
Returns
EINA_TRUE if valid, EINA_FALSE otherwise.

A type is invalid if it's NULL or if version field is not the same as runtime EINA_VALUE_TYPE_VERSION.

Since
1.2

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_VALUE_TYPE_VERSION.

Referenced by eina_value_array_new(), eina_value_convert(), eina_value_copy(), eina_value_hash_new(), eina_value_list_new(), eina_value_to_string(), and eina_value_type_name_get().

◆ eina_value_type_setup()

static Eina_Bool eina_value_type_setup ( const Eina_Value_Type type,
void *  mem 
)
inlinestatic

Initializes memory using type descriptor.

Parameters
[in]typetype reference.
[out]memmemory to operate, must be of size type->value_size.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_flush()

static Eina_Bool eina_value_type_flush ( const Eina_Value_Type type,
void *  mem 
)
inlinestatic

Flushes (clears) memory using type descriptor.

Parameters
[in]typetype reference.
[out]memmemory to operate, must be of size type->value_size.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_copy()

static Eina_Bool eina_value_type_copy ( const Eina_Value_Type type,
const void *  src,
void *  dst 
)
inlinestatic

Copies memory using type descriptor.

Parameters
[in]typetype reference.
[in]srcmemory to operate, must be of size type->value_size.
[out]dstmemory to operate, must be of size type->value_size.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_compare()

static int eina_value_type_compare ( const Eina_Value_Type type,
const void *  a,
const void *  b 
)
inlinestatic

Compares memory using type descriptor.

Parameters
[in]typetype reference.
[in]amemory to operate, must be of size type->value_size.
[in]bmemory to operate, must be of size type->value_size.
Returns
less than zero if a < b, greater than zero if a > b, zero if equal.
Since
1.2

◆ eina_value_type_convert_to()

static Eina_Bool eina_value_type_convert_to ( const Eina_Value_Type type,
const Eina_Value_Type convert,
const void *  type_mem,
void *  convert_mem 
)
inlinestatic

Converts memory using type descriptor.

Parameters
[in]typetype reference of the source.
[in]converttype reference of the destination.
[in]type_memmemory to operate, must be of size type->value_size.
[out]convert_memmemory to operate, must be of size convert->value_size.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_convert_from()

static Eina_Bool eina_value_type_convert_from ( const Eina_Value_Type type,
const Eina_Value_Type convert,
void *  type_mem,
const void *  convert_mem 
)
inlinestatic

Converts memory using type descriptor.

Parameters
[in]typetype reference of the destination.
[in]converttype reference of the source.
[out]type_memmemory to operate, must be of size type->value_size.
[in]convert_memmemory to operate, must be of size convert->value_size.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_vset()

static Eina_Bool eina_value_type_vset ( const Eina_Value_Type type,
void *  mem,
va_list  args 
)
inlinestatic

Sets memory using type descriptor and variable argument.

Parameters
[in]typetype reference of the source.
[out]memmemory to operate, must be of size type->value_size.
[in]argsinput value.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2

◆ eina_value_type_pset()

static Eina_Bool eina_value_type_pset ( const Eina_Value_Type type,
void *  mem,
const void *  ptr 
)
inlinestatic

Sets memory using type descriptor and pointer.

Parameters
[in]typetype reference of the source.
[out]memmemory to operate, must be of size type->value_size.
[in]ptrpointer to input value.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2
Examples
eina_value_03.c.

◆ eina_value_type_pget()

static Eina_Bool eina_value_type_pget ( const Eina_Value_Type type,
const void *  mem,
void *  ptr 
)
inlinestatic

Gets memory using type descriptor.

Parameters
[in]typetype reference of the source.
[in]memmemory to operate, must be of size type->value_size.
[out]ptrpointer to output.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2