80c11f54b76dd62af3e2770f8c304f08ef688de1
[platform/core/uifw/libscl-ui-nui.git] / scl / main_entry_parser.h
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 <libxml/parser.h>
19
20 #ifndef __MainEntryParser__H__
21 #define __MainEntryParser__H__
22 class XMLFiles{
23     public:
24     char* input_mode_configure;
25     char* layout;
26     char* default_configure;
27     char* autopopup_configure;
28     char* magnifier_configure;
29     char* key_label_property;
30     char* modifier_decoration;
31     char* nine_patch_file_list;
32
33     public:
34     XMLFiles() {
35         input_mode_configure = NULL;
36         layout = NULL;
37         key_label_property = NULL;
38         modifier_decoration = NULL;
39         default_configure = NULL;
40         autopopup_configure = NULL;
41         magnifier_configure = NULL;
42         nine_patch_file_list = NULL;
43     }
44     ~XMLFiles() {
45         reset();
46     }
47     void reset() {
48         if (input_mode_configure)
49             xmlFree(input_mode_configure);
50         if (layout)
51             xmlFree(layout);
52         if (key_label_property)
53             xmlFree(key_label_property);
54         if (modifier_decoration)
55             xmlFree(modifier_decoration);
56         if (default_configure)
57             xmlFree(default_configure);
58         if (autopopup_configure)
59             xmlFree(autopopup_configure);
60         if (magnifier_configure)
61             xmlFree(magnifier_configure);
62         if (nine_patch_file_list)
63             xmlFree(nine_patch_file_list);
64
65         input_mode_configure = NULL;
66         layout = NULL;
67         key_label_property = NULL;
68         modifier_decoration = NULL;
69         default_configure = NULL;
70         autopopup_configure = NULL;
71         magnifier_configure = NULL;
72         nine_patch_file_list = NULL;
73     }
74 };
75
76 class MainEntryParserImpl;
77 class MainEntryParser {
78     MainEntryParserImpl *m_impl;
79     public:
80     /* parsing xml file, path is assigned */
81     int init(const char* path);
82     int reload(const char* path);
83
84     XMLFiles& get_xml_files();
85     public:
86     ~MainEntryParser();
87     static MainEntryParser *get_instance();
88     private:
89     MainEntryParser();
90 };
91
92 #endif