From: Radoslaw Cybulski Date: Fri, 20 Apr 2018 11:14:57 +0000 (+0200) Subject: [Tizen][ATSPI] Adds support for enumeration in Property::Value X-Git-Tag: accepted/tizen/unified/20180514.094027~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d60dbcb98919afdb447746259f7c1ffcd10040;p=platform%2Fcore%2Fuifw%2Fdali-core.git [Tizen][ATSPI] Adds support for enumeration in Property::Value Property::Value can now be initialized with enumeration value. It will be converted into int. Similarly user can retrieve int value as enumeration. Note, that no attempt is made to check, if enumeration types for setting and retrieving match - user can set with one enumeration type and retrieve with another. Change-Id: Ib2eca2f1102b257f0f718b326999cc9a8ba42654 --- diff --git a/dali/public-api/object/property-value.h b/dali/public-api/object/property-value.h index 5f2fa8e..cb8d9a6 100644 --- a/dali/public-api/object/property-value.h +++ b/dali/public-api/object/property-value.h @@ -25,6 +25,8 @@ #include #include +#include + namespace Dali { /** @@ -186,6 +188,15 @@ public: Value( const Extents& extentsValue ); /** + * @brief Creates an enumeration property value. + * + * @SINCE_1_2.62 + * @param[in] extentsValue A collection of 4 uint16_t values + */ + template ::type>::type>::value>::type* = nullptr> + Value(T t) : Value(static_cast(t)) { } + + /** * @brief Explicitly sets a type and initialize it. * * @SINCE_1_0.0 @@ -229,7 +240,7 @@ public: /** * @brief Retrieves a specific value. * - * Works on a best-effort approach; if value type is not convertible returns a default value of the type. + * Works on a best-effort approach; if value type is different returns a default value of the type. * * @SINCE_1_0.0 * @return A value of type T @@ -243,6 +254,22 @@ public: } /** + * @brief Retrieves an enumeration value. + * + * @SINCE_1_0.0 + * @param[out] boolValue On return, an enumeration value + * @return @c true if the value is successfully retrieved, @c false if the type is different + * @pre GetType() is a type convertible to bool. + */ + template ::type>::type>::value>::type* = nullptr> + bool Get(T &t) const + { + int temp = 0; + if (!Get(temp)) return false; + t = static_cast(temp); + return true; + } + /** * @brief Retrieves a boolean value. * * @SINCE_1_0.0