20008932974472bf7b89fd21411f176ca22c8fae
[platform/core/uifw/libscl-ui-nui.git] / scl / magnifier_configure_bin_parser.cpp
1 /*
2  * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include "magnifier_configure_bin_parser.h"
19 #include "file_storage.h"
20 #include <assert.h>
21 using namespace std;
22 #include "put_record.h"
23
24 BinMagnifierConfigParser::BinMagnifierConfigParser() {
25     memset((void*)&m_magnifier_configure, 0x00, sizeof(SclMagnifierWndConfigure));
26     parser_info_provider = NULL;
27 }
28
29 BinMagnifierConfigParser::~BinMagnifierConfigParser() {
30 }
31
32 BinMagnifierConfigParser* BinMagnifierConfigParser::get_instance() {
33     static BinMagnifierConfigParser instance;
34     return &instance;
35 }
36
37 void BinMagnifierConfigParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* provider) {
38     m_storage.set_str_provider(provider);
39     m_storage.get_storage(storage, offset, size);
40     this->parser_info_provider = provider;
41     parsing_magnifier_configure();
42 }
43
44
45 void BinMagnifierConfigParser::parsing_magnifier_configure() {
46     Magnifier_configure_width record_width;
47     set_magnifier_configure_width(*parser_info_provider, record_width);
48
49     PSclMagnifierWndConfigure cur = &m_magnifier_configure;
50
51     // skip data_size
52     m_storage.advance(8);
53
54     //style
55     cur->style = (SCLMagnifierStyle)m_storage.get<sint_t>(record_width.style);
56     //width
57     cur->width = m_storage.get<sint_t>(record_width.width);
58     //height
59     cur->height = m_storage.get<sint_t>(record_width.height);
60     //label_area_record.left
61     cur->label_area_rect.left = m_storage.get<sint_t>(record_width.label_area_rect);
62     //label_area_rect.right
63     cur->label_area_rect.right = m_storage.get<sint_t>(record_width.label_area_rect);
64
65     //label_area_record.top
66     cur->label_area_rect.top = m_storage.get<sint_t>(record_width.label_area_rect);
67     //label_area_rect.bottom
68     cur->label_area_rect.bottom = m_storage.get<sint_t>(record_width.label_area_rect);
69     //bg_image_path
70     m_storage.get_str(&(cur->bg_image_path), record_width.bg_image_path, m_string_collector);
71
72     //bg_shift_image_path
73     m_storage.get_str(&(cur->bg_shift_image_path), record_width.bg_shift_image_path, m_string_collector);
74
75     //bg_shift_lock_image_path
76     m_storage.get_str(&(cur->bg_shift_lock_image_path), record_width.bg_shift_lock_image_path, m_string_collector);
77
78     //bg_long_key_image_path
79     m_storage.get_str(&(cur->bg_long_key_image_path), record_width.bg_long_key_image_path, m_string_collector);
80     //use_actual_window
81     cur->use_actual_window = m_storage.get<sint_t>(record_width.use_actual_window);
82     //label_name
83     m_storage.get_str(&(cur->label_type), record_width.label_type, m_string_collector);
84     //padding_x
85     cur->padding_x = m_storage.get<sint_t>(record_width.padding_x);
86     //padding_y
87     cur->padding_y = m_storage.get<sint_t>(record_width.padding_y);
88     //show_shift_label
89     cur->show_shift_label = m_storage.get<sint_t>(record_width.show_shift_label);
90
91 #ifdef __SCL_TXT_DEBUG
92     put_magnifier_wnd_configure(DECODE, m_magnifier_configure);
93 #endif
94 }
95
96 PSclMagnifierWndConfigure BinMagnifierConfigParser::get_magnifier_configure() {
97     return &m_magnifier_configure;
98 }
99