projects
/
platform
/
framework
/
native
/
appfw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[devel_3.0_main] Cherry-pick Beautification of source-code. 80383
[platform/framework/native/appfw.git]
/
src
/
base
/
FBaseLong.cpp
diff --git
a/src/base/FBaseLong.cpp
b/src/base/FBaseLong.cpp
index
d349748
..
c043b11
100644
(file)
--- a/
src/base/FBaseLong.cpp
+++ b/
src/base/FBaseLong.cpp
@@
-1,5
+1,4
@@
//
//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
@@
-20,7
+19,6
@@
* @brief This is the implementation file for Long class.
* @see Number
*/
* @brief This is the implementation file for Long class.
* @see Number
*/
-
#include <wchar.h>
#include <limits.h>
#include <errno.h>
#include <wchar.h>
#include <limits.h>
#include <errno.h>
@@
-73,7
+71,7
@@
Long::CompareTo(const Long& value) const
bool
Long::Equals(const Object& obj) const
{
bool
Long::Equals(const Object& obj) const
{
- const Long* pOther = dynamic_cast
<const Long*
>(&obj);
+ const Long* pOther = dynamic_cast
< const Long*
>(&obj);
if (pOther == null)
{
return false;
if (pOther == null)
{
return false;
@@
-85,13
+83,13
@@
Long::Equals(const Object& obj) const
int
Long::GetHashCode(void) const
{
int
Long::GetHashCode(void) const
{
- return static_cast<
int>
(value);
+ return static_cast<
int >
(value);
}
int
Long::GetHashCode(long val)
{
}
int
Long::GetHashCode(long val)
{
- return static_cast<
int>
(val);
+ return static_cast<
int >
(val);
}
result
}
result
@@
-101,20
+99,28
@@
Long::Decode(const String& s, long& ret)
"[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
int radix = 0;
"[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
int radix = 0;
+ int startIndex = 0;
+ int minLength = 2;
wchar_t* pEnd = null;
String str(s);
wchar_t* pEnd = null;
String str(s);
+ if (s[0] == L'-' || s[0] == L'+')
+ {
+ startIndex = 1;
+ minLength = 3;
+ }
+
// Find radix
// Find radix
- if (s[
0
] == L'#')
+ if (s[
startIndex
] == L'#')
{
radix = Character::RADIX_HEXADECIMAL;
// Remove '#'
{
radix = Character::RADIX_HEXADECIMAL;
// Remove '#'
- str.Remove(
0
, 1);
+ str.Remove(
startIndex
, 1);
}
}
- else if (s[
0] == L'0' && (s.GetLength() >= 2
))
+ else if (s[
startIndex] == L'0' && (s.GetLength() >= minLength
))
{
{
- if (s[
1] == L'x' || s[
1] == L'X')
+ if (s[
startIndex + 1] == L'x' || s[startIndex +
1] == L'X')
{
radix = Character::RADIX_HEXADECIMAL;
}
{
radix = Character::RADIX_HEXADECIMAL;
}
@@
-174,19
+180,19
@@
Long::Parse(const String& s, int radix, long& ret)
char
Long::ToChar(void) const
{
char
Long::ToChar(void) const
{
- return static_cast<
char>
(value);
+ return static_cast<
char >
(value);
}
short
Long::ToShort(void) const
{
}
short
Long::ToShort(void) const
{
- return static_cast<
short>
(value);
+ return static_cast<
short >
(value);
}
int
Long::ToInt(void) const
{
}
int
Long::ToInt(void) const
{
- return static_cast<
int>
(value);
+ return static_cast<
int >
(value);
}
long
}
long
@@
-198,19
+204,19
@@
Long::ToLong(void) const
long long
Long::ToLongLong(void) const
{
long long
Long::ToLongLong(void) const
{
- return static_cast<
long long>
(value);
+ return static_cast<
long long >
(value);
}
float
Long::ToFloat(void) const
{
}
float
Long::ToFloat(void) const
{
- return static_cast<
float>
(value);
+ return static_cast<
float >
(value);
}
double
Long::ToDouble(void) const
{
}
double
Long::ToDouble(void) const
{
- return static_cast<
double>
(value);
+ return static_cast<
double >
(value);
}
String
}
String