X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fmath%2Fuint-16-pair.h;h=2cb38468006b244bab17cb42a91355491f3ad113;hb=1c4fe5643de5582a964ebe859188f8e9bbbb8b61;hp=2e802e164b39d83896489f92e6c8c578696ab6bf;hpb=8096da59d2ec742f85ed05d4b8d6bc6164552874;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/math/uint-16-pair.h b/dali/public-api/math/uint-16-pair.h index 2e802e1..2cb3846 100644 --- a/dali/public-api/math/uint-16-pair.h +++ b/dali/public-api/math/uint-16-pair.h @@ -23,11 +23,12 @@ // INTERNAL INCLUDES #include +#include namespace Dali { /** - * @addtogroup dali-core-math + * @addtogroup dali_core_math * @{ */ @@ -37,22 +38,24 @@ namespace Dali * Use this for integer dimensions and points with limited range such as image * sizes and pixel coordinates where a pair of floating point numbers is * inefficient and illogical (i.e. the data is inherently integer). - * These are immutable. If you want to change a value, make a whole new object. * One of these can be passed in a single 32 bit integer register on * common architectures. + * @SINCE_1_0.0 */ class Uint16Pair { public: /** - * @brief Default constructor for the (0, 0) vector. + * @brief Default constructor for the (0, 0) tuple. + * @SINCE_1_0.0 */ Uint16Pair() : mData(0) {} /** * @brief Constructor taking separate x and y (width and height) parameters. - * @param[in] width The width or X dimension of the vector. Make sure it is less than 65536, - * @param[in] height The height or Y dimension of the vector. Make sure it is less than 65536, + * @SINCE_1_0.0 + * @param[in] width The width or X dimension of the tuple. Make sure it is less than 65536, + * @param[in] height The height or Y dimension of the tuple. Make sure it is less than 65536, */ Uint16Pair( uint32_t width, uint32_t height ) { @@ -69,6 +72,8 @@ public: /** * @brief Copy constructor. + * @SINCE_1_0.0 + * @param[in] rhs A reference to assign */ Uint16Pair( const Uint16Pair& rhs ) { @@ -76,7 +81,19 @@ public: } /** - * @returns the x dimension stored in this 2-tuple. + * @brief Sets the width. + * @SINCE_1_1.13 + * @param[in] width The x dimension to be stored in this 2-tuple. + */ + void SetWidth( uint16_t width ) + { + mComponents[0] = width; + } + + /** + * @brief Get the width. + * @SINCE_1_0.0 + * @return the x dimension stored in this 2-tuple */ uint16_t GetWidth() const { @@ -84,7 +101,19 @@ public: } /** - * @returns the y dimension stored in this 2-tuple. + * @brief Sets the height. + * @SINCE_1_1.13 + * @param[in] height The y dimension to be stored in this 2-tuple. + */ + void SetHeight( uint16_t height ) + { + mComponents[1] = height; + } + + /** + * @brief Returns the y dimension stored in this 2-tuple. + * @SINCE_1_0.0 + * @return Height */ uint16_t GetHeight() const { @@ -92,7 +121,19 @@ public: } /** - * @returns the x dimension stored in this 2-tuple. + * @brief Sets the x dimension (same as width). + * @SINCE_1_1.14 + * @param[in] x The x dimension to be stored in this 2-tuple. + */ + void SetX( uint16_t x ) + { + mComponents[0] = x; + } + + /** + * @brief Returns the x dimension stored in this 2-tuple. + * @SINCE_1_0.0 + * @return X */ uint16_t GetX() const { @@ -100,7 +141,19 @@ public: } /** - * @returns the y dimension stored in this 2-tuple. + * @brief Sets the y dimension (same as height). + * @SINCE_1_1.14 + * @param[in] y The y dimension to be stored in this 2-tuple. + */ + void SetY( uint16_t y ) + { + mComponents[1] = y; + } + + /** + * @brief Returns the y dimension stored in this 2-tuple. + * @SINCE_1_0.0 + * @return Y */ uint16_t GetY() const { @@ -108,7 +161,25 @@ public: } /** - * Equality operator. + * @brief Assignment operator. + * @SINCE_1_0.0 + * @param[in] rhs Handle to an object + * @return A reference to this + */ + Uint16Pair& operator=( const Uint16Pair& rhs ) + { + if( rhs != *this ) + { + mData = rhs.mData; + } + return *this; + } + + /** + * @brief Equality operator. + * @SINCE_1_0.0 + * @param[in] rhs A reference for comparison + * @return True if same */ bool operator==( const Uint16Pair& rhs ) const { @@ -116,7 +187,10 @@ public: } /** - * Inequality operator. + * @brief Inequality operator. + * @SINCE_1_0.0 + * @param[in] rhs A reference for comparison + * @return True if different */ bool operator!=( const Uint16Pair& rhs ) const { @@ -124,8 +198,11 @@ public: } /** - * Less than comparison operator for storing in collections (not geometrically + * @brief Less than comparison operator for storing in collections (not geometrically * meaningful). + * @SINCE_1_0.0 + * @param[in] rhs A reference for comparison + * @return True if less */ bool operator<( const Uint16Pair& rhs ) const { @@ -133,8 +210,11 @@ public: } /** - * Greater than comparison operator for storing in collections (not + * @brief Greater than comparison operator for storing in collections (not * geometrically meaningful). + * @SINCE_1_0.0 + * @param[in] rhs A reference for comparison + * @return True if greater */ bool operator>( const Uint16Pair& rhs ) const { @@ -147,6 +227,9 @@ public: * * Uses a template for loose coupling, to save a header include, and allow any * vector type with .x and .y members to be converted. + * @SINCE_1_0.0 + * @param[in] from Floating point vector2 + * @return Closest integer value. */ template static Uint16Pair FromFloatVec2( const FLOAT_VECTOR_N_TYPE& from ) @@ -162,6 +245,9 @@ public: * * Uses a template to allow any vector type with operator [] to be converted * in addition to plain arrays. + * @SINCE_1_0.0 + * @param[in] from Floating point array + * @return Closest integer value. */ template static Uint16Pair FromFloatArray( const FLOAT_ARRAY& from ) @@ -181,6 +267,9 @@ private: }; }; +// Allow Uint16Pair to be treated as a POD type +template <> struct TypeTraits< Uint16Pair > : public BasicTypes< Uint16Pair > { enum { IS_TRIVIAL_TYPE = true }; }; + /** * @} */