Data Structures | |
struct | _Eina_Value |
defines the contents of a value More... | |
Functions | |
EINA_API Eina_Value * | eina_value_new (const Eina_Value_Type *type) |
Creates generic value storage. More... | |
EINA_API void | eina_value_free (Eina_Value *value) |
Frees value and its data. More... | |
static Eina_Bool | eina_value_setup (Eina_Value *value, const Eina_Value_Type *type) |
Initializes generic value storage. More... | |
static void | eina_value_flush (Eina_Value *value) |
Empties a generic value storage. More... | |
EINA_API Eina_Bool | eina_value_copy (const Eina_Value *value, Eina_Value *copy) |
Copies generic value storage. More... | |
static int | eina_value_compare (const Eina_Value *a, const Eina_Value *b) |
Compares generic value storage. More... | |
static Eina_Bool | eina_value_set (Eina_Value *value,...) |
Sets the generic value. More... | |
static Eina_Bool | eina_value_get (const Eina_Value *value,...) |
Gets the generic value. More... | |
static Eina_Bool | eina_value_vset (Eina_Value *value, va_list args) |
Sets the generic value. More... | |
static Eina_Bool | eina_value_vget (const Eina_Value *value, va_list args) |
Gets the generic value. More... | |
static Eina_Bool | eina_value_pset (Eina_Value *value, const void *ptr) |
Sets the generic value from pointer. More... | |
static Eina_Bool | eina_value_pget (const Eina_Value *value, void *ptr) |
Gets the generic value to pointer. More... | |
EINA_API Eina_Bool | eina_value_convert (const Eina_Value *value, Eina_Value *convert) |
Converts one value to another type. More... | |
EINA_API Eina_Binbuf * | eina_value_to_binbuf (Eina_Value *value) |
Converts one value to Eina_Binbuf. More... | |
EINA_API char * | eina_value_to_string (const Eina_Value *value) |
Converts value to string. More... | |
static const Eina_Value_Type * | eina_value_type_get (const Eina_Value *value) |
Queries value type. More... | |
EINA_API Eina_Value * eina_value_new | ( | const Eina_Value_Type * | type | ) |
Creates generic value storage.
[in] | type | How to manage this value. |
NULL
on failure.Create a new generic value storage. The members are managed using the description specified by type.
Some types may specify more operations: e.g.. EINA_VALUE_TYPE_ARRAY uses eina_value_array_set(), eina_value_array_get() and so on.
On failure, NULL
is returned.
References eina_mempool_free(), eina_mempool_malloc(), and eina_value_setup().
Referenced by eina_value_util_time_string_new().
EINA_API void eina_value_free | ( | Eina_Value * | value | ) |
Frees value and its data.
[in] | value | value object |
References eina_mempool_free(), and eina_value_flush().
|
inlinestatic |
Initializes generic value storage.
[out] | value | Value object |
[out] | type | How to manage this value. |
Initializes existing generic value storage. The members are managed using the description specified by type.
Some types may specify more operations, as an example EINA_VALUE_TYPE_ARRAY uses eina_value_array_set(), eina_value_array_get() and so on.
On failure, EINA_FALSE is returned.
Referenced by ecore_main_loop_quit(), efl_exit(), eina_promise_all_array(), eina_promise_all_iterator(), eina_promise_as_value(), eina_promise_reject(), eina_value_copy(), eina_value_new(), eina_value_to_binbuf(), and eina_value_to_string().
|
inlinestatic |
Empties a generic value storage.
[in] | value | Value object |
Releases all the resources associated with an Eina_Value. The value must be already set with eina_value_setup() or eina_value_new().
After this call returns, the contents of the value are undefined, but the value can be reused by calling eina_value_setup() again.
Referenced by eina_future_cb_easy_desc_flush(), eina_future_chain_easy_array(), eina_future_resolved(), eina_promise_all_array(), eina_promise_all_iterator(), eina_promise_as_value(), eina_promise_reject(), eina_promise_resolve(), eina_value_copy(), eina_value_free(), and eina_value_to_binbuf().
EINA_API Eina_Bool eina_value_copy | ( | const Eina_Value * | value, |
Eina_Value * | copy | ||
) |
Copies generic value storage.
[in] | value | Source value object |
[out] | copy | Destination value object |
The copy object is considered uninitialized and its existing contents are overwritten (just as if eina_value_flush() was called on it).
The copy happens by calling eina_value_setup() on copy, followed by getting the contents of value and setting it to copy.
References EINA_FALSE, EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_TRUE, eina_value_flush(), eina_value_setup(), and eina_value_type_check().
|
inlinestatic |
Compares generic value storage.
[in] | a | left side of comparison |
[in] | b | right side of comparison |
|
inlinestatic |
Sets the generic value.
[in,out] | value | Source value object |
[in] | ... | Data to set. |
The variable argument is dependent on chosen type. The list for basic types:
Referenced by ecore_main_loop_quit(), efl_exit(), eina_promise_reject(), and eina_value_util_time_string_new().
|
inlinestatic |
Gets the generic value.
[in] | value | Source value object. |
[out] | ... | Data value retrieved. |
The value is returned in the variable argument parameter, the actual value is type-dependent, but usually it will be what is stored inside the object. There shouldn't be any memory allocation, thus the contents should not be freed.
The variable argument is dependent on chosen type. The list for basic types:
Referenced by eina_value_to_binbuf().
|
inlinestatic |
Sets the generic value.
[in,out] | value | Source value object |
[in] | args | Variable argument |
|
inlinestatic |
Gets the generic value.
[in] | value | Source value object |
[out] | args | Variable argument |
The value is returned in the variable argument parameter, the actual value is type-dependent, but usually it will be what is stored inside the object. There shouldn't be any memory allocation, thus the contents should not be freed.
|
inlinestatic |
Sets the generic value from pointer.
[in,out] | value | Source value object |
[in] | ptr | Pointer to specify the contents. |
The pointer type is dependent on chosen value type. The list for basic types:
Referenced by eina_promise_as_value().
|
inlinestatic |
Gets the generic value to pointer.
[in] | value | Source value object |
[out] | ptr | Pointer to receive the contents. |
The value is returned in pointer contents, the actual value is type-dependent, but usually it will be what is stored inside the object. There shouldn't be any memory allocation, thus the contents should not be freed.
The pointer type is dependent on chosen value type. The list for basic types:
EINA_API Eina_Bool eina_value_convert | ( | const Eina_Value * | value, |
Eina_Value * | convert | ||
) |
Converts one value to another type.
[in] | value | Source value object. |
[out] | convert | Destination value object. |
Converts one value to another trying first value type convert_to()
function. If unsuccessful, tries using convert_from()
function in convert.
Conversion functions are type defined, and the basic types can convert between themselves, but conversion is strict! That is, if converting from negative value to unsigned type, it will fail. It also fails on value overflow.
It is recommended that all types implement at least convert to string, used by eina_value_to_string().
References _Eina_Value_Type::convert_from, EINA_FALSE, EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_value_type_check(), and _Eina_Value::type.
Referenced by eina_value_to_binbuf(), and eina_value_to_string().
EINA_API Eina_Binbuf * eina_value_to_binbuf | ( | Eina_Value * | value | ) |
Converts one value to Eina_Binbuf.
[in,out] | value | Source value object. |
NULL
if it failed to get a memory content, a valid Eina_Binbuf otherwise.Converts one value to EINA_TYPE_VALUE_BLOB if necessary by calling eina_value_convert()
function.
References eina_binbuf_append_length(), eina_binbuf_new(), eina_value_convert(), EINA_VALUE_EMPTY, eina_value_flush(), eina_value_get(), eina_value_setup(), and EINA_VALUE_TYPE_BLOB.
EINA_API char * eina_value_to_string | ( | const Eina_Value * | value | ) |
Converts value to string.
[in] | value | value object. |
NULL
on failure.References EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_value_convert(), eina_value_setup(), eina_value_type_check(), EINA_VALUE_TYPE_STRING, _Eina_Value_Union::ptr, and _Eina_Value::value.
|
inlinestatic |
Queries value type.
[in] | value | Value object. |
NULL
if type is invalid.Check if value type is valid and returns it. A type is invalid if it does not exist or if it is using a different version field.