Initialize Tizen 2.3
[framework/web/wrt-plugins-common.git] / src_mobile / plugins-api-support / Object.cpp
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    Object.cpp
18  * @author  Grzegorz Krawczyk (g.krawczyk@samgsung.com)
19  * @version
20  * @brief
21  */
22
23 #include "Object.h"
24
25 namespace WrtPluginsApi {
26 void Object::AddChild(const IObjectPtr& child)
27 {
28     if (!m_children) {
29         m_children = IObjectsListPtr(new IObjectsList);
30     }
31     m_children->push_back(child);
32 }
33
34 void Object::setBoolOption(IObjectOption option, bool value)
35 {
36     if (!m_options) {
37         m_options = ObjectOptionPtr(new ObjectOption);
38     }
39
40     switch (option) {
41     case IObjectOption::Overlayed:
42         m_options->overlayedMode = value;
43         break;
44     default:
45         break;
46     }
47 }
48
49 IObjectsListPtr Object::GetChildren() const
50 {
51     return m_children;
52 }
53
54 ClassRef Object::GetClass() const
55 {
56     return m_classRef;
57 }
58
59 ClassRef Object::GetClassConstructor() const
60 {
61     return m_constructorRef;
62 }
63
64 const char* Object::GetInterfaceName() const
65 {
66     return m_interfaceName;
67 }
68
69 const char* Object::GetName() const
70 {
71     return m_name;
72 }
73
74 IObjectType Object::GetType() const
75 {
76     return m_type;
77 }
78
79 const char* Object::GetParentName() const
80 {
81     return m_parentName;
82 }
83
84 ObjectOptionPtr Object::GetOptions() const
85 {
86     return m_options;
87 }
88
89 Object::Object(const char* name,
90                ClassRef ref,
91                IObjectType type) :
92     m_name(name),
93     m_classRef(ref),
94     m_parentName(0),
95     m_type(type),
96     m_interfaceRef(0),
97     m_interfaceName(0),
98     m_constructorRef(0)
99 {}
100
101 Object::Object(const char* name,
102                ClassRef ref,
103                const char* parentName,
104                IObjectType type) :
105     m_name(name),
106     m_classRef(ref),
107     m_parentName(parentName),
108     m_type(type),
109     m_interfaceRef(0),
110     m_interfaceName(0),
111     m_constructorRef(0)
112 {}
113
114 Object::Object(const char* name,
115                ClassRef interfaceRef,
116                const char* interfaceName,
117                ClassRef constructorRef,
118                const char* parentName,
119                IObjectType type) :
120     m_name(name),
121     m_parentName(parentName),
122     m_type(type),
123     m_interfaceRef(interfaceRef),
124     m_interfaceName(interfaceName),
125     m_constructorRef(constructorRef)
126 {}
127
128 Object::~Object()
129 {}
130 }