Generic Value Array management

Data Structures

struct  _Eina_Value_Array
 Used to store the array and its subtype. More...
 

Typedefs

typedef struct _Eina_Value_Array Eina_Value_Array
 Value type for EINA_VALUE_TYPE_ARRAY. More...
 

Functions

Eina_Valueeina_value_array_new (const Eina_Value_Type *subtype, unsigned int step)
 Create generic value storage of type array. More...
 
static Eina_Bool eina_value_array_setup (Eina_Value *value, const Eina_Value_Type *subtype, unsigned int step)
 Initialize generic value storage of type array. More...
 
static unsigned int eina_value_array_count (const Eina_Value *value)
 Query number of elements in value of array type. More...
 
static Eina_Bool eina_value_array_remove (Eina_Value *value, unsigned int position)
 Remove element at given position in value of array type. More...
 
static Eina_Bool eina_value_array_set (Eina_Value *value, unsigned int position,...)
 Set the generic value in an array member. More...
 
static Eina_Bool eina_value_array_get (const Eina_Value *value, unsigned int position,...)
 Get the generic value from an array member. More...
 
static Eina_Bool eina_value_array_insert (Eina_Value *value, unsigned int position,...)
 Insert a generic value in an array member position. More...
 
static Eina_Bool eina_value_array_append (Eina_Value *value,...)
 Append a generic value in an array. More...
 
static Eina_Bool eina_value_array_vset (Eina_Value *value, unsigned int position, va_list args)
 Set a generic value to an array member. More...
 
static Eina_Bool eina_value_array_vget (const Eina_Value *value, unsigned int position, va_list args)
 Get the generic value from an array member. More...
 
static Eina_Bool eina_value_array_vinsert (Eina_Value *value, unsigned int position, va_list args)
 Insert a generic value to an array member position. More...
 
static Eina_Bool eina_value_array_vappend (Eina_Value *value, va_list args)
 Append a generic value to an array. More...
 
static Eina_Bool eina_value_array_pset (Eina_Value *value, unsigned int position, const void *ptr)
 Set a generic value to an array member from a pointer. More...
 
static Eina_Bool eina_value_array_pget (const Eina_Value *value, unsigned int position, void *ptr)
 Retrieve a generic value into a pointer from an array member. More...
 
static Eina_Bool eina_value_array_pinsert (Eina_Value *value, unsigned int position, const void *ptr)
 Insert a generic value to an array member position from a pointer. More...
 
static Eina_Bool eina_value_array_pappend (Eina_Value *value, const void *ptr)
 Append a generic value to an array from a pointer. More...
 
static Eina_Bool eina_value_array_value_get (const Eina_Value *src, unsigned int position, Eina_Value *dst)
 Retrieves a value from the array as an Eina_Value copy. More...
 

Detailed Description

Typedef Documentation

Value type for EINA_VALUE_TYPE_ARRAY.

See Also
_Eina_Value_Array explains fields.
Since
1.2

Function Documentation

Eina_Value* eina_value_array_new ( const Eina_Value_Type subtype,
unsigned int  step 
)

Create generic value storage of type array.

Parameters
subtypehow to manage this array members.
stephow to grow the members array.
Returns
The new value or NULL on failure.

Create a new generic value storage of type array. The members are managed using the description specified by subtype.

On failure, NULL is returned and EINA_ERROR_OUT_OF_MEMORY or EINA_ERROR_VALUE_FAILED is set.

Note
this creates from mempool and then uses eina_value_array_setup().
See Also
eina_value_free()
eina_value_array_setup()
Since
1.2

References EINA_FALSE, eina_mempool_free(), eina_mempool_malloc(), eina_value_array_setup(), and eina_value_type_check().

static Eina_Bool eina_value_array_setup ( Eina_Value value,
const Eina_Value_Type subtype,
unsigned int  step 
)
inlinestatic

Initialize generic value storage of type array.

Parameters
valuevalue object
subtypehow to manage array members.
stephow to grow the members array.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

Initializes new generic value storage of type array with the given subtype.

This is the same as calling eina_value_set() with EINA_VALUE_TYPE_ARRAY followed by eina_value_pset() with the Eina_Value_Array description configured.

Note
Existing contents are ignored! If the value was previously used, then use eina_value_flush() first.

On failure, EINA_FALSE is returned and EINA_ERROR_OUT_OF_MEMORY or EINA_ERROR_VALUE_FAILED is set.

