Modules | Data Structures | Macros | Typedefs | Variables
Generic Value Storage

Abstracts generic data storage and access to it in an extensible and efficient way. More...

Modules

 Generic Value management
 
 Generic Value Array management
 
 Generic Value List management
 
 Generic Value Hash management
 
 Generic Value Blob management
 
 Generic Value Struct management
 
 Generic Value Type management
 
 Generic Value Optional management
 

Data Structures

union  _Eina_Value_Union
 All possible value types. More...
 

Macros

#define EINA_VALUE_EMPTY   ((Eina_Value){ NULL, { { 0, 0, 0, 0, 0, 0, 0, 0 } } })
 This is simply a value with all memory zeroed. More...
 

Typedefs

typedef struct _Eina_Value Eina_Value
 Store generic values. More...
 
typedef struct _Eina_Value_Type Eina_Value_Type
 Describes the data contained by the value. More...
 
typedef union _Eina_Value_Union Eina_Value_Union
 Union of all known value types. More...
 

Variables

EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ERROR
 manages Eina_Error values. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_VALUE
 manages Eina_Value values. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UCHAR
 manages unsigned char type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_BOOL
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_USHORT
 manages unsigned short type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UINT
 manages unsigned int type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ULONG
 manages unsigned long type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TIMESTAMP
 manages unsigned long type used for timestamps. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UINT64
 manages unsigned integer of 64 bits type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_CHAR
 manages char type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_SHORT
 manages short type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_INT
 manages int type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_LONG
 manages long type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_INT64
 manages integer of 64 bits type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_FLOAT
 manages float type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_DOUBLE
 manages double type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRINGSHARE
 manages stringshared string type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRING
 manages string type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ARRAY
 manages array type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_LIST
 manages list type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_HASH
 manages hash type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TIMEVAL
 manages 'struct timeval' type More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_BLOB
 manages blob of bytes type, see Eina_Value_Blob More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRUCT
 manages struct type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TM
 manages 'struct tm' type More...
 
EINA_API Eina_Error EINA_ERROR_VALUE_FAILED
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ERROR = NULL
 manages Eina_Error values. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_VALUE = NULL
 manages Eina_Value values. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UCHAR = NULL
 manages unsigned char type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_USHORT = NULL
 manages unsigned short type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UINT = NULL
 manages unsigned int type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ULONG = NULL
 manages unsigned long type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TIMESTAMP = NULL
 manages unsigned long type used for timestamps. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_UINT64 = NULL
 manages unsigned integer of 64 bits type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_CHAR = NULL
 manages char type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_SHORT = NULL
 manages short type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_INT = NULL
 manages int type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_LONG = NULL
 manages long type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_INT64 = NULL
 manages integer of 64 bits type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_FLOAT = NULL
 manages float type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_DOUBLE = NULL
 manages double type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRINGSHARE = NULL
 manages stringshared string type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRING = NULL
 manages string type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_ARRAY = NULL
 manages array type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_LIST = NULL
 manages list type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_HASH = NULL
 manages hash type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TIMEVAL = NULL
 manages 'struct timeval' type More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_BLOB = NULL
 manages blob of bytes type, see Eina_Value_Blob More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_STRUCT = NULL
 manages struct type. More...
 
EINA_API const Eina_Value_TypeEINA_VALUE_TYPE_TM = NULL
 manages 'struct tm' type More...
 

Detailed Description

Abstracts generic data storage and access to it in an extensible and efficient way.

It comes with pre-defined types for numbers, arrays, lists, hashes, blobs and structs. It is able to convert between data types, including to string.

It is meant for simple data types, providing uniform access and release functions, useful to exchange data preserving their types. For more complex hierarchical data, with properties and children, reference counting, inheritance and interfaces,

Examples of usage of the Eina_Value API:

Macro Definition Documentation

◆ EINA_VALUE_EMPTY

#define EINA_VALUE_EMPTY   ((Eina_Value){ NULL, { { 0, 0, 0, 0, 0, 0, 0, 0 } } })

This is simply a value with all memory zeroed.

