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.
19 * @file FUi_ResourceConfigParser.cpp
20 * @brief This is the header file for the ConfigParser.
22 * This header file contains the declarations of the ConfigParser.
25 #include <FBaseByteBuffer.h>
26 #include <FBaseInteger.h>
27 #include <FBaseString.h>
28 #include <FBaseSysLog.h>
29 #include <FBaseColHashMapT.h>
31 #include <FGrpColor.h>
32 #include <FGrpDimension.h>
33 #include <FBase_StringConverter.h>
34 #include "FUi_ResourceMapContainer.h"
35 #include "FUi_ResourceConfigParser.h"
37 using namespace Tizen::Base;
38 using namespace Collection;
39 using namespace Tizen::Io;
40 using namespace Tizen::Graphics;
44 class _ColorMatchingMapProvider
45 : public IHashCodeProviderT <String>
48 _ColorMatchingMapProvider(void) {}
49 virtual ~_ColorMatchingMapProvider(void) {}
51 virtual int GetHashCode(const String& obj) const
53 return obj.GetHashCode();
57 class _ColorMatchingMapComparer
58 : public IComparerT <String>
61 _ColorMatchingMapComparer(void) {}
62 virtual ~_ColorMatchingMapComparer(void) {}
63 virtual result Compare(const String& obj1, const String& obj2, int& cmp) const
81 xmlSAXHandler mySaxHandler = {null, null, null, null, null, null, null, null, null, null, null, null, null, null,
82 Tizen::Ui::_Resource::ConfigParser::StartSaxFunc,
83 null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null};
86 namespace Tizen { namespace Ui { namespace _Resource
88 ConfigParser* pConfigXmlHandler = null;
89 HashMapT<String, String*>* pColorMatchingMap = null;
91 ConfigParser::ColorMatchingMap::ColorMatchingMap(void)
92 :HashMapT<String, String*>()
96 __pProvider = new (std::nothrow) _ColorMatchingMapProvider;
97 SysTryReturnVoidResult(NID_UI, __pProvider, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
98 __pComparer = new (std::nothrow) _ColorMatchingMapComparer;
99 SysTryReturnVoidResult(NID_UI, __pComparer, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
101 ConfigParser::ColorMatchingMap::~ColorMatchingMap(void)
103 result r = E_SUCCESS;
104 Collection::IMapEnumeratorT< String, String* >* pMapEnum = null;
105 if (Collection::HashMapT<String, String*>::GetCount() > 0)
107 pMapEnum = Collection::HashMapT<String, String*>::GetMapEnumeratorN();
108 SysTryReturn(NID_UI_ANIM, (pMapEnum != null), , E_SYSTEM, "[E_SYSTEM] System Error.");
110 Collection::MapEntryT< String, String* > value;
111 while ((pMapEnum->MoveNext() == E_SUCCESS))
113 r = pMapEnum->GetCurrent(value);
114 SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System Error.");
116 String* pObj = value.GetValue();
119 Collection::HashMapT<String, String*>::RemoveAll();
130 ConfigParser::ColorMatchingMap::Initialize(const String& version, const String& dVersion)
132 if (HashMapT<String, String*>::Construct(0,0,*__pProvider, *__pComparer) != E_SUCCESS)
137 if(version == L"beta1")
139 Add(L"W0612", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text_disabled"));
140 Add(L"B0622", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_01"));
141 Add(L"B0231", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_01"));
142 Add(L"B022", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_01"));
144 Add(L"B011", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_bg"));
145 Add(L"B012", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_group_list_bg"));
146 Add(L"B013", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_black"));
147 Add(L"B014", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_white"));
148 Add(L"B015", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_list_reorder_bg"));
149 Add(L"B0211", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_bg"));
150 Add(L"B0211D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_bg_disabled"));
151 Add(L"B0212", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_item_bg"));
152 Add(L"B0213", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_grid_item_bg"));
153 Add(L"B0214", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_2nd_depth_item_bg"));
154 Add(L"B0215", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_bg"));
155 Add(L"B0216", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_select_all_item_bg"));
156 Add(L"B0217", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bg"));
157 Add(L"B0217D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bg_disabled"));
158 Add(L"B0221", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_01"));
159 Add(L"B0222", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_02"));
160 Add(L"B0231L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_01"));
161 Add(L"B0231L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_02"));
162 Add(L"B0232", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bar"));
163 Add(L"B0233", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_top_line"));
164 Add(L"B031", new (std::nothrow) String(L"DEFAULTCOLORTABLE::indicator_bg"));
165 Add(L"B041", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_bg_pressed"));
166 Add(L"B042", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_item_bg_pressed"));
167 Add(L"B043", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_item_bg_pressed"));
168 Add(L"B044", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_bg_pressed"));
169 Add(L"B0511", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_bg"));
170 Add(L"B0512", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_optiontray_bg"));
171 Add(L"B0513", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_bg"));
172 Add(L"B0514", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg"));
173 Add(L"B0514P1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg_selected"));
174 Add(L"B0514P2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg_edit"));
175 Add(L"B0515", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_toolbar_bg"));
176 Add(L"B0516", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_toolbar_item_bg_pressed"));
177 Add(L"B0517", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_bg"));
178 Add(L"B0517P1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_selected"));
179 Add(L"B0517P2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_bg_edit"));
180 Add(L"B0518", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_item_bg"));
181 Add(L"B0518P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_bg"));
182 Add(L"B0520", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_bg_normal"));
183 Add(L"B0520P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_bg_pressed"));
184 Add(L"B052L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_normal"));
185 Add(L"B052L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_selected"));
186 Add(L"B052L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_disabled"));
187 Add(L"B052L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_normal"));
188 Add(L"B052L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_more_icon_pressed"));
189 Add(L"B052L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_font_normal"));
190 Add(L"B052L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_normal"));
191 Add(L"B052L4P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_pressed"));
192 Add(L"B052L4D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_disabled"));
193 Add(L"B052L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_title_text_normal"));
194 Add(L"B052L6", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_text_normal"));
195 Add(L"B052L6P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_text_pressed"));
196 Add(L"B052L8", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_normal"));
197 Add(L"B052L8P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_pressed"));
198 Add(L"B052L8D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_disabled"));
199 Add(L"B052L9", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_normal"));
200 Add(L"B052L9P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_pressed"));
201 Add(L"B052L9D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_disabled"));
202 Add(L"B0531", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_item_bg_normal"));
203 Add(L"B0532", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_item_bg_selected"));
204 Add(L"B0533", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_segment_item_bg_normal"));
205 Add(L"B0534", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_segment_item_bg_selected"));
206 Add(L"B0535", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_segment_item_bg_normal"));
207 Add(L"B0536", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_segment_item_bg_selected"));
208 Add(L"B0537", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_expandable_line"));
209 Add(L"B0545", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_button_item_bg_pressed"));
210 Add(L"B0556", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg"));
211 Add(L"B0557", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg_normal"));
212 Add(L"B0558", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg_pressed"));
213 Add(L"B061L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_bg"));
214 Add(L"B061L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_title_bg"));
215 Add(L"B061L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_bottom_bg"));
216 Add(L"B061L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_bg"));
217 Add(L"B0621", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_list_item_divider"));
218 Add(L"B0622L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_01"));
219 Add(L"B0622L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_02"));
220 Add(L"B0623L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_grid_item_divider_01"));
221 Add(L"B0623L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_grid_item_divider_02"));
222 Add(L"B063L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_text"));
223 Add(L"B063L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_pressed"));
224 Add(L"B063L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::ticker_detail_text"));
225 Add(L"B063L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_progress_text"));
226 Add(L"B063L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_title_text"));
227 Add(L"B063L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_normal"));
228 Add(L"B063L5D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_disabled"));
229 Add(L"B071", new (std::nothrow) String(L"DEFAULTCOLORTABLE::scroll_bar_bg"));
230 Add(L"B0721", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_text_normal"));
231 Add(L"B0722", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_text_selected"));
232 Add(L"B0723", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_bg"));
233 Add(L"B0724", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_line_01"));
234 Add(L"B0725", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_line_02"));
235 Add(L"B0731", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_popup_bg"));
236 Add(L"B0732", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_popup_text"));
237 Add(L"B0741", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_text_normal"));
238 Add(L"B0742", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_text_selected"));
239 Add(L"B0743", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_bg"));
240 Add(L"B0744", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_line_01"));
241 Add(L"B0745", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_line_02"));
242 Add(L"B0751", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_popup_bg"));
243 Add(L"F011L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_normal"));
244 Add(L"F011L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_pressed"));
245 Add(L"F011L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_disabled"));
246 Add(L"F011L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_setting_normal"));
247 Add(L"F011L2D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_setting_disabled"));
248 Add(L"F011L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_title_normal"));
249 Add(L"F011L3D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_title_disabled"));
250 Add(L"F011L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_read_normal"));
251 Add(L"F011L4D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_read_disabled"));
252 Add(L"F011L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_title_text"));
253 Add(L"F011L6", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_no_content_text"));
254 Add(L"F011L7", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_3line_2nd_text_normal"));
255 Add(L"F011L7D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_3line_2nd_text_disabled"));
256 Add(L"F011L8", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_invalid"));
257 Add(L"F011L9", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_white"));
258 Add(L"F011L10", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_bubble_text"));
259 Add(L"F011L11", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_contact_text"));
260 Add(L"F011L12", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_name_text"));
261 Add(L"F011L13", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_edit_mode_text_01"));
262 Add(L"F011L14", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_edit_mode_text_02"));
263 Add(L"F011L15", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_failed_text"));
264 Add(L"F011L16", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_sent_text"));
265 Add(L"F011L17", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_receive_text"));
266 Add(L"F011L18", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_date_text"));
267 Add(L"F011L19", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_group_chat_name_text"));
268 Add(L"F011L20", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sweep_text"));
269 Add(L"F011L21", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_help_text"));
270 Add(L"F011L22", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_help_text"));
271 Add(L"F021L1i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_normal"));
272 Add(L"F021L1iP", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_pressed"));
273 Add(L"F021L1iD", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_disabled"));
274 Add(L"F022L1i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_star_icon_normal"));
275 Add(L"F022L2i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_star_icon_selected"));
276 Add(L"F031L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_normal"));
277 Add(L"F031L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_pressed"));
278 Add(L"F031L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_disabled"));
279 Add(L"F031L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_normal"));
280 Add(L"F031L3P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_pressed"));
281 Add(L"F031L3D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_disabled"));
282 Add(L"F032L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_normal"));
283 Add(L"F032L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_pressed"));
284 Add(L"F032L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_disabled"));
285 Add(L"F032L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_normal"));
286 Add(L"F032L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_pressed"));
287 Add(L"F032L2D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_disabled"));
288 Add(L"F041i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_icon_normal"));
289 Add(L"F041iD", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_icon_disabled"));
290 Add(L"F051", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_guide_text"));
291 Add(L"F052", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_cursor"));
292 Add(L"W011", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_bg"));
293 Add(L"W012", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_button_bg"));
294 Add(L"W013", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_item_button_bg"));
295 Add(L"W0141", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_delete_button_bg_normal"));
296 Add(L"W0141P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_delete_button_bg_pressed"));
297 Add(L"W021L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_bg_normal"));
298 Add(L"W021L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_bg_pressed"));
299 Add(L"W021L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_line_normal"));
300 Add(L"W021L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_line_pressed"));
301 Add(L"W021L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_text_normal"));
302 Add(L"W021L3P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_text_pressed"));
303 Add(L"W031", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_field_bg_normal"));
304 Add(L"W031D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_field_bg_disabled"));
305 Add(L"W032", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_text_normal"));
306 Add(L"W032D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_text_disabled"));
307 Add(L"W041", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_bg"));
308 Add(L"W0611", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text"));
309 Add(L"W0611D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text_disabled"));
310 Add(L"W062L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bar_bg"));
311 Add(L"W062L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bar"));
312 Add(L"W062L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::progress_circle_bar_bg"));
313 Add(L"W062L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::progress_circle_bar"));
314 Add(L"W063", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bubble_bg"));
315 Add(L"W0641", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg"));
316 Add(L"W0641P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg_pressed"));
317 Add(L"W0641D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg_disabled"));
318 Add(L"W0711", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_bg_normal"));
319 Add(L"W0712", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_outline_normal"));
320 Add(L"W0713", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_bg_pressed"));
321 Add(L"W0714", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_outline_pressed"));
322 Add(L"W0721", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_expansion_button_bg"));
323 Add(L"W0811", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_bg"));
324 Add(L"W0812", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_button_bg"));
325 Add(L"W082", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_bg"));
326 Add(L"W083", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_keypad_button_bg"));
327 Add(L"W084", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_text_normal"));
328 Add(L"W084P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_text_pressed"));
329 Add(L"W101", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_bg_pressed"));
330 Add(L"W111", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_bg"));
331 Add(L"W1121", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_normal"));
332 Add(L"W1122", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_pressed"));
333 Add(L"W1123", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_disabled"));
334 Add(L"W1211", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_bg"));
335 Add(L"W1212", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_inputmode_bg"));
336 Add(L"W1221", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text"));
337 Add(L"W1222", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text_inputmode"));
338 Add(L"W1223", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text_pressed"));
339 Add(L"W131", new (std::nothrow) String(L"DEFAULTCOLORTABLE::splitpanel_divider_bg"));
340 Add(L"W132", new (std::nothrow) String(L"DEFAULTCOLORTABLE::splitpanel_divider_bg_pressed"));
341 Add(L"W141", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_no_content_icon"));
342 Add(L"W151", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_normal"));
343 Add(L"W152", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_loading"));
344 Add(L"W153", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_selected"));
349 HashMapT<String, String*>*
350 ConfigParser::GetMatchingTable(void)
352 return pColorMatchingMap;
355 ConfigParser::ConfigParser(void)
356 : __pMapContainer(null)
357 , __currentAttribute(L"")
360 ConfigParser::~ConfigParser(void)
362 delete pColorMatchingMap;
363 pColorMatchingMap = null;
366 ConfigParser::Parse(const String& filename, MapContainer & table)
370 FileAttributes attrib;
372 byte* pXmlContents = null;
373 result r = E_SUCCESS;
376 if (!File::IsFileExist(filename))
380 r = file.Construct(filename, L"r");
383 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- XML file Construct.");
387 r = Tizen::Io::File::GetAttributes(filename, attrib);
390 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- XML file GetAttributes.");
393 size = (int) attrib.GetFileSize();
395 r = buffer.Construct(size);
398 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed - Buffer Construct Failed.");
402 r = file.Read(buffer);
405 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- can't read the file.");
409 readCount = buffer.GetPosition();
410 pXmlContents = new (std::nothrow) byte[readCount];
411 SysTryReturn(NID_UI, pXmlContents != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create XmlContents.");
414 r = buffer.GetArray(pXmlContents, 0, readCount);
417 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- buffer.GetArray is Failed.");
418 delete[] pXmlContents;
421 char* pXmlBuffer = (char*) pXmlContents;
423 __pMapContainer = &table;
424 pConfigXmlHandler = this;
425 xmlSAXHandlerPtr pMySaxhandler = &mySaxHandler;
426 xmlSubstituteEntitiesDefault(1);
427 xmlSAXUserParseMemory(pMySaxhandler, null, pXmlBuffer, readCount);
428 pConfigXmlHandler = null;
429 delete [] pXmlContents;
433 ConfigParser::StartSaxFunc(void* pXmlParserCtxt, const xmlChar* pName, const xmlChar** pAttributes)
435 if (xmlStrcasecmp(pName, (xmlChar*) "Image") == 0)
437 pConfigXmlHandler->AddImage(pAttributes);
439 else if (xmlStrcasecmp(pName, (xmlChar*) "Color") == 0)
441 pConfigXmlHandler->AddColor(pAttributes);
443 else if (xmlStrcasecmp(pName, (xmlChar*) "Resource") == 0)
445 pConfigXmlHandler->SetInformation(pAttributes);
447 else if (xmlStrcasecmp(pName, (xmlChar*) "Palette") == 0)
449 pConfigXmlHandler->StartAttribute(pAttributes);
451 else if (xmlStrcasecmp(pName, (xmlChar*) "Control") == 0)
453 pConfigXmlHandler->StartAttribute(pAttributes);
462 ConfigParser::SetInformation(const xmlChar** pAttributes)
464 if (pAttributes != null)
466 for (int i = 0; (pAttributes[i] != null); i++)
468 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Version") == 0)
470 String version = (char*) pAttributes[++i];
471 __pMapContainer->SetVersion(version);
472 // ColorMatchingMap* matchingMap = new ColorMatchingMap;
473 // if (!matchingMap->Initialize(version))
475 // delete matchingMap;
479 // pColorMatchingMap = matchingMap;
487 ConfigParser::StartAttribute(const xmlChar** pAttributes)
489 if (pAttributes != null)
491 for (int i = 0; (pAttributes[i] != null); i++)
493 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Name") == 0)
495 __currentAttribute = (char*) pAttributes[++i];
502 ConfigParser::AddColor(const xmlChar** pAttributes)
504 if (pAttributes != null)
506 for (int i = 0; (pAttributes[i] != null); i++)
508 if (pAttributes[++i] != null)
511 String key = __currentAttribute + L"::" + (char*) pAttributes[i - 1];
512 if(__pMapContainer->GetColorMap()->ContainsKey(key, exist) == E_SUCCESS)
517 GetValue((char*) pAttributes[i], color);
518 SysLog(NID_UI,"The resource config parser changes resource color value, key %s, color %s", pAttributes[i - 1], pAttributes[i]);
519 __pMapContainer->GetColorMap()->SetValue(key,&color);
523 Color* pColor = new (std::nothrow) Color();
524 SysTryReturnVoidResult(NID_UI, pColor, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
525 SysLog(NID_UI,"The resource config parser adds resource color, key %s, color %s", pAttributes[i - 1], pAttributes[i]);
526 GetValue((char*) pAttributes[i], *pColor);
527 result r = __pMapContainer->GetColorMap()->Add(key, pColor);
540 ConfigParser::AddImage(const xmlChar** pAttributes)
542 if (pAttributes != null)
544 for (int i = 0; (pAttributes[i] != null); i++)
546 if (pAttributes[++i] != null)
549 String key = __currentAttribute + L"::" + (char*) pAttributes[i - 1];
550 if(__pMapContainer->GetImageMap()->ContainsKey(key, exist) == E_SUCCESS)
554 String value((char*) pAttributes[i]);
555 value.SubString(1, value);
556 __pMapContainer->GetImageMap()->SetValue(key,&value);
560 String* pString = new (std::nothrow) String((char*) pAttributes[i]);
561 SysTryReturnVoidResult(NID_UI, pString, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
562 pString->SubString(1,*pString);
563 result r = __pMapContainer->GetImageMap()->Add(key, pString);
576 ConfigParser::ConvertStringToColor32(const char* pString, Color& color)
582 unsigned int temp = 0;
584 len = strlen(pString);
588 SysLog(NID_UI, "String is empty");
592 for (index = 1; index < len + 1; index++)
595 if ((ch >= '0') && (ch <= '9'))
602 else if ((ch >= 'A') && (ch <= 'F'))
609 else if ((ch >= 'a') && (ch <= 'f'))
616 color.SetRGB32(temp, true);
620 ConfigParser::GetValue(const String& value, String& out)
622 if (value.StartsWith(L"#", 0))
624 value.SubString(1, out);
626 else if (value.StartsWith(L"$", 0))
628 String* pString = null;
629 if(__pMapContainer->GetImageMap()->GetValue(value, pString) != E_SUCCESS)
641 ConfigParser::GetValue(const String& value, Color& out)
643 if (value.StartsWith(L"#", 0))
645 char* pString = _StringConverter::CopyToCharArrayN(value);
646 ConvertStringToColor32(pString, out);
649 else if (value.StartsWith(L"$", 0))
651 Color* pColor = null;
653 value.SubString(1, key);
654 if(__pMapContainer->GetColorMap()->GetValue(key, pColor) != E_SUCCESS)