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
37 NumberSymbols::NumberSymbols(void)
38 : __pNumberSymbolsImpl(null)
42 NumberSymbols::~NumberSymbols(void)
44 delete __pNumberSymbolsImpl;
45 __pNumberSymbolsImpl = null;
49 NumberSymbols::Construct(const Locale& locale)
51 SysAssertf(__pNumberSymbolsImpl == null,
52 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
54 result r = E_INVALID_ARG;
56 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
58 r = E_UNSUPPORTED_OPERATION;
60 SysTryReturnResult(NID_LCL, _LocaleImpl::IsSupported(locale), r, "Given locale is not supported");
62 __pNumberSymbolsImpl = new (std::nothrow) _NumberSymbolsImpl;
63 SysTryReturnResult(NID_LCL, __pNumberSymbolsImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
65 r = __pNumberSymbolsImpl->Construct(locale);
68 delete __pNumberSymbolsImpl;
69 __pNumberSymbolsImpl = null;
76 NumberSymbols::GetNumberSymbol(NumberSymbol symbol) const
78 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
79 return __pNumberSymbolsImpl->GetNumberSymbol(symbol);
84 NumberSymbols::SetNumberSymbol(const NumberSymbol symbol, const String& str)
86 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
87 return __pNumberSymbolsImpl->SetNumberSymbol(symbol, str);
92 NumberSymbols::GetLocale(void) const
94 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
95 return __pNumberSymbolsImpl->GetLocale();