75bc55a249e9bf8c5191c029e47ebe2b91cb62eb
[framework/web/wrt-plugins-common.git] / src / modules / tizen / VConf / Node.h
1 /*
2  * Copyright (c) 2011 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 #ifndef WRTDEVICEAPIS_VCONF_NODE_H_
17 #define WRTDEVICEAPIS_VCONF_NODE_H_
18
19 #include <string>
20 #include <vconf.h>
21 #include <dpl/noncopyable.h>
22 #include <dpl/shared_ptr.h>
23
24 namespace WrtDeviceApis {
25 namespace VConf {
26 class Key;
27
28 class Node : private DPL::Noncopyable
29 {
30     friend class Key;
31
32   public:
33     /**
34      * Type of the node.
35      */
36     enum Type
37     {
38         TYPE_BOOL     = VCONF_TYPE_BOOL, //!< TYPE_BOOL
39         TYPE_INT      = VCONF_TYPE_INT, //!< TYPE_INT
40         TYPE_DOUBLE   = VCONF_TYPE_DOUBLE, //!< TYPE_DOUBLE
41         TYPE_STRING   = VCONF_TYPE_STRING //!< TYPE_STRING
42     };
43
44   public:
45     /**
46      * Gets node name.
47      * @return Node's name.
48      */
49     std::string getName() const;
50
51     /**
52      * Gets node type.
53      * @return Node's type.
54      */
55     Type getType() const;
56
57   private:
58     explicit Node(keynode_t* node);
59
60   private:
61     mutable keynode_t* m_node;
62     std::string m_name; ///< Name of the node.
63     Type m_type; ///< Type of the node.
64 };
65
66 typedef DPL::SharedPtr<Node> NodePtr;
67 } // VConf
68 } // WrtDeviceApis
69 #endif /* WRTDEVICEAPIS_VCONF_NODE_H_ */