See Also
eina_value_flush()
Since
1.2

Referenced by eina_value_array_new().

static unsigned int eina_value_array_count ( const Eina_Value value)
inlinestatic

Query number of elements in value of array type.

Parameters
valuevalue object.
Returns
number of child elements.
Since
1.2
static Eina_Bool eina_value_array_remove ( Eina_Value value,
unsigned int  position 
)
inlinestatic

Remove element at given position in value of array type.

Parameters
valuevalue object.
positionindex of the member
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
Since
1.2
static Eina_Bool eina_value_array_set ( Eina_Value value,
unsigned int  position,
  ... 
)
inlinestatic

Set the generic value in an array member.

Parameters
valuesource value object
positionindex of the member
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The variable argument is dependent on chosen subtype. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char
  • EINA_VALUE_TYPE_USHORT: unsigned short
  • EINA_VALUE_TYPE_UINT: unsigned int
  • EINA_VALUE_TYPE_ULONG: unsigned long
  • EINA_VALUE_TYPE_UINT64: uint64_t
  • EINA_VALUE_TYPE_CHAR: char
  • EINA_VALUE_TYPE_SHORT: short
  • EINA_VALUE_TYPE_INT: int
  • EINA_VALUE_TYPE_LONG: long
  • EINA_VALUE_TYPE_INT64: int64_t
  • EINA_VALUE_TYPE_FLOAT: float
  • EINA_VALUE_TYPE_DOUBLE: double
  • EINA_VALUE_TYPE_STRINGSHARE: const char *
  • EINA_VALUE_TYPE_STRING: const char *
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array
  • EINA_VALUE_TYPE_LIST: Eina_Value_List
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct
See Also
eina_value_array_get()
eina_value_array_vset()
eina_value_array_pset()
eina_value_array_insert()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_get ( const Eina_Value value,
unsigned int  position,
  ... 
)
inlinestatic

Get the generic value from an array member.

Parameters
valuesource value object
positionindex of the member
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The value is returned in the variable argument parameter, and 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 subtype. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char*
  • EINA_VALUE_TYPE_USHORT: unsigned short*
  • EINA_VALUE_TYPE_UINT: unsigned int*
  • EINA_VALUE_TYPE_ULONG: unsigned long*
  • EINA_VALUE_TYPE_UINT64: uint64_t*
  • EINA_VALUE_TYPE_CHAR: char*
  • EINA_VALUE_TYPE_SHORT: short*
  • EINA_VALUE_TYPE_INT: int*
  • EINA_VALUE_TYPE_LONG: long*
  • EINA_VALUE_TYPE_INT64: int64_t*
  • EINA_VALUE_TYPE_FLOAT: float*
  • EINA_VALUE_TYPE_DOUBLE: double*
  • EINA_VALUE_TYPE_STRINGSHARE: const char **
  • EINA_VALUE_TYPE_STRING: const char **
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array*
  • EINA_VALUE_TYPE_LIST: Eina_Value_List*
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash*
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval*
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob*
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct*
See Also
eina_value_array_set()
eina_value_array_vset()
eina_value_array_pset()
Since
1.2
static Eina_Bool eina_value_array_insert ( Eina_Value value,
unsigned int  position,
  ... 
)
inlinestatic

Insert a generic value in an array member position.

Parameters
valuesource value object
positionindex of the member
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The variable argument is dependent on chosen subtype. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char
  • EINA_VALUE_TYPE_USHORT: unsigned short
  • EINA_VALUE_TYPE_UINT: unsigned int
  • EINA_VALUE_TYPE_ULONG: unsigned long
  • EINA_VALUE_TYPE_UINT64: uint64_t
  • EINA_VALUE_TYPE_CHAR: char
  • EINA_VALUE_TYPE_SHORT: short
  • EINA_VALUE_TYPE_INT: int
  • EINA_VALUE_TYPE_LONG: long
  • EINA_VALUE_TYPE_INT64: int64_t
  • EINA_VALUE_TYPE_FLOAT: float
  • EINA_VALUE_TYPE_DOUBLE: double
  • EINA_VALUE_TYPE_STRINGSHARE: const char *
  • EINA_VALUE_TYPE_STRING: const char *
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array
  • EINA_VALUE_TYPE_LIST: Eina_Value_List
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_pset()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_append ( Eina_Value value,
  ... 
)
inlinestatic

