Evas_Object_Data_Group (3) - Linux Manuals

Evas_Object_Data_Group: Functions that retrieve and set data associated attached to an evas object.

NAME

Object Data Functions - Functions that retrieve and set data associated attached to an evas object.

Functions


EAPI void evas_object_data_set (Evas_Object *obj, const char *key, const void *data)
Set an attached data pointer to an object with a given string key.
EAPI void * evas_object_data_get (const Evas_Object *obj, const char *key)
Return an attached data pointer by its given string key.
EAPI void * evas_object_data_del (Evas_Object *obj, const char *key)
Delete at attached data pointer from an object.

Detailed Description

Functions that retrieve and set data associated attached to an evas object.

Function Documentation

EAPI void* evas_object_data_del (Evas_Object * obj, const char * key)

Delete at attached data pointer from an object.

Parameters:

obj The object to delete the data pointer from
key The string key the data was stored under

Returns:

The original data pointer stored at key on obj

This will remove thee stored data pointer from obj stored under key, and return the original pointer stored under key, if any, nor NULL if nothing was stored under that key.

Example:

 int *my_data;
 extern Evas_Object *obj;

 my_data = evas_object_data_del(obj, 'name_of_my_data');


 

References _Evas_List::data, evas_list_remove_list(), and _Evas_List::next.

Referenced by evas_object_data_set().

EAPI void* evas_object_data_get (const Evas_Object * obj, const char * key)

Return an attached data pointer by its given string key.

Parameters:

obj The object to which the data was attached
key The string key the data was stored under

Returns:

The data pointer stored, or NULL if none was stored

This function will return the data pointer attached to the object obj stored using the string key key. If the object is valid and data was stored under the given key, the pointer that was stored will be reuturned. If this is not the case, NULL will be returned, signifying an invalid object or non-existent key. It is possible a NULL pointer was stored given that key, but this situation is non-sensical and thus can be considered an error as well. NULL pointers are never stored as this is the return value if an error occurs.

Example:

 int *my_data;
 extern Evas_Object *obj;

 my_data = evas_object_data_get(obj, 'name_of_my_data');
 if (my_data) printf('Data stored was %p, my_data);
 else printf('No data was stored on the object);


 

References _Evas_List::data, and _Evas_List::next.

EAPI void evas_object_data_set (Evas_Object * obj, const char * key, const void * data)

Set an attached data pointer to an object with a given string key.

Parameters:

obj The object to attach the data pointer to
key The string key for the data to access it
data The ponter to the data to be attached

This attaches the pointer data to the object obj given the string key. This pointer will stay 'hooked' to the object until a new pointer with the same string key is attached with evas_object_data_set() or it is deleted with evas_object_data_del(). On deletion of the object obj, the pointers will not be accessible from the object anymore.

You can find the pointer attached under a string key using evas_object_data_get(). It is the job of the calling application to free any data pointed to by data when it is no longer required.

If data is NULL, the old value stored at key will be removed but no new value will be stored. This is synonymous with calling evas_object_data_del() with obj and key.

Example:

 int *my_data;
 extern Evas_Object *obj;

 my_data = malloc(500);
 evas_object_data_set(obj, 'name_of_data', my_data);
 printf('The data that was attached was %p, evas_object_data_get(obj, 'name_of_data'));


 

References evas_list_prepend(), and evas_object_data_del().

Author

Generated automatically by Doxygen for Evas from the source code.