Page MenuHomePhabricator

Eo simple reflection API
Closed, ResolvedPublic


New public API:

void efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value *value)
Eina_Value* efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value *value)

The set function sets the property property_name to the value passed in.
The get function gets the property property_nameand returns the Eina_Value.

The ownership etc. of the property will work as defined in the .eo file for the property.

New API that should only be used by the generator

typedef void (*Efl_Object_Property_Reflection_Setter)(Eo *obj, Eina_Value *value);
typedef Eina_Value* (*Efl_Object_Property_Reflection_Getter)(Eo *obj);

typedef struct {
   const char *property_name;
   Efl_Object_Property_Reflection_Setter *set;
   Efl_Object_Property_Reflection_Getter *get;
} Efl_Object_Property_Reflection;

efl_class_reflection_table_set(Eo *obj, Efl_Object_Property_Reflection *reflection)

Where reflection is a pointer to a list of reflection pointers, the array is terminated with a NULL property_name. The array can be defined with a simular macro like EFL_CALLBACKS_ARRAY_DEFINE

The functions from above obviously just searches the internal table for the property_name and calls the function accordingly.

The function which is passed into the the table, handles the generation of the correct Eina_Value, or handles the correct casting.

bu5hm4n created this task.Feb 4 2019, 1:06 PM
bu5hm4n removed q66 as the assignee of this task.
bu5hm4n added a subscriber: q66.
bu5hm4n added a subscriber: cedric.

@cedric you or me ? I would like to solve this ASAP as we then have a "feature" complete Eo.

bu5hm4n edited projects, added efl: data types; removed Restricted Project.
cedric added a comment.Feb 4 2019, 1:38 PM

I will be able to spend some time on this Wednesday morning if you want.

bu5hm4n claimed this task.Feb 5 2019, 5:21 AM

I will try to handle it :)