From: Jérôme Pinot <ngc891@gmail.com>
[framework/uifw/eet.git] / src / lib / Eet.h
index a228137..ca8095f 100644 (file)
@@ -6,7 +6,7 @@
    @mainpage Eet Library Documentation
 
    @version 1.5.0
-   @date 2000-2011
+   @date 2000-2012
 
    Please see the @ref authors page for contact details.
 
@@ -30,7 +30,7 @@
    Eet is extremely fast, small and simple. Eet files can be very small and
    highly compressed, making them very optimal for just sending across the
    internet without having to archive, compress or decompress and install them.
-   They allow for lightning-fast random-acess reads once created, making them
+   They allow for lightning-fast random-access reads once created, making them
    perfect for storing data that is written once (or rarely) and read many
    times, but the program does not want to have to read it all in at once.
 
@@ -188,7 +188,7 @@ extern "C" {
  */
 
 #define EET_VERSION_MAJOR 1
-#define EET_VERSION_MINOR 4
+#define EET_VERSION_MINOR 6
 /**
  * @typedef Eet_Version
  *
@@ -209,7 +209,7 @@ extern "C" {
  * #endif
  * @endcode
  *
- * Note the #if check can be dropped if your program refuses to compile or
+ * Note the \#if check can be dropped if your program refuses to compile or
  * work with an Eet version less than 1.3.0.
  */
 typedef struct _Eet_Version
@@ -577,7 +577,7 @@ EAPI Eet_File_Mode
 eet_mode_get(Eet_File *ef);
 
 /**
- * Close an eet file handle and flush and writes pending.
+ * Close an eet file handle and flush pending writes.
  * @param ef A valid eet file handle.
  *
  * This function will flush any pending writes to disk if the eet file
@@ -645,6 +645,17 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
                             const char *string);
 
 /**
+ * Return the number of strings inside a dictionary
+ * @param ed A valid dictionary handle
+ * @return the number of strings inside a dictionary
+ *
+ * @since 1.6.0
+ * @ingroup Eet_File_Group
+ */
+EAPI int
+eet_dictionary_count(const Eet_Dictionary *ed);
+
+/**
  * Read a specified entry from an eet file and return data
  * @param ef A valid eet file handle opened for reading.
  * @param name Name of the entry. eg: "/base/file_i_want".
@@ -755,7 +766,7 @@ eet_delete(Eet_File *ef,
 
 /**
  * Alias a specific section to another one. Destination may exist or not,
- * no check are done.
+ * no checks are done.
  * @param ef A valid eet file handle opened for writing.
  * @param name Name of the new entry. eg: "/base/file_i_want".
  * @param destination Actual source of the aliased entry eg: "/base/the_real_stuff_i_want".
@@ -775,6 +786,19 @@ eet_alias(Eet_File *ef,
           int compress);
 
 /**
+ * Retrieve the filename of an Eet_File
+ * @param ef A valid eet file handle opened for writing.
+ * @return The stringshared file string opened with eet_open(), or NULL on error
+ *
+ * @note This function will return NULL for files opened with eet_memopen_read()
+ *
+ * @since 1.6
+ * @ingroup Eet_File_Group
+ */
+EAPI const char *
+eet_file_get(Eet_File *ef);
+
+/**
  * Retrieve the destination name of an alias
  * @param ef A valid eet file handle opened for writing
  * @param name Name of the entry. eg: "/base/file_i_want"
@@ -959,7 +983,7 @@ eet_write_cipher(Eet_File *ef,
  * will be 1 or 0, denoting if the alpha channel of the image is used or not.
  * If the image was losslessly compressed, the @p compress parameter will hold
  * the compression amount used, ranging from 0 to 9 and @p lossy will be 0.
- * In the case of lossy compression, @p lossy will be 1, and the compreesion
+ * In the case of lossy compression, @p lossy will be 1, and the compression
  * quality will be placed under @p quality, with a value ranging from 0 to 100.
  *
  * @see eet_data_image_header_decode()
@@ -3133,6 +3157,38 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
     } while(0)
 
 /**
+ * Add a variable array of basic data elements to a data descriptor.
+ * @param edd The data descriptor to add the type to.
+ * @param struct_type The type of the struct.
+ * @param name The string name to use to encode/decode this member
+ *        (must be a constant global and never change).
+ * @param member The struct member itself to be encoded.
+ * @param type The type of the member to encode.
+ *
+ * This macro lets you easily add a variable size array of basic data
+ * types. All the parameters are the same as for
+ * EET_DATA_DESCRIPTOR_ADD_BASIC(). This assumes you have
+ * a struct member (of type EET_T_INT) called member_count (note the
+ * _count appended to the member) that holds the number of items in
+ * the array. This array will be allocated separately to the struct it
+ * is in.
+ *
+ * @since 1.5.0
+ * @ingroup Eet_Data_Group
+ */
+#define EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY(edd, struct_type, name, member, type) \
+  do {                                                                                \
+       struct_type ___ett;                                                            \
+       eet_data_descriptor_element_add(edd, name, type, EET_G_VAR_ARRAY,              \
+                                       (char *)(& (___ett.member)) -                  \
+                                       (char *)(& (___ett)),                          \
+                                       (char *)(& (___ett.member ## _count)) -        \
+                                       (char *)(& (___ett)),                          \
+                                       NULL,                                          \
+                                       NULL);                                         \
+    } while(0)
+
+/**
  * Add a fixed size array type to a data descriptor
  * @param edd The data descriptor to add the type to.
  * @param struct_type The type of the struct.