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 FLclNumberSymbols.cpp
19 * @brief This is the implementation file for NumberSymbols class.
22 #include <FBaseSysLog.h>
23 #include <FApp_AppInfo.h>
24 #include "FLcl_NumberSymbolsImpl.h"
25 #include "FLcl_LocaleData.h"
28 using namespace Tizen::Base;
30 namespace Tizen { namespace Locales
34 /////////////////////////////////////////////////////////////////////////////////////////////////////
37 _NumberSymbolsImpl::_NumberSymbolsImpl(void)
38 : __locale(LANGUAGE_INVALID, COUNTRY_INVALID)
43 _NumberSymbolsImpl::_NumberSymbolsImpl(const _NumberSymbolsImpl& other)
44 : __locale(LANGUAGE_INVALID, COUNTRY_INVALID)
46 this->__locale = other.__locale;
48 for (int i = 0; i < NUMBER_SYMBOL_COUNT; i++)
50 this->__symbols[i] = other.__symbols[i]; // Copying symbols
56 _NumberSymbolsImpl::operator =(const _NumberSymbolsImpl& rhs)
60 for (int i = 0; i < (int) NUMBER_SYMBOL_COUNT; ++i)
62 __symbols[(NumberSymbol) i] = rhs.__symbols[(NumberSymbol) i]; // Copying symbols
65 __locale = rhs.__locale;
72 _NumberSymbolsImpl::~_NumberSymbolsImpl(void)
77 _NumberSymbolsImpl::Construct(const Locale& locale)
80 _LocaleData localeData;
81 r = localeData.GetNumberSymbols(locale, __symbols); // Get number symbols from ICU
89 return (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat()) ? E_UNSUPPORTED_OPERATION : E_INVALID_ARG;
94 _NumberSymbolsImpl::GetNumberSymbol(NumberSymbol symbol) const
96 return (symbol < NUMBER_SYMBOL_COUNT) ? __symbols[symbol] : String(); // Get symbol value for symbol
101 _NumberSymbolsImpl::SetNumberSymbol(const NumberSymbol symbol, const String& str)
103 if (symbol < NUMBER_SYMBOL_COUNT) // validate symbol value
105 __symbols[symbol] = str; // Set symbol
113 _NumberSymbolsImpl::GetLocale(void) const
116 return &__locale; // return locale object stored during construction