Generic Value Type management

Data Structures

struct  _Eina_Value_Type
 API to access values. More...

Defines

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

Functions

const char * eina_value_type_name_get (const Eina_Value_Type *type)
 Query type name.
Eina_Bool eina_value_type_check (const Eina_Value_Type *type)
 Check if type is valid.
static Eina_Bool eina_value_type_setup (const Eina_Value_Type *type, void *mem)
 Initialize memory using type descriptor.
static Eina_Bool eina_value_type_flush (const Eina_Value_Type *type, void *mem)
 Flush (clear) memory using type descriptor.
static Eina_Bool eina_value_type_copy (const Eina_Value_Type *type, const void *src, void *dst)
 Copy memory using type descriptor.
static int eina_value_type_compare (const Eina_Value_Type *type, const void *a, const void *b)
 Compare memory using type descriptor.
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)
 Convert memory using type descriptor.
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)
 Convert memory using type descriptor.
static Eina_Bool eina_value_type_vset (const Eina_Value_Type *type, void *mem, va_list args)
 Set memory using type descriptor and variable argument.
static Eina_Bool eina_value_type_pset (const Eina_Value_Type *type, void *mem, const void *ptr)
 Set memory using type descriptor and pointer.
static Eina_Bool eina_value_type_pget (const Eina_Value_Type *type, const void *mem, void *ptr)
 Get memory using type descriptor.

Function Documentation

const char* eina_value_type_name_get ( const Eina_Value_Type type)

Query type name.

Parameters:
typetype reference.
Returns:
string or NULL if type is invalid.
Since:
1.2

References EINA_SAFETY_ON_FALSE_RETURN_VAL, eina_value_type_check(), and _Eina_Value_Type::name.

Check if type is valid.

Parameters:
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, EINA_VALUE_TYPE_VERSION, 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().

static Eina_Bool eina_value_type_setup ( const Eina_Value_Type type,
void *  mem 
) [inline, static]

Initialize memory using type descriptor.

Parameters:
typetype reference.
memmemory to operate, must be of size type->value_size.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
static Eina_Bool eina_value_type_flush ( const Eina_Value_Type type,
void *  mem 
) [inline, static]

Flush (clear) memory using type descriptor.

Parameters:
typetype reference.
memmemory to operate, must be of size type->value_size.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
static Eina_Bool eina_value_type_copy ( const Eina_Value_Type type,
const void *  src,
void *  dst 
) [inline, static]

Copy memory using type descriptor.

Parameters:
typetype reference.
srcmemory to operate, must be of size type->value_size.
dstmemory to operate, must be of size type->value_size.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
static int eina_value_type_compare ( const Eina_Value_Type type,
const void *  a,
const void *  b 
) [inline, static]

Compare memory using type descriptor.

Parameters:
typetype reference.
amemory to operate, must be of size type->value_size.
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
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 
) [inline, static]

Convert memory using type descriptor.

Parameters:
typetype reference of the source.
converttype reference of the destination.
type_memmemory to operate, must be of size type->value_size.
convert_memmemory to operate, must be of size convert->value_size.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
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 
) [inline, static]

Convert memory using type descriptor.

Parameters:
typetype reference of the destination.
converttype reference of the source.
type_memmemory to operate, must be of size type->value_size.
convert_memmemory to operate, must be of size convert->value_size.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
static Eina_Bool eina_value_type_vset ( const Eina_Value_Type type,
void *  mem,
va_list  args 
) [inline, static]

Set memory using type descriptor and variable argument.

Parameters:
typetype reference of the source.
memmemory to operate, must be of size type->value_size.
argsinput value.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
static Eina_Bool eina_value_type_pset ( const Eina_Value_Type type,
void *  mem,
const void *  ptr 
) [inline, static]

Set memory using type descriptor and pointer.

Parameters:
typetype reference of the source.
memmemory to operate, must be of size type->value_size.
ptrpointer to input value.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.
Since:
1.2
Examples:
eina_value_03.c.
static Eina_Bool eina_value_type_pget ( const Eina_Value_Type type,
const void *  mem,
void *  ptr 
) [inline, static]

Get memory using type descriptor.

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