It may be used to safely initialize or return a value without a type.

Since
1.21

Typedef Documentation

◆ Eina_Value

Store generic values.

Since
1.2

◆ Eina_Value_Type

Describes the data contained by the value.

Since
1.2

◆ Eina_Value_Union

Union of all known value types.

This is only used to specify the minimum payload memory for Eina_Value.

Variable Documentation

◆ EINA_VALUE_TYPE_ERROR [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_ERROR
extern

manages Eina_Error values.

This value will hold an Eina_Error number, which can be converted to string to get its message or call eina_error_msg_get() on the number to convert yourself.

Since
1.21

Referenced by eina_promise_reject().

◆ EINA_VALUE_TYPE_VALUE [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_VALUE
extern

manages Eina_Value values.

This value will hold an Eina_Value, which can be useful for storing data inside an Eina_Value_Array.

Since
1.21

Referenced by eina_promise_all_array(), and eina_promise_all_iterator().

◆ EINA_VALUE_TYPE_UCHAR [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_UCHAR
extern

manages unsigned char type.

Since
1.2
1.21

◆ EINA_VALUE_TYPE_USHORT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_USHORT
extern

manages unsigned short type.

Since
1.2

◆ EINA_VALUE_TYPE_UINT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_UINT
extern

manages unsigned int type.

Since
1.2

◆ EINA_VALUE_TYPE_ULONG [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_ULONG
extern

manages unsigned long type.

Since
1.2

◆ EINA_VALUE_TYPE_TIMESTAMP [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_TIMESTAMP
extern

manages unsigned long type used for timestamps.

Note
this is identical in function to EINA_VALUE_TYPE_ULONG
Since
1.2

Referenced by eina_value_util_time_string_new().

◆ EINA_VALUE_TYPE_UINT64 [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_UINT64
extern

manages unsigned integer of 64 bits type.

Since
1.2

◆ EINA_VALUE_TYPE_CHAR [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_CHAR
extern

manages char type.

Since
1.2

◆ EINA_VALUE_TYPE_SHORT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_SHORT
extern

manages short type.

Since
1.2

◆ EINA_VALUE_TYPE_INT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_INT
extern

◆ EINA_VALUE_TYPE_LONG [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_LONG
extern

manages long type.

Since
1.2

◆ EINA_VALUE_TYPE_INT64 [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_INT64
extern

manages integer of 64 bits type.

Since
1.2

◆ EINA_VALUE_TYPE_FLOAT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_FLOAT
extern

manages float type.

Since
1.2

◆ EINA_VALUE_TYPE_DOUBLE [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_DOUBLE
extern

manages double type.

Since
1.2

◆ EINA_VALUE_TYPE_STRINGSHARE [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_STRINGSHARE
extern

manages stringshared string type.

Since
1.2

◆ EINA_VALUE_TYPE_STRING [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_STRING
extern

manages string type.

Since
1.2

Referenced by eina_value_to_string().

◆ EINA_VALUE_TYPE_ARRAY [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_ARRAY
extern

manages array type.

Use the value get/set for arrays:

eina_value_set() takes an Eina_Value_Array where just subtype and step are used. If there is an array, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_Array. For your convenience, use eina_value_array_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Array, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2

◆ EINA_VALUE_TYPE_LIST [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_LIST
extern

manages list type.

Use the value get/set for lists:

eina_value_set() takes an Eina_Value_List where just subtype is used. If there is an list, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_List. For your convenience, use eina_value_list_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_List, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2

◆ EINA_VALUE_TYPE_HASH [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_HASH
extern

manages hash type.

Use the value get/set for hashes:

eina_value_set() takes an Eina_Value_Hash where just subtype and buckets_power_size are used. If there is an hash, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_Hash. For your convenience, use eina_value_hash_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Hash, it's an exact copy of the current structure in use by value, no copies are done.

Note
Be aware that hash data is always an allocated memory of size defined by subtype->value_size. If your subtype is an integer, add as data malloc(sizeof(int)). If your subtype is an string, add as data malloc(sizeof(char*)) and this data value must point to strdup(string)!
Since
1.2

◆ EINA_VALUE_TYPE_TIMEVAL [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_TIMEVAL
extern

manages 'struct timeval' type

eina_value_set() takes a "struct timeval" from sys/time.h. eina_value_pset() takes a pointer to "struct timeval".

eina_value_get() and eina_value_pget() takes a pointer to "struct timeval" and it's an exact copy of value.

Since
1.2

◆ EINA_VALUE_TYPE_BLOB [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_BLOB
extern

manages blob of bytes type, see Eina_Value_Blob

eina_value_set() takes an Eina_Value_Blob eina_value_pset() takes a pointer to Eina_Value_Blob.

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Blob and it's an exact copy of value, no allocations are made.

Memory is untouched unless you provide ops (operations) pointer.

Since
1.2

Referenced by eina_value_to_binbuf().

◆ EINA_VALUE_TYPE_STRUCT [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_STRUCT
extern

manages struct type.

Use the value get/set for structs:

eina_value_set() takes an Eina_Value_Struct where just desc is used. If there is an memory, it will be copied (including each member) and its contents must be properly configurable as desc expects. eina_value_pset() takes a pointer to an Eina_Value_Struct. For your convenience, use eina_value_struct_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Struct, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2

◆ EINA_VALUE_TYPE_TM [1/2]

EINA_API const Eina_Value_Type* EINA_VALUE_TYPE_TM
extern

manages 'struct tm' type

eina_value_set() takes a "struct tm" from time.h. eina_value_pset() takes a pointer to "struct tm".

eina_value_get() and eina_value_pget() takes a pointer to "struct tm" and it's an exact copy of value.

Since
1.21

◆ EINA_VALUE_TYPE_ERROR [2/2]

EINA_VALUE_TYPE_ERROR = NULL

manages Eina_Error values.

This value will hold an Eina_Error number, which can be converted to string to get its message or call eina_error_msg_get() on the number to convert yourself.

Since
1.21

Referenced by eina_promise_reject().

◆ EINA_VALUE_TYPE_VALUE [2/2]

EINA_VALUE_TYPE_VALUE = NULL

manages Eina_Value values.

This value will hold an Eina_Value, which can be useful for storing data inside an Eina_Value_Array.

Since
1.21

Referenced by eina_promise_all_array(), and eina_promise_all_iterator().

◆ EINA_VALUE_TYPE_UCHAR [2/2]

EINA_VALUE_TYPE_UCHAR = NULL

manages unsigned char type.

Since
1.2
1.21
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_USHORT [2/2]

EINA_VALUE_TYPE_USHORT = NULL

manages unsigned short type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_UINT [2/2]

EINA_VALUE_TYPE_UINT = NULL

manages unsigned int type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_ULONG [2/2]

EINA_VALUE_TYPE_ULONG = NULL

manages unsigned long type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_TIMESTAMP [2/2]

EINA_VALUE_TYPE_TIMESTAMP = NULL

manages unsigned long type used for timestamps.

Note
this is identical in function to EINA_VALUE_TYPE_ULONG
Since
1.2
Examples
eina_value_03.c.

Referenced by eina_value_util_time_string_new().

◆ EINA_VALUE_TYPE_UINT64 [2/2]

EINA_VALUE_TYPE_UINT64 = NULL

manages unsigned integer of 64 bits type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_CHAR [2/2]

EINA_VALUE_TYPE_CHAR = NULL

manages char type.

Since
1.2
Examples
eina_value_02.c, and eina_value_03.c.

◆ EINA_VALUE_TYPE_SHORT [2/2]

EINA_VALUE_TYPE_SHORT = NULL

manages short type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_INT [2/2]

EINA_VALUE_TYPE_INT = NULL

◆ EINA_VALUE_TYPE_LONG [2/2]

EINA_VALUE_TYPE_LONG = NULL

manages long type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_INT64 [2/2]

EINA_VALUE_TYPE_INT64 = NULL

manages integer of 64 bits type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_FLOAT [2/2]

EINA_VALUE_TYPE_FLOAT = NULL

manages float type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_DOUBLE [2/2]

EINA_VALUE_TYPE_DOUBLE = NULL

manages double type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_STRINGSHARE [2/2]

EINA_VALUE_TYPE_STRINGSHARE = NULL

manages stringshared string type.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_STRING [2/2]

EINA_VALUE_TYPE_STRING = NULL

manages string type.

Since
1.2
Examples
complex-types-client-eina-value.c, eina_value_01.c, and eina_value_03.c.

Referenced by eina_value_to_string().

◆ EINA_VALUE_TYPE_ARRAY [2/2]

EINA_VALUE_TYPE_ARRAY = NULL

manages array type.

Use the value get/set for arrays:

eina_value_set() takes an Eina_Value_Array where just subtype and step are used. If there is an array, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_Array. For your convenience, use eina_value_array_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Array, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2
Examples
complex-types-client-eina-value.c.

◆ EINA_VALUE_TYPE_LIST [2/2]

EINA_VALUE_TYPE_LIST = NULL

manages list type.

Use the value get/set for lists:

eina_value_set() takes an Eina_Value_List where just subtype is used. If there is an list, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_List. For your convenience, use eina_value_list_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_List, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2

◆ EINA_VALUE_TYPE_HASH [2/2]

EINA_VALUE_TYPE_HASH = NULL

manages hash type.

Use the value get/set for hashes:

eina_value_set() takes an Eina_Value_Hash where just subtype and buckets_power_size are used. If there is an hash, it will be copied (including each item) and its contents must be properly configurable as subtype expects. eina_value_pset() takes a pointer to an Eina_Value_Hash. For your convenience, use eina_value_hash_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Hash, it's an exact copy of the current structure in use by value, no copies are done.

Note
Be aware that hash data is always an allocated memory of size defined by subtype->value_size. If your subtype is an integer, add as data malloc(sizeof(int)). If your subtype is an string, add as data malloc(sizeof(char*)) and this data value must point to strdup(string)!
Since
1.2

◆ EINA_VALUE_TYPE_TIMEVAL [2/2]

EINA_VALUE_TYPE_TIMEVAL = NULL

manages 'struct timeval' type

eina_value_set() takes a "struct timeval" from sys/time.h. eina_value_pset() takes a pointer to "struct timeval".

eina_value_get() and eina_value_pget() takes a pointer to "struct timeval" and it's an exact copy of value.

Since
1.2
Examples
eina_value_03.c.

◆ EINA_VALUE_TYPE_BLOB [2/2]

EINA_VALUE_TYPE_BLOB = NULL

manages blob of bytes type, see Eina_Value_Blob

eina_value_set() takes an Eina_Value_Blob eina_value_pset() takes a pointer to Eina_Value_Blob.

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Blob and it's an exact copy of value, no allocations are made.

Memory is untouched unless you provide ops (operations) pointer.

Since
1.2

Referenced by eina_value_to_binbuf().

◆ EINA_VALUE_TYPE_STRUCT [2/2]

EINA_VALUE_TYPE_STRUCT = NULL

manages struct type.

Use the value get/set for structs:

eina_value_set() takes an Eina_Value_Struct where just desc is used. If there is an memory, it will be copied (including each member) and its contents must be properly configurable as desc expects. eina_value_pset() takes a pointer to an Eina_Value_Struct. For your convenience, use eina_value_struct_setup().

eina_value_get() and eina_value_pget() takes a pointer to Eina_Value_Struct, it's an exact copy of the current structure in use by value, no copies are done.

Since
1.2
Examples
complex-types-client-eina-value.c, and eina_value_02.c.

◆ EINA_VALUE_TYPE_TM [2/2]

EINA_VALUE_TYPE_TM = NULL

manages 'struct tm' type

eina_value_set() takes a "struct tm" from time.h. eina_value_pset() takes a pointer to "struct tm".

eina_value_get() and eina_value_pget() takes a pointer to "struct tm" and it's an exact copy of value.

Since
1.21