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.
22 #include <FBaseCharacter.h>
23 #include <FApp_AppInfo.h>
24 #include <FBaseSysLog.h>
25 #include "FBase_CharacterImpl.h"
27 namespace Tizen { namespace Base
30 Character::Character(wchar_t value)
32 , __pCharacterImpl(null)
36 Character::Character(const Character& value)
38 , __pCharacterImpl(null)
42 Character::~Character(void)
47 Character::operator =(const Character& rhs)
57 Character::CompareTo(const Character& value) const
59 return __val - value.__val;
63 Character::Equals(const Object& obj) const
65 const Character* pOther = dynamic_cast< const Character* >(&obj);
71 return((*this).CompareTo((*pOther).ToMchar()) == 0 ? true : false);
75 Character::GetHashCode(void) const
81 Character::ToMchar(void) const
87 Character::ToLower(void)
91 __val = towlower(__val);
96 Character::ToLowerCase(void)
98 __val = _CharacterImpl::ToLowerCase(__val);
102 Character::ToUpper(void)
106 __val = towupper(__val);
111 Character::ToUpperCase(void)
113 __val = _CharacterImpl::ToUpperCase(__val);
117 Character::ToString(void) const
119 return Character::ToString(__val);
123 Character::ToString(wchar_t value)
125 return String(value);
129 Character::GetUnicodeCategory(wchar_t ch)
131 return _CharacterImpl::GetUnicodeCategory(ch);
135 Character::ToLower(wchar_t ch)
148 Character::ToLowerCase(wchar_t ch)
150 return _CharacterImpl::ToLowerCase(ch);
154 Character::ToUpper(wchar_t ch)
167 Character::ToUpperCase(wchar_t ch)
169 return _CharacterImpl::ToUpperCase(ch);
173 Character::IsAlphaNumeric(wchar_t ch)
175 if (_CharacterImpl::IsLetter(ch))
180 if (_CharacterImpl::IsDigit(ch))
189 Character::IsDigit(wchar_t ch)
191 if (_CharacterImpl::IsDigit(ch))
200 Character::IsLetter(wchar_t ch)
203 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
205 return(iswalpha(ch) != 0);
209 return _CharacterImpl::IsLetter(ch);
214 Character::IsLower(wchar_t ch)
216 return(iswlower(ch) != 0);
220 Character::IsLowerCase(wchar_t ch)
222 return(Character::ToUpperCase(ch) != ch);
226 Character::IsUpper(wchar_t ch)
228 return(iswupper(ch) != 0);
232 Character::IsUpperCase(wchar_t ch)
234 return(Character::ToLowerCase(ch) != ch);
238 Character::ToDigit(wchar_t ch, int radix)
240 return _CharacterImpl::ToDigit(ch, radix);
245 Character::ForDigit(int digit, int radix)
247 return _CharacterImpl::ForDigit(digit, radix);
252 Character::GetNumericValue(wchar_t ch)
254 return _CharacterImpl::GetNumericValue(ch);
259 Character::IsDefined(wchar_t ch)
261 return _CharacterImpl::IsDefined(ch);
266 Character::IsWhitespace(wchar_t ch)
268 return _CharacterImpl::IsWhitespace(ch);
272 Character::IsTitleCase(wchar_t ch)
274 return _CharacterImpl::IsTitleCase(ch);
278 Character::ToTitleCase(wchar_t ch)
280 return _CharacterImpl::ToTitleCase(ch);
284 Character::IsISOControl(wchar_t ch)
286 return _CharacterImpl::IsISOControl(ch);