15 # define EAPI __declspec(dllexport)
18 # endif /* ! DLL_EXPORT */
20 # define EAPI __declspec(dllimport)
21 # endif /* ! EFL_EET_BUILD */
25 # define EAPI __attribute__ ((visibility("default")))
40 * @brief The file that provides the eet functions.
42 * This header provides the Eet management functions.
46 /***************************************************************************/
48 #define EET_T_UNKNOW 0 /**< Unknown data encoding type */
49 #define EET_T_CHAR 1 /**< Data type: char */
50 #define EET_T_SHORT 2 /**< Data type: short */
51 #define EET_T_INT 3 /**< Data type: int */
52 #define EET_T_LONG_LONG 4 /**< Data type: long long */
53 #define EET_T_FLOAT 5 /**< Data type: float */
54 #define EET_T_DOUBLE 6 /**< Data type: double */
55 #define EET_T_UCHAR 7 /**< Data type: unsigned char */
56 #define EET_T_USHORT 8 /**< Data type: unsigned short */
57 #define EET_T_UINT 9 /**< Data type: unsigned int */
58 #define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */
59 #define EET_T_STRING 11 /**< Data type: char * */
60 #define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed inside the resulting eet) */
61 #define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */
62 #define EET_T_LAST 14 /**< Last data type */
64 #define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */
65 #define EET_G_ARRAY 101 /**< Fixed size array group type */
66 #define EET_G_VAR_ARRAY 102 /**< Variable size array group type */
67 #define EET_G_LIST 103 /**< Linked list group type */
68 #define EET_G_HASH 104 /**< Hash table group type */
69 #define EET_G_LAST 105 /**< Last group type */
71 /***************************************************************************/
73 typedef enum _Eet_File_Mode
75 EET_FILE_MODE_INVALID = -1,
78 EET_FILE_MODE_READ_WRITE
81 typedef enum _Eet_Error
86 EET_ERROR_NOT_WRITABLE,
87 EET_ERROR_OUT_OF_MEMORY,
88 EET_ERROR_WRITE_ERROR,
89 EET_ERROR_WRITE_ERROR_FILE_TOO_BIG,
90 EET_ERROR_WRITE_ERROR_IO_ERROR,
91 EET_ERROR_WRITE_ERROR_OUT_OF_SPACE,
92 EET_ERROR_WRITE_ERROR_FILE_CLOSED,
93 EET_ERROR_MMAP_FAILED,
94 EET_ERROR_X509_ENCODING_FAILED,
95 EET_ERROR_SIGNATURE_FAILED,
96 EET_ERROR_INVALID_SIGNATURE,
98 EET_ERROR_NOT_IMPLEMENTED,
99 EET_ERROR_PRNG_NOT_SEEDED,
100 EET_ERROR_ENCRYPT_FAILED,
101 EET_ERROR_DECRYPT_FAILED
104 typedef struct _Eet_File Eet_File;
105 typedef struct _Eet_Dictionary Eet_Dictionary;
106 typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
107 typedef struct _Eet_Key Eet_Key;
108 typedef struct _Eet_Node Eet_Node;
110 typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
112 #define EET_DATA_DESCRIPTOR_CLASS_VERSION 2
113 struct _Eet_Data_Descriptor_Class
119 void *(*mem_alloc) (size_t size);
120 void (*mem_free) (void *mem);
121 char *(*str_alloc) (const char *str);
122 void (*str_free) (const char *str);
123 void *(*list_next) (void *l);
124 void *(*list_append) (void *l, void *d);
125 void *(*list_data) (void *l);
126 void *(*list_free) (void *l);
127 void (*hash_foreach) (void *h, int (*func) (void *h, const char *k, void *dt, void *fdt), void *fdt);
128 void *(*hash_add) (void *h, const char *k, void *d);
129 void (*hash_free) (void *h);
130 char *(*str_direct_alloc) (const char *str);
131 void (*str_direct_free) (const char *str);
135 /***************************************************************************/
138 * Initialize the EET library.
140 * @return The new init count.
144 EAPI int eet_init(void);
147 * Shut down the EET library.
149 * @return The new init count.
153 EAPI int eet_shutdown(void);
158 * Eet didn't free items by default. If you are under memory presure, just
159 * call this function to recall all memory that are not yet referenced anymore.
160 * The cache take care of modification on disk.
164 EAPI void eet_clearcache(void);
167 * Open an eet file on disk, and returns a handle to it.
168 * @param file The file path to the eet file. eg: "/tmp/file.eet".
169 * @param mode The mode for opening. Either EET_FILE_MODE_READ, EET_FILE_MODE_WRITE or EET_FILE_MODE_READ_WRITE.
170 * @return An opened eet file handle.
172 * This function will open an exiting eet file for reading, and build
173 * the directory table in memory and return a handle to the file, if it
174 * exists and can be read, and no memory errors occur on the way, otherwise
175 * NULL will be returned.
177 * It will also open an eet file for writing. This will, if successful,
178 * delete the original file and replace it with a new empty file, till
179 * the eet file handle is closed or flushed. If it cannot be opened for
180 * writing or a memory error occurs, NULL is returned.
182 * You can also open the file for read/write. If you then write a key that
183 * does not exist it will be created, if the key exists it will be replaced
192 * main(int argc, char **argv)
195 * char buf[1024], *ret, **list;
198 * strcpy(buf, "Here is a string of data to save!");
200 * ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_WRITE);
201 * if (!ef) return -1;
202 * if (!eet_write(ef, "/key/to_store/at", buf, 1024, 1))
203 * fprintf(stderr, "Error writing data!\n");
206 * ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_READ);
207 * if (!ef) return -1;
208 * list = eet_list(ef, "*", &num);
211 * for (i = 0; i < num; i++)
212 * printf("Key stored: %s\n", list[i]);
215 * ret = eet_read(ef, "/key/to_store/at", &size);
218 * printf("Data read (%i bytes):\n%s\n", size, ret);
229 EAPI Eet_File *eet_open(const char *file, Eet_File_Mode mode);
232 * Open an eet file directly from a memory location. The data are not copied,
233 * so you must keep them around as long as the eet file is open. Their is
234 * currently no cache for this kind of Eet_File, so it's reopen every time
235 * you do use eet_memopen_read.
239 EAPI Eet_File *eet_memopen_read(const void *data, size_t size);
242 * Get the mode an Eet_File was opened with.
243 * @param ef A valid eet file handle.
244 * @return The mode ef was opened with.
248 EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
251 * Close an eet file handle and flush and writes pending.
252 * @param ef A valid eet file handle.
254 * This function will flush any pending writes to disk if the eet file
255 * was opened for write, and free all data associated with the file handle
256 * and file, and close the file.
258 * If the eet file handle is not valid nothing will be done.
262 EAPI Eet_Error eet_close(Eet_File *ef);
265 * Callback used to request if needed the password of a private key.
269 typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
272 * Create an Eet_Key needed for signing an eet file.
274 * The certificate should provide the public that match the private key.
275 * No verification is done to ensure that.
279 EAPI Eet_Key* eet_identity_open(const char *certificate_file, const char *private_key_file, Eet_Key_Password_Callback cb);
282 * Close and release all ressource used by an Eet_Key.
283 * An reference counter prevent it from being freed until all file using it are
288 EAPI void eet_identity_close(Eet_Key *key);
291 * Set a key to sign a file
295 EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
298 * Display both private and public key of an Eet_Key.
302 EAPI void eet_identity_print(Eet_Key *key, FILE *out);
305 * Get the x509 der certificate associated with an Eet_File. Will return NULL
306 * if the file is not signed.
310 EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
313 * Get the raw signature associated with an Eet_File. Will return NULL
314 * if the file is not signed.
316 EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
319 * Get the SHA1 associated with a file. Could be the one used to sign the data
320 * or if the data where not signed, it will be the SHA1 of the file.
324 EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
327 * Display the x509 der certificate to out.
331 EAPI void eet_identity_certificate_print(const unsigned char *certificate, int der_length, FILE *out);
334 * Return a handle to the shared string dictionary of the Eet file
335 * @param ef A valid eet file handle.
336 * @return A handle to the dictionary of the file
338 * This function returns a handle to the dictionary of an Eet file whose
339 * handle is @p ef, if a dictionary exists. NULL is returned otherwise or
340 * if the file handle is known to be invalid.
344 EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
347 * Check if a given string comes from a given dictionary
348 * @param ed A valid dictionary handle
349 * @param string A valid 0 byte terminated C string
350 * @return 1 if it is in the dictionary, 0 otherwise
352 * This checks the given dictionary to see if the given string is actually
353 * inside that dictionary (i.e. comes from it) and returns 1 if it does.
354 * If the dictionary handle is invlide, the string is NULL or the string is
355 * not in the dictionary, 0 is returned.
359 EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char *string);
362 * Read a specified entry from an eet file and return data
363 * @param ef A valid eet file handle opened for reading.
364 * @param name Name of the entry. eg: "/base/file_i_want".
365 * @param size_ret Number of bytes read from entry and returned.
366 * @return The data stored in that entry in the eet file.
368 * This function finds an entry in the eet file that is stored under the
369 * name specified, and returns that data, decompressed, if successful.
370 * NULL is returned if the lookup fails or if memory errors are
371 * encountered. It is the job of the calling program to call free() on
372 * the returned data. The number of bytes in the returned data chunk are
373 * placed in size_ret.
375 * If the eet file handle is not valid NULL is returned and size_ret is
380 EAPI void *eet_read_cipher(Eet_File *ef, const char *name, int *size_ret, const char *cipher_key);
381 EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret);
384 * Read a specified entry from an eet file and return data
385 * @param ef A valid eet file handle opened for reading.
386 * @param name Name of the entry. eg: "/base/file_i_want".
387 * @param size_ret Number of bytes read from entry and returned.
388 * @return The data stored in that entry in the eet file.
390 * This function finds an entry in the eet file that is stored under the
391 * name specified, and returns that data if not compressed and successful.
392 * NULL is returned if the lookup fails or if memory errors are
393 * encountered or if the data is comrpessed. The calling program must never
394 * call free() on the returned data. The number of bytes in the returned
395 * data chunk are placed in size_ret.
397 * If the eet file handle is not valid NULL is returned and size_ret is
402 EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *size_ret);
405 * Write a specified entry to an eet file handle
406 * @param ef A valid eet file handle opened for writing.
407 * @param name Name of the entry. eg: "/base/file_i_want".
408 * @param data Pointer to the data to be stored.
409 * @param size Length in bytes in the data to be stored.
410 * @param compress Compression flags (1 == compress, 0 = don't compress).
411 * @return Success or failure of the write.
413 * This function will write the specified chunk of data to the eet file
414 * and return greater than 0 on success. 0 will be returned on failure.
416 * The eet file handle must be a valid file handle for an eet file opened
417 * for writing. If it is not, 0 will be returned and no action will be
420 * Name, and data must not be NULL, and size must be > 0. If these
421 * conditions are not met, 0 will be returned.
423 * The data will be copied (and optionally compressed) in ram, pending
424 * a flush to disk (it will stay in ram till the eet file handle is
429 EAPI int eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int compress, const char *cipher_key);
430 EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress);
433 * Delete a specified entry from an Eet file being written or re-written
434 * @param ef A valid eet file handle opened for writing.
435 * @param name Name of the entry. eg: "/base/file_i_want".
436 * @return Success or failure of the delete.
438 * This function will delete the specified chunk of data from the eet file
439 * and return greater than 0 on success. 0 will be returned on failure.
441 * The eet file handle must be a valid file handle for an eet file opened
442 * for writing. If it is not, 0 will be returned and no action will be
445 * Name, must not be NULL, otherwise 0 will be returned.
449 EAPI int eet_delete(Eet_File *ef, const char *name);
452 * List all entries in eet file matching shell glob.
453 * @param ef A valid eet file handle.
454 * @param glob A shell glob to match against.
455 * @param count_ret Number of entries found to match.
456 * @return Pointer to an array of strings.
458 * This function will list all entries in the eet file matching the
459 * supplied shell glob and return an allocated list of their names, if
460 * there are any, and if no memory errors occur.
462 * The eet file handle must be valid and glob must not be NULL, or NULL
463 * will be returned and count_ret will be filled with 0.
465 * The calling program must call free() on the array returned, but NOT
466 * on the string pointers in the array. They are taken as read-only
467 * internals from the eet file handle. They are only valid as long as
468 * the file handle is not closed. When it is closed those pointers in the
469 * array are now not valid and should not be used.
471 * On success the array returned will have a list of string pointers
472 * that are the names of the entries that matched, and count_ret will have
473 * the number of entries in this array placed in it.
475 * Hint: an easy way to list all entries in an eet file is to use a glob
480 EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
483 * Return the number of entries in the specified eet file.
484 * @param ef A valid eet file handle.
485 * @return Number of entries in ef or -1 if the number of entries
486 * cannot be read due to open mode restrictions.
490 EAPI int eet_num_entries(Eet_File *ef);
492 /***************************************************************************/
495 * Read just the header data for an image and dont decode the pixels.
496 * @param ef A valid eet file handle opened for reading.
497 * @param name Name of the entry. eg: "/base/file_i_want".
498 * @param w A pointer to the unsigned int to hold the width in pixels.
499 * @param h A pointer to the unsigned int to hold the height in pixels.
500 * @param alpha A pointer to the int to hold the alpha flag.
501 * @param compress A pointer to the int to hold the compression amount.
502 * @param quality A pointer to the int to hold the quality amount.
503 * @param lossy A pointer to the int to hold the lossiness flag.
504 * @return 1 on successfull decode, 0 otherwise
506 * This function reads an image from an eet file stored under the named
507 * key in the eet file and return a pointer to the decompressed pixel data.
509 * The other parameters of the image (width, height etc.) are placed into
510 * the values pointed to (they must be supplied). The pixel data is a linear
511 * array of pixels starting from the top-left of the image scanning row by
512 * row from left to right. Each pile is a 32bit value, with the high byte
513 * being the alpha channel, the next being red, then green, and the low byte
514 * being blue. The width and height are measured in pixels and will be
515 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
516 * that the alpha channel is not used. 1 denotes that it is significant.
517 * Compress is filled with the compression value/amount the image was
518 * stored with. The quality value is filled with the quality encoding of
519 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
520 * the image was encoded lossily or not.
522 * On success the function returns 1 indicating the header was read and
523 * decoded properly, or 0 on failure.
527 EAPI int eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
528 EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
531 * Read image data from the named key in the eet file.
532 * @param ef A valid eet file handle opened for reading.
533 * @param name Name of the entry. eg: "/base/file_i_want".
534 * @param w A pointer to the unsigned int to hold the width in pixels.
535 * @param h A pointer to the unsigned int to hold the height in pixels.
536 * @param alpha A pointer to the int to hold the alpha flag.
537 * @param compress A pointer to the int to hold the compression amount.
538 * @param quality A pointer to the int to hold the quality amount.
539 * @param lossy A pointer to the int to hold the lossiness flag.
540 * @return The image pixel data decoded
542 * This function reads an image from an eet file stored under the named
543 * key in the eet file and return a pointer to the decompressed pixel data.
545 * The other parameters of the image (width, height etc.) are placed into
546 * the values pointed to (they must be supplied). The pixel data is a linear
547 * array of pixels starting from the top-left of the image scanning row by
548 * row from left to right. Each pile is a 32bit value, with the high byte
549 * being the alpha channel, the next being red, then green, and the low byte
550 * being blue. The width and height are measured in pixels and will be
551 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
552 * that the alpha channel is not used. 1 denotes that it is significant.
553 * Compress is filled with the compression value/amount the image was
554 * stored with. The quality value is filled with the quality encoding of
555 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
556 * the image was encoded lossily or not.
558 * On success the function returns a pointer to the image data decoded. The
559 * calling application is responsible for calling free() on the image data
560 * when it is done with it. On failure NULL is returned and the parameter
561 * values may not contain any sensible data.
565 EAPI void *eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
566 EAPI void *eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
569 * Read image data from the named key in the eet file.
570 * @param ef A valid eet file handle opened for reading.
571 * @param name Name of the entry. eg: "/base/file_i_want".
572 * @param src_x The starting x coordinate from where to dump the stream.
573 * @param src_y The starting y coordinate from where to dump the stream.
574 * @param d A pointer to the pixel surface.
575 * @param w The expected width in pixels of the pixel surface to decode.
576 * @param h The expected height in pixels of the pixel surface to decode.
577 * @param row_stride The length of a pixels line in the destination surface.
578 * @param alpha A pointer to the int to hold the alpha flag.
579 * @param compress A pointer to the int to hold the compression amount.
580 * @param quality A pointer to the int to hold the quality amount.
581 * @param lossy A pointer to the int to hold the lossiness flag.
582 * @return 1 on success, 0 otherwise.
584 * This function reads an image from an eet file stored under the named
585 * key in the eet file and return a pointer to the decompressed pixel data.
587 * The other parameters of the image (width, height etc.) are placed into
588 * the values pointed to (they must be supplied). The pixel data is a linear
589 * array of pixels starting from the top-left of the image scanning row by
590 * row from left to right. Each pile is a 32bit value, with the high byte
591 * being the alpha channel, the next being red, then green, and the low byte
592 * being blue. The width and height are measured in pixels and will be
593 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
594 * that the alpha channel is not used. 1 denotes that it is significant.
595 * Compress is filled with the compression value/amount the image was
596 * stored with. The quality value is filled with the quality encoding of
597 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
598 * the image was encoded lossily or not.
600 * On success the function returns 1, and 0 on failure. On failure the
601 * parameter values may not contain any sensible data.
605 EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char *key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
606 EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
609 * Write image data to the named key in an eet file.
610 * @param ef A valid eet file handle opened for writing.
611 * @param name Name of the entry. eg: "/base/file_i_want".
612 * @param data A pointer to the image pixel data.
613 * @param w The width of the image in pixels.
614 * @param h The height of the image in pixels.
615 * @param alpha The alpha channel flag.
616 * @param compress The compression amount.
617 * @param quality The quality encoding amount.
618 * @param lossy The lossiness flag.
619 * @return Success if the data was encoded and written or not.
621 * This function takes image pixel data and encodes it in an eet file
622 * stored under the supplied name key, and returns how many bytes were
623 * actually written to encode the image data.
625 * The data expected is the same format as returned by eet_data_image_read.
626 * If this is not the case weird things may happen. Width and height must
627 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
628 * the alpha values are not useful and 1 meaning they are). Compress can
629 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
630 * This is only used if the image is not lossily encoded. Quality is used on
631 * lossy compression and should be a value from 0 to 100. The lossy flag
632 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
633 * image quality loss (but then have a much smaller encoding).
635 * On success this function returns the number of bytes that were required
636 * to encode the image data, or on failure it returns 0.
640 EAPI int eet_data_image_write_cipher(Eet_File *ef, const char *name, const char *key, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
641 EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
644 * Decode Image data header only to get information.
645 * @param data The encoded pixel data.
646 * @param size The size, in bytes, of the encoded pixel data.
647 * @param w A pointer to the unsigned int to hold the width in pixels.
648 * @param h A pointer to the unsigned int to hold the height in pixels.
649 * @param alpha A pointer to the int to hold the alpha flag.
650 * @param compress A pointer to the int to hold the compression amount.
651 * @param quality A pointer to the int to hold the quality amount.
652 * @param lossy A pointer to the int to hold the lossiness flag.
653 * @return 1 on success, 0 on failure.
655 * This function takes encoded pixel data and decodes it into raw RGBA
658 * The other parameters of the image (width, height etc.) are placed into
659 * the values pointed to (they must be supplied). The pixel data is a linear
660 * array of pixels starting from the top-left of the image scanning row by
661 * row from left to right. Each pixel is a 32bit value, with the high byte
662 * being the alpha channel, the next being red, then green, and the low byte
663 * being blue. The width and height are measured in pixels and will be
664 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
665 * that the alpha channel is not used. 1 denotes that it is significant.
666 * Compress is filled with the compression value/amount the image was
667 * stored with. The quality value is filled with the quality encoding of
668 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
669 * the image was encoded lossily or not.
671 * On success the function returns 1 indicating the header was read and
672 * decoded properly, or 0 on failure.
676 EAPI int eet_data_image_header_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
677 EAPI int eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
680 * Decode Image data into pixel data.
681 * @param data The encoded pixel data.
682 * @param size The size, in bytes, of the encoded pixel data.
683 * @param w A pointer to the unsigned int to hold the width in pixels.
684 * @param h A pointer to the unsigned int to hold the height in pixels.
685 * @param alpha A pointer to the int to hold the alpha flag.
686 * @param compress A pointer to the int to hold the compression amount.
687 * @param quality A pointer to the int to hold the quality amount.
688 * @param lossy A pointer to the int to hold the lossiness flag.
689 * @return The image pixel data decoded
691 * This function takes encoded pixel data and decodes it into raw RGBA
694 * The other parameters of the image (width, height etc.) are placed into
695 * the values pointed to (they must be supplied). The pixel data is a linear
696 * array of pixels starting from the top-left of the image scanning row by
697 * row from left to right. Each pixel is a 32bit value, with the high byte
698 * being the alpha channel, the next being red, then green, and the low byte
699 * being blue. The width and height are measured in pixels and will be
700 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
701 * that the alpha channel is not used. 1 denotes that it is significant.
702 * Compress is filled with the compression value/amount the image was
703 * stored with. The quality value is filled with the quality encoding of
704 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
705 * the image was encoded lossily or not.
707 * On success the function returns a pointer to the image data decoded. The
708 * calling application is responsible for calling free() on the image data
709 * when it is done with it. On failure NULL is returned and the parameter
710 * values may not contain any sensible data.
714 EAPI void *eet_data_image_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
715 EAPI void *eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
718 * Decode Image data into pixel data.
719 * @param data The encoded pixel data.
720 * @param size The size, in bytes, of the encoded pixel data.
721 * @param src_x The starting x coordinate from where to dump the stream.
722 * @param src_y The starting y coordinate from where to dump the stream.
723 * @param d A pointer to the pixel surface.
724 * @param w The expected width in pixels of the pixel surface to decode.
725 * @param h The expected height in pixels of the pixel surface to decode.
726 * @param row_stride The length of a pixels line in the destination surface.
727 * @param alpha A pointer to the int to hold the alpha flag.
728 * @param compress A pointer to the int to hold the compression amount.
729 * @param quality A pointer to the int to hold the quality amount.
730 * @param lossy A pointer to the int to hold the lossiness flag.
731 * @return 1 on success, 0 otherwise.
733 * This function takes encoded pixel data and decodes it into raw RGBA
736 * The other parameters of the image (alpha, compress etc.) are placed into
737 * the values pointed to (they must be supplied). The pixel data is a linear
738 * array of pixels starting from the top-left of the image scanning row by
739 * row from left to right. Each pixel is a 32bit value, with the high byte
740 * being the alpha channel, the next being red, then green, and the low byte
741 * being blue. The width and height are measured in pixels and will be
742 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
743 * that the alpha channel is not used. 1 denotes that it is significant.
744 * Compress is filled with the compression value/amount the image was
745 * stored with. The quality value is filled with the quality encoding of
746 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
747 * the image was encoded lossily or not.
749 * On success the function returns 1, and 0 on failure. On failure the
750 * parameter values may not contain any sensible data.
754 EAPI int eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
755 EAPI int eet_data_image_decode_to_surface(const void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
758 * Encode image data for storage or transmission.
759 * @param data A pointer to the image pixel data.
760 * @param size_ret A pointer to an int to hold the size of the returned data.
761 * @param w The width of the image in pixels.
762 * @param h The height of the image in pixels.
763 * @param alpha The alpha channel flag.
764 * @param compress The compression amount.
765 * @param quality The quality encoding amount.
766 * @param lossy The lossiness flag.
767 * @return The encoded image data.
769 * This function stakes image pixel data and encodes it with compression and
770 * possible loss of quality (as a trade off for size) for storage or
771 * transmission to another system.
773 * The data expected is the same format as returned by eet_data_image_read.
774 * If this is not the case weird things may happen. Width and height must
775 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
776 * the alpha values are not useful and 1 meaning they are). Compress can
777 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
778 * This is only used if the image is not lossily encoded. Quality is used on
779 * lossy compression and should be a value from 0 to 100. The lossy flag
780 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
781 * image quality loss (but then have a much smaller encoding).
783 * On success this function returns a pointer to the encoded data that you
784 * can free with free() when no longer needed.
788 EAPI void *eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy, int *size_ret);
789 EAPI void *eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
791 /***************************************************************************/
794 * Create a new empty data structure descriptor.
795 * @param name The string name of this data structure (most be a global constant and never change).
796 * @param size The size of the struct (in bytes).
797 * @param func_list_next The function to get the next list node.
798 * @param func_list_append The function to append a member to a list.
799 * @param func_list_data The function to get the data from a list node.
800 * @param func_list_free The function to free an entire linked list.
801 * @param func_hash_foreach The function to iterate through all hash table entries.
802 * @param func_hash_add The function to add a member to a hash table.
803 * @param func_hash_free The function to free an entire hash table.
804 * @return A new empty data descriptor.
806 * This function creates a new data descriptore and returns a handle to the
807 * new data descriptor. On creation it will be empty, containing no contents
808 * describing anything other than the shell of the data structure.
810 * You add structure members to the data descriptor using the macros
811 * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
812 * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
813 * adding to the description.
815 * Once you have described all the members of a struct you want loaded, or
816 * saved eet can load and save those members for you, encode them into
817 * endian-independant serialised data chunks for transmission across a
820 * The function pointers to the list and hash table functions are only
821 * needed if you use those data types, else you can pass NULL instead.
829 * typedef struct _blah2
835 * typedef struct _blah3
841 * typedef struct _blah
848 * double floating_lots;
856 * eet_eina_hash_add(Eina_Hash *hash, const char *key, const void *data)
858 * if (!hash) hash = eina_hash_string_superfast_new(NULL);
859 * if (!hash) return NULL;
861 * eina_hash_add(hash, key, data);
866 * main(int argc, char **argv)
871 * Eet_Data_Descriptor *edd, *edd2, *edd3;
877 * edd3 = eet_data_descriptor_new("blah3", sizeof(Blah3),
880 * eina_list_data_get,
885 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_T_STRING);
887 * edd2 = eet_data_descriptor_new("blah2", sizeof(Blah2),
890 * eina_list_data_get,
895 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_T_STRING);
897 * edd = eet_data_descriptor_new("blah", sizeof(Blah),
900 * eina_list_data_get,
905 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, EET_T_CHAR);
906 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T_SHORT);
907 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T_INT);
908 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_LONG);
909 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET_T_FLOAT);
910 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating_lots, EET_T_DOUBLE);
911 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_STRING);
912 * EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2);
913 * EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3);
915 * blah3.string="PANTS";
917 * blah2.string="subtype string here!";
919 * blah.character='7';
920 * blah.sixteen=0x7777;
921 * blah.integer=0xc0def00d;
922 * blah.lots=0xdeadbeef31337777;
923 * blah.floating=3.141592654;
924 * blah.floating_lots=0.777777777777777;
925 * blah.string="bite me like a turnip";
926 * blah.blah2 = &blah2;
927 * blah.blah3 = eina_list_append(NULL, &blah3);
928 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
929 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
930 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
931 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
932 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
933 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
935 * data = eet_data_descriptor_encode(edd, &blah, &size);
936 * printf("-----DECODING\n");
937 * blah_in = eet_data_descriptor_decode(edd, data, size);
939 * printf("-----DECODED!\n");
940 * printf("%c\n", blah_in->character);
941 * printf("%x\n", (int)blah_in->sixteen);
942 * printf("%x\n", blah_in->integer);
943 * printf("%lx\n", blah_in->lots);
944 * printf("%f\n", (double)blah_in->floating);
945 * printf("%f\n", (double)blah_in->floating_lots);
946 * printf("%s\n", blah_in->string);
947 * printf("%p\n", blah_in->blah2);
948 * printf(" %s\n", blah_in->blah2->string);
953 * EINA_LIST_FOREACH(blah_in->blah3, l, blah3_in)
955 * printf("%p\n", blah3_in);
956 * printf(" %s\n", blah3_in->string);
959 * eet_data_descriptor_free(edd);
960 * eet_data_descriptor_free(edd2);
961 * eet_data_descriptor_free(edd3);
970 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) (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));
974 * moving to this api from the old above. this will break things when the
975 * move happens - but be warned
977 EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(Eet_Data_Descriptor_Class *eddc);
978 EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(Eet_Data_Descriptor_Class *eddc);
981 * This function frees a data descriptor when it is not needed anymore.
982 * @param edd The data descriptor to free.
984 * This function takes a data descriptor handle as a parameter and frees all
985 * data allocated for the data descriptor and the handle itself. After this
986 * call the descriptor is no longer valid.
990 EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
993 * This function is an internal used by macros.
995 * This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(),
996 * EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is
997 * complex to use by hand and should be left to be used by the macros, and
998 * thus is not documented.
1002 EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, const char *name, int type, int group_type, int offset, /* int count_offset, */int count, const char *counter_name, Eet_Data_Descriptor *subtype);
1005 * Read a data structure from an eet file and decodes it.
1006 * @param ef The eet file handle to read from.
1007 * @param edd The data descriptor handle to use when decoding.
1008 * @param name The key the data is stored under in the eet file.
1009 * @return A pointer to the decoded data structure.
1011 * This function decodes a data structure stored in an eet file, returning
1012 * a pointer to it if it decoded successfully, or NULL on failure. This
1013 * can save a programmer dozens of hours of work in writing configuration
1014 * file parsing and writing code, as eet does all that work for the program
1015 * and presents a program-friendly data structure, just as the programmer
1016 * likes. Eet can handle members being added or deleted from the data in
1017 * storage and safely zero-fills unfilled members if they were not found
1018 * in the data. It checks sizes and headers whenever it reads data, allowing
1019 * the programmer to not worry about corrupt data.
1021 * Once a data structure has been described by the programmer with the
1022 * fields they wish to save or load, storing or retrieving a data structure
1023 * from an eet file, or from a chunk of memory is as simple as a single
1028 EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key);
1029 EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name);
1032 * Write a data structure from memory and store in an eet file.
1033 * @param ef The eet file handle to write to.
1034 * @param edd The data descriptor to use when encoding.
1035 * @param name The key to store the data under in the eet file.
1036 * @param data A pointer to the data structure to ssave and encode.
1037 * @param compress Compression flags for storage.
1038 * @return 1 on successful write, 0 on failure.
1040 * This function is the reverse of eet_data_read(), saving a data structure
1045 EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key, const void *data, int compress);
1046 EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const void *data, int compress);
1049 * Dump an eet encoded data structure into ascii text
1050 * @param data_in The pointer to the data to decode into a struct.
1051 * @param size_in The size of the data pointed to in bytes.
1052 * @param dumpfunc The function to call passed a string when new data is converted to text
1053 * @param dumpdata The data to pass to the @p dumpfunc callback.
1054 * @return 1 on success, 0 on failure
1056 * This function will take a chunk of data encoded by
1057 * eet_data_descriptor_encode() and convert it into human readable ascii text.
1058 * It does this by calling the @p dumpfunc callback for all new text that is
1059 * generated. This callback should append to any existing text buffer and
1060 * will be passed the pointer @p dumpdata as a parameter as well as a string
1061 * with new text to be appended.
1067 * void output(void *data, const char *string)
1069 * printf("%s", string);
1072 * void dump(const char *file)
1078 * f = fopen(file, "r");
1079 * fseek(f, 0, SEEK_END);
1082 * data = malloc(len);
1083 * fread(data, len, 1, f);
1085 * eet_data_text_dump(data, len, output, NULL);
1091 EAPI int eet_data_text_dump_cipher(const void *data_in, const char *key, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1092 EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1095 * Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
1096 * @param text The pointer to the string data to parse and encode.
1097 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1098 * @param size_ret This gets filled in with the encoded data blob size in bytes.
1099 * @return The encoded data on success, NULL on failure.
1101 * This function will parse the string pointed to by @p text and return
1102 * an encoded data lump the same way eet_data_descriptor_encode() takes an
1103 * in-memory data struct and encodes into a binary blob. @p text is a normal
1108 EAPI void *eet_data_text_undump_cipher(const char *text, const char *key, int textlen, int *size_ret);
1109 EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
1112 * Dump an eet encoded data structure from an eet file into ascii text
1113 * @param ef A valid eet file handle.
1114 * @param name Name of the entry. eg: "/base/file_i_want".
1115 * @param dumpfunc The function to call passed a string when new data is converted to text
1116 * @param dumpdata The data to pass to the @p dumpfunc callback.
1117 * @return 1 on success, 0 on failure
1119 * This function will take an open and valid eet file from eet_open() request
1120 * the data encoded by eet_data_descriptor_encode() corresponding to the key @p name
1121 * and convert it into human readable ascii text. It does this by calling the
1122 * @p dumpfunc callback for all new text that is generated. This callback should
1123 * append to any existing text buffer and will be passed the pointer @p dumpdata
1124 * as a parameter as well as a string with new text to be appended.
1128 EAPI int eet_data_dump_cipher(Eet_File *ef, const char *name, const char *key, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1129 EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1132 * Take an ascii encoding from eet_data_dump() and re-encode in binary.
1133 * @param ef A valid eet file handle.
1134 * @param name Name of the entry. eg: "/base/file_i_want".
1135 * @param text The pointer to the string data to parse and encode.
1136 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1137 * @param compress Compression flags (1 == compress, 0 = don't compress).
1138 * @return 1 on success, 0 on failure
1140 * This function will parse the string pointed to by @p text, encode it the same
1141 * way eet_data_descriptor_encode() takes an in-memory data struct and encodes into a
1144 * The data (optionally compressed) will be in ram, pending a flush to
1145 * disk (it will stay in ram till the eet file handle is closed though).
1149 EAPI int eet_data_undump_cipher(Eet_File *ef, const char *name, const char *key, const char *text, int textlen, int compress);
1150 EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *text, int textlen, int compress);
1153 * Decode a data structure from an arbitary location in memory.
1154 * @param edd The data descriptor to use when decoding.
1155 * @param data_in The pointer to the data to decode into a struct.
1156 * @param size_in The size of the data pointed to in bytes.
1157 * @return NULL on failure, or a valid decoded struct pointer on success.
1159 * This function will decode a data structure that has been encoded using
1160 * eet_data_descriptor_encode(), and return a data structure with all its
1161 * elements filled out, if successful, or NULL on failure.
1163 * The data to be decoded is stored at the memory pointed to by @p data_in,
1164 * and is described by the descriptor pointed to by @p edd. The data size is
1165 * passed in as the value to @p size_in, ande must be greater than 0 to
1168 * This function is useful for decoding data structures delivered to the
1169 * application by means other than an eet file, such as an IPC or socket
1170 * connection, raw files, shared memory etc.
1172 * Please see eet_data_read() for more information.
1176 EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int size_in);
1177 EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const void *data_in, int size_in);
1180 * Encode a dsata struct to memory and return that encoded data.
1181 * @param edd The data descriptor to use when encoding.
1182 * @param data_in The pointer to the struct to encode into data.
1183 * @param size_ret A pointer to the an int to be filled with the decoded size.
1184 * @return NULL on failure, or a valid encoded data chunk on success.
1186 * This function takes a data structutre in memory and encodes it into a
1187 * serialised chunk of data that can be decoded again by
1188 * eet_data_descriptor_decode(). This is useful for being able to transmit
1189 * data structures across sockets, pipes, IPC or shared file mechanisms,
1190 * without having to worry about memory space, machine type, endianess etc.
1192 * The parameter @p edd must point to a valid data descriptor, and
1193 * @p data_in must point to the right data structure to encode. If not, the
1194 * encoding may fail.
1196 * On success a non NULL valid pointer is returned and what @p size_ret
1197 * points to is set to the size of this decoded data, in bytes. When the
1198 * encoded data is no longer needed, call free() on it. On failure NULL is
1199 * returned and what @p size_ret points to is set to 0.
1201 * Please see eet_data_write() for more information.
1205 EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int *size_ret);
1206 EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const void *data_in, int *size_ret);
1209 * Add a basic data element to a data descriptor.
1210 * @param edd The data descriptor to add the type to.
1211 * @param struct_type The type of the struct.
1212 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1213 * @param member The struct member itself to be encoded.
1214 * @param type The type of the member to encode.
1216 * This macro is a convenience macro provided to add a member to the data
1217 * descriptor @p edd. The type of the structure is provided as the
1218 * @p struct_type parameter (for example: struct my_struct). The @p name
1219 * parameter defines a string that will be used to uniquely name that
1220 * member of the struct (it is suggested to use the struct member itself).
1221 * The @p member parameter is the actual struct member itself (for
1222 eet_dictionary_string_check * example: values), and @p type is the basic data type of the member which
1223 * must be one of: EET_T_CHAR, EET_T_SHORT, EET_T_INT, EET_T_LONG_LONG,
1224 * EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR, EET_T_USHORT, EET_T_UINT,
1225 * EET_T_ULONG_LONG or EET_T_STRING.
1229 #define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
1231 struct_type ___ett; \
1233 eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
1234 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1235 0, /* 0, */NULL, NULL); \
1239 * Add a sub-element type to a data descriptor
1240 * @param edd The data descriptor to add the type to.
1241 * @param struct_type The type of the struct.
1242 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1243 * @param member The struct member itself to be encoded.
1244 * @param subtype The type of sub-type struct to add.
1246 * This macro lets you easily add a sub-type (a struct that's pointed to
1247 * by this one). All the parameters are the same as for
1248 * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the exception.
1249 * This must be the data descriptor of the struct that is pointed to by
1254 #define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
1256 struct_type ___ett; \
1258 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
1259 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1260 0, /* 0, */NULL, subtype); \
1264 * Add a linked list type to a data descriptor
1265 * @param edd The data descriptor to add the type to.
1266 * @param struct_type The type of the struct.
1267 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1268 * @param member The struct member itself to be encoded.
1269 * @param subtype The type of linked list member to add.
1271 * This macro lets you easily add a linked list of other data types. All the
1272 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1273 * @p subtype being the exception. This must be the data descriptor of the
1274 * element that is in each member of the linked list to be stored.
1278 #define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
1280 struct_type ___ett; \
1282 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
1283 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1284 0, /* 0, */NULL, subtype); \
1288 * Add a hash type to a data descriptor
1289 * @param edd The data descriptor to add the type to.
1290 * @param struct_type The type of the struct.
1291 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1292 * @param member The struct member itself to be encoded.
1293 * @param subtype The type of hash member to add.
1295 * This macro lets you easily add a hash of other data types. All the
1296 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1297 * @p subtype being the exception. This must be the data descriptor of the
1298 * element that is in each member of the hash to be stored.
1302 #define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
1304 struct_type ___ett; \
1306 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
1307 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1308 0, /* 0, */NULL, subtype); \
1312 * Add a fixed size array type to a data descriptor
1313 * @param edd The data descriptor to add the type to.
1314 * @param struct_type The type of the struct.
1315 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1316 * @param member The struct member itself to be encoded.
1317 * @param subtype The type of hash member to add.
1319 * This macro lets you easily add a fixed size array of other data types. All the
1320 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1321 * @p subtype being the exception. This must be the data descriptor of the
1322 * element that is in each member of the hash to be stored.
1326 #define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
1328 struct_type ___ett; \
1330 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
1331 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1332 /* 0, */sizeof(___ett.member)/sizeof(___ett.member[0]), NULL, subtype); \
1336 * Add a variable size array type to a data descriptor
1337 * @param edd The data descriptor to add the type to.
1338 * @param struct_type The type of the struct.
1339 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1340 * @param member The struct member itself to be encoded.
1341 * @param subtype The type of hash member to add.
1343 * This macro lets you easily add a fixed size array of other data types. All the
1344 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1345 * @p subtype being the exception. This must be the data descriptor of the
1346 * element that is in each member of the hash to be stored.
1350 #define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype) \
1352 struct_type ___ett; \
1354 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_ARRAY, \
1355 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1356 (char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0, */NULL, subtype); \
1359 /***************************************************************************/
1361 EAPI Eet_Node *eet_node_char_new(const char *name, char c);
1362 EAPI Eet_Node *eet_node_short_new(const char *name, short s);
1363 EAPI Eet_Node *eet_node_int_new(const char *name, int i);
1364 EAPI Eet_Node *eet_node_long_long_new(const char *name, long long l);
1365 EAPI Eet_Node *eet_node_float_new(const char *name, float f);
1366 EAPI Eet_Node *eet_node_double_new(const char *name, double d);
1367 EAPI Eet_Node *eet_node_unsigned_char_new(const char *name, unsigned char uc);
1368 EAPI Eet_Node *eet_node_unsigned_short_new(const char *name, unsigned short us);
1369 EAPI Eet_Node *eet_node_unsigned_int_new(const char *name, unsigned int ui);
1370 EAPI Eet_Node *eet_node_unsigned_long_long_new(const char *name, unsigned long long l);
1371 EAPI Eet_Node *eet_node_string_new(const char *name, const char *str);
1372 EAPI Eet_Node *eet_node_inlined_string_new(const char *name, const char *str);
1373 EAPI Eet_Node *eet_node_null_new(const char *name);
1374 EAPI Eet_Node *eet_node_list_new(const char *name, Eina_List *nodes);
1375 EAPI Eet_Node *eet_node_array_new(const char *name, int count, Eina_List *nodes);
1376 EAPI Eet_Node *eet_node_var_array_new(const char *name, Eina_List *nodes);
1377 EAPI Eet_Node *eet_node_hash_new(const char *name, const char *key, Eet_Node *node);
1378 EAPI Eet_Node *eet_node_struct_new(const char *name, Eina_List *nodes);
1379 EAPI void eet_node_del(Eet_Node *n);
1381 EAPI void *eet_data_node_encode_cipher(Eet_Node *node, const char *key, int *size_ret);
1382 EAPI int eet_data_node_write_cipher(Eet_File *ef, const char *name, const char *key, Eet_Node *node, int compress);
1384 /***************************************************************************/