hey there

I'd like to seriailze this structure with Eet

<code>
typedef enum _Type Type;
typedef struct _Value Value;

enum _Type {NUMBER, STRING, ARRAY, OBJECT};

struct _Value {
    Type type;
    union {
       float number;
       char *string;
       Eina_List *array;
       Eina_Hash *object;
    } data;
};
</code>

if the union instead would be a struct, I could use

<code>
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Value, "type", type, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Value, "data.number", data.number, 
EET_T_FLOAT);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Value, "data.string", data.string, 
EET_T_FLOAT);
EET_DATA_DESCRIPTOR_ADD_LIST(edd, Value, "data.array", data.array, edd);
EET_DATA_DESCRIPTOR_ADD_HASH(edd, Value, "data.object", data.object, edd);
</code>

but what if I'd like to use the union to safe some space?
with the code above I'd have four entries for the same address :-(
is there a method/workaround to do this without changing the structure?

thanks
hanspeter


------------------------------------------------------------------------------
_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to