X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inc%2FFBaseDouble.h;h=b4e49c24b14e2443fcd5aa66af63e5c571f613aa;hb=f26b0f83d7c103adbd5468d05b5b89772563041f;hp=87f873cf053607a1cd6159271c0e95c669583781;hpb=93dbe1cee1ab177db0d891052974fe74f4f5cbcc;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/inc/FBaseDouble.h b/inc/FBaseDouble.h index 87f873c..b4e49c2 100644 --- a/inc/FBaseDouble.h +++ b/inc/FBaseDouble.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); @@ -16,10 +15,10 @@ // /** - * @file FBaseDouble.h - * @brief This is the header file for the %Double class. + * @file FBaseDouble.h + * @brief This is the header file for the %Double class. * - * @see Tizen::Base::Number + * @see Tizen::Base::Number * * This header file contains the declarations of the %Double class. */ @@ -28,7 +27,6 @@ #include - namespace Tizen { namespace Base { /** @@ -86,11 +84,10 @@ public: * * @since 2.0 * - * @param[in] value A @c double value + * @param[in] value A @c double value */ Double(double value = 0.0L); - /** * Copying of objects using this copy constructor is allowed. * @@ -180,7 +177,7 @@ public: * @since 2.0 * * @return An integer value indicating the hash value of the current instance of %Double - * @remarks Two equal instances must return the same hash value. For better performance, + * @remarks Two equal instances must return the same hash value. For better performance, * the used hash function must generate a random distribution for all inputs. @n * The default implementation of this method returns the value of the current instance. */ @@ -191,8 +188,8 @@ public: * * @since 2.0 * - * @return An integer value indicating the hash value of the specified @c double value - * @param[in] val A @c double value to get the hash value + * @return An integer value indicating the hash value of the specified @c double value + * @param[in] val A @c double value to get the hash value */ static int GetHashCode(double val); @@ -203,108 +200,164 @@ public: * * @return An error code * @param[in] s A unicode representation of @c signed @c double value - * @param[out] ret The converted numeric value + * @param[out] ret The converted numeric value * @exception E_SUCCESS The method is successful. * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed. - * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error. + * @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. */ static result Parse(const String& s, double& ret); /** - * Gets the @c signed @c char equivalent of the current instance of %Double. + * Gets the @c signed @c char equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c char equivalent of the current instance + * @return A @c signed @c char equivalent of the current instance */ virtual char ToChar(void) const; /** - * Gets the @c signed @c short equivalent of the current instance of %Double. + * Gets the @c signed @c short equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c short equivalent of the current instance + * @return A @c signed @c short equivalent of the current instance */ virtual short ToShort(void) const; /** - * Gets the @c signed @c int equivalent of the current instance of %Double. + * Gets the @c signed @c int equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c int equivalent of the current instance + * @return A @c signed @c int equivalent of the current instance */ virtual int ToInt(void) const; /** - * Gets the @c signed @c long equivalent of the current instance of %Double. + * Gets the @c signed @c long equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c long equivalent of the current instance + * @return A @c signed @c long equivalent of the current instance */ virtual long ToLong(void) const; /** - * Gets the @c signed @c long @c long equivalent of the current instance of %Double. + * Gets the @c signed @c long @c long equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c long @c long equivalent of the current instance + * @return A @c signed @c long @c long equivalent of the current instance */ virtual long long ToLongLong(void) const; /** - * Gets the @c signed @c float equivalent of the current instance of %Double. + * Gets the @c signed @c float equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c float equivalent of the current instance + * @return A @c signed @c float equivalent of the current instance */ virtual float ToFloat(void) const; /** - * Gets the @c signed @c double equivalent of the current instance of %Double. + * Gets the @c signed @c double equivalent of the current %Double instance. * * @since 2.0 * - * @return A @c signed @c double equivalent of the current instance + * @return A @c signed @c double equivalent of the current instance */ virtual double ToDouble(void) const; /** - * Gets the string representing the value of the current instance of %Double. + * Gets the string representing the value of the current %Double instance. * * @since 2.0 * - * @return A string containing a Unicode representation of the value of the current instance - * @remarks If the value of the current instance is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity + * @return A string containing a Unicode representation 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 - * 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 Double::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 %Double instance. + * + * @since 3.0 + * + * @param[in] precision Number of digits after a decimal separator + * @return A string containing a Unicode representation 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 + * + * Double dbl(3.1416); + * String str1 = dbl.ToString(3); + * // str1 contains "3.142" + * + * String str2 = dbl.ToString(2); + * // str2 contains "3.14" + * + * @endcode + */ + virtual String ToString(int precision) const; + + /** * Gets the string representing the specified @c double value. * * @since 2.0 * * @return A string containing a Unicode representation of the specified @c double value * @param[in] value A @c double value to convert - * @remarks If the input value is Not-a-Number (NaN), the result is the string "NaN". Furthermore, infinity + * @remarks + * - If the input 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 Double::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(double value); /** + * Gets the string representing the specified @c double value. + * + * @since 3.0 + * + * @return A string containing a Unicode representation of the specified @c double value + * @param[in] value A @c double value to convert + * @param[in] precision Number of digits after a decimal separator + * @remarks + * - If the input 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 = Double::ToString(3.1416f, 3); + * // str1 contains "3.142" + * + * String str2 = Double::ToString(3.1416f, 2); + * // str2 contains "3.14" + * + * @endcode + */ + static String ToString(double value, int precision); + + /** * Gets the IEEE 754 floating-point "double format" bit layout representation of the specified @c double value. * * @since 2.0 * * @return The bits that represent the floating-point number in the IEEE 754 floating-point "double format" bit layout - * @param[in] value A @c double value to convert + * @param[in] value A @c double value to convert */ static long long ToBits(double value); @@ -314,7 +367,7 @@ public: * @since 2.0 * * @return The @c double floating-point value with the same bit pattern - * @param[in] value The floating-point value to convert + * @param[in] value The floating-point value to convert */ static double ToDoubleFromBits(long long value); @@ -335,9 +388,8 @@ public: * * @return @c true if the specified value equals negative or positive infinity, @n * else @c false - * @param[in] value A @c double value to check + * @param[in] value A @c double value to check */ - static bool IsInfinity(double value); /** @@ -357,7 +409,7 @@ public: * * @return @c true if the specified value is Not-a-Number, @n * else @c false - * @param[in] value A @c double value to check + * @param[in] value A @c double value to check */ static bool IsNaN(double value); @@ -388,7 +440,6 @@ public: */ double value; - private: /** * Checks if the specified @c double value is finite. @@ -404,10 +455,8 @@ private: static const int __DBL_MAX_10_EXP = 308; friend class _DoubleImpl; - class _DoubleImpl * __pDoubleImpl; + class _DoubleImpl* __pDoubleImpl; }; // Double - }} // Tizen::Base - #endif //_FBASE_DOUBLE_H_