2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseCharacter.cpp
19 * @brief This is the implementation file for Char class.
23 #include <FBaseCharacter.h>
24 #include <FApp_AppInfo.h>
25 #include <FBaseSysLog.h>
26 #include "FBase_CharacterImpl.h"
29 namespace Tizen { namespace Base
32 Character::Character(wchar_t value)
34 , __pCharacterImpl(null)
38 Character::Character(const Character& value)
40 , __pCharacterImpl(null)
44 Character::~Character(void)
49 Character::operator =(const Character& rhs)
59 Character::CompareTo(const Character& value) const
61 return __val - value.__val;
65 Character::Equals(const Object& obj) const
67 const Character* pOther = dynamic_cast <const Character*>(&obj);
73 return((*this).CompareTo((*pOther).ToMchar()) == 0 ? true : false);
77 Character::GetHashCode(void) const
83 Character::ToMchar(void) const
89 Character::ToLower(void)
93 __val = towlower(__val);
98 Character::ToLowerCase(void)
100 __val = _CharacterImpl::ToLowerCase(__val);
104 Character::ToUpper(void)
108 __val = towupper(__val);
113 Character::ToUpperCase(void)
115 __val = _CharacterImpl::ToUpperCase(__val);
119 Character::ToString(void) const
121 return Character::ToString(__val);
125 Character::ToString(wchar_t value)
127 return String(value);
131 Character::GetUnicodeCategory(wchar_t ch)
133 return _CharacterImpl::GetUnicodeCategory(ch);
137 Character::ToLower(wchar_t ch)
150 Character::ToLowerCase(wchar_t ch)
152 return _CharacterImpl::ToLowerCase(ch);
156 Character::ToUpper(wchar_t ch)
169 Character::ToUpperCase(wchar_t ch)
171 return _CharacterImpl::ToUpperCase(ch);
175 Character::IsAlphaNumeric(wchar_t ch)
177 if (_CharacterImpl::IsLetter(ch))
182 if (_CharacterImpl::IsDigit(ch))
191 Character::IsDigit(wchar_t ch)
193 if (_CharacterImpl::IsDigit(ch))
202 Character::IsLetter(wchar_t ch)
205 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
207 return(iswalpha(ch) !=0);
211 return _CharacterImpl::IsLetter(ch);
216 Character::IsLower(wchar_t ch)
218 return(iswlower(ch) != 0);
222 Character::IsLowerCase(wchar_t ch)
224 return(Character::ToUpperCase(ch) != ch);
228 Character::IsUpper(wchar_t ch)
230 return(iswupper(ch) != 0);
234 Character::IsUpperCase(wchar_t ch)
236 return(Character::ToLowerCase(ch) != ch);
240 Character::ToDigit(wchar_t ch, int radix)
242 return _CharacterImpl::ToDigit(ch, radix);
247 Character::ForDigit(int digit, int radix)
249 return _CharacterImpl::ForDigit(digit, radix);
254 Character::GetNumericValue(wchar_t ch)
256 return _CharacterImpl::GetNumericValue(ch);
261 Character::IsDefined(wchar_t ch)
263 return _CharacterImpl::IsDefined(ch);
268 Character::IsWhitespace(wchar_t ch)
270 return _CharacterImpl::IsWhitespace(ch);
274 Character::IsTitleCase(wchar_t ch)
276 return _CharacterImpl::IsTitleCase(ch);
280 Character::ToTitleCase(wchar_t ch)
282 return _CharacterImpl::ToTitleCase(ch);
286 Character::IsISOControl(wchar_t ch)
288 return _CharacterImpl::IsISOControl(ch);