Data Structures | |
struct | _Eina_Value_Struct_Operations |
How to manage struct. More... | |
struct | _Eina_Value_Struct_Member |
Describes a single member of struct. More... | |
struct | _Eina_Value_Struct_Desc |
Describes the struct by listing its size, members and operations. More... | |
struct | _Eina_Value_Struct |
Used to store the memory and its description. More... | |
Macros | |
#define | EINA_VALUE_STRUCT_OPERATIONS_VERSION (1) |
Current API version, used to validate _Eina_Value_Struct_Operations. | |
#define | EINA_VALUE_STRUCT_DESC_VERSION (1) |
Current API version, used to validate _Eina_Value_Struct_Desc. | |
#define | EINA_VALUE_STRUCT_MEMBER(eina_value_type, type, member) {#member, eina_value_type, offsetof(type, member)} |
Helper to define Eina_Value_Struct_Member fields, uses offsetof() with type and member. More... | |
#define | EINA_VALUE_STRUCT_MEMBER_SENTINEL {NULL, NULL, 0} |
Helper to define Eina_Value_Struct_Member fields for sentinel (last item), useful if you did not define member_count . More... | |
#define | EINA_VALUE_STRUCT_DESC_DEFINE(Name, Ops, Size, ...) |
Typedefs | |
typedef struct _Eina_Value_Struct_Operations | Eina_Value_Struct_Operations |
How to manage struct. More... | |
typedef struct _Eina_Value_Struct_Member | Eina_Value_Struct_Member |
Describes a single member of struct. More... | |
typedef struct _Eina_Value_Struct_Desc | Eina_Value_Struct_Desc |
Describes the struct by listing its size, members and operations. More... | |
Functions | |
EINA_API Eina_Value * | eina_value_struct_new (const Eina_Value_Struct_Desc *desc) |
Creates generic value storage of type struct. More... | |
static Eina_Bool | eina_value_struct_setup (Eina_Value *value, const Eina_Value_Struct_Desc *desc) |
Initializes generic value storage of type struct. More... | |
static const Eina_Value_Struct_Desc * | eina_value_struct_desc_get (const Eina_Value *value) |
Checks for a struct and get its description. More... | |
static Eina_Bool | eina_value_struct_set (Eina_Value *value, const char *name,...) |
Sets the generic value in a struct member. More... | |
static Eina_Bool | eina_value_struct_get (const Eina_Value *value, const char *name,...) |
Gets the generic value from a struct member. More... | |
static Eina_Bool | eina_value_struct_vset (Eina_Value *value, const char *name, va_list args) |
Sets the generic value in a struct member. More... | |
static Eina_Bool | eina_value_struct_vget (const Eina_Value *value, const char *name, va_list args) |
Gets the generic value from a struct member. More... | |
static Eina_Bool | eina_value_struct_pset (Eina_Value *value, const char *name, const void *ptr) |
Sets the generic value in a struct member from pointer. More... | |
static Eina_Bool | eina_value_struct_pget (const Eina_Value *value, const char *name, void *ptr) |
Gets the generic value to pointer from a struct member. More... | |
static Eina_Bool | eina_value_struct_value_get (const Eina_Value *src, const char *name, Eina_Value *dst) |
Gets the member as Eina_Value copy. More... | |
static Eina_Bool | eina_value_struct_value_set (Eina_Value *dst, const char *name, const Eina_Value *src) |
Sets the member from Eina_Value source. More... | |
static Eina_Bool | eina_value_struct_member_value_get (const Eina_Value *src, const Eina_Value_Struct_Member *member, Eina_Value *dst) |
Gets the member as Eina_Value copy given its member description. More... | |
static Eina_Bool | eina_value_struct_member_value_set (Eina_Value *dst, const Eina_Value_Struct_Member *member, const Eina_Value *src) |
Sets the member from Eina_Value source. More... | |
Variables | |
EINA_API const Eina_Value_Struct_Operations * | EINA_VALUE_STRUCT_OPERATIONS_BINSEARCH |
Assumes members is sorted by name and applies binary search for names. More... | |
EINA_API const Eina_Value_Struct_Operations * | EINA_VALUE_STRUCT_OPERATIONS_STRINGSHARE |
Assumes members name are stringshared and can be compared for equality without using its contents (simple pointer comparison). More... | |
EINA_API const Eina_Value_Struct_Operations * | EINA_VALUE_STRUCT_OPERATIONS_BINSEARCH = NULL |
Assumes members is sorted by name and applies binary search for names. More... | |
EINA_API const Eina_Value_Struct_Operations * | EINA_VALUE_STRUCT_OPERATIONS_STRINGSHARE = NULL |
Assumes members name are stringshared and can be compared for equality without using its contents (simple pointer comparison). More... | |
#define EINA_VALUE_STRUCT_MEMBER | ( | eina_value_type, | |
type, | |||
member | |||
) | {#member, eina_value_type, offsetof(type, member)} |
Helper to define Eina_Value_Struct_Member fields, uses offsetof() with type and member.
#define EINA_VALUE_STRUCT_MEMBER_SENTINEL {NULL, NULL, 0} |
Helper to define Eina_Value_Struct_Member fields for sentinel (last item), useful if you did not define member_count
.
#define EINA_VALUE_STRUCT_DESC_DEFINE | ( | Name, | |
Ops, | |||
Size, | |||
... | |||
) |
How to manage struct.
Any NULL
callback is ignored.
A structure can specify alternative methods to allocate, free and copy itself. See structure definition for all methods.
Describes a single member of struct.
The member holds a name, type and its byte offset within the struct memory. Most Eina_Value_Struct functions takes the member name as parameter, as in eina_value_struct_set().
Describes the struct by listing its size, members and operations.
EINA_API Eina_Value * eina_value_struct_new | ( | const Eina_Value_Struct_Desc * | desc | ) |
Creates generic value storage of type struct.
[in] | desc | How to manage this struct members. |
NULL
on failure.Create a new generic value storage of type struct. The members are managed using the description specified by desc.
On failure, NULL
is returned.
References eina_mempool_free(), eina_mempool_malloc(), and eina_value_struct_setup().
|
inlinestatic |
Initializes generic value storage of type struct.
[out] | value | Value object |
[in] | desc | How to manage this struct members. |
Initializes new generic value storage of type struct with the given desc.
This is the same as calling eina_value_set() with EINA_VALUE_TYPE_STRUCT followed by eina_value_pset() with the Eina_Value_Struct description configured.
On failure, EINA_FALSE is returned.
Referenced by eina_value_struct_new().
|
inlinestatic |
Checks for a struct and get its description.
[in] | value | Value object |
NULL
is returned.
|
inlinestatic |
Sets the generic value in a struct member.
[in,out] | value | Source value object |
[in] | name | Name to find the member |
[in] | ... | Variable arguments |
The variable argument is dependent on chosen member type. The list for basic types:
|
inlinestatic |
Gets the generic value from a struct member.
[in] | value | Source value object |
[in] | name | Name to find the member |
[out] | ... | Variable arguments |
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 member type. The list for basic types:
|
inlinestatic |
Sets the generic value in a struct member.
[in,out] | value | Source value object |
[in] | name | Name to find the member |
[in] | args | Variable argument |
|
inlinestatic |
Gets the generic value from a struct member.
[in] | value | Source value object |
[in] | name | Name to find the member |
[in,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 in a struct member from pointer.
[in,out] | value | Source value object |
[in] | name | Name to find the member |
[in] | ptr | Pointer to specify the contents. |
The pointer type is dependent on chosen value type. The list for basic types:
|
inlinestatic |
Gets the generic value to pointer from a struct member.
[in] | value | Source value object |
[in] | name | Name to find the member |
[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:
|
inlinestatic |
Gets the member as Eina_Value copy.
[in] | src | Source value object |
[in] | name | Name to find the member |
[out] | dst | Where to return the member value. |
The argument dst is considered uninitialized and it's setup to the type of the member.
|
inlinestatic |
Sets the member from Eina_Value source.
[in,out] | dst | destination value object |
[in] | name | name to find the member |
[in] | src | source value |
|
inlinestatic |
Gets the member as Eina_Value copy given its member description.
[in] | src | Source value object |
[in] | member | The member description to use |
[out] | dst | Where to return the member value. |
The argument dst is considered uninitialized and it's setup to the type of the member.
|
inlinestatic |
Sets the member from Eina_Value source.
[out] | dst | destination value object |
[in] | member | the member description to use |
[in] | src | source value |
|
extern |
Assumes members
is sorted by name and applies binary search for names.
Ideally the member_count
field is set to speed it up.
No other methods are set (alloc, free, copy, compare), then it uses the default operations.
|
extern |
Assumes members
name are stringshared and can be compared for equality without using its contents (simple pointer comparison).
Ideally the search name
will be stringshared as well, but it will do a second loop with a forced stringshare if it did not find the member.
No other methods are set (alloc, free, copy, compare), then it uses the default operations.
EINA_VALUE_STRUCT_OPERATIONS_BINSEARCH = NULL |
Assumes members
is sorted by name and applies binary search for names.
Ideally the member_count
field is set to speed it up.
No other methods are set (alloc, free, copy, compare), then it uses the default operations.
EINA_VALUE_STRUCT_OPERATIONS_STRINGSHARE = NULL |
Assumes members
name are stringshared and can be compared for equality without using its contents (simple pointer comparison).
Ideally the search name
will be stringshared as well, but it will do a second loop with a forced stringshare if it did not find the member.
No other methods are set (alloc, free, copy, compare), then it uses the default operations.