Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / common / object-impl.h
1 #ifndef __DALI_INTERNAL_OBJECT_H__
2 #define __DALI_INTERNAL_OBJECT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/object/base-object.h>
22 #include <dali/public-api/object/handle.h>
23 #include <dali/public-api/object/property.h>
24
25 namespace Dali
26 {
27
28 class PropertyNotification;
29
30 namespace Internal
31 {
32 class Handle;
33
34 class PropertyCondition;
35
36 /**
37  * A base class for objects which optionally provide properties.
38  * The concrete derived class is responsible for implementing the property system methods.
39  * Classes may derive from Dali::BaseObject, until any properties are required.
40  */
41 class Object : public Dali::BaseObject
42 {
43 public:
44
45   typedef Dali::Handle::Capability Capability;
46
47   /**
48    * @copydoc Dali::Handle::Supports()
49    */
50   virtual bool Supports(Capability capability) const = 0;
51
52   /**
53    * @copydoc Dali::Handle::GetPropertyCount()
54    */
55   virtual unsigned int GetPropertyCount() const = 0;
56
57   /**
58    * @copydoc Dali::Handle::GetPropertyName()
59    */
60   virtual const std::string& GetPropertyName(Property::Index index) const = 0;
61
62   /**
63    * @copydoc Dali::Handle::GetPropertyIndex()
64    */
65   virtual Property::Index GetPropertyIndex(const std::string& name) const = 0;
66
67   /**
68    * @copydoc Dali::Handle::IsPropertyWritable()
69    */
70   virtual bool IsPropertyWritable(Property::Index index) const = 0;
71
72   /**
73    * @copydoc Dali::Handle::IsPropertyAnimatable()
74    */
75   virtual bool IsPropertyAnimatable(Property::Index index) const = 0;
76
77   /**
78    * @copydoc Dali::Handle::IsPropertyAConstraintInput()
79    */
80   virtual bool IsPropertyAConstraintInput(Property::Index index) const = 0;
81
82   /**
83    * @copydoc Dali::Handle::GetPropertyType()
84    */
85   virtual Property::Type GetPropertyType(Property::Index index) const = 0;
86
87   /**
88    * @copydoc Dali::Handle::SetProperty()
89    */
90   virtual void SetProperty(Property::Index index, const Property::Value& propertyValue) = 0;
91
92   /**
93    * @copydoc Dali::Handle::GetProperty()
94    */
95   virtual Property::Value GetProperty(Property::Index index) const = 0;
96
97   /**
98    * @copydoc Dali::Handle::GetPropertyIndices()
99    */
100   virtual void GetPropertyIndices( Property::IndexContainer& indices ) const = 0;
101
102   /**
103    * @copydoc Dali::Handle::RegisterProperty()
104    */
105   virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue) = 0;
106
107   /**
108    * @copydoc Dali::Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
109    */
110   virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue, Property::AccessMode accessMode) = 0;
111
112   /**
113    * @copydoc Dali::Handle::AddPropertyNotification()
114    */
115   virtual Dali::PropertyNotification AddPropertyNotification(Property::Index index,
116                                                              int componentIndex,
117                                                              const Dali::PropertyCondition& condition) = 0;
118
119   /**
120    * @copydoc Dali::Handle::RemovePropertyNotification()
121    */
122   virtual void RemovePropertyNotification(Dali::PropertyNotification propertyNotification) = 0;
123
124   /**
125    * @copydoc Dali::Handle::RemovePropertyNotifications()
126    */
127   virtual void RemovePropertyNotifications() = 0;
128
129
130 protected:
131
132   /**
133    * Default constructor.
134    */
135   Object()
136   {
137   }
138
139   /**
140    * A reference counted object may only be deleted by calling Unreference()
141    */
142   virtual ~Object()
143   {
144   }
145
146 private:
147
148   // Not implemented
149   Object(const Object& rhs);
150
151   // Not implemented
152   Object& operator=(const Object& rhs);
153 };
154
155 } // namespace Internal
156
157 // Helpers for public-api forwarding methods
158
159 inline Internal::Object& GetImplementation(Dali::Handle& object)
160 {
161   DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
162
163   BaseObject& handle = object.GetBaseObject();
164
165   return static_cast<Internal::Object&>(handle);
166 }
167
168 inline const Internal::Object& GetImplementation(const Dali::Handle& object)
169 {
170   DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
171
172   const BaseObject& handle = object.GetBaseObject();
173
174   return static_cast<const Internal::Object&>(handle);
175 }
176
177 } // namespace Dali
178
179 #endif // __DALI_INTERNAL_OBJECT_H__
180