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