summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Sadoine <chris@indefini.org>2013-09-06 11:30:37 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-09-24 15:10:44 +0900
commit87b17f1ce9c68de1fc2ec7d21c46a3c90ba7441a (patch)
tree4b89db8796937a37b5729e9a845c429d359855b4
parenta7fe49139d608c1858515b81895be8061772df41 (diff)
eet: added EET_DATA_DESCRIPTOR_ADD_SUB_NESTED().
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/eet/Eet.h29
-rw-r--r--src/lib/eet/eet_data.c32
4 files changed, 57 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a6823ba62..a6de7dc12a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-09-06 Christophe Sadoine
2
3 * Eet: Added EET_DATA_DESCRIPTOR_ADD_SUB_NESTED().
4
12013-09-24 Jorge Zapata 52013-09-24 Jorge Zapata
2 6
3 * Eina: add a substraction in rectangles and more helpers, 7 * Eina: add a substraction in rectangles and more helpers,
diff --git a/NEWS b/NEWS
index 3f9ab5eee6..1ac141c204 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,7 @@ Additions:
45 - Add eet_mmap() 45 - Add eet_mmap()
46 - Add eet_data_descriptor_name_get() 46 - Add eet_data_descriptor_name_get()
47 - Add support EET_T_VALUE 47 - Add support EET_T_VALUE
48 - Add EET_DATA_DESCRIPTOR_ADD_SUB_NESTED()
48 * Eo: 49 * Eo:
49 - Add generic efl object infrastructure 50 - Add generic efl object infrastructure
50 - Add debugging facility 51 - Add debugging facility
diff --git a/src/lib/eet/Eet.h b/src/lib/eet/Eet.h
index 935afead9c..3aeb520ea6 100644
--- a/src/lib/eet/Eet.h
+++ b/src/lib/eet/Eet.h
@@ -2391,7 +2391,8 @@ eet_identity_certificate_print(const unsigned char *certificate,
2391#define EET_G_HASH 104 /**< Hash table group type */ 2391#define EET_G_HASH 104 /**< Hash table group type */
2392#define EET_G_UNION 105 /**< Union group type */ 2392#define EET_G_UNION 105 /**< Union group type */
2393#define EET_G_VARIANT 106 /**< Selectable subtype group */ 2393#define EET_G_VARIANT 106 /**< Selectable subtype group */
2394#define EET_G_LAST 107 /**< Last group type */ 2394#define EET_G_UNKNOWN_NESTED 107 /**< Unknown nested group type. @since 1.8 */
2395#define EET_G_LAST 108 /**< Last group type */
2395 2396
2396#define EET_I_LIMIT 128 /**< Other type exist but are reserved for internal purpose. */ 2397#define EET_I_LIMIT 128 /**< Other type exist but are reserved for internal purpose. */
2397 2398
@@ -3098,6 +3099,32 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
3098 } while (0) 3099 } while (0)
3099 3100
3100/** 3101/**
3102 * Add a nested sub-element type to a data descriptor
3103 * @param edd The data descriptor to add the type to.
3104 * @param struct_type The type of the struct.
3105 * @param name The string name to use to encode/decode this member
3106 * (must be a constant global and never change).
3107 * @param member The struct member itself to be encoded.
3108 * @param subtype The type of sub-type struct to add.
3109 *
3110 * This macro lets you easily add a sub-type: a struct that is nested into
3111 * this one. If your data is pointed by this element instead of being nested,
3112 * you should use EET_DATA_DESCRIPTOR_ADD_SUB().
3113 * All the parameters are the same as for EET_DATA_DESCRIPTOR_ADD_SUB().
3114 *
3115 * @since 1.8.0
3116 * @ingroup Eet_Data_Group
3117 */
3118#define EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(edd, struct_type, name, member, subtype) \
3119 do { \
3120 struct_type ___ett; \
3121 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN_NESTED, \
3122 (char *)(& (___ett.member)) - \
3123 (char *)(& (___ett)), \
3124 0, /* 0, */ NULL, subtype); \
3125 } while (0)
3126
3127/**
3101 * Add a linked list type to a data descriptor 3128 * Add a linked list type to a data descriptor
3102 * @param edd The data descriptor to add the type to. 3129 * @param edd The data descriptor to add the type to.
3103 * @param struct_type The type of the struct. 3130 * @param struct_type The type of the struct.
diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index 0a492ac10a..23d5504661 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -548,7 +548,8 @@ static const Eet_Data_Group_Type_Codec eet_group_codec[] =
548 { eet_data_get_list, eet_data_put_list }, 548 { eet_data_get_list, eet_data_put_list },
549 { eet_data_get_hash, eet_data_put_hash }, 549 { eet_data_get_hash, eet_data_put_hash },
550 { eet_data_get_union, eet_data_put_union }, 550 { eet_data_get_union, eet_data_put_union },
551 { eet_data_get_variant, eet_data_put_variant } 551 { eet_data_get_variant, eet_data_put_variant },
552 { eet_data_get_unknown, eet_data_put_unknown }
552}; 553};
553 554
554static int _eet_data_words_bigendian = -1; 555static int _eet_data_words_bigendian = -1;
@@ -4570,8 +4571,16 @@ eet_data_get_unknown(Eet_Free_Context *context,
4570 4571
4571 if (edd) 4572 if (edd)
4572 { 4573 {
4573 ptr = (void **)(((char *)data)); 4574 if (subtype && ede->group_type == EET_G_UNKNOWN_NESTED)
4574 *ptr = (void *)data_ret; 4575 {
4576 memcpy(data, data_ret, subtype->size);
4577 free(data_ret);
4578 }
4579 else
4580 {
4581 ptr = (void **)(((char *)data));
4582 *ptr = (void *)data_ret;
4583 }
4575 } 4584 }
4576 else 4585 else
4577 { 4586 {
@@ -4680,11 +4689,18 @@ eet_data_put_unknown(Eet_Dictionary *ed,
4680 if (IS_SIMPLE_TYPE(ede->type)) 4689 if (IS_SIMPLE_TYPE(ede->type))
4681 data = eet_data_put_type(ed, ede->type, data_in, &size); 4690 data = eet_data_put_type(ed, ede->type, data_in, &size);
4682 else if (ede->subtype) 4691 else if (ede->subtype)
4683 if (*((char **)data_in)) 4692 {
4684 data = _eet_data_descriptor_encode(ed, 4693 if (ede->group_type == EET_G_UNKNOWN_NESTED)
4685 ede->subtype, 4694 data = _eet_data_descriptor_encode(ed,
4686 *((char **)((char *)(data_in))), 4695 ede->subtype,
4687 &size); 4696 data_in,
4697 &size);
4698 else if (*((char **)data_in))
4699 data = _eet_data_descriptor_encode(ed,
4700 ede->subtype,
4701 *((char **)((char *)(data_in))),
4702 &size);
4703 }
4688 4704
4689 if (data) 4705 if (data)
4690 eet_data_encode(ed, 4706 eet_data_encode(ed,