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.
25 #include <FBaseCharacter.h>
26 #include <FBaseSysLog.h>
28 #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)
205 if ((appinfo_get_api_version() == APP_INFO_VERSION_2_0) && (appinfo_is_compat() == 1))
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);