From 162d93a14a389b20cb2cbb0719e80dcd0b15c132 Mon Sep 17 00:00:00 2001 From: Lee Morgan Date: Fri, 23 Oct 2015 13:51:32 +0100 Subject: [PATCH] Removed redundant type field Change-Id: Ibf4681ba76d685a620e6c149a487dbf8644540a5 --- dali/internal/event/actors/actor-impl.cpp | 2 +- dali/internal/event/common/object-impl-helper.h | 2 +- dali/internal/event/common/object-impl.cpp | 8 ++--- dali/internal/event/common/property-metadata.h | 41 ++++++++++++------------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index b34a01b..557e6d4 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -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: { diff --git a/dali/internal/event/common/object-impl-helper.h b/dali/internal/event/common/object-impl-helper.h index 8b5032b..016aa12 100644 --- a/dali/internal/event/common/object-impl-helper.h +++ b/dali/internal/event/common/object-impl-helper.h @@ -196,7 +196,7 @@ struct ObjectImplHelper { const SceneGraph::PropertyOwner* sceneObject = object->GetSceneObject(); - switch ( entry.type ) + switch ( entry.GetType() ) { case Property::BOOLEAN: { diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index f50fb07..501775d 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -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() ) ); } } diff --git a/dali/internal/event/common/property-metadata.h b/dali/internal/event/common/property-metadata.h index 61b3c82..3517b85 100644 --- a/dali/internal/event/common/property-metadata.h +++ b/dali/internal/event/common/property-metadata.h @@ -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* property = dynamic_cast< SceneGraph::AnimatableProperty* >( 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 -- 2.7.4