26 #ifndef ewk_object_private_h 27 #define ewk_object_private_h 29 #include <wtf/RefCounted.h> 34 virtual const char* instanceClassName()
const = 0;
38 inline bool ewk_object_is_of_type(
const EwkObject*
object)
40 return (reinterpret_cast<T>(0)->className() == object->instanceClassName());
44 inline bool ewk_object_cast_check(
const EwkObject*
object)
46 EINA_SAFETY_ON_NULL_RETURN_VAL(
object,
false);
48 if (!ewk_object_is_of_type<T>(
object)) {
49 EINA_LOG_CRIT(
"attempt to convert object of type %s to type %s",
50 object->instanceClassName(),
reinterpret_cast<T
>(0)->className());
59 inline const T ewk_object_cast(
const EwkObject*
object)
61 return ewk_object_cast_check<T>(object) ? static_cast<T>(
object) : 0;
65 inline T ewk_object_cast(
EwkObject*
object)
67 return ewk_object_cast_check<T>(object) ? static_cast<T>(
object) : 0;
70 #define EWK_OBJ_GET_IMPL_OR_RETURN(ImplClass, object, impl, ...) \ 71 ImplClass* impl = ewk_object_cast<ImplClass*>(object); \ 76 #define EWK_OBJECT_DECLARE(_className) \ 77 static const char* className() \ 79 static const char* name = #_className; \ 82 virtual const char* instanceClassName() const \ 87 #endif // ewk_object_private_h Definition: ewk_object_private.h:31