X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inc%2FFBaseFloat.h;h=82b7abb0d0763f9a0e1dbd63b41bec173985feac;hb=f26b0f83d7c103adbd5468d05b5b89772563041f;hp=77cf05f7afa29c749b1ce43dd2d4606fea2fce1e;hpb=43fc16c2f3f305ffaf1ada5d4a022e4e476c8a55;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/inc/FBaseFloat.h b/inc/FBaseFloat.h index 77cf05f..82b7abb 100644 --- a/inc/FBaseFloat.h +++ b/inc/FBaseFloat.h @@ -1,5 +1,4 @@ // -// Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); @@ -194,7 +193,7 @@ public: * @param[out] ret The numeric representation of the string * @exception E_SUCCESS The method is successful. * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed. - * @remarks + * @remarks * - This method guarantees that the original value of out-parameter is not changed when the method returns error. * - The behavior of this method is dependent on the system default locale setting. * @see Tizen::Base::Double::Parse() @@ -202,7 +201,7 @@ public: static result Parse(const String& s, float& ret); /** - * Gets the @c signed @c char equivalent of the current instance of the %Float class. + * Gets the @c signed @c char equivalent of the current %Float instance. * * @since 2.0 * @@ -211,7 +210,7 @@ public: virtual char ToChar(void) const; /** - * Gets the @c signed @c short equivalent of the current instance of the %Float class. + * Gets the @c signed @c short equivalent of the current %Float instance. * * @since 2.0 * @@ -220,7 +219,7 @@ public: virtual short ToShort(void) const; /** - * Gets the @c signed @c int equivalent of the current instance of the %Float class. + * Gets the @c signed @c int equivalent of the current %Float instance. * * @since 2.0 * @@ -229,7 +228,7 @@ public: virtual int ToInt(void) const; /** - * Gets the @c signed @c long equivalent of the current instance of the %Float class. + * Gets the @c signed @c long equivalent of the current %Float instance. * * @since 2.0 * @@ -238,7 +237,7 @@ public: virtual long ToLong(void) const; /** - * Gets the @c signed @c long @c long equivalent of the current instance of the %Float class. + * Gets the @c signed @c long @c long equivalent of the current %Float instance. * * @since 2.0 * @@ -247,7 +246,7 @@ public: virtual long long ToLongLong(void) const; /** - * Gets the @c signed @c float equivalent of the current instance of the %Float class. + * Gets the @c signed @c float equivalent of the current %Float instance. * * @since 2.0 * @@ -256,7 +255,7 @@ public: virtual float ToFloat(void) const; /** - * Gets the @c signed @c double equivalent of the current instance of the %Float class. + * Gets the @c signed @c double equivalent of the current %Float instance. * * @since 2.0 * @@ -265,35 +264,86 @@ public: virtual double ToDouble(void) const; /** - * Gets the string representing the value of the current instance of %Float. + * Gets the string representing the value of the current %Float instance. * * @since 2.0 * - * @return A string containing a Unicode representation of the value of the current instance - * @remarks + * @return A string containing a Unicode representation of the value of the current instance value + * @remarks * - If the value is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity * produces the result "Infinity". @n - * 6 digits are given for the precision of this method. Use String::Format() to set the specific precision. + * 6 digits are given for the precision of this method. Use Float::ToString(int precision) to set the specific precision. * - The behavior of this method is dependent on the system default locale setting. */ virtual String ToString(void) const; /** + * Gets the string representing the value of the current %Float instance. + * + * @since 3.0 + * + * @param[in] precision Number of digits after a decimal separator + * @return A string containing a Unicode representation of the value of the current instance value + * @remarks + * - If the value of the current instance is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity + * produces the result "Infinity". @n + * - The behavior of this method is dependent on the system default locale setting. + * + * @code + * + * Float flt(3.1416); + * String str1 = flt.ToString(3); + * // str1 contains "3.142" + * + * String str2 = flt.ToString(2); + * // str2 contains "3.14" + * + * @endcode + */ + virtual String ToString(int precision) const; + + /** * Gets the string representing the specified @c float value. * * @since 2.0 * * @return A string containing a Unicode representation of the specified @c float value * @param[in] value A @c float value to convert - * @remarks + * @remarks * - If the value is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity * produces the result "Infinity". @n - * 6 digits are given for the precision of this method. Use String::Format() to set the specific precision. + * 6 digits are given for the precision of this method. Use Float::ToString(float value, int precision) to set the specific precision. * - The behavior of this method is dependent on the system default locale setting. */ static String ToString(float value); /** + * Gets the string representing the specified @c float value. + * + * @since 3.0 + * + * @return A string containing a Unicode representation of the specified @c float value + * @param[in] value A @c float value to convert + * @param[in] precision Number of digits after a decimal separator + * @remarks + * - If the value is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity + * produces the result "Infinity". @n + * - The behavior of this method is dependent on the system default locale setting. + * + * @code + * + * String str1 = Float::ToString(3.1416f, 3); + * // str1 contains "3.142" + * + * String str2 = Float::ToString(3.1416f, 2); + * // str2 contains "3.14" + * + * @endcode + */ + static String ToString(float value, int precision); + + + /** * Gets the IEEE 754 floating-point "single format" bit layout representation of the specified @c float value. * * @since 2.0 @@ -400,7 +450,7 @@ private: static const int __DBL_MAX_10_EXP = 308; friend class _FloatImpl; - class _FloatImpl * __pFloatImpl; + class _FloatImpl* __pFloatImpl; }; // Float