summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Walter Seikel <onefang@gmail.com>2012-03-29 11:18:52 +0000
committerDavid Walter Seikel <onefang@gmail.com>2012-03-29 11:18:52 +0000
commit9a068b7247bf07f17b6bd8d659c97cdb5be7adb5 (patch)
tree9f21a2d7d65f1c2376176c45ce506b3d5586c4ce
parent9353d7e9de555e59e23fc4efb680f7ec4d6728a0 (diff)
downloadeet-9a068b7247bf07f17b6bd8d659c97cdb5be7adb5.tar.gz
Added a new macro for adding variable arrays of basic types.
EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY SVN revision: 69745
-rw-r--r--ChangeLog6
-rw-r--r--NEWS1
-rw-r--r--src/lib/Eet.h32
3 files changed, 39 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c74c55a..1077123 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -573,3 +573,9 @@
* add eet_dictionary_count.
* add "eet -t FILE.EET".
+
+2012-03-29 David Seikel (onefang)
+
+ * Added a new macro for adding variable arrays of basic types.
+ EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY
+
diff --git a/NEWS b/NEWS
index 026be2b..c8bc565 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ Additions:
* eet_alias_get API
* eet_data_xattr_cipher_get and eet_data_xattr_cipher_set APIs
* EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY API
+ * EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY API
Fixes:
diff --git a/src/lib/Eet.h b/src/lib/Eet.h
index 7495090..c49def7 100644
--- a/src/lib/Eet.h
+++ b/src/lib/Eet.h
@@ -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.