Initialize Tizen 2.3
[framework/web/wrt-plugins-common.git] / src_wearable / plugins-api-support / Object.h
1 /*
2  * Copyright (c) 2012 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  * @file    IObject.h
18  * @author  Grzegorz Krawczyk (g.krawczyk@samgsung.com)
19  * @version
20  * @brief
21  */
22
23 #ifndef _WRT_PLUGINS_COMMON_PLUGIN_API_SUPPORT_OBJECT_H_
24 #define _WRT_PLUGINS_COMMON_PLUGIN_API_SUPPORT_OBJECT_H_
25
26 #include <memory>
27 #include <list>
28
29 #include <IObject.h>
30 #include <dpl/optional_typedefs.h>
31
32 namespace WrtPluginsApi {
33 class Object;
34 typedef std::shared_ptr<Object> ObjectPtr;
35
36 struct ObjectOption
37 {
38     DPL::OptionalBool overlayedMode;
39 };
40 typedef std::shared_ptr<ObjectOption> ObjectOptionPtr;
41
42 class Object : public IObject
43 {
44   public:
45     Object(const char* name,
46            ClassRef ref,
47            IObjectType type = IObjectType::Object);
48
49     Object(const char* name,
50            ClassRef ref,
51            const char* parentName = IObject::WINDOW_OBJECT(),
52            IObjectType type = IObjectType::Object);
53
54     Object(const char* name,
55            ClassRef interfaceRef,
56            const char* interfaceName,
57            ClassRef constructorRef,
58            const char* parentName = IObject::WINDOW_OBJECT(),
59            IObjectType type = IObjectType::Object);
60
61     ~Object();
62
63     void AddChild(const IObjectPtr&);
64
65     void setBoolOption(IObjectOption option, bool value);
66
67     IObjectsListPtr GetChildren() const;
68
69     ClassRef GetClass() const;
70
71     /*
72      * Available only for object with type InterfaceInstance
73      * */
74     ClassRef GetClassConstructor() const;
75
76     const char* GetInterfaceName() const;
77
78     const char* GetName() const;
79
80     IObjectType GetType() const;
81
82     const char* GetParentName() const;
83
84     ObjectOptionPtr GetOptions() const;
85
86   private:
87     const char* m_name;
88     ClassRef m_classRef;
89
90     const char* m_parentName;
91
92     IObjectType m_type;
93
94     ClassRef m_interfaceRef;
95     const char* m_interfaceName;
96     ClassRef m_constructorRef;
97
98     ObjectOptionPtr m_options;
99
100     IObjectsListPtr m_children;
101 };
102 }
103
104 #endif