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.
24 #include <FBaseResult.h>
25 #include <FBaseSysLog.h>
26 #include <FApp_AppInfo.h>
27 #include <FLclNumberSymbols.h>
28 #include "FLcl_NumberSymbolsImpl.h"
29 #include "FLcl_LocaleImpl.h"
32 using namespace Tizen::Base;
34 namespace Tizen { namespace Locales
38 /////////////////////////////////////////////////////////////////////////////////////////////////////
41 NumberSymbols::NumberSymbols(void)
42 : __pNumberSymbolsImpl(null)
46 NumberSymbols::~NumberSymbols(void)
48 delete __pNumberSymbolsImpl;
49 __pNumberSymbolsImpl = null;
53 NumberSymbols::Construct(const Locale& locale)
55 // Object is not allowed to construct twice
56 SysAssertf(__pNumberSymbolsImpl == null,
57 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
59 result r = E_INVALID_ARG;
61 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
63 r = E_UNSUPPORTED_OPERATION;
66 SysTryReturnResult(NID_LCL, _LocaleImpl::IsSupported(locale), r, "Given locale is not supported");
68 __pNumberSymbolsImpl = new (std::nothrow) _NumberSymbolsImpl;
69 SysTryReturnResult(NID_LCL, __pNumberSymbolsImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
71 r = __pNumberSymbolsImpl->Construct(locale);
74 delete __pNumberSymbolsImpl;
75 __pNumberSymbolsImpl = null;
82 NumberSymbols::GetNumberSymbol(NumberSymbol symbol) const
84 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
85 return __pNumberSymbolsImpl->GetNumberSymbol(symbol);
90 NumberSymbols::SetNumberSymbol(const NumberSymbol symbol, const String& str)
92 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
93 return __pNumberSymbolsImpl->SetNumberSymbol(symbol, str);
98 NumberSymbols::GetLocale(void) const
100 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
101 return __pNumberSymbolsImpl->GetLocale();