From: Jérôme Pinot <ngc891@gmail.com>
[framework/uifw/eet.git] / src / lib / Eet.h
index 7495090..ca8095f 100644 (file)
@@ -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
@@ -3157,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.