Merge "[Native][25/11/2013][Add]Adding BigInteger class" into tizen
[platform/framework/native/appfw.git] / inc / FBaseDouble.h
index fffd8a3..b4e49c2 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 //
 
 /**
- * @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 <FBaseNumber.h>
 
-
 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,114 +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.
-        *                                      - The behavior of this method is dependent on the system default locale setting.
+        * @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             
+        * @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.
-        *                              - The behavior of this method is dependent on the system default locale setting.
+        *                              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.
-        *                              - The behavior of this method is dependent on the system default locale setting.
+        *                              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);
 
@@ -320,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);
 
@@ -341,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);
 
        /**
@@ -363,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);
 
@@ -394,7 +440,6 @@ public:
         */
        double value;
 
-
 private:
        /**
         *      Checks if the specified @c double value is finite.
@@ -410,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_