Implementation of ImmutableString
[platform/framework/native/appfw.git] / inc / FBaseLongLong.h
index 27c73a8..3207efd 100644 (file)
@@ -176,15 +176,31 @@ public:
        static int GetHashCode(long long val);
 
        /**
-        *      Gets the @c signed @c char equivalent of the current instance of the %LongLong class.
+        *      Gets the @c char equivalent of the current instance of the %LongLong class.
         *
         *      @since          2.0
         *
-        *      @return         The @c signed @c char equivalent of the current instance
+        *      @brief  <i> [Deprecated] </i>
+        *
+        *      @deprecated     This method has portability issue.
+        *                      Return value may not be @c signed @c char since char is treated as unsigned char in ARM architecture. @n
+        *                      Use ToInt8() method to get @c int8_t
+        *
+        *      @return         The @c char equivalent of the current instance
         */
        virtual char ToChar(void) const;
 
        /**
+        *      Gets the @c int8_t equivalent of the current instance of %LongLong.
+        *
+        *      @since 3.0
+        *
+        *      @return The @c int8_t equivalent of the current instance
+        *
+        */
+       virtual int8_t ToInt8(void) const;
+
+       /**
         *      Gets the @c signed @c short equivalent of the current instance of the %LongLong class.
         *
         *      @since          2.0
@@ -258,6 +274,34 @@ public:
        static String ToString(long long value);
 
        /**
+        * Decodes a string into a @c signed @c long @c long value.
+        *
+        * @since 3.0
+        *
+        * @return                      An error code
+        * @param[in]   inputStr        A string representing a numeric value
+        * @param[out]  ret             The result of the operation
+        * @exception   E_SUCCESS       The method is successful.
+        * @exception   E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        * @exception   E_OUT_OF_RANGE  The decoded value is not between VALUE_MIN and VALUE_MAX range.
+        * @remarks
+        *              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+        *              - This method accepts decimal, hexadecimal, and octal numbers given by the
+        *                              following grammar:
+        * @code
+        *      - DecodableString:
+        *              Sign[opt] DecimalNumeral
+        *              Sign[opt] 0x HexDigits
+        *              Sign[opt] 0X HexDigits
+        *              Sign[opt] # HexDigits
+        *              Sign[opt] 0 OctalDigits
+        *      - Sign:
+        *              '-'
+        * @endcode
+        */
+       static result Decode(const String& inputStr, long long& ret);
+
+       /**
         *      Parses the specified string representing a numeric value and
         *      returns the value as a @c signed @c long @c long (as out parameter).
         *
@@ -266,8 +310,10 @@ public:
         *      @return                 An error code
         *      @param[in]      s                               A string representing a numeric value
         *      @param[out]     ret                             The result of the operation
-        *      @exception      E_SUCCESS               The method is successful.
+        *      @exception      E_SUCCESS       The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
+        *      @exception      E_OUT_OF_RANGE  The parsed value is not between VALUE_MIN and VALUE_MAX range.
+        *
         *      @remarks
         *                              - This method assumes that the string representing the numeric value uses a radix 10.
         *                              - This method guarantees that the original value of out-parameter is not changed when the method returns error.
@@ -283,11 +329,13 @@ public:
         *      @return                 An error code
         *      @param[in]      s                               A string representing a numeric value
         *      @param[in]      radix                   The radix of the string representing a numeric value @n
-        *                                                              It must be either 2, 8, 10 or 16.
+        *                                              Radix value range is from 2 to 36.
         *      @param[out]     ret                             The result of the operation
         *      @exception      E_SUCCESS               The method is successful.
         *      @exception      E_NUM_FORMAT    The specified string does not contain a number that can be parsed.
-        *      @exception      E_OUT_OF_RANGE  The specified @c radix is invalid.
+        *      @exception      E_OUT_OF_RANGE  The specified @c radix is invalid or
+        *                                      The parsed value is not between VALUE_MIN and VALUE_MAX range.
+        *
         *      @remarks        This method guarantees that the original value of out-parameter is not changed when the method returns error.
         */
        static result Parse(const String& s, int radix, long long& ret);
@@ -297,14 +345,14 @@ public:
         *
         *      @since  2.0
         */
-       static const long long VALUE_MAX = (long long) 0x7FFFFFFFFFFFFFFFLL;
+       static const long long VALUE_MAX = static_cast< long long >(0x7FFFFFFFFFFFFFFFLL);
 
        /**
         *      A constant holding the minimum value a @c long @c long can have; -2^63.
         *
         *      @since  2.0
         */
-       static const long long VALUE_MIN = (long long) 0x8000000000000000LL;
+       static const long long VALUE_MIN = static_cast< long long >(0x8000000000000000LL);
 
        /**
         * A @c long @c long value of this instance.