Data Model Type management
[Data Model API]
Functions and structures related to implementing new types or extending existing ones.
More...Data Structures | |
struct | _Eina_Model_Type |
API to access models. More... | |
struct | _Eina_Model_Interface |
API to access models. More... | |
struct | _Eina_Model_Event_Description |
Data Model Event Description. More... | |
struct | _Eina_Model_Interface_Properties |
Interface to manage model's properties. More... | |
struct | _Eina_Model_Interface_Children |
Interface to manage model's children. More... | |
Defines | |
#define | EINA_MODEL_TYPE_VERSION (1) |
Current API version, used to validate _Eina_Model_Type. | |
#define | EINA_MODEL_TYPE_INIT(name, type, private_type, parent, interfaces, events) |
#define | EINA_MODEL_TYPE_INIT_NOPRIVATE(name, type, parent, interfaces, events) |
#define | EINA_MODEL_TYPE_INIT_NULL |
#define | eina_model_method_resolve(model, struct_type, method) eina_model_method_offset_resolve((model), offsetof(struct_type, method)) |
#define | eina_model_type_method_resolve(type, model, struct_type, method) eina_model_type_method_offset_resolve((type), (model), offsetof(struct_type, method)) |
#define | EINA_MODEL_INTERFACE_VERSION (1) |
Current API version, used to validate _Eina_Model_Interface. | |
#define | EINA_MODEL_INTERFACE_INIT(name, iface, private_type, parent, events) |
#define | EINA_MODEL_INTERFACE_INIT_NOPRIVATE(name, iface, parent, events) |
#define | EINA_MODEL_INTERFACE_INIT_NULL |
#define | eina_model_interface_method_resolve(iface, model, struct_type, method) eina_model_interface_method_offset_resolve((iface), (model), offsetof(struct_type, method)) |
#define | EINA_MODEL_EVENT_DESCRIPTION(name, type, doc) {name, type, doc} |
Helper to define Eina_Model_Event_Description fields. | |
#define | EINA_MODEL_EVENT_DESCRIPTION_SENTINEL {NULL, NULL, NULL} |
Helper to define Eina_Model_Event_Description fields for sentinel (last item). | |
#define | EINA_MODEL_INTERFACE_PROPERTIES_VERSION (1) |
Current API version, used to validate _Eina_Model_Interface_Properties. | |
#define | EINA_MODEL_INTERFACE_CHILDREN_VERSION (1) |
Current API version, used to validate _Eina_Model_Interface_Children. | |
Typedefs | |
typedef struct _Eina_Model_Interface_Properties | Eina_Model_Interface_Properties |
Interface to manage model's properties. | |
typedef struct _Eina_Model_Interface_Children | Eina_Model_Interface_Children |
Interface to manage model's children. | |
Functions | |
Eina_Bool | eina_model_type_constructor (const Eina_Model_Type *type, Eina_Model *model) |
Calls the constructor of type for model. | |
Eina_Bool | eina_model_type_destructor (const Eina_Model_Type *type, Eina_Model *model) |
Calls the destructor of type for model. | |
Eina_Bool | eina_model_type_copy (const Eina_Model_Type *type, const Eina_Model *src, Eina_Model *dst) |
Calls the copy method of type for model. | |
Eina_Bool | eina_model_type_deep_copy (const Eina_Model_Type *type, const Eina_Model *src, Eina_Model *dst) |
Calls the deep copy method of type for model. | |
Eina_Bool | eina_model_type_compare (const Eina_Model_Type *type, const Eina_Model *a, const Eina_Model *b, int *cmp) |
Calls the compare method of type for model. | |
Eina_Bool | eina_model_type_load (const Eina_Model_Type *type, Eina_Model *model) |
Calls the load method of type for model. | |
Eina_Bool | eina_model_type_unload (const Eina_Model_Type *type, Eina_Model *model) |
Calls the unload method of type for model. | |
Eina_Bool | eina_model_type_property_get (const Eina_Model_Type *type, const Eina_Model *model, const char *name, Eina_Value *value) |
Calls the property get method of type for model. | |
Eina_Bool | eina_model_type_property_set (const Eina_Model_Type *type, Eina_Model *model, const char *name, const Eina_Value *value) |
Calls the property set method of type for model. | |
Eina_Bool | eina_model_type_property_del (const Eina_Model_Type *type, Eina_Model *model, const char *name) |
Calls the property del method of type for model. | |
Eina_List * | eina_model_type_properties_names_list_get (const Eina_Model_Type *type, const Eina_Model *model) |
Calls the properties name list method of type for model. | |
int | eina_model_type_child_count (const Eina_Model_Type *type, const Eina_Model *model) |
Calls the child count method of type for model. | |
Eina_Model * | eina_model_type_child_get (const Eina_Model_Type *type, const Eina_Model *model, unsigned int position) |
Calls the child get method of type for model. | |
Eina_Bool | eina_model_type_child_set (const Eina_Model_Type *type, Eina_Model *model, unsigned int position, Eina_Model *child) |
Calls the child set method of type for model. | |
Eina_Bool | eina_model_type_child_del (const Eina_Model_Type *type, Eina_Model *model, unsigned int position) |
Calls the child del method of type for model. | |
Eina_Bool | eina_model_type_child_insert_at (const Eina_Model_Type *type, Eina_Model *model, unsigned int position, Eina_Model *child) |
Calls the child insert at method of type for model. | |
int | eina_model_type_child_find (const Eina_Model_Type *type, const Eina_Model *model, unsigned int start_position, const Eina_Model *other) |
Calls the child find method of type for model. | |
int | eina_model_type_child_criteria_match (const Eina_Model_Type *type, const Eina_Model *model, unsigned int start_position, Eina_Each_Cb match, const void *data) |
Calls the child criteria match method of type for model. | |
void | eina_model_type_child_sort (const Eina_Model_Type *type, Eina_Model *model, Eina_Compare_Cb compare) |
Calls the child sort method of type for model. | |
Eina_Iterator * | eina_model_type_child_iterator_get (const Eina_Model_Type *type, Eina_Model *model, unsigned int start, unsigned int count) |
Calls the child iterator get method of type for model. | |
Eina_Iterator * | eina_model_type_child_reversed_iterator_get (const Eina_Model_Type *type, Eina_Model *model, unsigned int start, unsigned int count) |
Calls the child reversed iterator get method of type for model. | |
Eina_Iterator * | eina_model_type_child_sorted_iterator_get (const Eina_Model_Type *type, Eina_Model *model, unsigned int start, unsigned int count, Eina_Compare_Cb compare) |
Calls the child sorted iterator get method of type for model. | |
Eina_Iterator * | eina_model_type_child_filtered_iterator_get (const Eina_Model_Type *type, Eina_Model *model, unsigned int start, unsigned int count, Eina_Each_Cb match, const void *data) |
Calls the child filtered get method of type for model. | |
char * | eina_model_type_to_string (const Eina_Model_Type *type, const Eina_Model *model) |
Calls the to string method of type for model. | |
const void * | eina_model_method_offset_resolve (const Eina_Model *model, unsigned int offset) |
Get resolved method from types that extend Eina_Model_Type given offset. | |
const void * | eina_model_type_method_offset_resolve (const Eina_Model_Type *type, const Eina_Model *model, unsigned int offset) |
Gets resolved method from type of model given offset. | |
Eina_Bool | eina_model_interface_constructor (const Eina_Model_Interface *iface, Eina_Model *model) |
Calls the constructor of iface on model. | |
Eina_Bool | eina_model_interface_destructor (const Eina_Model_Interface *iface, Eina_Model *model) |
Calls the destructor of iface on model. | |
Eina_Bool | eina_model_interface_copy (const Eina_Model_Interface *iface, const Eina_Model *src, Eina_Model *dst) |
Calls the copy method of iface on model. | |
Eina_Bool | eina_model_interface_deep_copy (const Eina_Model_Interface *iface, const Eina_Model *src, Eina_Model *dst) |
Calls the deep copy method of iface on model. | |
const void * | eina_model_interface_method_offset_resolve (const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int offset) |
Gets the iface's method for model at offset. | |
Eina_Bool | eina_model_type_check (const Eina_Model_Type *type) |
Check type is valid. | |
const char * | eina_model_type_name_get (const Eina_Model_Type *type) |
Gets the name type. | |
const Eina_Model_Type * | eina_model_type_parent_get (const Eina_Model_Type *type) |
Gets the parent type of type. | |
Eina_Bool | eina_model_type_subclass_setup (Eina_Model_Type *type, const Eina_Model_Type *parent) |
Setup the type to be a subclass of another parent type. | |
Eina_Bool | eina_model_type_subclass_check (const Eina_Model_Type *type, const Eina_Model_Type *self_or_parent) |
Checks if type is a subclass of(or the same as) self_or_parent. | |
const Eina_Model_Interface * | eina_model_type_interface_get (const Eina_Model_Type *type, const char *name) |
Gets a interface with name name from type. | |
void * | eina_model_type_private_data_get (const Eina_Model *model, const Eina_Model_Type *type) |
Gets the private date of model for type type. | |
Eina_Bool | eina_model_interface_check (const Eina_Model_Interface *iface) |
Checks if iface is a valid interface. | |
void * | eina_model_interface_private_data_get (const Eina_Model *model, const Eina_Model_Interface *iface) |
Gets the private date of model for interface iface. | |
Eina_Bool | eina_model_interface_properties_compare (const Eina_Model_Interface *iface, const Eina_Model *a, const Eina_Model *b, int *cmp) |
Compares properties using iface's comparing function. | |
Eina_Bool | eina_model_interface_properties_load (const Eina_Model_Interface *iface, Eina_Model *model) |
Loads properties using iface's loading function. | |
Eina_Bool | eina_model_interface_properties_unload (const Eina_Model_Interface *iface, Eina_Model *model) |
Unloads properties using iface's unloading function. | |
Eina_Bool | eina_model_interface_properties_get (const Eina_Model_Interface *iface, const Eina_Model *model, const char *name, Eina_Value *value) |
Gets property named name using iface's function to get properties. | |
Eina_Bool | eina_model_interface_properties_set (const Eina_Model_Interface *iface, Eina_Model *model, const char *name, const Eina_Value *value) |
Sets property named name using iface's function to set properties. | |
Eina_Bool | eina_model_interface_properties_del (const Eina_Model_Interface *iface, Eina_Model *model, const char *name) |
Deletes property named name using iface's function to delete properties. | |
Eina_List * | eina_model_interface_properties_names_list_get (const Eina_Model_Interface *iface, const Eina_Model *model) |
Gets properties name list using iface's function to get properties name list. | |
Eina_Bool | eina_model_interface_children_compare (const Eina_Model_Interface *iface, const Eina_Model *a, const Eina_Model *b, int *cmp) |
Compares children using iface's comparing function. | |
Eina_Bool | eina_model_interface_children_load (const Eina_Model_Interface *iface, Eina_Model *model) |
Loads children using iface's loading function. | |
Eina_Bool | eina_model_interface_children_unload (const Eina_Model_Interface *iface, Eina_Model *model) |
Unloads children using iface's unloading function. | |
int | eina_model_interface_children_count (const Eina_Model_Interface *iface, const Eina_Model *model) |
Count children using iface's counting function. | |
Eina_Model * | eina_model_interface_children_get (const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int position) |
Get child using iface's function to get children. | |
Eina_Bool | eina_model_interface_children_set (const Eina_Model_Interface *iface, Eina_Model *model, unsigned int position, Eina_Model *child) |
Set child using iface's function to set children. | |
Eina_Bool | eina_model_interface_children_del (const Eina_Model_Interface *iface, Eina_Model *model, unsigned int position) |
Delete child using iface's function to delete children. | |
Eina_Bool | eina_model_interface_children_insert_at (const Eina_Model_Interface *iface, Eina_Model *model, unsigned int position, Eina_Model *child) |
Insert child using iface's function to insert children. | |
void | eina_model_interface_children_sort (const Eina_Model_Interface *iface, Eina_Model *model, Eina_Compare_Cb compare) |
Sort children using iface's function to sort children. |
Detailed Description
Functions and structures related to implementing new types or extending existing ones.All eina_model_type functions takes an Eina_Model_Type or Eina_Model_Interface as parameter and may be used to validate or query information about them.
The functions with prefix eina_model_type that matches eina_model counterparts, such as eina_model_type_compare() and eina_model_compare() are used as "super", that is, calls the compare()
method of the given type (or its parent) instead of the most specific type of provided Eina_Model.
Examples:
- Creating a simple model contains an easy to follow example that demonstrates several of the important features of eina_model, uses EINA_MODEL_TYPE_GENERIC.
- Using Eina_Model and inheritance walk-through example on how to inherit types, a suggestion of eina_model_load() usage and uses EINA_MODEL_TYPE_STRUCT.
Define Documentation
#define EINA_MODEL_INTERFACE_INIT | ( | name, | |||
iface, | |||||
private_type, | |||||
parent, | |||||
events | ) |
Value:
{EINA_MODEL_INTERFACE_VERSION, \ sizeof(private_type), \ sizeof(iface), \ name, \ parent, \ events, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL \ }
#define EINA_MODEL_INTERFACE_INIT_NOPRIVATE | ( | name, | |||
iface, | |||||
parent, | |||||
events | ) |
Value:
{EINA_MODEL_INTERFACE_VERSION, \ 0, \ sizeof(iface), \ name, \ parent, \ events, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL \ }
#define EINA_MODEL_INTERFACE_INIT_NULL |
Value:
{0, \ 0, \ 0, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL, \ NULL \ }
#define EINA_MODEL_EVENT_DESCRIPTION | ( | name, | |||
type, | |||||
doc | ) | {name, type, doc} |
Helper to define Eina_Model_Event_Description fields.
- Since:
- 1.2
#define EINA_MODEL_EVENT_DESCRIPTION_SENTINEL {NULL, NULL, NULL} |
Helper to define Eina_Model_Event_Description fields for sentinel (last item).
- Since:
- 1.2
Typedef Documentation
Interface to manage model's properties.
This extends Eina_Model_Interface as expected by interface name EINA_MODEL_INTERFACE_NAME_PROPERTIES.
This interface is meant to help managing properties of a model, it is used by EINA_MODEL_TYPE_MIXIN in order to configure methods for children independently from properties.
- See also:
- _Eina_Model_Interface_Properties explains fields.
- Since:
- 1.2
Interface to manage model's children.
This extends Eina_Model_Interface as expected by interface name EINA_MODEL_INTERFACE_NAME_CHILDREN.
This interface is meant to help managing properties of a model, it is used by EINA_MODEL_TYPE_MIXIN in order to configure methods for children independently from properties.
- See also:
- _Eina_Model_Interface_Children explains fields.
- Since:
- 1.2
Function Documentation
Eina_Bool eina_model_type_constructor | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model | |||
) |
Calls the constructor of type for model.
- Parameters:
-
type The type whose constructor will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
static Eina_Bool my_type_constructor(Eina_Model *m) { // call parents constructor: if (!eina_model_type_constructor(MY_TYPE->parent, m)) return EINA_FALSE; // do my stuff return EINA_TRUE; }
- Note:
- You should only do your type's initialization after the parent type has done his own(this is as to ensure you can call on your parent's methods).
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_new()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_destructor | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model | |||
) |
Calls the destructor of type for model.
- Parameters:
-
type The type whose destructor will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
static Eina_Bool my_type_destructor(Eina_Model *m) { // do my stuff // call parents destructor: if (!eina_model_type_destructor(MY_TYPE->parent, m)) return EINA_FALSE; return EINA_TRUE; }
- Note:
- It's considered good practice to free your type's resources before calling the parent's destructor.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_del()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_copy | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | src, | |||
Eina_Model * | dst | |||
) |
Calls the copy method of type for model.
- Parameters:
-
type The type whose copy method will be called. src Pointer to the model to be copied. dst Pointer to where copy will be put.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_copy()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_deep_copy | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | src, | |||
Eina_Model * | dst | |||
) |
Calls the deep copy method of type for model.
- Parameters:
-
type The type whose copy method will be called. src Pointer to the model to be copied. dst Pointer to where copy will be put.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_deep_copy()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_compare | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | a, | |||
const Eina_Model * | b, | |||
int * | cmp | |||
) |
Calls the compare method of type for model.
- Parameters:
-
[in] type The type whose compare method will be called. [in] a Pointer to the first model to be compared. [in] b Pointer to the second model to be compared. [out] cmp The value of the comparison, 1 if b is greater than a, -1 if b is smaller than a, 0 if a and b are equal.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_compare()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_load | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model | |||
) |
Calls the load method of type for model.
- Parameters:
-
type The type whose load method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_load()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_unload | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model | |||
) |
Calls the unload method of type for model.
- Parameters:
-
type The type whose unload method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_unload()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_property_get | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model, | |||
const char * | name, | |||
Eina_Value * | value | |||
) |
Calls the property get method of type for model.
- Parameters:
-
[in] type The type whose property get method will be called. [in] model The model instance. [in] name Name of property to get. [out] value Pointer to where value of property will be placed.
- Returns:
- EINA_TRUE if able to get property, EINA_FALSE otherwise.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_property_set | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
const char * | name, | |||
const Eina_Value * | value | |||
) |
Calls the property set method of type for model.
- Parameters:
-
type The type whose property set method will be called. model The model instance. name Name of property whose value will be set. value The value to be set.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
References EINA_FALSE, eina_value_type_check(), and _Eina_Value::type.
Eina_Bool eina_model_type_property_del | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
const char * | name | |||
) |
Calls the property del method of type for model.
- Parameters:
-
type The type whose property delete method will be called. model The model instance. name The name of the property to be deleted.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
References EINA_FALSE.
Eina_List* eina_model_type_properties_names_list_get | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model | |||
) |
Calls the properties name list method of type for model.
- Parameters:
-
type The type whose property name list get method will be called. model The model instance.
- Returns:
- Eina_List of properties' names.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
int eina_model_type_child_count | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model | |||
) |
Calls the child count method of type for model.
- Parameters:
-
type The type whose child count method will be called. model The model instance.
- Returns:
- Number of children in model.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_count()
- Since:
- 1.2
Eina_Model* eina_model_type_child_get | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model, | |||
unsigned int | position | |||
) |
Calls the child get method of type for model.
- Parameters:
-
type The type whose child get method will be called. model The model instance. position The position of the child to get.
- Returns:
- The child model, or NULL on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_get()
- Since:
- 1.2
Eina_Bool eina_model_type_child_set | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | position, | |||
Eina_Model * | child | |||
) |
Calls the child set method of type for model.
- Parameters:
-
type The type whose child set method will be called. model The model instance. position The position of the child to be set. child Pointer to value(child) to be set.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_set()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_child_del | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | position | |||
) |
Calls the child del method of type for model.
- Parameters:
-
type The type whose child delete method will be called. model The model instance. position Position of child to be deleted.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_del()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_type_child_insert_at | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | position, | |||
Eina_Model * | child | |||
) |
Calls the child insert at method of type for model.
- Parameters:
-
type The type whose child insert method will be called. model The model instance. position Position in which child will be inserted. child The child to be inserted.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
References EINA_FALSE.
int eina_model_type_child_find | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model, | |||
unsigned int | start_position, | |||
const Eina_Model * | other | |||
) |
Calls the child find method of type for model.
- Parameters:
-
type The type whose find method will be called. model The model instance. start_position The first position to search for. other The child being searched for.
- Returns:
- The index of the searched child, or -1 if not found.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_find()
- Since:
- 1.2
int eina_model_type_child_criteria_match | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model, | |||
unsigned int | start_position, | |||
Eina_Each_Cb | match, | |||
const void * | data | |||
) |
Calls the child criteria match method of type for model.
- Parameters:
-
type The type whose child criteria match method will be called. model The model instance. start_position The first position to be checked. match The function used to determine if a child matches the criteria. data Data given to the match function. May be NULL.
- Returns:
- The position of the first child to match the criteria or -1 if no child matches it.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
void eina_model_type_child_sort | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
Eina_Compare_Cb | compare | |||
) |
Calls the child sort method of type for model.
- Parameters:
-
type The type whose child sort method will be called. model The model instance. compare Function used to compare children.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_child_sort()
- Since:
- 1.2
Eina_Iterator* eina_model_type_child_iterator_get | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | start, | |||
unsigned int | count | |||
) |
Calls the child iterator get method of type for model.
- Parameters:
-
type The type whose child iterator get method will be called. model The model instance. start The first child to be a part of the iterator. count The number of children included in the iterator.
- Returns:
- Newly created iterator instance on success or
NULL
on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
Eina_Iterator* eina_model_type_child_reversed_iterator_get | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | start, | |||
unsigned int | count | |||
) |
Calls the child reversed iterator get method of type for model.
- Parameters:
-
type The type whose child reversed iterator get method will be called. model The model instance. start The first child to be a part of the iterator. count The number of children included in the iterator.
- Returns:
- Newly created iterator instance on success or
NULL
on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
Eina_Iterator* eina_model_type_child_sorted_iterator_get | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | start, | |||
unsigned int | count, | |||
Eina_Compare_Cb | compare | |||
) |
Calls the child sorted iterator get method of type for model.
- Parameters:
-
type The type whose child sorted iterator get method will be called. model The model instance. start The first child to be a part of the iterator. count The number of children included in the iterator. compare Function used to compare children.
- Returns:
- Newly created iterator instance on success or
NULL
on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
Eina_Iterator* eina_model_type_child_filtered_iterator_get | ( | const Eina_Model_Type * | type, | |
Eina_Model * | model, | |||
unsigned int | start, | |||
unsigned int | count, | |||
Eina_Each_Cb | match, | |||
const void * | data | |||
) |
Calls the child filtered get method of type for model.
- Parameters:
-
type The type whose child filtered iterator get method will be called. model The model instance. start The first child to be a part of the iterator. count Number of children to be checked for inclusion in the iterator. match Function used to check if child will be included in the iterator. data Data given to the match function. May be NULL.
- Returns:
- Newly created iterator instance on success or
NULL
on failure.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- Since:
- 1.2
char* eina_model_type_to_string | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model | |||
) |
Calls the to string method of type for model.
- Parameters:
-
type The type whose to string method will be called. model The model instance.
- Returns:
- String representationof model.
- Warning:
- If model doesn't inherit from(or is of) type does nothing and returns EINA_FALSE.
- See also:
- eina_model_to_string()
- Since:
- 1.2
const void* eina_model_method_offset_resolve | ( | const Eina_Model * | model, | |
unsigned int | offset | |||
) |
Get resolved method from types that extend Eina_Model_Type given offset.
- Parameters:
-
model the model to query the method offset the byte offset in the structure given as type, it must be bigger than Eina_Model_Type itself.
- Returns:
- Address to resolved method, or
NULL
if method is not implemented.
When implementing new types that augments the basic methods from Eina_Model_Type, the recommended structure layout is as follow:
typedef struct _My_Type My_Type; struct _My_Type { Eina_Model_Type base; int (*my_method)(Eina_Model *model); }; int my_type_my_method(Eina_Model *model);
Then the implementation of my_type_my_method()
needs to get the most specific my_method
that is not NULL
from type hierarchy, also called "resolve the method".
To do this in an efficient way, Eina_Model infrastructure pre-resolves all methods and provides this function for efficient query. The recommended implementation of my_type_my_method() would be:
int my_type_my_method(Eina_Model *model) { int (*meth)(Eina_Model *); EINA_SAFETY_ON_FALSE_RETURN(eina_model_instance_check(model, MY_TYPE), -1); meth = eina_model_method_offset_resolve(model, offsetof(My_Type, my_method)); EINA_SAFETY_ON_NULL_RETURN(meth, -1); return meth(model); }
- Note:
- offset must be bigger than Eina_Model_Type, otherwise use specific functions such as eina_model_property_get().
- See also:
- eina_model_method_resolve
eina_model_type_method_resolve
- Since:
- 1.2
const void* eina_model_type_method_offset_resolve | ( | const Eina_Model_Type * | type, | |
const Eina_Model * | model, | |||
unsigned int | offset | |||
) |
Gets resolved method from type of model given offset.
- Parameters:
-
type The type whose method offset resolve method will be called. model The model instance. offset The offset of the wanted method.
- Returns:
- Address to resolved method, or
NULL
if method is not implemented.
- See also:
- eina_model_method_offset_resolve()
- Since:
- 1.2
Eina_Bool eina_model_interface_constructor | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Calls the constructor of iface on model.
- Parameters:
-
iface The interface whose constructor will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't implement iface does nothing and returns EINA_FALSE.
- See also:
- eina_model_new()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_destructor | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Calls the destructor of iface on model.
- Parameters:
-
iface The interface whose destructor will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't implement iface does nothing and returns EINA_FALSE.
- See also:
- eina_model_del()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_copy | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | src, | |||
Eina_Model * | dst | |||
) |
Calls the copy method of iface on model.
- Parameters:
-
iface The interface whose copy method will be called. src Pointer to the model to be copied. dst Pointer to where copy will be put.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't implement iface does nothing and returns EINA_FALSE.
- See also:
- eina_model_copy()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_deep_copy | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | src, | |||
Eina_Model * | dst | |||
) |
Calls the deep copy method of iface on model.
- Parameters:
-
iface The interface whose deep copy method will be called. src Pointer to the model to be copied. dst Pointer to where copy will be put.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If model doesn't implement iface does nothing and returns EINA_FALSE.
- Since:
- 1.2
References EINA_FALSE.
const void* eina_model_interface_method_offset_resolve | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | model, | |||
unsigned int | offset | |||
) |
Gets the iface's method for model at offset.
- Parameters:
-
iface The interface whose method offset resolve method will be called. model The model instance. offset The offset of the wanted method.
- Returns:
- Address to resolved method, or
NULL
if method is not implemented.
- See also:
- eina_model_method_offset_resolve()
- Since:
- 1.2
Eina_Bool eina_model_type_check | ( | const Eina_Model_Type * | type | ) |
Check type is valid.
- Parameters:
-
type The type to be checked.
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
- Since:
- 1.2
References EINA_FALSE.
Referenced by eina_model_new().
const char* eina_model_type_name_get | ( | const Eina_Model_Type * | type | ) |
Gets the name type.
- Parameters:
-
type The type whose name is wanted.
- Returns:
- Name of type.
- Since:
- 1.2
References _Eina_Model_Type::name.
const Eina_Model_Type* eina_model_type_parent_get | ( | const Eina_Model_Type * | type | ) |
Gets the parent type of type.
- Parameters:
-
type The type whose parent is wanted.
- Returns:
- Type of parent.
- Since:
- 1.2
References _Eina_Model_Type::parent.
Eina_Bool eina_model_type_subclass_setup | ( | Eina_Model_Type * | type, | |
const Eina_Model_Type * | parent | |||
) |
Setup the type to be a subclass of another parent type.
- Parameters:
-
type type to be modified parent type to be used as parent
- Returns:
- EINA_TRUE on success, EINA_FALSE otherwise.
type->version
must be EINA_MODEL_TYPE_VERSION;type->private_size
unmodified, should be set to type's size;type->name
unmodified, should be set to type's name.
type->type_size
initiated to parent->type_sizetype->interfaces
= NULL;type->events
= NULL;type->setup
= NULL;type->flush
= NULL;type->constructor
= NULL;type->destructor
= NULL;type->copy
= NULL;type->deep_copy
= NULL;type->compare
= NULL;type->load
= NULL;type->unload
= NULL;type->property_get
= NULL;type->property_set
= NULL;type->property_del
= NULL;type->properties_names_list_get
= NULL;type->child_count
= NULL;type->child_get
= NULL;type->child_set
= NULL;type->child_del
= NULL;type->child_insert_at
= NULL;type->child_find
= NULL;type->child_criteria_match
= NULL;type->child_sort
= NULL;type->child_iterator_get
= NULL;type->child_reversed_iterator_get
= NULL;type->child_sorted_iterator_get
= NULL;type->child_filtered_iterator_get
= NULL;type->to_string
= NULL;
- Since:
- 1.2
References _Eina_Model_Type::__extension_ptr0, _Eina_Model_Type::__extension_ptr1, _Eina_Model_Type::__extension_ptr2, _Eina_Model_Type::__extension_ptr3, _Eina_Model_Type::child_count, _Eina_Model_Type::child_criteria_match, _Eina_Model_Type::child_del, _Eina_Model_Type::child_filtered_iterator_get, _Eina_Model_Type::child_find, _Eina_Model_Type::child_get, _Eina_Model_Type::child_insert_at, _Eina_Model_Type::child_iterator_get, _Eina_Model_Type::child_reversed_iterator_get, _Eina_Model_Type::child_set, _Eina_Model_Type::child_sort, _Eina_Model_Type::child_sorted_iterator_get, _Eina_Model_Type::compare, _Eina_Model_Type::constructor, _Eina_Model_Type::copy, _Eina_Model_Type::deep_copy, _Eina_Model_Type::destructor, EINA_FALSE, EINA_MODEL_TYPE_VERSION, EINA_TRUE, _Eina_Model_Type::events, _Eina_Model_Type::flush, _Eina_Model_Type::interfaces, _Eina_Model_Type::load, _Eina_Model_Type::parent, _Eina_Model_Type::properties_names_list_get, _Eina_Model_Type::property_del, _Eina_Model_Type::property_get, _Eina_Model_Type::property_set, _Eina_Model_Type::setup, _Eina_Model_Type::to_string, _Eina_Model_Type::type_size, _Eina_Model_Type::unload, and _Eina_Model_Type::version.
Eina_Bool eina_model_type_subclass_check | ( | const Eina_Model_Type * | type, | |
const Eina_Model_Type * | self_or_parent | |||
) |
Checks if type is a subclass of(or the same as) self_or_parent.
- Parameters:
-
type The type to be checked. self_or_parent The type being checked for.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Since:
- 1.2
References EINA_FALSE, EINA_TRUE, and _Eina_Model_Type::parent.
Referenced by eina_model_type_struct_new().
const Eina_Model_Interface* eina_model_type_interface_get | ( | const Eina_Model_Type * | type, | |
const char * | name | |||
) |
Gets a interface with name name from type.
- Parameters:
-
type The type instance. name The name of the desired interface.
- Returns:
- The interface implemented by type with name name, or null if this type doesn't implement any interface with name name.
- Since:
- 1.2
References EINA_FALSE, and EINA_TRUE.
void* eina_model_type_private_data_get | ( | const Eina_Model * | model, | |
const Eina_Model_Type * | type | |||
) |
Gets the private date of model for type type.
- Parameters:
-
model The model instance. type The type whose private data will be gotten.
- Returns:
- Pointer to type's private data.
- Since:
- 1.2
References _Eina_Model_Type::name.
Eina_Bool eina_model_interface_check | ( | const Eina_Model_Interface * | iface | ) |
Checks if iface is a valid interface.
- Parameters:
-
iface The interface instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Since:
- 1.2
References EINA_FALSE.
void* eina_model_interface_private_data_get | ( | const Eina_Model * | model, | |
const Eina_Model_Interface * | iface | |||
) |
Gets the private date of model for interface iface.
- Parameters:
-
model The model instance. iface The interface whose private data will be gotten.
- Returns:
- Pointer to interface's private data.
- Since:
- 1.2
References _Eina_Model_Interface::name.
Referenced by eina_model_struct_get().
Eina_Bool eina_model_interface_properties_compare | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | a, | |||
const Eina_Model * | b, | |||
int * | cmp | |||
) |
Compares properties using iface's comparing function.
- Parameters:
-
[in] iface The interface used to compare the properties. [in] a The first model whose properties will be compared. [in] b The second model whose properties will be compared. [out] cmp A pointer to an integer which will contain the result of the comparison.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_compare()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_properties_load | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Loads properties using iface's loading function.
- Parameters:
-
iface The properties interface whose load method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_load()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_properties_unload | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Unloads properties using iface's unloading function.
- Parameters:
-
iface The properties interface whose unload method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_unload()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_properties_get | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | model, | |||
const char * | name, | |||
Eina_Value * | value | |||
) |
Gets property named name using iface's function to get properties.
- Parameters:
-
iface The properties interface whose property get method will be called. model The model instance. name The name of the property to get. value Pointer to where value will be stored.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_property_get()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_properties_set | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
const char * | name, | |||
const Eina_Value * | value | |||
) |
Sets property named name using iface's function to set properties.
- Parameters:
-
iface The properties interface whose property set method will be called. model The model instance. name The name of the property to set. value The value to be set.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_property_set()
- Since:
- 1.2
References EINA_FALSE, eina_value_type_check(), and _Eina_Value::type.
Eina_Bool eina_model_interface_properties_del | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
const char * | name | |||
) |
Deletes property named name using iface's function to delete properties.
- Parameters:
-
iface The properties interface whose property delete method will be called. model The model instance. name The name of the property to delete.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_property_del()
- Since:
- 1.2
References EINA_FALSE.
Eina_List* eina_model_interface_properties_names_list_get | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | model | |||
) |
Gets properties name list using iface's function to get properties name list.
- Parameters:
-
iface The properties interface whose property name list get method will be called. model The model instance.
- Returns:
- Eina_List of properties' names.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- Since:
- 1.2 list of stringshare
Eina_Bool eina_model_interface_children_compare | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | a, | |||
const Eina_Model * | b, | |||
int * | cmp | |||
) |
Compares children using iface's comparing function.
- Parameters:
-
[in] iface The interface used to compare the properties. [in] a The first model whose properties will be compared. [in] b The second model whose properties will be compared. [out] cmp A pointer to an integer which will contain the result of the comparison.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_compare()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_children_load | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Loads children using iface's loading function.
- Parameters:
-
iface The children interface whose load method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_load()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_children_unload | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model | |||
) |
Unloads children using iface's unloading function.
- Parameters:
-
iface The children interface whose unload method will be called. model The model instance.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return EINA_FALSE.
- See also:
- eina_model_unload()
- Since:
- 1.2
References EINA_FALSE.
int eina_model_interface_children_count | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | model | |||
) |
Count children using iface's counting function.
- Parameters:
-
iface The children interface whose count method will be called. model The model instance.
- Returns:
- Number of children in model.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_count()
- Since:
- 1.2
Eina_Model* eina_model_interface_children_get | ( | const Eina_Model_Interface * | iface, | |
const Eina_Model * | model, | |||
unsigned int | position | |||
) |
Get child using iface's function to get children.
- Parameters:
-
iface The children interface whose get method will be called. model The model instance. position Position of child to be retrieved.
- Returns:
- The requested child.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_get()
- Since:
- 1.2
Eina_Bool eina_model_interface_children_set | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
unsigned int | position, | |||
Eina_Model * | child | |||
) |
Set child using iface's function to set children.
- Parameters:
-
iface The children interface whose set method will be called. model The model instance. position Position of child to be set. child Value(child) to be set.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_set()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_children_del | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
unsigned int | position | |||
) |
Delete child using iface's function to delete children.
- Parameters:
-
iface The children interface whose delete method will be called. model The model instance. position Position of child to be deleted.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_del()
- Since:
- 1.2
References EINA_FALSE.
Eina_Bool eina_model_interface_children_insert_at | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
unsigned int | position, | |||
Eina_Model * | child | |||
) |
Insert child using iface's function to insert children.
- Parameters:
-
iface The children interface whose insert method will be called. model The model instance. position Position in which to insert child. child Value(child) to be inserted.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_insert_at()
- Since:
- 1.2
References EINA_FALSE.
void eina_model_interface_children_sort | ( | const Eina_Model_Interface * | iface, | |
Eina_Model * | model, | |||
Eina_Compare_Cb | compare | |||
) |
Sort children using iface's function to sort children.
- Parameters:
-
iface The children interface whose sort method will be called. model The model instance. compare Function used to compare children.
- Warning:
- If either model doesn't implement iface will do nothing and return -1.
- See also:
- eina_model_child_sort().
- Since:
- 1.2