parent
7dc9294519
commit
c22277e070
|
@ -1492,9 +1492,8 @@ extern "C" {
|
|||
#define EET_G_LIST 103 /**< Linked list group type */
|
||||
#define EET_G_HASH 104 /**< Hash table group type */
|
||||
#define EET_G_UNION 105 /**< Union group type */
|
||||
#define EET_G_INHERIT 106 /**< Inherit object group type */
|
||||
#define EET_G_VARIANT 107 /**< Selectable subtype group */
|
||||
#define EET_G_LAST 108 /**< Last group type */
|
||||
#define EET_G_VARIANT 106 /**< Selectable subtype group */
|
||||
#define EET_G_LAST 107 /**< Last group type */
|
||||
|
||||
#define EET_I_LIMIT 128 /**< Other type exist but are reserved for internal purpose. */
|
||||
|
||||
|
@ -2198,36 +2197,6 @@ extern "C" {
|
|||
NULL, unified_type); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a structure variable in size/content depend on it's type
|
||||
* @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_member The member that give hints on what is in the union.
|
||||
* @param unified_type Describe all possible type the union could handle.
|
||||
*
|
||||
* This macro lets you easily add a switch for an object oriented representation. The position
|
||||
* of the member that define the type must be fixed for all possible type. Eet will then choose
|
||||
* in the unified_type the structure that need to be allocated to match the detected type.
|
||||
* The type_get and type_set callback of unified_type should be defined. This should be the only
|
||||
* type in edd.
|
||||
*
|
||||
* @since 1.2.4
|
||||
* @ingroup Eet_Data_Group
|
||||
* @see Eet_Data_Descriptor_Class
|
||||
*/
|
||||
#define EET_DATA_DESCRIPTOR_ADD_INHERIT(edd, struct_type, name, member, type_member, unified_type) \
|
||||
{ \
|
||||
struct_type ___ett; \
|
||||
\
|
||||
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_INHERIT, \
|
||||
(char *) (&(___ett.member)) - (char *)(&(___ett)), \
|
||||
(char *) (&(___ett.type_member)) - (char *)(&(___ett)), \
|
||||
NULL, unified_type); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a automatically selectable type to a data descriptor
|
||||
* @param edd The data descriptor to add the type to.
|
||||
|
|
|
@ -243,8 +243,6 @@ static void eet_data_put_hash(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_
|
|||
static int eet_data_get_hash(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data, char **p, int *size);
|
||||
static void eet_data_put_union(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Stream *ds, void *data_in);
|
||||
static int eet_data_get_union(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data, char **p, int *size);
|
||||
static void eet_data_put_inherit(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Stream *ds, void *data_in);
|
||||
static int eet_data_get_inherit(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data, char **p, int *size);
|
||||
static void eet_data_put_variant(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Stream *ds, void *data_in);
|
||||
static int eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data, char **p, int *size);
|
||||
|
||||
|
@ -296,7 +294,6 @@ static const Eet_Data_Group_Type_Codec eet_group_codec[] =
|
|||
{ eet_data_get_list, eet_data_put_list },
|
||||
{ eet_data_get_hash, eet_data_put_hash },
|
||||
{ eet_data_get_union, eet_data_put_union },
|
||||
{ eet_data_get_inherit, eet_data_put_inherit },
|
||||
{ eet_data_get_variant, eet_data_put_variant }
|
||||
};
|
||||
|
||||
|
@ -1448,9 +1445,8 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
|
|||
Eet_Data_Element *ede;
|
||||
Eet_Data_Element *tmp;
|
||||
|
||||
/* UNION, INHERITED or VARIANT type would not work with simple type, we need a way to map the type. */
|
||||
if ((group_type == EET_G_INHERIT
|
||||
|| group_type == EET_G_UNION
|
||||
/* UNION, VARIANT type would not work with simple type, we need a way to map the type. */
|
||||
if ((group_type == EET_G_UNION
|
||||
|| group_type == EET_G_VARIANT)
|
||||
&&
|
||||
(type != EET_T_UNKNOW
|
||||
|
@ -1459,13 +1455,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
|
|||
|| subtype->func.type_set == NULL))
|
||||
return ;
|
||||
|
||||
/* Only one element is allowed with INHERITED type */
|
||||
if (group_type == EET_G_INHERIT && edd->elements.num != 0)
|
||||
return ;
|
||||
if (edd->elements.num > 0 && edd->elements.set[0].group_type == EET_G_INHERIT)
|
||||
return ;
|
||||
|
||||
/* VARIANT type will only work if the map only contains EET_G_*, but not INHERIT, UNION, VARIANT and ARRAY. */
|
||||
/* VARIANT type will only work if the map only contains EET_G_*, but not UNION, VARIANT and ARRAY. */
|
||||
if (group_type == EET_G_VARIANT)
|
||||
{
|
||||
int i;
|
||||
|
@ -1519,7 +1509,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
|
|||
ede->group_type = group_type;
|
||||
ede->offset = offset;
|
||||
ede->count = count;
|
||||
/* FIXME: For the time being, VAR_ARRAY, INHERIT, UNION and VARIANT will put the counter_offset in count. */
|
||||
/* FIXME: For the time being, VAR_ARRAY, UNION and VARIANT will put the counter_offset in count. */
|
||||
ede->counter_offset = count;
|
||||
/* ede->counter_offset = counter_offset; */
|
||||
ede->counter_name = counter_name;
|
||||
|
@ -2504,9 +2494,6 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
|
|||
break;
|
||||
case EET_G_VAR_ARRAY:
|
||||
return eet_node_var_array_new(chnk.name, NULL);
|
||||
case EET_G_INHERIT:
|
||||
/* This one should work */
|
||||
goto error;
|
||||
case EET_G_LIST:
|
||||
case EET_G_HASH:
|
||||
case EET_G_ARRAY:
|
||||
|
@ -3011,24 +2998,6 @@ eet_data_get_union(Eet_Free_Context *context, const Eet_Dictionary *ed,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
eet_data_put_inherit(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede,
|
||||
Eet_Data_Stream *ds, void *data_in)
|
||||
{
|
||||
/* FIXME */
|
||||
fprintf(stderr, "wrong !!!\n");
|
||||
}
|
||||
|
||||
static int
|
||||
eet_data_get_inherit(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede, Eet_Data_Chunk *echnk,
|
||||
int type, int group_type, void *data,
|
||||
char **p, int *size)
|
||||
{
|
||||
/* FIXME */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
eet_data_put_variant(Eet_Dictionary *ed,
|
||||
__UNUSED__ Eet_Data_Descriptor *edd,
|
||||
|
|
Loading…
Reference in New Issue