Removed redundant type field 06/50106/3
authorLee Morgan <Lee.morgan@partner.samsung.com>
Fri, 23 Oct 2015 12:51:32 +0000 (13:51 +0100)
committerLee Morgan <Lee.morgan@partner.samsung.com>
Fri, 23 Oct 2015 14:30:33 +0000 (15:30 +0100)
Change-Id: Ibf4681ba76d685a620e6c149a487dbf8644540a5

dali/internal/event/actors/actor-impl.cpp
dali/internal/event/common/object-impl-helper.h
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/property-metadata.h

index b34a01b..557e6d4 100644 (file)
@@ -2545,7 +2545,7 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 // TODO: This method needs to be removed
 void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
 {
-  switch( entry.type )
+  switch( entry.GetType() )
   {
     case Property::BOOLEAN:
     {
index 8b5032b..016aa12 100644 (file)
@@ -196,7 +196,7 @@ struct ObjectImplHelper
   {
     const SceneGraph::PropertyOwner* sceneObject = object->GetSceneObject();
 
-    switch ( entry.type )
+    switch ( entry.GetType() )
     {
       case Property::BOOLEAN:
       {
index f50fb07..501775d 100644 (file)
@@ -358,7 +358,7 @@ Property::Type Object::GetPropertyType( Property::Index index ) const
   CustomPropertyMetadata* custom = FindCustomProperty( index );
   if( custom )
   {
-    return custom->type;
+    return custom->GetType();
   }
   return Property::NONE;
 }
@@ -819,7 +819,7 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const
   {
     BufferIndex bufferIndex( GetEventThreadServices().GetEventBufferIndex() );
 
-    switch ( entry->type )
+    switch ( entry->GetType() )
     {
       case Property::BOOLEAN:
       {
@@ -960,7 +960,7 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const
 
 void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
 {
-  switch ( entry.type )
+  switch ( entry.GetType() )
   {
     case Property::BOOLEAN:
     {
@@ -1271,7 +1271,7 @@ AnimatablePropertyMetadata* Object::RegisterAnimatableProperty(Property::Index i
         if(animatableProperty)
         {
           // Create the metadata for the property component.
-          mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, typeInfo->GetComponentIndex(index), animatableProperty->type, animatableProperty->GetSceneGraphProperty() ) );
+          mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, typeInfo->GetComponentIndex(index), animatableProperty->GetType(), animatableProperty->GetSceneGraphProperty() ) );
         }
       }
 
index 61b3c82..3517b85 100644 (file)
@@ -39,12 +39,12 @@ class PropertyBase;
 
 /**
  * An entry in a property metadata lookup.
- * The type field should be queried, before accessing the scene-graph property:
+ * The value type field should be queried, before accessing the scene-graph property:
  *
  * @code
  * void Example(PropertyEntry entry)
  * {
- *   if (entry.type == Property::VECTOR3)
+ *   if (entry.value.GetType() == Property::VECTOR3)
  *   {
  *     SceneGraph::AnimatableProperty<Vector3>* property = dynamic_cast< SceneGraph::AnimatableProperty<Vector3>* >( entry.property );
  *     ...
@@ -60,8 +60,7 @@ public:
    * Constructor for an uninitalized property metadata
    */
   PropertyMetadata()
-  : type(Property::NONE),
-    value(),
+  : value(),
     componentIndex(Property::INVALID_COMPONENT_INDEX),
     mProperty(NULL)
   {
@@ -72,12 +71,11 @@ public:
    * @param [in] newProperty A pointer to the property metadata.
    */
   PropertyMetadata(const SceneGraph::PropertyBase* newProperty)
-  : type(Property::NONE),
-    value(), // value is held by newProperty
+  : value(), // value is held by newProperty
     componentIndex(Property::INVALID_COMPONENT_INDEX),
     mProperty(newProperty)
   {
-    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property") ;
+    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
   }
 
   /**
@@ -85,8 +83,7 @@ public:
    * @param [in] newValue The value of the scene-graph owned property.
    */
   PropertyMetadata(Property::Value newValue)
-  : type(newValue.GetType()),
-    value(newValue),
+  : value(newValue),
     componentIndex(Property::INVALID_COMPONENT_INDEX),
     mProperty(NULL)
   {
@@ -117,11 +114,15 @@ public:
    */
   const SceneGraph::PropertyBase* GetSceneGraphProperty() const
   {
-    DALI_ASSERT_DEBUG(mProperty && "Accessing uninitialized SceneGraph property") ;
+    DALI_ASSERT_DEBUG(mProperty && "Accessing uninitialized SceneGraph property");
     return mProperty;
   }
 
-  Property::Type type;    ///< The type of the property
+  /*
+   * @return type of the held property value
+   */
+  inline Property::Type GetType() const { return value.GetType(); }
+
   Property::Value value;  ///< The property value for a non animatable and custom property
   int componentIndex;     ///< The index of the property component
 
@@ -137,7 +138,7 @@ protected:
 
 /**
  * An entry in an animatable property metadata lookup.
- * The type field should be queried, before accessing the animatable property:
+ * The value type field should be queried, before accessing the animatable property:
  */
 class AnimatablePropertyMetadata : public PropertyMetadata
 {
@@ -156,9 +157,9 @@ public:
   : index(newIndex)
   {
     componentIndex = newComponentIndex;
-    type = newType;
+    value = Property::Value(newType);
     mProperty = newProperty;
-    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property") ;
+    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
   }
 
   /**
@@ -172,7 +173,6 @@ public:
   : index(newIndex)
   {
     componentIndex = newComponentIndex;
-    type = newValue.GetType();
     value = newValue;
   }
 
@@ -181,7 +181,7 @@ public:
    */
   virtual bool IsWritable(void) const
   {
-    return true ;
+    return true;
   }
 
   Property::Index index;       ///< The index of the property
@@ -210,9 +210,9 @@ public:
   : name(newName),
     mAccessMode(Property::ANIMATABLE)
   {
-    type = newType;
+    value = Property::Value(newType);
     mProperty = newProperty;
-    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property") ;
+    DALI_ASSERT_DEBUG(mProperty && "Uninitialized scenegraph property");
   }
 
   /**
@@ -227,9 +227,8 @@ public:
   : name(newName),
     mAccessMode(accessMode)
   {
-    type = newValue.GetType();
     value = newValue;
-    DALI_ASSERT_DEBUG(accessMode != Property::ANIMATABLE && "Animatable must have scenegraph property") ;
+    DALI_ASSERT_DEBUG(accessMode != Property::ANIMATABLE && "Animatable must have scenegraph property");
   }
 
   /**
@@ -237,7 +236,7 @@ public:
    */
   virtual bool IsWritable(void) const
   {
-    return (mAccessMode == Property::ANIMATABLE) || (mAccessMode == Property::READ_WRITE) ;
+    return (mAccessMode == Property::ANIMATABLE) || (mAccessMode == Property::READ_WRITE);
   }
 
   std::string name;       ///< The name of the property