[ACR][15/10/2013][Add]Adding Decode() API in LongLong class 19/11319/2
authordarpan.ka <darpan.ka@samsung.com>
Thu, 24 Oct 2013 08:40:25 +0000 (14:10 +0530)
committerdarpan.ka <darpan.ka@samsung.com>
Tue, 29 Oct 2013 08:19:15 +0000 (13:49 +0530)
Change-Id: Idcf8fc72be079d463592692535b4c67699e58bec
Signed-off-by: darpan.ka <darpan.ka@samsung.com>
inc/FBaseLongLong.h
src/base/FBaseLongLong.cpp

index d748f09..3207efd 100644 (file)
@@ -274,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).
         *
index 995bf08..dfea06d 100644 (file)
@@ -161,6 +161,16 @@ LongLong::ToString(long long value)
 }
 
 result
+LongLong::Decode(const String& inputStr, long long& ret)
+{
+       long long value;
+       result r = _NumberUtil::Decode(inputStr, value);
+       SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
+       ret = value;
+       return r;
+}
+
+result
 LongLong::Parse(const String& s, long long& ret)
 {
        return Parse(s, Character::RADIX_DECIMAL, ret);