[Release] wrt-plugins-common_0.3.66
[platform/framework/web/wrt-plugins-common.git] / src / 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.h>
31
32 namespace WrtPluginsApi
33 {
34
35 class Object;
36 typedef std::shared_ptr<Object> ObjectPtr;
37
38 struct ObjectOption
39 {
40     DPL::Optional<bool> overlayedMode;
41 };
42 typedef std::shared_ptr<ObjectOption> ObjectOptionPtr;
43
44
45 class Object : public IObject
46 {
47   public:
48     Object(const char* name,
49            ClassRef ref,
50            IObjectType type = IObjectType::Object);
51
52     Object(const char* name,
53            ClassRef ref,
54            const char* parentName = IObject::WINDOW_OBJECT(),
55            IObjectType type = IObjectType::Object);
56
57     Object(const char* name,
58            ClassRef interfaceRef,
59            const char* interfaceName,
60            ClassRef constructorRef,
61            const char* parentName = IObject::WINDOW_OBJECT(),
62            IObjectType type = IObjectType::Object);
63
64     ~Object();
65
66     void AddChild(const IObjectPtr& );
67
68     void setBoolOption(IObjectOption option, bool value);
69
70     IObjectsListPtr GetChildren() const ;
71
72     ClassRef GetClass() const;
73
74     /*
75      * Available only for object with type InterfaceInstance
76      * */
77     ClassRef GetClassConstructor() const;
78
79     const char* GetInterfaceName() const;
80
81     const char* GetName() const;
82
83     IObjectType GetType() const;
84
85     const char* GetParentName() const;
86
87     ObjectOptionPtr GetOptions() const;
88
89   private:
90     const char* m_name;
91     ClassRef m_classRef;
92
93     const char* m_parentName;
94
95     IObjectType m_type;
96
97     ClassRef m_interfaceRef;
98     const char* m_interfaceName;
99     ClassRef m_constructorRef;
100
101     ObjectOptionPtr m_options;
102
103     IObjectsListPtr m_children;
104 };
105
106 }
107
108 #endif