Append a generic value in an array.

Parameters
valuesource value object
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The variable argument is dependent on chosen subtype. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char
  • EINA_VALUE_TYPE_USHORT: unsigned short
  • EINA_VALUE_TYPE_UINT: unsigned int
  • EINA_VALUE_TYPE_ULONG: unsigned long
  • EINA_VALUE_TYPE_UINT64: uint64_t
  • EINA_VALUE_TYPE_CHAR: char
  • EINA_VALUE_TYPE_SHORT: short
  • EINA_VALUE_TYPE_INT: int
  • EINA_VALUE_TYPE_LONG: long
  • EINA_VALUE_TYPE_INT64: int64_t
  • EINA_VALUE_TYPE_FLOAT: float
  • EINA_VALUE_TYPE_DOUBLE: double
  • EINA_VALUE_TYPE_STRINGSHARE: const char *
  • EINA_VALUE_TYPE_STRING: const char *
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array
  • EINA_VALUE_TYPE_LIST: Eina_Value_List
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_pset()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_vset ( Eina_Value value,
unsigned int  position,
va_list  args 
)
inlinestatic

Set a generic value to an array member.

Parameters
valuesource value object
positionindex of the member
argsvariable argument
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_pset()
eina_value_array_insert()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_vget ( const Eina_Value value,
unsigned int  position,
va_list  args 
)
inlinestatic

Get the generic value from an array member.

Parameters
valuesource value object
positionindex of the member
argsvariable argument
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

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.

See Also
eina_value_array_vset()
eina_value_array_get()
eina_value_array_pget()
Since
1.2
static Eina_Bool eina_value_array_vinsert ( Eina_Value value,
unsigned int  position,
va_list  args 
)
inlinestatic

Insert a generic value to an array member position.

Parameters
valuesource value object
positionindex of the member
argsvariable argument
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_pset()
eina_value_array_insert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_vappend ( Eina_Value value,
va_list  args 
)
inlinestatic
static Eina_Bool eina_value_array_pset ( Eina_Value value,
unsigned int  position,
const void *  ptr 
)
inlinestatic

Set a generic value to an array member from a pointer.

Parameters
valuesource value object
positionindex of the member
ptrpointer to specify the contents.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The pointer type is dependent on chosen value type. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char*
  • EINA_VALUE_TYPE_USHORT: unsigned short*
  • EINA_VALUE_TYPE_UINT: unsigned int*
  • EINA_VALUE_TYPE_ULONG: unsigned long*
  • EINA_VALUE_TYPE_UINT64: uint64_t*
  • EINA_VALUE_TYPE_CHAR: char*
  • EINA_VALUE_TYPE_SHORT: short*
  • EINA_VALUE_TYPE_INT: int*
  • EINA_VALUE_TYPE_LONG: long*
  • EINA_VALUE_TYPE_INT64: int64_t*
  • EINA_VALUE_TYPE_FLOAT: float*
  • EINA_VALUE_TYPE_DOUBLE: double*
  • EINA_VALUE_TYPE_STRINGSHARE: const char **
  • EINA_VALUE_TYPE_STRING: const char **
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array*
  • EINA_VALUE_TYPE_LIST: Eina_Value_List*
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash*
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval*
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob*
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct*
Note
the pointer contents are written using the size defined by type. It can be larger than void* or uint64_t.
int x = 1234;
eina_value_array_pset(value, 0, &x);
eina_value_array_pget(value, 0, &x);
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_insert()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_pget ( const Eina_Value value,
unsigned int  position,
void *  ptr 
)
inlinestatic

Retrieve a generic value into a pointer from an array member.

