Dali 3D User Interface Engine
property-metadata.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_PROPERTY_METADATA_H__
2 #define __DALI_INTERNAL_PROPERTY_METADATA_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 
21 // EXTERNAL INCLUDES
22 #include <algorithm>
23 #include <utility>
24 
25 // INTERNAL INCLUDES
28 
29 namespace Dali
30 {
31 
32 namespace Internal
33 {
34 
35 namespace SceneGraph
36 {
37 class PropertyBase;
38 }
39 
56 {
57 public:
58 
63  : value(),
64  componentIndex(Property::INVALID_COMPONENT_INDEX),
65  mProperty(NULL)
66  {
67  }
68 
74  : value(), // value is held by newProperty
75  componentIndex(Property::INVALID_COMPONENT_INDEX),
76  mProperty(newProperty)
77  {
78  DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
79  }
80 
86  : value(newValue),
87  componentIndex(Property::INVALID_COMPONENT_INDEX),
88  mProperty(NULL)
89  {
90  }
91 
96  {
97  }
98 
102  bool IsAnimatable(void) const
103  {
104  return NULL != mProperty;
105  }
106 
110  virtual bool IsWritable(void) const = 0;
111 
116  {
117  DALI_ASSERT_DEBUG(mProperty && "Accessing uninitialized SceneGraph property");
118  return mProperty;
119  }
120 
121  /*
122  * @return type of the held property value
123  */
124  inline Property::Type GetType() const { return value.GetType(); }
125 
128 
129 protected:
130 
131  // Not implemented
134 
136 };
137 
138 
144 {
145 public:
146 
154  int newComponentIndex,
155  Property::Type newType,
156  const SceneGraph::PropertyBase* newProperty )
157  : index(newIndex)
158  {
159  componentIndex = newComponentIndex;
160  value = Property::Value(newType);
161  mProperty = newProperty;
162  DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
163  }
164 
171  int newComponentIndex,
172  Property::Value newValue )
173  : index(newIndex)
174  {
175  componentIndex = newComponentIndex;
176  value = newValue;
177  }
178 
182  virtual bool IsWritable(void) const
183  {
184  return true;
185  }
186 
188 
189 private:
190 
191  // Not implemented
195 };
196 
198 {
199 public:
200 
207  CustomPropertyMetadata( const std::string& newName,
208  Property::Type newType,
209  const SceneGraph::PropertyBase* newProperty)
210  : name(newName),
211  mAccessMode(Property::ANIMATABLE)
212  {
213  value = Property::Value(newType);
214  mProperty = newProperty;
215  DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
216  }
217 
224  CustomPropertyMetadata( const std::string& newName,
225  Property::Value newValue,
226  Property::AccessMode accessMode )
227  : name(newName),
228  mAccessMode(accessMode)
229  {
230  value = newValue;
231  DALI_ASSERT_DEBUG(accessMode != Property::ANIMATABLE && "Animatable must have scenegraph property");
232  }
233 
237  virtual bool IsWritable(void) const
238  {
240  }
241 
242  std::string name;
243 
244 private:
245 
246  // Not implemented
250 
251 private:
253 };
254 
255 } // namespace Internal
256 
257 } // namespace Dali
258 
259 #endif // __DALI_INTERNAL_PROPERTY_METADATA_H__
Dali Docs Home
Read more about Dali