Defines | |
#define | EET_T_UNKNOW 0 /**< Unknown data encding type */ |
Unknown data encding type. | |
#define | EET_T_CHAR 1 /**< Data type: char */ |
Data type: char. | |
#define | EET_T_SHORT 2 /**< Data type: short */ |
Data type: short. | |
#define | EET_T_INT 3 /**< Data type: int */ |
Data type: int. | |
#define | EET_T_LONG_LONG 4 /**< Data type: long long */ |
Data type: long long. | |
#define | EET_T_FLOAT 5 /**< Data type: float */ |
Data type: float. | |
#define | EET_T_DOUBLE 6 /**< Data type: double */ |
Data type: double. | |
#define | EET_T_UCHAR 7 /**< Data type: unsigned char */ |
Data type: unsigned char. | |
#define | EET_T_USHORT 8 /**< Data type: unsigned short */ |
Data type: unsigned short. | |
#define | EET_T_UINT 9 /**< Data type: unsigned int */ |
Data type: unsigned int. | |
#define | EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */ |
Data type: unsigned long long. | |
#define | EET_T_STRING 11 /**< Data type: char * */ |
Data type: char *. | |
#define | EET_T_LAST 12 /**< Last data type */ |
Last data type. | |
#define | EET_G_UNKNOWN 100 /**< Unknown group data encoding type */ |
Unknown group data encoding type. | |
#define | EET_G_ARRAY 101 /**< Fixed size array group type */ |
Fixed size array group type. | |
#define | EET_G_VAR_ARRAY 102 /**< Variable size array group type */ |
Variable size array group type. | |
#define | EET_G_LIST 103 /**< Linked list group type */ |
Linked list group type. | |
#define | EET_G_HASH 104 /**< Hash table group type */ |
Hash table group type. | |
#define | EET_G_LAST 105 /**< Last group type */ |
Last group type. | |
#define | EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) |
Add a basic data element to a data descriptor. | |
#define | EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) |
Add a sub-element type to a data descriptor. | |
#define | EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) |
Add a linked list type to a data descriptor. | |
Functions | |
int | eet_shutdown (void) |
Shut down the EET library. | |
Eet_File * | eet_open (char *file, Eet_File_Mode mode) |
Open an eet file on disk, and returns a handle to it. | |
void | eet_close (Eet_File *ef) |
Close an eet file handle and flush and writes pending. | |
void * | eet_read (Eet_File *ef, char *name, int *size_ret) |
Read a specified entry from an eet file and return data. | |
int | eet_write (Eet_File *ef, char *name, void *data, int size, int compress) |
Write a specified entry to an eet file handle. | |
char ** | eet_list (Eet_File *ef, char *glob, int *count_ret) |
List all entries in eet file matching shell glob. | |
int | eet_data_image_header_read (Eet_File *ef, char *name, int *w, int *h, int *alpha, int *compress, int *quality, int *lossy) |
Read just the header data for an image and dont decode the pixels. | |
void * | eet_data_image_read (Eet_File *ef, char *name, int *w, int *h, int *alpha, int *compress, int *quality, int *lossy) |
Read image data from the named key in the eet file. | |
int | eet_data_image_write (Eet_File *ef, char *name, void *data, int w, int h, int alpha, int compress, int quality, int lossy) |
Write image data to the named key in an eet file. | |
int | eet_data_image_header_decode (void *data, int size, int *w, int *h, int *alpha, int *compress, int *quality, int *lossy) |
Decode Image data header only to get information. | |
void * | eet_data_image_decode (void *data, int size, int *w, int *h, int *alpha, int *compress, int *quality, int *lossy) |
Decode Image data into pixel data. | |
void * | eet_data_image_encode (void *data, int *size_ret, int w, int h, int alpha, int compress, int quality, int lossy) |
Encode image data for storage or transmission. | |
Eet_Data_Descriptor * | eet_data_descriptor_new (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)(void *h, const char *k, void *dt, void *fdt), void *fdt), void *(*func_hash_add)(void *h, const char *k, void *d), void(*func_hash_free)(void *h)) |
Create a new empty data structure descriptor. | |
void | eet_data_descriptor_free (Eet_Data_Descriptor *edd) |
This function frees a data descriptor when it is not needed anymore. | |
void | eet_data_descriptor_element_add (Eet_Data_Descriptor *edd, char *name, int type, int group_type, int offset, int count, char *counter_name, Eet_Data_Descriptor *subtype) |
This function is an internal used by macros. | |
void * | eet_data_read (Eet_File *ef, Eet_Data_Descriptor *edd, char *name) |
Read a data structure from an eet file and decodes it. | |
int | eet_data_write (Eet_File *ef, Eet_Data_Descriptor *edd, char *name, void *data, int compress) |
Write a data structure from memory and store in an eet file. | |
void * | eet_data_descriptor_decode (Eet_Data_Descriptor *edd, void *data_in, int size_in) |
Decode a data structure from an arbitary location in memory. | |
void * | eet_data_descriptor_encode (Eet_Data_Descriptor *edd, void *data_in, int *size_ret) |
Encode a dsata struct to memory and return that encoded data. |
These routines are used for Eet Library interaction
|
Value: Add a basic data element to a data descriptor.
edd . The type of the structure is provided as the struct_type parameter (for example: struct my_struct). The name parameter defines a string that will be used to uniquely name that member of the struct (it is suggested to use the struct member itself). The member parameter is the actual struct member itself (for example: values), and type is the basic data type of the member which must be one of: EET_T_CHAR, EET_T_SHORT, EET_T_INT, EET_T_LONG_LONG, EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR, EET_T_USHORT, EET_T_UINT, EET_T_ULONG_LONG or EET_T_STRING. |
|
Value: Add a linked list type to a data descriptor.
subtype being the exception. This must be the data descriptor of the element that is in each member of the linked list to be stored. |
|
Value: Add a sub-element type to a data descriptor.
subtype being the exception. This must be the data descriptor of the struct that is pointed to by this element. |
|
Close an eet file handle and flush and writes pending.
If the eet file handle is not valid nothing will be done. |
|
Decode a data structure from an arbitary location in memory.
The data to be decoded is stored at the memory pointed to by This function is useful for decoding data structures delivered to the application by means other than an eet file, such as an IPC or socket connection, raw files, shared memory etc. Please see eet_data_read() for more information. |
|
This function is an internal used by macros. This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is complex to use by hand and should be left to be used by the macros, and thus is not documented. |
|
Encode a dsata struct to memory and return that encoded data.
The parameter
On success a non NULL valid pointer is returned and what Please see eet_data_write() for more information. |
|
This function frees a data descriptor when it is not needed anymore.
|
|
Create a new empty data structure descriptor.
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. Example:
|
|
Decode Image data into pixel data.
The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not. On success the function returns a pointer to the image data decoded. The calling application is responsible for calling free() on the image data when it is done with it. On failure NULL is returned and the parameter values may not contain any sensible data. |
|
Encode image data for storage or transmission.
The data expected is the same format as returned by eet_data_image_read. If this is not the case weird things may happen. Width and height must be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning the alpha values are not useful and 1 meaning they are). Compress can be from 0 to 9 (0 meaning no compression, 9 meaning full compression). This is only used if the image is not lossily encoded. Quality is used on lossy compression and should be a value from 0 to 100. The lossy flag can be 0 or 1. 0 means encode losslessly and 1 means to encode with image quality loss (but then have a much smaller encoding). On success this function returns a pointer to the encoded data that you can free with free() when no longer needed. |
|
Decode Image data header only to get information.
The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not. On success the function returns 1 indicating the header was read and decoded properly, or 0 on failure. |
|
Read just the header data for an image and dont decode the pixels.
The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pile is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not. On success the function returns 1 indicating the header was read and decoded properly, or 0 on failure. |
|
Read image data from the named key in the eet file.
The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pile is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not. On success the function returns a pointer to the image data decoded. The calling application is responsible for calling free() on the image data when it is done with it. On failure NULL is returned and the parameter values may not contain any sensible data. |
|
Write image data to the named key in an eet file.
The data expected is the same format as returned by eet_data_image_read. If this is not the case weird things may happen. Width and height must be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning the alpha values are not useful and 1 meaning they are). Compress can be from 0 to 9 (0 meaning no compression, 9 meaning full compression). This is only used if the image is not lossily encoded. Quality is used on lossy compression and should be a value from 0 to 100. The lossy flag can be 0 or 1. 0 means encode losslessly and 1 means to encode with image quality loss (but then have a much smaller encoding). On success this function returns the number of bytes that were required to encode the image data, or on failure it returns 0. |
|
Read a data structure from an eet file and decodes it.
Once a data structure has been described by the programmer with the fields they wish to save or load, storing or retrieving a data structure from an eet file, or from a chunk of memory is as simple as a single function call. |
|
Write a data structure from memory and store in an eet file.
|
|
List all entries in eet file matching shell glob.
The eet file handle must be valid and glob must not be NULL, or NULL will be returned and count_ret will be filled with 0. The calling program must call free() on the array returned, but NOT on the string pointers in the array. They are taken as read-only internals from the eet file handle. They are only valid as long as the file handle is not closed. When it is closed those pointers in the array are now not valid and should not be used. On success the array returned will have a list of string pointers that are the names of the entries that matched, and count_ret will have the number of entries in this array placed in it. Hint: an easy way to list all entries in an eet file is to use a glob value of "*". |
|
Open an eet file on disk, and returns a handle to it.
It will also open an eet file for writing. This will, if successful, delete the original file and replace it with a new empty file, till the eet file handle is closed or flushed. If it cannot be opened for writing or a memory error occurs, NULL is returned. Example:
|
|
Read a specified entry from an eet file and return data.
If the eet file handle is not valid NULL is returned and size_ret is filled with 0. |
|
Shut down the EET library.
|
|
Write a specified entry to an eet file handle.
The eet file handle must be a valid file handle for an eet file opened for writing. If it is not, 0 will be returned and no action will be performed. Name, and data must not be NULL, and size must be > 0. If these conditions are not met, 0 will be returned. The data will be copied (and optionally compressed) in ram, pending a flush to disk (it will stay in ram till the eet file handle is closed though). |