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.
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FApp_AppInfo.h>
28 #include <FLclNumberSymbols.h>
29 #include "FLcl_NumberSymbolsImpl.h"
30 #include "FLcl_LocaleImpl.h"
33 using namespace Tizen::Base;
35 namespace Tizen { namespace Locales
39 /////////////////////////////////////////////////////////////////////////////////////////////////////
42 NumberSymbols::NumberSymbols(void)
43 : __pNumberSymbolsImpl(null)
47 NumberSymbols::~NumberSymbols(void)
49 delete __pNumberSymbolsImpl;
50 __pNumberSymbolsImpl = null;
54 NumberSymbols::Construct(const Locale& locale)
56 // Object is not allowed to construct twice
57 SysAssertf(__pNumberSymbolsImpl == null,
58 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
60 result r = E_INVALID_ARG;
62 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
64 r = E_UNSUPPORTED_OPERATION;
67 SysTryReturnResult(NID_LCL, _LocaleImpl::IsSupported(locale), r, "Given locale is not supported");
69 __pNumberSymbolsImpl = new (std::nothrow) _NumberSymbolsImpl;
70 SysTryReturnResult(NID_LCL, __pNumberSymbolsImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
72 r = __pNumberSymbolsImpl->Construct(locale);
75 delete __pNumberSymbolsImpl;
76 __pNumberSymbolsImpl = null;
83 NumberSymbols::GetNumberSymbol(NumberSymbol symbol) const
85 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
86 return __pNumberSymbolsImpl->GetNumberSymbol(symbol);
91 NumberSymbols::SetNumberSymbol(const NumberSymbol symbol, const String& str)
93 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
94 return __pNumberSymbolsImpl->SetNumberSymbol(symbol, str);
99 NumberSymbols::GetLocale(void) const
101 SysAssertf(__pNumberSymbolsImpl != null, "Not yet constructed! Construct() should be called before use.");
102 return __pNumberSymbolsImpl->GetLocale();