#include <FBaseCharacter.h>
#include <FBaseSysLog.h>
#include "FBase_NumberUtil.h"
+#include "FApp_AppInfo.h"
namespace Tizen { namespace Base
{
result r = _NumberUtil::Decode(s, value);
SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
- if (value > Int8::VALUE_MAX)
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
{
- ret = Int8::VALUE_MAX;
- }
- else if (value < Int8::VALUE_MIN)
- {
- ret = Int8::VALUE_MIN;
+ 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);
+ }
}
else
{
+ 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 r;
+ return E_SUCCESS;
}
result
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)
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
{
- ret = Int8::VALUE_MIN;
+ 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);
+ }
}
else
{
+ 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 r;
+ return E_SUCCESS;
}
char
#include <FBaseCharacter.h>
#include <FBaseSysLog.h>
#include "FBase_NumberUtil.h"
+#include "FApp_AppInfo.h"
namespace Tizen { namespace Base
{
result r = _NumberUtil::Decode(inputStr, value);
SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
- if (value > Integer8::VALUE_MAX)
- {
- ret = Integer8::VALUE_MAX;
- }
- else if (value < Integer8::VALUE_MIN)
- {
- ret = Integer8::VALUE_MIN;
- }
- else
- {
- ret = static_cast< int8_t >(value);
- }
- return r;
+ SysTryReturnResult(NID_BASE, (value >= Integer8::VALUE_MIN) && (value <= Integer8::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
+ ret = static_cast< int8_t >(value);
+ return E_SUCCESS;
}
result
result r = _NumberUtil::Parse(inputStr, radix, value);
SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
- if (value > Integer8::VALUE_MAX)
- {
- ret = Integer8::VALUE_MAX;
- }
- else if (value < Integer8::VALUE_MIN)
- {
- ret = Integer8::VALUE_MIN;
- }
- else
- {
- ret = static_cast< int8_t >(value);
- }
-
+ SysTryReturnResult(NID_BASE, (value >= Integer8::VALUE_MIN) && (value <= Integer8::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
+ ret = static_cast< int8_t >(value);
return E_SUCCESS;
}
#include <FBaseCharacter.h>
#include <FBaseSysLog.h>
#include "FBase_NumberUtil.h"
+#include "FApp_AppInfo.h"
namespace Tizen { namespace Base
{
result r = _NumberUtil::Decode(s, value);
SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
- if (value > Short::VALUE_MAX)
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
{
- ret = Short::VALUE_MAX;
- }
- else if (value < Short::VALUE_MIN)
- {
- ret = Short::VALUE_MIN;
+ if (value > Short::VALUE_MAX)
+ {
+ ret = Short::VALUE_MAX;
+ }
+ else if (value < Short::VALUE_MIN)
+ {
+ ret = Short::VALUE_MIN;
+ }
+ else
+ {
+ ret = static_cast< short >(value);
+ }
}
else
{
+ SysTryReturnResult(NID_BASE, (value >= Short::VALUE_MIN) && (value <= Short::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
ret = static_cast< short >(value);
}
- return r;
+ return E_SUCCESS;
}
result
result r = _NumberUtil::Parse(s, radix, value);
SysTryReturnResult(NID_BASE, r == E_SUCCESS, r, "Propagating.");
- if (value > Short::VALUE_MAX)
- {
- ret = Short::VALUE_MAX;
- }
- else if (value < Short::VALUE_MIN)
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
{
- ret = Short::VALUE_MIN;
+ if (value > Short::VALUE_MAX)
+ {
+ ret = Short::VALUE_MAX;
+ }
+ else if (value < Short::VALUE_MIN)
+ {
+ ret = Short::VALUE_MIN;
+ }
+ else
+ {
+ ret = static_cast< short >(value);
+ }
}
else
{
+ SysTryReturnResult(NID_BASE, (value >= Short::VALUE_MIN) && (value <= Short::VALUE_MAX), E_OUT_OF_RANGE, "The value(%d) is out of range.", value);
ret = static_cast< short >(value);
}
- return r;
+ return E_SUCCESS;
}
char
#include <FBaseCharacter.h>
#include <FBaseSysLog.h>
#include "FBase_NumberUtil.h"
+#include "FApp_AppInfo.h"
namespace Tizen { namespace Base
{
int sysErrno = errno;
SysTryReturnResult(NID_BASE, pEnd[0] == 0, E_NUM_FORMAT, "_NumberUtil parse failed. Scan stopped at (%ls).", pEnd);
- SysTryReturnResult(NID_BASE, !((value == LONG_MAX || value == LONG_MIN) && (sysErrno != 0)), E_NUM_FORMAT,
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
+ {
+ SysTryReturnResult(NID_BASE, !((value == LONG_MAX || value == LONG_MIN) && (sysErrno != 0)), E_NUM_FORMAT,
"Parsed value cannot fit into a long.");
+ }
+ else
+ {
+ SysTryReturnResult(NID_BASE, sysErrno != ERANGE, E_OUT_OF_RANGE, "Parsed value cannot fit into a long.");
+ }
return E_SUCCESS;
}
int sysErrno = errno;
SysTryReturnResult(NID_BASE, pEnd[0] == 0, E_NUM_FORMAT, "_NumberUtil parse failed. Scan stopped at (%ls).", pEnd);
- SysTryReturnResult(NID_BASE, !((value == LLONG_MAX || value == LLONG_MIN) && (sysErrno != 0)), E_NUM_FORMAT,
+ if ((Tizen::App::_AppInfo::GetApiVersion() >= _API_VERSION_2_0) && (Tizen::App::_AppInfo::GetApiVersion() <= _API_VERSION_2_2))
+ {
+ SysTryReturnResult(NID_BASE, !((value == LLONG_MAX || value == LLONG_MIN) && (sysErrno != 0)), E_NUM_FORMAT,
"Parsed value cannot fit into a long long.");
+ }
+ else
+ {
+ SysTryReturnResult(NID_BASE, sysErrno != ERANGE, E_OUT_OF_RANGE, "Parsed value cannot fit into a long long.");
+ }
return E_SUCCESS;
}
}} // Tizen::Base
* @param[out] value 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 string value is not between VALUE_MIN and VALUE_MAX range
* @remarks This method accepts decimal, hexadecimal, and octal numbers given by the
* following grammar:
*
* @param[out] value 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 accepts decimal, hexadecimal, and octal numbers given by the
* following grammar:
*
* @param[out] value 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.
+ * The parsed value is not between VALUE_MIN and VALUE_MAX range
*/
static result Parse(const String& inputStr, int radix, long& value);
* @param[out] value 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.
+ * The parsed value is not between VALUE_MIN and VALUE_MAX range
*/
static result Parse(const String& inputStr, int radix, long long& value);