Cleaning up the property framework; removal of duplicate methods and incorrect assers
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / active-constraint-base.cpp
index 55ec3e5..05b58c5 100644 (file)
@@ -61,7 +61,7 @@ namespace // unnamed namespace
  * We want to discourage the use of property strings (minimize string comparisons),
  * particularly for the default properties.
  */
-const std::string DEFAULT_PROPERTY_NAMES[] =
+const char* DEFAULT_PROPERTY_NAMES[] =
 {
   "weight"
 };
@@ -315,11 +315,6 @@ unsigned int ActiveConstraintBase::GetTag() const
   return mTag;
 }
 
-bool ActiveConstraintBase::IsSceneObjectRemovable() const
-{
-  return true; // The constraint removed when target SceneGraph::PropertyOwner is destroyed
-}
-
 unsigned int ActiveConstraintBase::GetDefaultPropertyCount() const
 {
   return DEFAULT_PROPERTY_COUNT;
@@ -335,7 +330,7 @@ void ActiveConstraintBase::GetDefaultPropertyIndices( Property::IndexContainer&
   }
 }
 
-const std::string& ActiveConstraintBase::GetDefaultPropertyName( Property::Index index ) const
+const char* ActiveConstraintBase::GetDefaultPropertyName( Property::Index index ) const
 {
   if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
   {
@@ -343,9 +338,7 @@ const std::string& ActiveConstraintBase::GetDefaultPropertyName( Property::Index
   }
   else
   {
-    // index out of range..return empty string
-    static const std::string INVALID_PROPERTY_NAME;
-    return INVALID_PROPERTY_NAME;
+    return NULL;
   }
 }
 
@@ -354,7 +347,7 @@ Property::Index ActiveConstraintBase::GetDefaultPropertyIndex( const std::string
   Property::Index index = Property::INVALID_INDEX;
 
   // Only one name to compare with...
-  if ( name == DEFAULT_PROPERTY_NAMES[0] )
+  if( 0 == strcmp( name.c_str(), DEFAULT_PROPERTY_NAMES[0] ) ) // dont want to convert rhs to string
   {
     index = 0;
   }
@@ -392,54 +385,24 @@ Property::Type ActiveConstraintBase::GetDefaultPropertyType( Property::Index ind
 
 void ActiveConstraintBase::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
 {
-  switch ( index )
+  if( Dali::ActiveConstraint::WEIGHT == index )
   {
-    case Dali::ActiveConstraint::WEIGHT:
-    {
-      SetWeight( propertyValue.Get<float>() );
-      break;
-    }
-
-    default:
-    {
-      DALI_ASSERT_ALWAYS( false && "ActiveConstraint property out of bounds" ); // should not come here
-      break;
-    }
+    SetWeight( propertyValue.Get<float>() );
   }
 }
 
-void ActiveConstraintBase::SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value )
-{
-  DALI_ASSERT_ALWAYS( false && "ActiveConstraintBase does not have custom properties"); // should not come here
-}
-
 Property::Value ActiveConstraintBase::GetDefaultProperty( Property::Index index ) const
 {
   Property::Value value;
 
-  switch ( index )
+  if( Dali::ActiveConstraint::WEIGHT == index )
   {
-    case Dali::ActiveConstraint::WEIGHT:
-    {
-      value = GetCurrentWeight();
-      break;
-    }
-
-    default:
-    {
-      DALI_ASSERT_ALWAYS( false && "ActiveConstraint property out of bounds" ); // should not come here
-      break;
-    }
+    value = GetCurrentWeight();
   }
 
   return value;
 }
 
-void ActiveConstraintBase::InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index )
-{
-  DALI_ASSERT_ALWAYS( false && "ActiveConstraintBase does not have custom properties" ); // should not come here
-}
-
 const SceneGraph::PropertyOwner* ActiveConstraintBase::GetSceneObject() const
 {
   return mSceneGraphConstraint;