Parameters
valuesource value object
positionindex of the member
ptrpointer to receive the contents.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

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_VALUE_TYPE_UCHAR: unsigned char*
  • EINA_VALUE_TYPE_USHORT: unsigned short*
  • EINA_VALUE_TYPE_UINT: unsigned int*
  • EINA_VALUE_TYPE_ULONG: unsigned long*
  • EINA_VALUE_TYPE_UINT64: uint64_t*
  • EINA_VALUE_TYPE_CHAR: char*
  • EINA_VALUE_TYPE_SHORT: short*
  • EINA_VALUE_TYPE_INT: int*
  • EINA_VALUE_TYPE_LONG: long*
  • EINA_VALUE_TYPE_INT64: int64_t*
  • EINA_VALUE_TYPE_FLOAT: float*
  • EINA_VALUE_TYPE_DOUBLE: double*
  • EINA_VALUE_TYPE_STRINGSHARE: const char **
  • EINA_VALUE_TYPE_STRING: const char **
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array*
  • EINA_VALUE_TYPE_LIST: Eina_Value_List*
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash*
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval*
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob*
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct*
See Also
eina_value_array_set()
eina_value_array_vset()
eina_value_array_pset()
Since
1.2
static Eina_Bool eina_value_array_pinsert ( Eina_Value value,
unsigned int  position,
const void *  ptr 
)
inlinestatic

Insert a generic value to an array member position from a pointer.

Parameters
valuesource value object
positionindex of the member
ptrpointer to specify the contents.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The pointer type is dependent on chosen value type. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char*
  • EINA_VALUE_TYPE_USHORT: unsigned short*
  • EINA_VALUE_TYPE_UINT: unsigned int*
  • EINA_VALUE_TYPE_ULONG: unsigned long*
  • EINA_VALUE_TYPE_UINT64: uint64_t*
  • EINA_VALUE_TYPE_CHAR: char*
  • EINA_VALUE_TYPE_SHORT: short*
  • EINA_VALUE_TYPE_INT: int*
  • EINA_VALUE_TYPE_LONG: long*
  • EINA_VALUE_TYPE_INT64: int64_t*
  • EINA_VALUE_TYPE_FLOAT: float*
  • EINA_VALUE_TYPE_DOUBLE: double*
  • EINA_VALUE_TYPE_STRINGSHARE: const char **
  • EINA_VALUE_TYPE_STRING: const char **
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array*
  • EINA_VALUE_TYPE_LIST: Eina_Value_List*
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash*
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval*
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob*
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct*
Note
the pointer contents are written using the size defined by type. It can be larger than void* or uint64_t.
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_insert()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_pappend ( Eina_Value value,
const void *  ptr 
)
inlinestatic

Append a generic value to an array from a pointer.

Parameters
valuesource value object
ptrpointer to specify the contents.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The pointer type is dependent on chosen value type. The list for basic types:

  • EINA_VALUE_TYPE_UCHAR: unsigned char*
  • EINA_VALUE_TYPE_USHORT: unsigned short*
  • EINA_VALUE_TYPE_UINT: unsigned int*
  • EINA_VALUE_TYPE_ULONG: unsigned long*
  • EINA_VALUE_TYPE_UINT64: uint64_t*
  • EINA_VALUE_TYPE_CHAR: char*
  • EINA_VALUE_TYPE_SHORT: short*
  • EINA_VALUE_TYPE_INT: int*
  • EINA_VALUE_TYPE_LONG: long*
  • EINA_VALUE_TYPE_INT64: int64_t*
  • EINA_VALUE_TYPE_FLOAT: float*
  • EINA_VALUE_TYPE_DOUBLE: double*
  • EINA_VALUE_TYPE_STRINGSHARE: const char **
  • EINA_VALUE_TYPE_STRING: const char **
  • EINA_VALUE_TYPE_ARRAY: Eina_Value_Array*
  • EINA_VALUE_TYPE_LIST: Eina_Value_List*
  • EINA_VALUE_TYPE_HASH: Eina_Value_Hash*
  • EINA_VALUE_TYPE_TIMEVAL: struct timeval*
  • EINA_VALUE_TYPE_BLOB: Eina_Value_Blob*
  • EINA_VALUE_TYPE_STRUCT: Eina_Value_Struct*
Note
the pointer contents are written using the size defined by type. It can be larger than void* or uint64_t.
See Also
eina_value_array_set()
eina_value_array_get()
eina_value_array_vset()
eina_value_array_insert()
eina_value_array_vinsert()
eina_value_array_pinsert()
eina_value_array_append()
eina_value_array_vappend()
eina_value_array_pappend()
Since
1.2
static Eina_Bool eina_value_array_value_get ( const Eina_Value src,
unsigned int  position,
Eina_Value dst 
)
inlinestatic

Retrieves a value from the array as an Eina_Value copy.

Parameters
srcsource value object
positionindex of the member
dstwhere to return the array member
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

The argument dst is considered uninitialized and it's setup to the type of the member.

Since
1.2