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 FLclNumberSymbols.cpp
20 * @brief This is the implementation file for NumberSymbols class.
23 #include <FBaseSysLog.h>
24 #include <FApp_AppInfo.h>
25 #include "FLcl_NumberSymbolsImpl.h"
26 #include "FLcl_LocaleData.h"
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Locales
35 /////////////////////////////////////////////////////////////////////////////////////////////////////
38 _NumberSymbolsImpl::_NumberSymbolsImpl(void)
39 : __locale(LANGUAGE_INVALID, COUNTRY_INVALID)
44 _NumberSymbolsImpl::_NumberSymbolsImpl(const _NumberSymbolsImpl& other)
45 : __locale(LANGUAGE_INVALID, COUNTRY_INVALID)
47 this->__locale = other.__locale;
49 for (int i = 0; i < NUMBER_SYMBOL_COUNT; i++)
51 this->__symbols[i] = other.__symbols[i]; // Copying symbols
57 _NumberSymbolsImpl::operator =(const _NumberSymbolsImpl& rhs)
61 for (int i = 0; i < (int) NUMBER_SYMBOL_COUNT; ++i)
63 __symbols[(NumberSymbol) i] = rhs.__symbols[(NumberSymbol) i]; // Copying symbols
66 __locale = rhs.__locale;
73 _NumberSymbolsImpl::~_NumberSymbolsImpl(void)
78 _NumberSymbolsImpl::Construct(const Locale& locale)
81 _LocaleData localeData;
82 r = localeData.GetNumberSymbols(locale, __symbols); // Get number symbols from ICU
90 return (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat()) ? E_UNSUPPORTED_OPERATION : E_INVALID_ARG;
95 _NumberSymbolsImpl::GetNumberSymbol(NumberSymbol symbol) const
97 return (symbol < NUMBER_SYMBOL_COUNT) ? __symbols[symbol] : String(); // Get symbol value for symbol
102 _NumberSymbolsImpl::SetNumberSymbol(const NumberSymbol symbol, const String& str)
104 if (symbol < NUMBER_SYMBOL_COUNT) // validate symbol value
106 __symbols[symbol] = str; // Set symbol
114 _NumberSymbolsImpl::GetLocale(void) const
117 return &__locale; // return locale object stored during construction