Fix issue detected by static analysis tool
[platform/core/uifw/libscl-ui.git] / sclres / sclres.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 #ifndef __SCLRES__
19 #define __SCLRES__
20 #include "sclres_type.h"
21 #include <string>
22
23 namespace sclres {
24 class SclRes{
25 public:
26     SclRes();
27     virtual ~SclRes();
28
29     /* Inform the SclRes where the resource files are */
30     virtual void set_resource_directory(const char *directory);
31     /* Returns the current filepath where the resource files are */
32     virtual const char* get_resource_directory();
33
34 public: /* These are the functions need to be implemented by the descendants of SclRes */
35     /* Initialize SclRes, with the given entry file that exists under the resource directory */
36     virtual void init(const char *entry_filename) = 0;
37     virtual void reload() = 0;
38
39     /* These functions are for dynamic (lazy) loading layouts */
40     virtual void load(int layout_id) = 0;
41     virtual void unload() = 0;
42     virtual bool loaded(int layout_id) = 0;
43
44     /* Functions returning the SCL structure containing the information described in resource files */
45     virtual PSclInputModeConfigure get_input_mode_configure_table() = 0;
46     virtual PSclLayout get_layout_table() = 0;
47     virtual PSclLayoutKeyCoordinatePointerTable get_key_coordinate_pointer_frame() = 0;
48     virtual PSclModifierDecoration get_modifier_decoration_table() = 0;
49     virtual PSclLabelPropertiesTable get_label_properties_frame() = 0;
50     virtual PSclDefaultConfigure get_default_configure() = 0;
51     virtual PSclAutoPopupConfigure get_autopopup_configure() = 0;
52     virtual PSclMagnifierWndConfigure get_magnifier_configure() = 0;
53
54     /* Functions returning specific data described in resource files */
55     virtual int get_inputmode_id(const char* name) = 0;
56     virtual const char* get_inputmode_name(int id) = 0;
57     virtual int get_inputmode_size() = 0;
58     virtual int get_layout_id(const char* name) = 0;
59     virtual int get_layout_size() = 0;
60     virtual int get_labelproperty_size() = 0;
61     virtual int get_modifier_decoration_id(const char *name) = 0;
62     virtual bool get_nine_patch_info(const char *filename, SclNinePatchInfo *info) = 0;
63
64     /* Function returning the name of current SclRes instance */
65     virtual const char* get_name() = 0;
66
67 private:
68     std::string m_resource_directory;
69 };
70 }
71
72 #endif
73