Task TT-75 Implement "Main page loading UI" view
[profile/tv/apps/web/browser.git] / core / Config / Config.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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 #ifndef __CONFIG_H__
18 #define __CONFIG_H__ 1
19
20 #include <string>
21 #include <map>
22
23 #include <boost/any.hpp>
24
25 namespace tizen_browser
26 {
27 namespace config
28 {
29
30 /**
31  * @brief Abstract config interface.
32  */
33 class BasicConfig
34 {
35 public:
36     virtual ~BasicConfig() {}
37     virtual void load(const std::string & filename) = 0;
38     virtual void store(const std::string & filename) = 0;
39 };
40
41
42 /**
43  * @brief Default config placeholder.
44  */
45 class DefaultConfig : BasicConfig
46 {
47 public:
48
49     /**
50      * @brief This method loads config from file, validates if file has
51          * necessary values and sections.
52      *
53      * @param filename Name of config file.
54      */
55     void load(const std::string & filename); //final;
56     /**
57      * @brief This method stores config to file.
58      *
59      * @param filename Name of config file.
60      */
61     void store(const std::string & filename); //final;
62     /**
63      * @brief This method gets value from config stored under key.
64      *
65      * @param key Key of item we want to get
66      *
67      * @return Value from config.
68      */
69     boost::any get(const std::string & key);
70     /**
71      * @brief This method sets passed value under passed key.
72      *
73      * @param key Key of item to set value.
74      * @param value Value to be set.
75      */
76     void set(const std::string & key, const boost::any & value);
77 private:
78     std::map<std::string, boost::any> m_data;
79 };
80
81
82 } /* end of namespace config */
83 } /* end of namespace tizen_browser */
84
85 #endif /* __CONFIG_H__ */