Cleaning up the property framework; removal of duplicate methods and incorrect assers
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pan-gesture-detector-impl.cpp
index 9ea8920..77bb5bb 100644 (file)
@@ -103,8 +103,6 @@ float GetOppositeAngle( float angle )
 
 } // unnamed namespace
 
-PanGestureDetector::DefaultPropertyLookup* PanGestureDetector::mDefaultPropertyLookup = NULL;
-
 PanGestureDetectorPtr PanGestureDetector::New()
 {
   return new PanGestureDetector;
@@ -116,15 +114,6 @@ PanGestureDetector::PanGestureDetector()
   mMaximumTouches(1),
   mSceneObject(NULL)
 {
-  if( !mDefaultPropertyLookup )
-  {
-    mDefaultPropertyLookup = new DefaultPropertyLookup();
-    const int start = DEFAULT_GESTURE_DETECTOR_PROPERTY_MAX_COUNT;
-    for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
-    {
-      ( *mDefaultPropertyLookup )[ DEFAULT_PROPERTIES[i].name ] = i + start;
-    }
-  }
 }
 
 PanGestureDetector::~PanGestureDetector()
@@ -335,11 +324,6 @@ void PanGestureDetector::OnActorDestroyed(Object& object)
   // Do nothing
 }
 
-bool PanGestureDetector::IsSceneObjectRemovable() const
-{
-  return false;
-}
-
 unsigned int PanGestureDetector::GetDefaultPropertyCount() const
 {
   return DEFAULT_PROPERTY_COUNT;
@@ -356,7 +340,7 @@ void PanGestureDetector::GetDefaultPropertyIndices( Property::IndexContainer& in
   }
 }
 
-const std::string& PanGestureDetector::GetDefaultPropertyName( Property::Index index ) const
+const char* PanGestureDetector::GetDefaultPropertyName( Property::Index index ) const
 {
   index -= DEFAULT_GESTURE_DETECTOR_PROPERTY_MAX_COUNT;
   if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
@@ -365,9 +349,7 @@ const std::string& PanGestureDetector::GetDefaultPropertyName( Property::Index i
   }
   else
   {
-    // Index out-of-range... return empty string.
-    static const std::string INVALID_PROPERTY_NAME;
-    return INVALID_PROPERTY_NAME;
+    return NULL;
   }
 }
 
@@ -375,15 +357,16 @@ Property::Index PanGestureDetector::GetDefaultPropertyIndex(const std::string& n
 {
   Property::Index index = Property::INVALID_INDEX;
 
-  DALI_ASSERT_DEBUG( NULL != mDefaultPropertyLookup );
-
   // Look for name in default properties
-  DefaultPropertyLookup::const_iterator result = mDefaultPropertyLookup->find( name );
-  if ( mDefaultPropertyLookup->end() != result )
+  for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
   {
-    index = result->second;
+    const Internal::PropertyDetails* property = &DEFAULT_PROPERTIES[ i ];
+    if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
+    {
+      index = i;
+      break;
+    }
   }
-
   return index;
 }
 
@@ -424,11 +407,6 @@ void PanGestureDetector::SetDefaultProperty( Property::Index index, const Proper
   // None of our properties should be settable from Public API
 }
 
-void PanGestureDetector::SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value )
-{
-  // None of our properties should be settable from Public API
-}
-
 Property::Value PanGestureDetector::GetDefaultProperty(Property::Index index) const
 {
   Property::Value value;
@@ -536,12 +514,6 @@ Property::Value PanGestureDetector::GetDefaultProperty(Property::Index index) co
   return value;
 }
 
-void PanGestureDetector::InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index )
-{
-  // We do not want the user to install custom properties
-  DALI_ASSERT_ALWAYS(false && "PanGestureDetector does not allow custom properties" );
-}
-
 const SceneGraph::PropertyOwner* PanGestureDetector::GetSceneObject() const
 {
   // This method should only return an object connected to the scene-graph
@@ -568,11 +540,9 @@ const PropertyInputImpl* PanGestureDetector::GetSceneObjectInputProperty( Proper
 
   if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
   {
-    CustomPropertyLookup::const_iterator entry = GetCustomPropertyLookup().find( index );
-
-    DALI_ASSERT_ALWAYS( GetCustomPropertyLookup().end() != entry && "property index is invalid" );
-
-    property = entry->second.GetSceneGraphProperty();
+    CustomProperty* custom = FindCustomProperty( index );
+    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
+    property = custom->GetSceneGraphProperty();
   }
   else
   {