From: Denis Dolzhenko Date: Fri, 5 Aug 2016 11:03:37 +0000 (+0300) Subject: Fixed: set/get user data in View class X-Git-Tag: submit/tizen/20160810.144952^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F82741%2F1;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git Fixed: set/get user data in View class Change-Id: I0b01915e94a280e446dbd8b4b6f30f505f7f690f Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/View/inc/View.h b/src/Common/View/inc/View.h index 56625e8..c25ccc5 100644 --- a/src/Common/View/inc/View.h +++ b/src/Common/View/inc/View.h @@ -294,10 +294,10 @@ namespace Msg View(View&) = delete; View& operator=(View&) = delete; Evas_Object_Event_Cb getCb(Evas_Callback_Type); - void *getSmartData() const; - static void *getSmartData(Evas_Object *obj); - void setSmartData(const void *data); - static void setSmartData(Evas_Object *obj, const void *data); + void *getData() const; + static void *getData(Evas_Object *obj); + void setData(const void *data); + static void setData(Evas_Object *obj, const void *data); private: static void on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -471,36 +471,26 @@ namespace Msg return evas_object_data_get(m_pEo, key); } - inline void View::setSmartData(const void *data) + inline void View::setData(const void *data) { - setSmartData(m_pEo, data); + setData(m_pEo, data); } - inline void *View::getSmartData() const + inline void *View::getData() const { - return getSmartData(m_pEo); - } - - inline void View::setSmartData(Evas_Object *obj, const void *data) - { - evas_object_smart_data_set(obj, (void*)data); - } - - inline void *View::getSmartData(Evas_Object *obj) - { - return evas_object_smart_data_get(obj); + return getData(m_pEo); } template inline T View::staticCast(void *evasObj) { - return static_cast(getSmartData((Evas_Object*)evasObj)); + return static_cast(getData((Evas_Object*)evasObj)); } template inline T View::reinterpretCast(void *evasObj) { - return reinterpret_cast(getSmartData((Evas_Object*)evasObj)); + return reinterpret_cast(getData((Evas_Object*)evasObj)); } template diff --git a/src/Common/View/src/View.cpp b/src/Common/View/src/View.cpp index b984fca..7ec00b8 100644 --- a/src/Common/View/src/View.cpp +++ b/src/Common/View/src/View.cpp @@ -25,6 +25,11 @@ using namespace Msg; +namespace +{ + const char *thisKey = "this"; +} + View::View() : m_pEo(nullptr) { @@ -72,7 +77,7 @@ void View::setEo(Evas_Object *eo) m_pEo = eo; if(eo) { - setSmartData(this); + setData(this); setEventCb(EVAS_CALLBACK_FREE); setEventCb(EVAS_CALLBACK_DEL); } @@ -145,6 +150,16 @@ Evas_Object *View::addLayout(Evas_Object *parent, const std::string &edjePath, c return layout; } +void View::setData(Evas_Object *obj, const void *data) +{ + evas_object_data_set(obj, thisKey, (void*)data); +} + +void *View::getData(Evas_Object *obj) +{ + return evas_object_data_get(obj, thisKey); +} + std::string Msg::markupToUtf8(const char *str) { if(!str)