2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
18 * @file FUi_ResourceMapContainer.cpp
19 * @brief This is the implementation file for Config class.
22 * This cpp file contains implementation of Config class.
23 * The ActionEvent class can call listener's method. So, when event occurred,
24 * application can handle it appropriately.
27 #include <FBaseInteger.h>
28 #include <FGrpColor.h>
29 #include <FGrpDimension.h>
30 #include <FBaseSysLog.h>
31 #include <FBaseColIHashCodeProviderT.h>
32 #include "FUi_ResourceMapContainer.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Collection;
36 using namespace Tizen::Graphics;
38 namespace Tizen { namespace Ui { namespace _Resource
41 MapContainer::MapContainer(void)
43 , __pDimensionMap(null)
44 , __pFixedValueMap(null)
52 , __resolutionForImage(L"")
54 __pProvider = new _ResourceHashCodeProvider;
55 SysTryReturnVoidResult(NID_UI, __pProvider, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
56 __pComparer = new _ResourceComparer;
57 SysTryReturnVoidResult(NID_UI, __pComparer, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
59 MapContainer::~MapContainer(void)
63 delete __pDimensionMap;
64 __pDimensionMap = null;
65 delete __pFixedValueMap;
66 __pFixedValueMap = null;
78 MapContainer::CreateMap(_ResourceType type)
82 case RESOURCE_TYPE_COLOR:
83 if(__pColorMap == null)
85 __pColorMap = new (std::nothrow) ResourceColorMap(type);
86 SysTryReturnVoidResult(NID_UI, __pColorMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
87 __pColorMap->Construct(0, 0, *__pProvider, *__pComparer);
90 case RESOURCE_TYPE_DIMENSION:
91 if(__pDimensionMap == null)
93 __pDimensionMap = new (std::nothrow) ResourceDimensionMap(type);
94 SysTryReturnVoidResult(NID_UI, __pDimensionMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
95 __pDimensionMap->Construct(0, 0, *__pProvider, *__pComparer);
99 case RESOURCE_TYPE_FIXED_VALUE:
100 if(__pFixedValueMap == null)
102 __pFixedValueMap = new (std::nothrow) ResourceShapeMap(type);
103 SysTryReturnVoidResult(NID_UI, __pFixedValueMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
104 __pFixedValueMap->Construct(0, 0, *__pProvider, *__pComparer);
107 case RESOURCE_TYPE_IMAGE:
108 if(__pImageMap == null)
110 __pImageMap = new (std::nothrow) ResourceImageMap(type);
111 SysTryReturnVoidResult(NID_UI, __pImageMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
112 __pImageMap->Construct(0, 0, *__pProvider, *__pComparer);
115 case RESOURCE_TYPE_SHAPE:
116 if(__pShapeMap == null)
118 __pShapeMap = new (std::nothrow) ResourceShapeMap(type);
119 SysTryReturnVoidResult(NID_UI, __pShapeMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
120 __pShapeMap->Construct(0, 0, *__pProvider, *__pComparer);
129 MapContainer::InitializeMap(_ResourceType type)
133 case RESOURCE_TYPE_COLOR:
134 if(__pColorMap != null)
136 __pColorMap->Initialize();
139 case RESOURCE_TYPE_DIMENSION:
140 if(__pDimensionMap != null)
142 __pDimensionMap->Initialize();
145 case RESOURCE_TYPE_FIXED_VALUE:
146 if(__pFixedValueMap != null)
148 __pFixedValueMap->Initialize();
151 case RESOURCE_TYPE_IMAGE:
152 if(__pImageMap != null)
154 __pImageMap->Initialize();
157 case RESOURCE_TYPE_SHAPE:
158 if(__pShapeMap != null)
160 __pShapeMap->Initialize();
169 MapContainer::GetColorMap(void) const
174 ResourceDimensionMap*
175 MapContainer::GetDimensionMap(void) const
177 return __pDimensionMap;
181 MapContainer::GetFixedValueMap(void) const
183 return __pFixedValueMap;
187 MapContainer::GetImageMap(void) const
193 MapContainer::GetShapeMap(void) const
198 MapContainer::SetVersion (const Tizen::Base::String& version)
203 MapContainer::GetVersion(void)
208 MapContainer::SetThemeName(const Tizen::Base::String& themeName)
210 __themeName = themeName;
213 MapContainer::GetThemeName(void)
218 MapContainer::SetResolution(const Tizen::Base::String& resolution)
220 __resolution = resolution;
223 MapContainer::GetResolution(void)
228 MapContainer::SetResolutionForImage(const Tizen::Base::String& resolution)
230 __resolutionForImage = resolution;
233 MapContainer::GetResolutionForImage(void)
235 return __resolutionForImage;
238 }}} //Tizen::Ui::_Resource