BigInteger class implementation
[platform/framework/native/appfw.git] / src / base / FBaseInt8.cpp
index 24a28ec..e988535 100644 (file)
@@ -27,6 +27,7 @@
 #include <FBaseCharacter.h>
 #include <FBaseSysLog.h>
 #include "FBase_NumberUtil.h"
+#include "FApp_AppInfo.h"
 
 namespace Tizen { namespace Base
 {
@@ -99,20 +100,9 @@ Int8::Decode(const String& s, char& ret)
        long value;
        result r = _NumberUtil::Decode(s, value);
        SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
-
-       if (value > Int8::VALUE_MAX)
-       {
-               ret = Int8::VALUE_MAX;
-       }
-       else if (value < Int8::VALUE_MIN)
-       {
-               ret = Int8::VALUE_MIN;
-       }
-       else
-       {
-               ret = static_cast< char >(value);
-       }
-       return r;
+       SysTryReturnResult(NID_BASE, (value >= Int8::VALUE_MIN) && (value <= Int8::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
+       ret = static_cast< char >(value);
+       return E_SUCCESS;
 }
 
 result
@@ -127,20 +117,9 @@ Int8::Parse(const String& s, int radix, char& ret)
        long value;
        result r = _NumberUtil::Parse(s, radix, value);
        SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
-
-       if (value > Int8::VALUE_MAX)
-       {
-               ret = Int8::VALUE_MAX;
-       }
-       else if (value < Int8::VALUE_MIN)
-       {
-               ret = Int8::VALUE_MIN;
-       }
-       else
-       {
-               ret = static_cast< char >(value);
-       }
-       return r;
+       SysTryReturnResult(NID_BASE, (value >= Int8::VALUE_MIN) && (value <= Int8::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
+       ret = static_cast< char >(value);
+       return E_SUCCESS;
 }
 
 char
@@ -149,6 +128,12 @@ Int8::ToChar(void) const
        return static_cast< char >(value);
 }
 
+int8_t
+Int8::ToInt8(void) const
+{
+       return 0;
+}
+
 short
 Int8::ToShort(void) const
 {