add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
/* EINA - EFL data type library
* Copyright ( C ) 2012 ProFUSION embedded systems
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ;
* if not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef EINA_VALUE_H_
# define EINA_VALUE_H_
# include "eina_types.h"
# include "eina_fp.h" /* defines int64_t and uint64_t */
# include "eina_inarray.h"
2012-01-11 13:52:32 -08:00
# include "eina_list.h"
2012-01-11 15:54:35 -08:00
# include "eina_hash.h"
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
# include <stdarg.h>
/**
* @ addtogroup Eina_Data_Types_Group Data Types
*
* @ since 1.2
*
* @ {
*/
/**
* @ addtogroup Eina_Containers_Group Containers
*
* @ {
*/
/**
* @ defgroup Eina_Value_Group Generic Value Storage
*
* @ {
*/
/**
* @ typedef Eina_Value
* Store generic values .
*
* @ since 1.2
*/
typedef struct _Eina_Value Eina_Value ;
/**
* @ typedef Eina_Value_Type
2012-01-11 19:21:52 -08:00
* Describes the data contained by the value
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
typedef struct _Eina_Value_Type Eina_Value_Type ;
/**
* @ typedef Eina_Value_Union
2012-01-11 19:21:52 -08:00
* Union of all known value types .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
typedef union _Eina_Value_Union Eina_Value_Union ;
/**
* @ union _Eina_Value_Union
2012-01-11 19:21:52 -08:00
* All possible value types .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
union _Eina_Value_Union
{
unsigned char buf [ 8 ] ; /**< just hold 8-bytes, more goes into ptr */
void * ptr ; /**< used as generic pointer */
uint64_t _guarantee ; /**< guarantees 8-byte alignment */
} ;
/**
* @ var EINA_VALUE_TYPE_UCHAR
* manages unsigned char type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_UCHAR ;
/**
* @ var EINA_VALUE_TYPE_USHORT
* manages unsigned short type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_USHORT ;
/**
* @ var EINA_VALUE_TYPE_UINT
* manages unsigned int type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_UINT ;
/**
* @ var EINA_VALUE_TYPE_ULONG
* manages unsigned long type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_ULONG ;
/**
* @ var EINA_VALUE_TYPE_UINT64
* manages unsigned integer of 64 bits type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_UINT64 ;
/**
* @ var EINA_VALUE_TYPE_CHAR
* manages char type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_CHAR ;
/**
* @ var EINA_VALUE_TYPE_SHORT
* manages short type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_SHORT ;
/**
* @ var EINA_VALUE_TYPE_INT
* manages int type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_INT ;
/**
* @ var EINA_VALUE_TYPE_LONG
* manages long type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_LONG ;
/**
* @ var EINA_VALUE_TYPE_INT64
* manages integer of 64 bits type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_INT64 ;
/**
* @ var EINA_VALUE_TYPE_FLOAT
* manages float type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_FLOAT ;
/**
* @ var EINA_VALUE_TYPE_DOUBLE
* manages double type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_DOUBLE ;
/**
* @ var EINA_VALUE_TYPE_STRINGSHARE
2012-01-11 19:21:52 -08:00
* manages stringshared string type .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_STRINGSHARE ;
/**
* @ var EINA_VALUE_TYPE_STRING
* manages string type .
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_STRING ;
/**
* @ var EINA_VALUE_TYPE_ARRAY
*
2012-01-11 19:21:52 -08:00
* manages array type . Use the value get / set for arrays :
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ li eina_value_array_get ( ) and eina_value_array_set ( )
* @ li eina_value_array_vget ( ) and eina_value_array_vset ( )
* @ li eina_value_array_pget ( ) and eina_value_array_pset ( )
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_ARRAY ;
2012-01-11 13:52:32 -08:00
/**
* @ var EINA_VALUE_TYPE_LIST
*
2012-01-11 19:21:52 -08:00
* manages list type . Use the value get / set for lists :
2012-01-11 13:52:32 -08:00
* @ li eina_value_list_get ( ) and eina_value_list_set ( )
* @ li eina_value_list_vget ( ) and eina_value_list_vset ( )
* @ li eina_value_list_pget ( ) and eina_value_list_pset ( )
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_LIST ;
2012-01-11 15:54:35 -08:00
/**
* @ var EINA_VALUE_TYPE_HASH
*
2012-01-11 19:21:52 -08:00
* manages hash type . Use the value get / set for hashes :
2012-01-11 15:54:35 -08:00
* @ li eina_value_hash_get ( ) and eina_value_hash_set ( )
* @ li eina_value_hash_vget ( ) and eina_value_hash_vset ( )
* @ li eina_value_hash_pget ( ) and eina_value_hash_pset ( )
*
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_HASH ;
2012-01-11 17:31:21 -08:00
/**
* @ var EINA_VALUE_TYPE_TIMEVAL
* manages ' struct timeval ' type
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_TIMEVAL ;
2012-01-11 19:00:03 -08:00
/**
* @ var EINA_VALUE_TYPE_BLOB
* manages blob of bytes type , see @ ref Eina_Value_Blob
* @ since 1.2
*/
EAPI extern const Eina_Value_Type * EINA_VALUE_TYPE_BLOB ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
/**
* @ var EINA_ERROR_VALUE_FAILED
* Error identifier corresponding to value check failure .
*
* @ since 1.2
*/
EAPI extern int EINA_ERROR_VALUE_FAILED ;
/**
* @ defgroup Eina_Value_Value_Group Generic Value management
*
* @ {
*/
/**
* @ struct _Eina_Value
* defines the contents of a value
*
* @ since 1.2
*/
struct _Eina_Value
{
const Eina_Value_Type * type ; /**< how to access values */
Eina_Value_Union value ; /**< to be accessed with type descriptor */
} ;
/**
* @ brief Create generic value storage .
* @ param type how to manage this value .
* @ return The new value or @ c NULL on failure .
*
* Create a new generic value storage . The members are managed using
* the description specified by @ a type .
*
2012-01-11 19:21:52 -08:00
* Some types may specify more operations :
* eg . # EINA_VALUE_TYPE_ARRAY uses eina_value_array_set ( ) ,
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* eina_value_array_get ( ) and so on .
*
2012-01-11 19:21:52 -08:00
* On failure , @ c NULL is returned and either # EINA_ERROR_OUT_OF_MEMORY or
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* # EINA_ERROR_VALUE_FAILED is set .
*
2012-01-11 19:21:52 -08:00
* @ note this calls malloc and then uses eina_value_setup ( ) .
* Consider using eina_value_flush ( ) and eina_value_setup ( ) instead
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* to avoid memory allocations .
*
* @ see eina_value_free ( )
*
* @ since 1.2
*/
EAPI Eina_Value * eina_value_new ( const Eina_Value_Type * type ) EINA_ARG_NONNULL ( 1 ) EINA_MALLOC EINA_WARN_UNUSED_RESULT ;
/**
* @ brief Free value and its data .
* @ param value value object
*
* @ see eina_value_flush ( )
*
* @ since 1.2
*/
EAPI void eina_value_free ( Eina_Value * value ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Initialize generic value storage .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value value object
* @ param type how to manage this value .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
2012-01-11 19:21:52 -08:00
* Initializes existing generic value storage . The members are managed using the
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* description specified by @ a 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 .
*
2012-01-11 19:21:52 -08:00
* @ note Existing contents are ignored ! If the value was previously used , then
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* 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 eina_value_flush ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_setup ( Eina_Value * value ,
const Eina_Value_Type * type ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Create generic value storage .
* @ param value value object
*
2012-01-11 19:21:52 -08:00
* Releases all the resources associated with an # Eina_Value . The
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* 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 .
*
* @ see eina_value_setup ( )
* @ see eina_value_free ( )
*
* @ since 1.2
*/
static inline void eina_value_flush ( Eina_Value * value ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Copy generic value storage .
* @ param value source value object
* @ param copy destination value object
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The @ a copy object is considered internalized and its existing
2012-01-11 19:21:52 -08:00
* contents are overwritten ( just as if eina_value_flush ( ) was called on
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* it ) .
*
* The copy happens by calling eina_value_setup ( ) on @ a copy , followed
* by getting the contents of @ a value and setting it to @ a copy .
*
* @ since 1.2
*/
EAPI Eina_Bool eina_value_copy ( const Eina_Value * value ,
Eina_Value * copy ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Compare generic value storage .
* @ param a left side of comparison
* @ param b right side of comparison
* @ return less than zero if a < b , greater than zero if a > b , zero
2012-01-11 19:21:52 -08:00
* if a = = b
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
static inline int eina_value_compare ( const Eina_Value * a ,
const Eina_Value * b ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Set the generic value .
* @ param value source value object
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array
2012-01-11 13:52:32 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
* Eina_Value * value = eina_value_new ( EINA_VALUE_TYPE_INT ) ;
* int x = 567 ;
* eina_value_set ( value , 1234 ) ;
* eina_value_set ( value , x ) ;
*
* eina_value_flush ( value ) ;
*
* eina_value_setup ( value , EINA_VALUE_TYPE_STRING ) ;
* eina_value_set ( value , " hello world! " ) ;
*
* eina_value_free ( value ) ;
* @ endcode
*
* @ note for array member see eina_value_array_set ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_set ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_set ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_get ( )
* @ see eina_value_vset ( )
* @ see eina_value_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_set ( Eina_Value * value ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value .
* @ param value source value object
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* The variable argument is dependent on chosen type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 13:52:32 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
* Eina_Value * value = eina_value_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
* const char * s ;
*
* eina_value_set ( value , 1234 ) ;
* eina_value_get ( value , & x ) ;
*
* eina_value_flush ( value ) ;
*
* eina_value_setup ( value , EINA_VALUE_TYPE_STRING ) ;
* eina_value_set ( value , " hello world! " ) ;
* eina_value_get ( value , & s ) ;
*
* eina_value_free ( value ) ;
* @ endcode
*
* @ note for array member see eina_value_array_get ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_get ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_get ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_set ( )
* @ see eina_value_vset ( )
* @ see eina_value_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_get ( const Eina_Value * value ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value .
* @ param value source value object
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* @ note for array member see eina_value_array_vset ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_vset ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_vset ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_vget ( )
* @ see eina_value_set ( )
* @ see eina_value_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_vset ( Eina_Value * value ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value .
* @ param value source value object
* @ param args variable argument
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ note for array member see eina_value_array_vget ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_vget ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_vget ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_vset ( )
* @ see eina_value_get ( )
* @ see eina_value_pget ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_vget ( const Eina_Value * value ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value from pointer .
* @ param value source value object
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 13:52:32 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
* Eina_Value * value = eina_value_new ( EINA_VALUE_TYPE_INT ) ;
* int x = 567 ;
* const char * s = " hello world! " ;
*
* eina_value_pset ( value , & x ) ;
*
* eina_value_flush ( value ) ;
*
* eina_value_setup ( value , EINA_VALUE_TYPE_STRING ) ;
* eina_value_pset ( value , & s ) ;
*
* eina_value_free ( value ) ;
* @ endcode
*
* @ note for array member see eina_value_array_pset ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_pset ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_pset ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_pget ( )
* @ see eina_value_set ( )
* @ see eina_value_vset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_pset ( Eina_Value * value ,
const void * ptr ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Get the generic value to pointer .
* @ param value source value object
* @ param ptr pointer to receive the contents .
* @ return # 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
2012-01-11 19:21:52 -08:00
* should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 13:52:32 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
* Eina_Value * value = eina_value_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
* const char * s ;
*
* eina_value_set ( value , 1234 ) ;
* eina_value_pget ( value , & x ) ;
*
* eina_value_flush ( value ) ;
*
* eina_value_setup ( value , EINA_VALUE_TYPE_STRING ) ;
* eina_value_set ( value , " hello world! " ) ;
* eina_value_pget ( value , & s ) ;
*
* eina_value_free ( value ) ;
* @ endcode
*
* @ note for array member see eina_value_array_get ( )
2012-01-11 13:52:32 -08:00
* @ note for list member see eina_value_list_get ( )
2012-01-11 15:54:35 -08:00
* @ note for hash member see eina_value_hash_get ( )
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_set ( )
* @ see eina_value_vset ( )
* @ see eina_value_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_pget ( const Eina_Value * value ,
void * ptr ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Convert one value to another type .
* @ param value source value object .
* @ param convert destination value object .
* @ return # EINA_TRUE if converted , # EINA_FALSE otherwise .
*
* Converts one value to another trying first @ a value type
2012-01-11 19:21:52 -08:00
* @ c convert_to ( ) function . If unsuccessful , tries using @ c convert_from ( )
* function in @ a convert .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
2012-01-11 19:21:52 -08:00
* Conversion functions are type defined , and the basic types can convert
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* 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 ( ) .
*
2012-01-11 19:21:52 -08:00
* @ note Both objects must have eina_value_setup ( ) called on them beforehand !
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ since 1.2
*/
EAPI Eina_Bool eina_value_convert ( const Eina_Value * value ,
Eina_Value * convert ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Convert value to string .
* @ param value value object .
* @ return newly allocated memory or @ c NULL on failure .
*
* @ see eina_value_convert ( )
* @ since 1.2
*/
EAPI char * eina_value_to_string ( const Eina_Value * value ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Query value type .
* @ param value value object .
* @ return type instance or @ c 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 .
*
* @ see eina_value_type_check ( )
*
* @ since 1.2
*/
static inline const Eina_Value_Type * eina_value_type_get ( const Eina_Value * value ) EINA_PURE EINA_ARG_NONNULL ( 1 ) EINA_WARN_UNUSED_RESULT ;
/**
* @ }
*/
/**
* @ defgroup Eina_Value_Array_Group Generic Value Array management
*
* @ {
*/
/**
* @ typedef Eina_Value_Array
* Value type for # EINA_VALUE_TYPE_ARRAY
*
* @ since 1.2
*/
typedef struct _Eina_Value_Array Eina_Value_Array ;
/**
* @ struct _Eina_Value_Array
* Used to store the array and its subtype .
*/
struct _Eina_Value_Array
{
const Eina_Value_Type * subtype ; /**< how to allocate and access items */
unsigned int step ; /**< how to grow the members array */
Eina_Inarray * array ; /**< the array that holds data, members are of subtype->value_size bytes. */
2012-01-11 02:37:13 -08:00
} ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
/**
* @ brief Create generic value storage of type array .
* @ param subtype how to manage this array members .
* @ param step how to grow the members array .
* @ return The new value or @ c NULL on failure .
*
* Create a new generic value storage of type array . The members are
* managed using the description specified by @ a subtype .
*
* On failure , @ c NULL is returned and # EINA_ERROR_OUT_OF_MEMORY or
* # EINA_ERROR_VALUE_FAILED is set .
*
2012-01-11 19:21:52 -08:00
* @ note this calls malloc and then uses eina_value_array_setup ( ) .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ see eina_value_free ( )
* @ see eina_value_array_setup ( )
*
* @ since 1.2
*/
EAPI Eina_Value * eina_value_array_new ( const Eina_Value_Type * subtype ,
unsigned int step ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Initialize generic value storage of type array .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value value object
2012-01-11 19:21:52 -08:00
* @ param subtype how to manage array members .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param step how to grow the members array .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
2012-01-11 19:21:52 -08:00
* Initializes new generic value storage of type array with the given
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ a 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 .
*
2012-01-11 19:21:52 -08:00
* @ note Existing contents are ignored ! If the value was previously used , then
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* 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 eina_value_flush ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_setup ( Eina_Value * value ,
const Eina_Value_Type * subtype ,
unsigned int step ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Query number of elements in value of array type .
* @ param value value object .
* @ return number of child elements .
* @ since 1.2
*/
static inline unsigned int eina_value_array_count ( const Eina_Value * value ) ;
/**
* @ brief Remove element at given position in value of array type .
* @ param value value object .
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_remove ( Eina_Value * value ,
unsigned int position ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an array member .
* @ param value source value object
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x ;
*
* eina_value_array_append ( value , 1234 ) ;
* eina_value_array_set ( value , 0 , 5678 ) ;
* eina_value_array_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_set ( Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an array member .
* @ param value source value object
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
2012-01-11 19:21:52 -08:00
* The value is returned in the variable argument parameter , and the
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* actual value is type - dependent , but usually it will be what is
2012-01-11 19:21:52 -08:00
* stored inside the object . There shouldn ' t be any memory allocation ;
* thus the contents should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x ;
*
* eina_value_array_append ( value , 1234 ) ;
* eina_value_array_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_get ( const Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Insert a generic value in an array member position .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x ;
*
* eina_value_array_insert ( value , 0 , 1234 ) ;
* eina_value_array_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_insert ( Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Append a generic value in an array .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x ;
*
* eina_value_array_append ( value , 1234 ) ;
* eina_value_array_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_append ( Eina_Value * value ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Set a generic value to an array member .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_vset ( Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an array member .
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ see eina_value_array_vset ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_pget ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_vget ( const Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Insert a generic value to an array member position .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_vinsert ( Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Append a generic value to an array .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vget ( )
* @ see eina_value_array_pset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_vappend ( Eina_Value * value ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Set a generic value to an array member from a pointer .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x = 1234 ;
*
* eina_value_array_append ( value , 1234 ) ;
* eina_value_array_pset ( value , 0 , & x ) ;
* eina_value_array_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_pset ( Eina_Value * value ,
unsigned int position ,
const void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Retrieve a generic value into a pointer from an array member .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to receive the contents .
* @ return # 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
2012-01-11 19:21:52 -08:00
* should @ b not be freed .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x ;
*
* eina_value_array_append ( value , 1234 ) ;
* eina_value_array_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_pget ( const Eina_Value * value ,
unsigned int position ,
void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Insert a generic value to an array member position from a pointer .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x = 1234 ;
*
* eina_value_array_pinsert ( value , 0 , & x ) ;
* eina_value_array_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_pinsert ( Eina_Value * value ,
unsigned int position ,
const void * ptr ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Append a generic value to an array from a pointer .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param value source value object
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_ARRAY : Eina_Value_Array *
2012-01-11 15:54:35 -08:00
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
2012-01-11 15:54:35 -08:00
* Eina_Value * value = eina_value_array_new ( EINA_VALUE_TYPE_INT , 0 ) ;
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* int x = 1234 ;
*
* eina_value_array_pappend ( value , & x ) ;
* eina_value_array_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_array_set ( )
* @ see eina_value_array_get ( )
* @ see eina_value_array_vset ( )
* @ see eina_value_array_insert ( )
* @ see eina_value_array_vinsert ( )
* @ see eina_value_array_pinsert ( )
* @ see eina_value_array_append ( )
* @ see eina_value_array_vappend ( )
* @ see eina_value_array_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_array_pappend ( Eina_Value * value ,
const void * ptr ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ }
*/
2012-01-11 13:52:32 -08:00
/**
* @ defgroup Eina_Value_List_Group Generic Value List management
*
* @ {
*/
/**
* @ typedef Eina_Value_List
* Value type for # EINA_VALUE_TYPE_LIST
*
* @ since 1.2
*/
typedef struct _Eina_Value_List Eina_Value_List ;
/**
* @ struct _Eina_Value_List
* Used to store the list and its subtype .
*/
struct _Eina_Value_List
{
const Eina_Value_Type * subtype ; /**< how to allocate and access items */
Eina_List * list ; /**< the list that holds data, members are of subtype->value_size bytes. */
} ;
/**
* @ brief Create generic value storage of type list .
* @ param subtype how to manage this list members .
* @ return The new value or @ c NULL on failure .
*
* Create a new generic value storage of type list . The members are
* managed using the description specified by @ a subtype .
*
* On failure , @ c NULL is returned and # EINA_ERROR_OUT_OF_MEMORY or
* # EINA_ERROR_VALUE_FAILED is set .
*
2012-01-11 19:21:52 -08:00
* @ note this calls malloc and then uses eina_value_list_setup ( ) .
2012-01-11 13:52:32 -08:00
*
* @ see eina_value_free ( )
* @ see eina_value_list_setup ( )
*
* @ since 1.2
*/
EAPI Eina_Value * eina_value_list_new ( const Eina_Value_Type * subtype ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Initialize generic value storage of type list .
2012-01-11 13:52:32 -08:00
* @ param value value object
* @ param subtype how to manage this list members .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
2012-01-11 19:21:52 -08:00
* Initializes new generic value storage of type list with the given
2012-01-11 13:52:32 -08:00
* @ a subtype .
*
* This is the same as calling eina_value_set ( ) with
* # EINA_VALUE_TYPE_LIST followed by eina_value_pset ( ) with the
* # Eina_Value_List description configured .
*
2012-01-11 19:21:52 -08:00
* @ note Existing contents are ignored ! If the value was previously used , then
2012-01-11 13:52:32 -08:00
* 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 eina_value_flush ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_setup ( Eina_Value * value ,
const Eina_Value_Type * subtype ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Query number of elements in value of list type .
* @ param value value object .
* @ return number of child elements .
* @ since 1.2
*/
static inline unsigned int eina_value_list_count ( const Eina_Value * value ) ;
/**
* @ brief Remove element at given position in value of list type .
* @ param value value object .
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_remove ( Eina_Value * value ,
unsigned int position ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an list member .
* @ param value source value object
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
*
* eina_value_list_append ( value , 1234 ) ;
* eina_value_list_set ( value , 0 , 5678 ) ;
* eina_value_list_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_set ( Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an list member .
* @ param value source value object
* @ param position index of the member
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
2012-01-11 13:52:32 -08:00
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
*
* eina_value_list_append ( value , 1234 ) ;
* eina_value_list_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_get ( const Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Insert the generic value in an list member position .
* @ param value source value object
* @ param position index of the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
*
* eina_value_list_insert ( value , 0 , 1234 ) ;
* eina_value_list_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_insert ( Eina_Value * value ,
unsigned int position ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Append the generic value in an list .
* @ param value source value object
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
*
* eina_value_list_append ( value , 1234 ) ;
* eina_value_list_get ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_append ( Eina_Value * value ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an list member .
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_vset ( Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an list member .
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
2012-01-11 13:52:32 -08:00
*
* @ see eina_value_list_vset ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_pget ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_vget ( const Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Insert the generic value in an list member position .
* @ param value source value object
* @ param position index of the member
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_vinsert ( Eina_Value * value ,
unsigned int position ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Append the generic value in an list .
* @ param value source value object
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vget ( )
* @ see eina_value_list_pset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_vappend ( Eina_Value * value ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an list member from pointer .
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x = 1234 ;
*
* eina_value_list_append ( value , 1234 ) ;
* eina_value_list_pset ( value , 0 , & x ) ;
* eina_value_list_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_pset ( Eina_Value * value ,
unsigned int position ,
const void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
* @ brief Get the generic value to pointer from an list member .
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to receive the contents .
* @ return # 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
2012-01-11 19:21:52 -08:00
* should @ b not be freed .
2012-01-11 13:52:32 -08:00
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x ;
*
* eina_value_list_append ( value , 1234 ) ;
* eina_value_list_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_pget ( const Eina_Value * value ,
unsigned int position ,
void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
* @ brief Insert the generic value in an list member position from pointer .
* @ param value source value object
* @ param position index of the member
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x = 1234 ;
*
* eina_value_list_pinsert ( value , 0 , & x ) ;
* eina_value_list_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_pinsert ( Eina_Value * value ,
unsigned int position ,
const void * ptr ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Append the generic value in an list from pointer .
* @ param value source value object
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The list for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_LIST : Eina_Value_List *
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
* Eina_Value * value = eina_value_list_new ( EINA_VALUE_TYPE_INT ) ;
* int x = 1234 ;
*
* eina_value_list_pappend ( value , & x ) ;
* eina_value_list_pget ( value , 0 , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_list_set ( )
* @ see eina_value_list_get ( )
* @ see eina_value_list_vset ( )
* @ see eina_value_list_insert ( )
* @ see eina_value_list_vinsert ( )
* @ see eina_value_list_pinsert ( )
* @ see eina_value_list_append ( )
* @ see eina_value_list_vappend ( )
* @ see eina_value_list_pappend ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_list_pappend ( Eina_Value * value ,
const void * ptr ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ }
*/
2012-01-11 15:54:35 -08:00
/**
* @ defgroup Eina_Value_Hash_Group Generic Value Hash management
*
* @ {
*/
/**
* @ typedef Eina_Value_Hash
* Value type for # EINA_VALUE_TYPE_HASH
*
* @ since 1.2
*/
typedef struct _Eina_Value_Hash Eina_Value_Hash ;
/**
* @ struct _Eina_Value_Hash
* Used to store the hash and its subtype .
*/
struct _Eina_Value_Hash
{
const Eina_Value_Type * subtype ; /**< how to allocate and access items */
unsigned int buckets_power_size ; /**< how to allocate hash buckets, if zero a sane default is chosen. */
Eina_Hash * hash ; /**< the hash that holds data, members are of subtype->value_size bytes. */
} ;
/**
* @ brief Create generic value storage of type hash .
* @ param subtype how to manage this hash members .
* @ param buckets_power_size how to allocate hash buckets ( 2 ^
* buckets_power_size ) , if zero then a sane value is chosen .
* @ return The new value or @ c NULL on failure .
*
* Create a new generic value storage of type hash . The members are
* managed using the description specified by @ a subtype .
*
* On failure , @ c NULL is returned and # EINA_ERROR_OUT_OF_MEMORY or
* # EINA_ERROR_VALUE_FAILED is set .
*
2012-01-11 19:21:52 -08:00
* @ note this calls malloc and then uses eina_value_hash_setup ( ) .
2012-01-11 15:54:35 -08:00
*
* @ see eina_value_free ( )
* @ see eina_value_hash_setup ( )
*
* @ since 1.2
*/
EAPI Eina_Value * eina_value_hash_new ( const Eina_Value_Type * subtype , unsigned int buckets_power_size ) EINA_ARG_NONNULL ( 1 ) ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Initialize generic value storage of type hash .
2012-01-11 15:54:35 -08:00
* @ param value value object
* @ param subtype how to manage this hash members .
* @ param buckets_power_size how to allocate hash buckets ( 2 ^
* buckets_power_size ) , if zero then a sane value is chosen .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
2012-01-11 19:21:52 -08:00
* Initializes new generic value storage of type hash with the given
2012-01-11 15:54:35 -08:00
* @ a subtype .
*
* This is the same as calling eina_value_set ( ) with
* # EINA_VALUE_TYPE_HASH followed by eina_value_pset ( ) with the
* # Eina_Value_Hash description configured .
*
2012-01-11 19:21:52 -08:00
* @ note Existing contents are ignored ! If the value was previously used , then
2012-01-11 15:54:35 -08:00
* 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 eina_value_flush ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_setup ( Eina_Value * value ,
const Eina_Value_Type * subtype ,
unsigned int buckets_power_size ) EINA_ARG_NONNULL ( 1 , 2 ) ;
/**
* @ brief Query number of elements in value of hash type .
* @ param value value object .
* @ return number of child elements .
* @ since 1.2
*/
static inline unsigned int eina_value_hash_population ( const Eina_Value * value ) ;
/**
* @ brief Remove element at given position in value of hash type .
* @ param value value object .
* @ param key key to find the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_del ( Eina_Value * value ,
const char * key ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an hash member .
* @ param value source value object
* @ param key key to find the member
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The variable argument is dependent on chosen subtype . The hash for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char
* @ li EINA_VALUE_TYPE_USHORT : unsigned short
* @ li EINA_VALUE_TYPE_UINT : unsigned int
* @ li EINA_VALUE_TYPE_ULONG : unsigned long
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t
* @ li EINA_VALUE_TYPE_CHAR : char
* @ li EINA_VALUE_TYPE_SHORT : short
* @ li EINA_VALUE_TYPE_INT : int
* @ li EINA_VALUE_TYPE_LONG : long
* @ li EINA_VALUE_TYPE_INT64 : int64_t
* @ li EINA_VALUE_TYPE_FLOAT : float
* @ li EINA_VALUE_TYPE_DOUBLE : double
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char *
* @ li EINA_VALUE_TYPE_STRING : const char *
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash
*
* @ code
* Eina_Value * value = eina_value_hash_new ( EINA_VALUE_TYPE_INT , 0 ) ;
* int x ;
*
* eina_value_hash_set ( value , " abc " , 5678 ) ;
* eina_value_hash_get ( value , " abc " , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_hash_get ( )
* @ see eina_value_hash_vset ( )
* @ see eina_value_hash_pset ( )
* @ see eina_value_hash_del ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_set ( Eina_Value * value ,
const char * key ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an hash member .
* @ param value source value object
* @ param key key to find the member
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
2012-01-11 15:54:35 -08:00
*
* The variable argument is dependent on chosen subtype . The hash for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
*
* @ code
* Eina_Value * value = eina_value_hash_new ( EINA_VALUE_TYPE_INT , 0 ) ;
* int x ;
*
* eina_value_hash_set ( value , " abc " , 1234 ) ;
* eina_value_hash_get ( value , " abc " , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_hash_set ( )
* @ see eina_value_hash_vset ( )
* @ see eina_value_hash_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_get ( const Eina_Value * value ,
const char * key ,
. . . ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an hash member .
* @ param value source value object
* @ param key key to find the member
* @ param args variable argument
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ see eina_value_hash_set ( )
* @ see eina_value_hash_get ( )
* @ see eina_value_hash_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_vset ( Eina_Value * value ,
const char * key ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Get the generic value from an hash member .
* @ param value source value object
* @ param key key to find the member
* @ param args variable argument
* @ return # 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 ,
2012-01-11 19:21:52 -08:00
* thus the contents should @ b not be freed .
2012-01-11 15:54:35 -08:00
*
* @ see eina_value_hash_vset ( )
* @ see eina_value_hash_get ( )
* @ see eina_value_hash_pget ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_vget ( const Eina_Value * value ,
const char * key ,
va_list args ) EINA_ARG_NONNULL ( 1 ) ;
/**
* @ brief Set the generic value in an hash member from pointer .
* @ param value source value object
* @ param key key to find the member
* @ param ptr pointer to specify the contents .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
*
* The pointer type is dependent on chosen value type . The hash for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
*
* @ note the pointer contents are written using the size defined by
* type . It can be larger than void * or uint64_t .
*
* @ code
* Eina_Value * value = eina_value_hash_new ( EINA_VALUE_TYPE_INT , 0 ) ;
* int x = 1234 ;
*
* eina_value_hash_pset ( value , " abc " , & x ) ;
* eina_value_hash_pget ( value , " abc " , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_hash_set ( )
* @ see eina_value_hash_get ( )
* @ see eina_value_hash_vset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_pset ( Eina_Value * value ,
const char * key ,
const void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
* @ brief Get the generic value to pointer from an hash member .
* @ param value source value object
* @ param key key to find the member
* @ param ptr pointer to receive the contents .
* @ return # 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
2012-01-11 19:21:52 -08:00
* should @ b not be freed .
2012-01-11 15:54:35 -08:00
*
* The pointer type is dependent on chosen value type . The hash for
* basic types :
*
* @ li EINA_VALUE_TYPE_UCHAR : unsigned char *
* @ li EINA_VALUE_TYPE_USHORT : unsigned short *
* @ li EINA_VALUE_TYPE_UINT : unsigned int *
* @ li EINA_VALUE_TYPE_ULONG : unsigned long *
* @ li EINA_VALUE_TYPE_UINT64 : uint64_t *
* @ li EINA_VALUE_TYPE_CHAR : char *
* @ li EINA_VALUE_TYPE_SHORT : short *
* @ li EINA_VALUE_TYPE_INT : int *
* @ li EINA_VALUE_TYPE_LONG : long *
* @ li EINA_VALUE_TYPE_INT64 : int64_t *
* @ li EINA_VALUE_TYPE_FLOAT : float *
* @ li EINA_VALUE_TYPE_DOUBLE : double *
* @ li EINA_VALUE_TYPE_STRINGSHARE : const char * *
* @ li EINA_VALUE_TYPE_STRING : const char * *
* @ li EINA_VALUE_TYPE_HASH : Eina_Value_Hash *
*
* @ code
* Eina_Value * value = eina_value_hash_new ( EINA_VALUE_TYPE_INT , 0 ) ;
* int x ;
*
* eina_value_hash_set ( value , " abc " , 1234 ) ;
* eina_value_hash_pget ( value , " abc " , & x ) ;
* eina_value_free ( value ) ;
* @ endcode
*
* @ see eina_value_hash_set ( )
* @ see eina_value_hash_vset ( )
* @ see eina_value_hash_pset ( )
*
* @ since 1.2
*/
static inline Eina_Bool eina_value_hash_pget ( const Eina_Value * value ,
const char * key ,
void * ptr ) EINA_ARG_NONNULL ( 1 , 3 ) ;
/**
* @ }
*/
2012-01-11 19:00:03 -08:00
/**
* @ defgroup Eina_Value_Blob_Group Generic Value Blob management
*
* @ {
*/
/**
* @ typedef Eina_Value_Blob_Operations
* How to manage blob . Any @ c NULL callback is ignored .
* @ since 1.2
*/
typedef struct _Eina_Value_Blob_Operations Eina_Value_Blob_Operations ;
/**
* @ struct _Eina_Value_Blob_Operations
* How to manage blob . Any @ c NULL callback is ignored .
* @ since 1.2
*/
struct _Eina_Value_Blob_Operations
{
# define EINA_VALUE_BLOB_OPERATIONS_VERSION (1)
unsigned int version ; /**< must be EINA_VALUE_BLOB_OPERATIONS_VERSION */
void ( * free ) ( const Eina_Value_Blob_Operations * ops , void * memory , size_t size ) ;
void * ( * copy ) ( const Eina_Value_Blob_Operations * ops , const void * memory , size_t size ) ;
int ( * compare ) ( const Eina_Value_Blob_Operations * ops , const void * data1 , size_t size_data1 , const void * data2 , size_t size_data2 ) ;
char * ( * to_string ) ( const Eina_Value_Blob_Operations * ops , const void * memory , size_t size ) ;
} ;
/**
* @ typedef Eina_Value_Blob
* @ since 1.2
*/
typedef struct _Eina_Value_Blob Eina_Value_Blob ;
/**
* @ struct _Eina_Value_Blob
* @ since 1.2
*/
struct _Eina_Value_Blob
{
const Eina_Value_Blob_Operations * ops ; /**< if @c NULL, nothing is freed, copy will just copy the memory pointer, not its value. */
const void * memory ;
unsigned int size ;
} ;
/**
* @ }
*/
2012-01-11 15:54:35 -08:00
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
/**
* @ defgroup Eina_Value_Type_Group Generic Value Type management
*
* @ {
*/
/**
* @ struct _Eina_Value_Type
* API to access values .
*
* @ since 1.2
*/
struct _Eina_Value_Type
{
/**
* @ def EINA_VALUE_TYPE_VERSION
* Current API version , used to validate type .
*/
# define EINA_VALUE_TYPE_VERSION (1)
unsigned int version ; /**< must be #EINA_VALUE_TYPE_VERSION */
unsigned int value_size ; /**< byte size of value */
const char * name ; /**< name for debug and introspection */
Eina_Bool ( * setup ) ( const Eina_Value_Type * type , void * mem ) ; /**< mem will be malloc(value_size) and should be configured */
Eina_Bool ( * flush ) ( const Eina_Value_Type * type , void * mem ) ; /**< clear any values from mem */
Eina_Bool ( * copy ) ( const Eina_Value_Type * type , const void * src , void * dst ) ; /**< how to copy values, both memory are @c value_size */
int ( * compare ) ( const Eina_Value_Type * type , const void * a , const void * b ) ; /**< how to compare values, both memory are @c value_size */
Eina_Bool ( * convert_to ) ( const Eina_Value_Type * type , const Eina_Value_Type * convert , const void * type_mem , void * convert_mem ) ; /**< how to convert values, both memory are @c value_size */
Eina_Bool ( * convert_from ) ( const Eina_Value_Type * type , const Eina_Value_Type * convert , void * type_mem , const void * convert_mem ) ; /**< how to convert values, both memory are @c value_size */
Eina_Bool ( * vset ) ( const Eina_Value_Type * type , void * mem , va_list args ) ; /**< how to set memory from variable argument */
Eina_Bool ( * pset ) ( const Eina_Value_Type * type , void * mem , const void * ptr ) ; /**< how to set memory from pointer */
Eina_Bool ( * pget ) ( const Eina_Value_Type * type , const void * mem , void * ptr ) ; /**< how to read memory */
} ;
/**
* @ brief Query type name .
* @ param type type reference .
* @ return string or @ c NULL if type is invalid .
* @ since 1.2
*/
EAPI const char * eina_value_type_name_get ( const Eina_Value_Type * type ) EINA_PURE EINA_ARG_NONNULL ( 1 ) EINA_WARN_UNUSED_RESULT ;
/**
* @ brief Check if type is valid .
* @ param type type reference .
* @ return # 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
*/
EAPI Eina_Bool eina_value_type_check ( const Eina_Value_Type * type ) EINA_PURE EINA_ARG_NONNULL ( 1 ) EINA_WARN_UNUSED_RESULT ;
/**
2012-01-11 19:21:52 -08:00
* @ brief Initialize memory using type descriptor .
add eina_value.
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
2012-01-10 18:20:26 -08:00
* @ param type type reference .
* @ param mem memory to operate , must be of size @ c type - > value_size .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_setup ( const Eina_Value_Type * type , void * mem ) ;
/**
* @ brief Flush ( clear ) memory using type descriptor .
* @ param type type reference .
* @ param mem memory to operate , must be of size @ c type - > value_size .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_flush ( const Eina_Value_Type * type , void * mem ) ;
/**
* @ brief Copy memory using type descriptor .
* @ param type type reference .
* @ param src memory to operate , must be of size @ c type - > value_size .
* @ param dst memory to operate , must be of size @ c type - > value_size .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_copy ( const Eina_Value_Type * type , const void * src , void * dst ) ;
/**
* @ brief Compare memory using type descriptor .
* @ param type type reference .
* @ param a memory to operate , must be of size @ c type - > value_size .
* @ param b memory to operate , must be of size @ c type - > value_size .
* @ return less than zero if a < b , greater than zero if a > b , zero if equal .
* @ since 1.2
*/
static inline int eina_value_type_compare ( const Eina_Value_Type * type , const void * a , void * b ) ;
/**
* @ brief Convert memory using type descriptor .
* @ param type type reference of the source .
* @ param convert type reference of the destination .
* @ param type_mem memory to operate , must be of size @ c type - > value_size .
* @ param convert_mem memory to operate , must be of size @ c convert - > value_size .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_convert_to ( const Eina_Value_Type * type , const Eina_Value_Type * convert , const void * type_mem , void * convert_mem ) ;
/**
* @ brief Convert memory using type descriptor .
* @ param type type reference of the destination .
* @ param convert type reference of the source .
* @ param type_mem memory to operate , must be of size @ c type - > value_size .
* @ param convert_mem memory to operate , must be of size @ c convert - > value_size .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_convert_from ( const Eina_Value_Type * type , const Eina_Value_Type * convert , void * type_mem , const void * convert_mem ) ;
/**
* @ brief Set memory using type descriptor and variable argument .
* @ param type type reference of the source .
* @ param mem memory to operate , must be of size @ c type - > value_size .
* @ param args input value .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_vset ( const Eina_Value_Type * type , void * mem , va_list args ) ;
/**
* @ brief Set memory using type descriptor and pointer .
* @ param type type reference of the source .
* @ param mem memory to operate , must be of size @ c type - > value_size .
* @ param ptr pointer to input value .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_pset ( const Eina_Value_Type * type , void * mem , const void * ptr ) ;
/**
* @ brief Get memory using type descriptor .
* @ param type type reference of the source .
* @ param mem memory to operate , must be of size @ c type - > value_size .
* @ param ptr pointer to output .
* @ return # EINA_TRUE on success , # EINA_FALSE otherwise .
* @ since 1.2
*/
static inline Eina_Bool eina_value_type_pget ( const Eina_Value_Type * type , const void * mem , void * ptr ) ;
/**
* @ }
*/
# include "eina_inline_value.x"
/**
* @ }
*/
/**
* @ }
*/
/**
* @ }
*/
# endif