2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FBaseCharacter.cpp
20 * @brief This is the implementation file for Char class.
24 #include <FBaseCharacter.h>
25 #include <FApp_AppInfo.h>
26 #include <FBaseSysLog.h>
27 #include "FBase_CharacterImpl.h"
30 namespace Tizen { namespace Base
33 Character::Character(wchar_t value)
35 , __pCharacterImpl(null)
39 Character::Character(const Character& value)
41 , __pCharacterImpl(null)
45 Character::~Character(void)
50 Character::operator =(const Character& rhs)
60 Character::CompareTo(const Character& value) const
62 return __val - value.__val;
66 Character::Equals(const Object& obj) const
68 const Character* pOther = dynamic_cast <const Character*>(&obj);
74 return((*this).CompareTo((*pOther).ToMchar()) == 0 ? true : false);
78 Character::GetHashCode(void) const
84 Character::ToMchar(void) const
90 Character::ToLower(void)
94 __val = towlower(__val);
99 Character::ToLowerCase(void)
101 __val = _CharacterImpl::ToLowerCase(__val);
105 Character::ToUpper(void)
109 __val = towupper(__val);
114 Character::ToUpperCase(void)
116 __val = _CharacterImpl::ToUpperCase(__val);
120 Character::ToString(void) const
122 return Character::ToString(__val);
126 Character::ToString(wchar_t value)
128 return String(value);
132 Character::GetUnicodeCategory(wchar_t ch)
134 return _CharacterImpl::GetUnicodeCategory(ch);
138 Character::ToLower(wchar_t ch)
151 Character::ToLowerCase(wchar_t ch)
153 return _CharacterImpl::ToLowerCase(ch);
157 Character::ToUpper(wchar_t ch)
170 Character::ToUpperCase(wchar_t ch)
172 return _CharacterImpl::ToUpperCase(ch);
176 Character::IsAlphaNumeric(wchar_t ch)
178 if (_CharacterImpl::IsLetter(ch))
183 if (_CharacterImpl::IsDigit(ch))
192 Character::IsDigit(wchar_t ch)
194 if (_CharacterImpl::IsDigit(ch))
203 Character::IsLetter(wchar_t ch)
206 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
208 return(iswalpha(ch) !=0);
212 return _CharacterImpl::IsLetter(ch);
217 Character::IsLower(wchar_t ch)
219 return(iswlower(ch) != 0);
223 Character::IsLowerCase(wchar_t ch)
225 return(Character::ToUpperCase(ch) != ch);
229 Character::IsUpper(wchar_t ch)
231 return(iswupper(ch) != 0);
235 Character::IsUpperCase(wchar_t ch)
237 return(Character::ToLowerCase(ch) != ch);
241 Character::ToDigit(wchar_t ch, int radix)
243 return _CharacterImpl::ToDigit(ch, radix);
248 Character::ForDigit(int digit, int radix)
250 return _CharacterImpl::ForDigit(digit, radix);
255 Character::GetNumericValue(wchar_t ch)
257 return _CharacterImpl::GetNumericValue(ch);
262 Character::IsDefined(wchar_t ch)
264 return _CharacterImpl::IsDefined(ch);
269 Character::IsWhitespace(wchar_t ch)
271 return _CharacterImpl::IsWhitespace(ch);
275 Character::IsTitleCase(wchar_t ch)
277 return _CharacterImpl::IsTitleCase(ch);
281 Character::ToTitleCase(wchar_t ch)
283 return _CharacterImpl::ToTitleCase(ch);
287 Character::IsISOControl(wchar_t ch)
289 return _CharacterImpl::IsISOControl(ch);