Il 26/03/2012 16:20, Zhi Yong Wu ha scritto:
> struct PropertyInfo {
>     const char *name;
>     const char *legacy_name;
>     const char **enum_table;
>     int64_t min;
>     int64_t max;
>     int (*parse)(DeviceState *dev, Property *prop, const char *str);
>     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
>     ObjectPropertyAccessor *get;
>     ObjectPropertyAccessor *set;
>     ObjectPropertyRelease *release;
> };
> 
> Like above, its member functions pointers use DeviceState, so we will
> have to consider how to make this PropertyInfo more generic and be
> used by other Class and Object which are not based on DeviceState.

The member functions do not really do anything that is
DeviceState-specific.  You can change the argument to Object and add a
cast inside the implementations.

Besides, most property types do not have parse/print anymore.  Another
possibility would be to forbid hexNN types for non-DeviceState, since
only those have parse/print.

Paolo

Reply via email to