forked from enlightenment/efl
eo: add the ability to get the size of object of a certain class.
Their was two different way to implement this, either like this with a simple function that work on Efl_Class, or by a function on Efl.Object. I leaned on the first one, but I could easily be convinced it should be done on Efl.Object actually. Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D7441
This commit is contained in:
parent
35acfebee4
commit
e02dba3377
|
@ -918,13 +918,22 @@ EAPI Eina_Bool efl_isa(const Eo *obj, const Efl_Class *klass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the name of the passed class.
|
* @brief Gets the name of the passed class.
|
||||||
* @param klass the class to work on.
|
* @param[in] klass The class (or object) to work on.
|
||||||
* @return The class' name.
|
* @return The class' name.
|
||||||
*
|
*
|
||||||
* @see efl_class_get()
|
* @see efl_class_get()
|
||||||
*/
|
*/
|
||||||
EAPI const char *efl_class_name_get(const Efl_Class *klass);
|
EAPI const char *efl_class_name_get(const Efl_Class *klass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the amount of memory this class object would use.
|
||||||
|
* @param[in] klass The class (or object) to work on.
|
||||||
|
* @return The amount of memory in Bytes.
|
||||||
|
*
|
||||||
|
* @see efl_class_get()
|
||||||
|
*/
|
||||||
|
EAPI size_t efl_class_memory_size_get(const Efl_Class *klass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets a debug name for this object
|
* @brief Gets a debug name for this object
|
||||||
* @param obj_id The object (or class)
|
* @param obj_id The object (or class)
|
||||||
|
|
|
@ -1150,6 +1150,31 @@ err_obj:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI const size_t
|
||||||
|
efl_class_memory_size_get(const Efl_Class *eo_id)
|
||||||
|
{
|
||||||
|
const _Efl_Class *klass;
|
||||||
|
|
||||||
|
if (_eo_is_a_class(eo_id))
|
||||||
|
{
|
||||||
|
EO_CLASS_POINTER_GOTO(eo_id, _klass, err_klass);
|
||||||
|
klass = _klass;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EO_OBJ_POINTER_GOTO(eo_id, obj, err_obj);
|
||||||
|
klass = obj->klass;
|
||||||
|
EO_OBJ_DONE(eo_id);
|
||||||
|
}
|
||||||
|
return klass->obj_size;
|
||||||
|
|
||||||
|
err_klass:
|
||||||
|
_EO_POINTER_ERR(eo_id, "Class (%p) is an invalid ref.", eo_id);
|
||||||
|
err_obj:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_vtable_init(Eo_Vtable *vtable, size_t size)
|
_vtable_init(Eo_Vtable *vtable, size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue