Eet.h | Eet.h | |||
---|---|---|---|---|
skipping to change at line 62 | skipping to change at line 62 | |||
#define EET_T_LONG_LONG 4 /**< Data type: long long */ | #define EET_T_LONG_LONG 4 /**< Data type: long long */ | |||
#define EET_T_FLOAT 5 /**< Data type: float */ | #define EET_T_FLOAT 5 /**< Data type: float */ | |||
#define EET_T_DOUBLE 6 /**< Data type: double */ | #define EET_T_DOUBLE 6 /**< Data type: double */ | |||
#define EET_T_UCHAR 7 /**< Data type: unsigned char */ | #define EET_T_UCHAR 7 /**< Data type: unsigned char */ | |||
#define EET_T_USHORT 8 /**< Data type: unsigned short */ | #define EET_T_USHORT 8 /**< Data type: unsigned short */ | |||
#define EET_T_UINT 9 /**< Data type: unsigned int */ | #define EET_T_UINT 9 /**< Data type: unsigned int */ | |||
#define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */ | #define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */ | |||
#define EET_T_STRING 11 /**< Data type: char * */ | #define EET_T_STRING 11 /**< Data type: char * */ | |||
#define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed i nside the resulting eet) */ | #define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed i nside the resulting eet) */ | |||
#define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */ | #define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */ | |||
#define EET_T_LAST 14 /**< Last data type */ | #define EET_T_F32P32 14 /**< Data type: */ | |||
#define EET_T_F16P16 15 /**< Data type: */ | ||||
#define EET_T_F8P24 16 /**< Data type: */ | ||||
#define EET_T_LAST 17 /**< Last data type */ | ||||
#define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */ | #define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */ | |||
#define EET_G_ARRAY 101 /**< Fixed size array group type */ | #define EET_G_ARRAY 101 /**< Fixed size array group type */ | |||
#define EET_G_VAR_ARRAY 102 /**< Variable size array group type */ | #define EET_G_VAR_ARRAY 102 /**< Variable size array group type */ | |||
#define EET_G_LIST 103 /**< Linked list group type */ | #define EET_G_LIST 103 /**< Linked list group type */ | |||
#define EET_G_HASH 104 /**< Hash table group type */ | #define EET_G_HASH 104 /**< Hash table group type */ | |||
#define EET_G_LAST 105 /**< Last group type */ | #define EET_G_LAST 105 /**< Last group type */ | |||
/************************************************************************** */ | /************************************************************************** */ | |||
skipping to change at line 416 | skipping to change at line 419 | |||
*/ | */ | |||
EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *si ze_ret); | EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *si ze_ret); | |||
/** | /** | |||
* Write a specified entry to an eet file handle | * Write a specified entry to an eet file handle | |||
* @param ef A valid eet file handle opened for writing. | * @param ef A valid eet file handle opened for writing. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param data Pointer to the data to be stored. | * @param data Pointer to the data to be stored. | |||
* @param size Length in bytes in the data to be stored. | * @param size Length in bytes in the data to be stored. | |||
* @param compress Compression flags (1 == compress, 0 = don't compress) . | * @param compress Compression flags (1 == compress, 0 = don't compress) . | |||
* @return Success or failure of the write. | * @return bytes written on successful write, 0 on failure. | |||
* | * | |||
* This function will write the specified chunk of data to the eet file | * This function will write the specified chunk of data to the eet file | |||
* and return greater than 0 on success. 0 will be returned on failure. | * and return greater than 0 on success. 0 will be returned on failure. | |||
* | * | |||
* The eet file handle must be a valid file handle for an eet file opene d | * The eet file handle must be a valid file handle for an eet file opene d | |||
* for writing. If it is not, 0 will be returned and no action will be | * for writing. If it is not, 0 will be returned and no action will be | |||
* performed. | * performed. | |||
* | * | |||
* Name, and data must not be NULL, and size must be > 0. If these | * Name, and data must not be NULL, and size must be > 0. If these | |||
* conditions are not met, 0 will be returned. | * conditions are not met, 0 will be returned. | |||
skipping to change at line 979 | skipping to change at line 982 | |||
* | * | |||
* eet_shutdown(); | * eet_shutdown(); | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
* | * | |||
* @endcode | * @endcode | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI Eet_Data_Descriptor *eet_data_descriptor_new(const char *name, int size, void *(*func_list_next) (void *l), void *(*func_list_append) (void *l , void *d), void *(*func_list_data) (void *l), void *(*func_list_free) (voi d *l), void (*func_hash_foreach) (void *h, int (*func) (void *h, const cha r *k, void *dt, void *fdt), void *fdt), void *(*func_hash_add) (void *h, co nst char *k, void *d), void (*func_hash_free) (void *h)); | EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor_new(const char *name, int size, void *(*func_list_next) (void *l), void *(*func_list_ append) (void *l, void *d), void *(*func_list_data) (void *l), void *(*func _list_free) (void *l), void (*func_hash_foreach) (void *h, int (*func) (vo id *h, const char *k, void *dt, void *fdt), void *fdt), void *(*func_hash_a dd) (void *h, const char *k, void *d), void (*func_hash_free) (void *h)); | |||
/* | /* | |||
* FIXME: | * FIXME: | |||
* | * | |||
* moving to this api from the old above. this will break things when th e | * moving to this api from the old above. this will break things when th e | |||
* move happens - but be warned | * move happens - but be warned | |||
*/ | */ | |||
EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(Eet_Data_Descriptor_C | EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(const | |||
lass *eddc); | Eet_Data_Descriptor_Class *eddc); | |||
EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(Eet_Data_Descriptor_C | EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(const | |||
lass *eddc); | Eet_Data_Descriptor_Class *eddc); | |||
/** | ||||
* This function creates a new data descriptore and returns a handle to | ||||
the | ||||
* new data descriptor. On creation it will be empty, containing no cont | ||||
ents | ||||
* describing anything other than the shell of the data structure. | ||||
* @param edd The data descriptor to free. | ||||
* | ||||
* You add structure members to the data descriptor using the macros | ||||
* EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and | ||||
* EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you | ||||
are | ||||
* adding to the description. | ||||
* | ||||
* Once you have described all the members of a struct you want loaded, | ||||
or | ||||
* saved eet can load and save those members for you, encode them into | ||||
* endian-independant serialised data chunks for transmission across a | ||||
* a network or more. | ||||
* | ||||
* This function specially ignore str_direct_alloc and str_direct_free. | ||||
It | ||||
* is usefull when the eet_data you are reading don't have a dictionnary | ||||
* like network stream or ipc. It also mean that all string will be allo | ||||
cated | ||||
* and duplicated in memory. | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
EAPI Eet_Data_Descriptor *eet_data_descriptor_stream_new(const Eet_Data_ | ||||
Descriptor_Class *eddc); | ||||
/** | ||||
* This function creates a new data descriptore and returns a handle to | ||||
the | ||||
* new data descriptor. On creation it will be empty, containing no cont | ||||
ents | ||||
* describing anything other than the shell of the data structure. | ||||
* @param edd The data descriptor to free. | ||||
* | ||||
* You add structure members to the data descriptor using the macros | ||||
* EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and | ||||
* EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you | ||||
are | ||||
* adding to the description. | ||||
* | ||||
* Once you have described all the members of a struct you want loaded, | ||||
or | ||||
* saved eet can load and save those members for you, encode them into | ||||
* endian-independant serialised data chunks for transmission across a | ||||
* a network or more. | ||||
* | ||||
* This function use str_direct_alloc and str_direct_free. It is usefull | ||||
when | ||||
* the eet_data you are reading come from a file and have a dictionnary. | ||||
This | ||||
* will reduce memory use, improve the possibility for the OS to page th | ||||
is | ||||
* string out. But be carrefull all EET_T_STRING are pointer to a mmappe | ||||
d area | ||||
* and it will point to nowhere if you close the file. So as long as you | ||||
use | ||||
* this strings, you need to have the Eet_File open. | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
EAPI Eet_Data_Descriptor *eet_data_descriptor_file_new(const Eet_Data_De | ||||
scriptor_Class *eddc); | ||||
/** | ||||
* This function is an helper that set all the parameter of an Eet_Data_ | ||||
Descriptor_Class | ||||
* correctly when you use Eina data type with a stream. | ||||
* @param class The Eet_Data_Descriptor_Class you want to set. | ||||
* @param name The name of the structure described by this class. | ||||
* @param size The size of the structure described by this class. | ||||
* @return EINA_TRUE if the structure was correctly set (The only reason | ||||
that could make | ||||
* it fail is if you did give wrong parameter). | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
EAPI Eina_Bool eet_eina_stream_data_descriptor_class_set(Eet_Data_Descri | ||||
ptor_Class *eddc, const char *name, int size); | ||||
/** | ||||
* This macro is an helper that set all the parameter of an Eet_Data_Des | ||||
criptor_Class | ||||
* correctly when you use Eina data type with stream. | ||||
* @param class The Eet_Data_Descriptor_Class you want to set. | ||||
* @param type The type of the structure described by this class. | ||||
* @return EINA_TRUE if the structure was correctly set (The only reason | ||||
that could make | ||||
* it fail is if you did give wrong parameter). | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(Clas, Type) (eet_eina_str | ||||
eam_data_descriptor_class_set(Clas, #Type , sizeof (Type))) | ||||
/** | ||||
* This function is an helper that set all the parameter of an Eet_Data_ | ||||
Descriptor_Class | ||||
* correctly when you use Eina data type with a file. | ||||
* @param class The Eet_Data_Descriptor_Class you want to set. | ||||
* @param name The name of the structure described by this class. | ||||
* @param size The size of the structure described by this class. | ||||
* @return EINA_TRUE if the structure was correctly set (The only reason | ||||
that could make | ||||
* it fail is if you did give wrong parameter). | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(Eet_Data_Descript | ||||
or_Class *eddc, const char *name, int size); | ||||
/** | ||||
* This macro is an helper that set all the parameter of an Eet_Data_Des | ||||
criptor_Class | ||||
* correctly when you use Eina data type with file. | ||||
* @param class The Eet_Data_Descriptor_Class you want to set. | ||||
* @param type The type of the structure described by this class. | ||||
* @return EINA_TRUE if the structure was correctly set (The only reason | ||||
that could make | ||||
* it fail is if you did give wrong parameter). | ||||
* | ||||
* @since 1.3.0 | ||||
*/ | ||||
#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(Clas, Type) (eet_eina_file_ | ||||
data_descriptor_class_set(Clas, #Type , sizeof (Type))) | ||||
/** | /** | |||
* This function frees a data descriptor when it is not needed anymore. | * This function frees a data descriptor when it is not needed anymore. | |||
* @param edd The data descriptor to free. | * @param edd The data descriptor to free. | |||
* | * | |||
* This function takes a data descriptor handle as a parameter and frees all | * This function takes a data descriptor handle as a parameter and frees all | |||
* data allocated for the data descriptor and the handle itself. After t his | * data allocated for the data descriptor and the handle itself. After t his | |||
* call the descriptor is no longer valid. | * call the descriptor is no longer valid. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
skipping to change at line 1047 | skipping to change at line 1152 | |||
EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key); | EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key); | |||
EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const c har *name); | EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const c har *name); | |||
/** | /** | |||
* Write a data structure from memory and store in an eet file. | * Write a data structure from memory and store in an eet file. | |||
* @param ef The eet file handle to write to. | * @param ef The eet file handle to write to. | |||
* @param edd The data descriptor to use when encoding. | * @param edd The data descriptor to use when encoding. | |||
* @param name The key to store the data under in the eet file. | * @param name The key to store the data under in the eet file. | |||
* @param data A pointer to the data structure to ssave and encode. | * @param data A pointer to the data structure to ssave and encode. | |||
* @param compress Compression flags for storage. | * @param compress Compression flags for storage. | |||
* @return 1 on successful write, 0 on failure. | * @return bytes written on successful write, 0 on failure. | |||
* | * | |||
* This function is the reverse of eet_data_read(), saving a data struct ure | * This function is the reverse of eet_data_read(), saving a data struct ure | |||
* to an eet file. | * to an eet file. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, c onst char *name, const char *key, const void *data, int compress); | EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, c onst char *name, const char *key, const void *data, int compress); | |||
EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const ch ar *name, const void *data, int compress); | EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const ch ar *name, const void *data, int compress); | |||
/** | /** | |||
End of changes. 5 change blocks. | ||||
8 lines changed or deleted | 142 lines changed or added | |||