From 84a91ec6d4d9273bc8bacd798786af377e853833 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 16 Jun 2016 17:50:20 +0900 Subject: [PATCH] Evas: Move smart_type_check[_ptr] to legacy --- src/lib/evas/Evas_Legacy.h | 35 +++++++++++++++++++ src/lib/evas/canvas/evas_object.eo | 31 ---------------- src/lib/evas/canvas/evas_object_main.c | 12 ------- src/lib/evas/canvas/evas_object_smart.c | 14 ++++---- src/lib/evas/canvas/evas_object_smart.eo | 2 -- .../evas/canvas/evas_object_smart_clipped.c | 2 +- 6 files changed, 42 insertions(+), 54 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 947dbc90c1..cdf4992053 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -4968,6 +4968,41 @@ EAPI const void *evas_object_smart_interface_get(const Evas_Object *obj, c */ EAPI void *evas_object_smart_interface_data_get(const Evas_Object *obj, const Evas_Smart_Interface *iface); +/** + * @brief Checks whether a given smart object or any of its smart object + * parents is of a given smart class. + * + * If @c obj is not a smart object, this call will fail immediately. + * + * This function supports Eo and legacy inheritance mechanisms. However, it is + * recommended to use @ref eo_isa instead if your object is using Eo from top + * to bottom. + * + * The checks use smart classes names and string comparison. There is a version + * of this same check using pointer comparison, since a smart class' name is a + * single string in Evas. + * + * See also @ref evas_object_smart_type_check_ptr. + * + * @param[in] type The name (type) of the smart class to check for. + * + * @ingroup Evas_Object + */ +EAPI Eina_Bool evas_object_smart_type_check(const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(2); + +/** + * @brief Checks whether a given smart object or any of its smart object + * parents is of a given smart class, using pointer comparison. + * + * @param[in] type The type (name string) to check for. Must be the name. + * + * @return @c true if @c obj or any of its parents is of type @c type, @c false + * otherwise. + * + * @ingroup Evas_Object + */ +EAPI Eina_Bool evas_object_smart_type_check_ptr(const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(2); + /** * This gets the internal counter that counts the number of smart calculations * diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo index df19118a8f..952e97f633 100644 --- a/src/lib/evas/canvas/evas_object.eo +++ b/src/lib/evas/canvas/evas_object.eo @@ -614,27 +614,6 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, receiving the $keyname events.]] } } - smart_type_check @const { - [[Checks whether a given smart object or any of its smart object - parents is of a given smart class. - - If $obj is not a smart object, this call will fail immediately. - - This function supports Eo and legacy inheritance mechanisms. - However, it is recommended to use \@ref eo_isa instead if your - object is using Eo from top to bottom. - - The checks use smart classes names and string comparison. There - is a version of this same check using pointer comparison, since - a smart class' name is a single string in Evas. - - See also @.smart_type_check_ptr. - ]] - return: bool @warn_unused; - params { - @in type: string @nonull; [[The name (type) of the smart class to check for.]] - } - } key_ungrab { [[Removes the grab on $keyname key events by $obj. @@ -690,16 +669,6 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, @in dy: Evas.Coord; [[Vertical offset (delta).]] } } - smart_type_check_ptr @const { - [[Checks whether a given smart object or any of its smart object - parents is of a given smart class, using pointer comparison. - ]] - return: bool @warn_unused; [[$true if $obj or any of its parents - is of type $type, $false otherwise.]] - params { - @in type: string @nonull; [[The type (name string) to check for. Must be the name.]] - } - } @property no_render { get { [[Returns the state of the "no-render" flag, which means, when diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index ecca75918e..2106a33733 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -2135,18 +2135,6 @@ _evas_object_render_parent_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Dat return obj->smart.parent; } -EOLIAN static Eina_Bool -_evas_object_smart_type_check(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, const char *type EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN static Eina_Bool -_evas_object_smart_type_check_ptr(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, const char *type EINA_UNUSED) -{ - return EINA_FALSE; -} - EOLIAN static void _evas_object_paragraph_direction_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, Evas_BiDi_Direction dir EINA_UNUSED) { diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index e94a54bc8d..068d1feea3 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -346,15 +346,14 @@ _evas_object_smart_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUSED, E evas_object_mapped_clip_across_mark(eo_obj, obj); } -EOLIAN static Eina_Bool -_evas_object_smart_evas_object_smart_type_check(const Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, const char *type) +EAPI Eina_Bool +evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type) { const Evas_Smart_Class *sc; Eo_Class *klass; Eina_Bool type_check = EINA_FALSE; - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (!obj) return EINA_FALSE; + Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj, EINA_FALSE); klass = eina_hash_find(_evas_smart_class_names_hash_table, type); if (klass) type_check = eo_isa(eo_obj, klass); @@ -376,15 +375,14 @@ _evas_object_smart_evas_object_smart_type_check(const Eo *eo_obj, Evas_Smart_Dat return type_check; } -EOLIAN static Eina_Bool -_evas_object_smart_evas_object_smart_type_check_ptr(const Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, const char* type) +EAPI Eina_Bool +evas_object_smart_type_check_ptr(const Eo *eo_obj, const char* type) { Eo_Class *klass; const Evas_Smart_Class *sc; Eina_Bool type_check = EINA_FALSE; - Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); - if (!obj) return EINA_FALSE; + Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj, EINA_FALSE); klass = eina_hash_find(_evas_smart_class_names_hash_table, type); if (klass) type_check = eo_isa(eo_obj, klass); diff --git a/src/lib/evas/canvas/evas_object_smart.eo b/src/lib/evas/canvas/evas_object_smart.eo index 62497e3aab..4859528e44 100644 --- a/src/lib/evas/canvas/evas_object_smart.eo +++ b/src/lib/evas/canvas/evas_object_smart.eo @@ -304,8 +304,6 @@ class Evas.Object.Smart (Evas.Object) class.constructor; class.destructor; Eo.Base.constructor; - Evas.Object.smart_type_check_ptr; - Evas.Object.smart_type_check; Evas.Object.paragraph_direction.set; Evas.Object.paragraph_direction.get; } diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c index d8061de897..1bdd549994 100644 --- a/src/lib/evas/canvas/evas_object_smart_clipped.c +++ b/src/lib/evas/canvas/evas_object_smart_clipped.c @@ -36,7 +36,7 @@ _evas_object_smart_move_children_relative(Eo *eo_obj, Evas_Object_Protected_Data } static EOLIAN Evas_Object * -_evas_object_smart_clipped_smart_clipped_clipper_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Smart_Clipped_Data *obj) +_evas_smart_clipped_smart_clipped_clipper_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Smart_Clipped_Data *obj) { return obj->clipper; }