use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / linear-constrainer-impl.h
index 73b1706..52e9198 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_LINEAR_CONSTRAINER_H__
-#define __DALI_INTERNAL_LINEAR_CONSTRAINER_H__
+#ifndef DALI_INTERNAL_LINEAR_CONSTRAINER_H
+#define DALI_INTERNAL_LINEAR_CONSTRAINER_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -56,15 +56,15 @@ struct LinearConstraintFunctor
   /**
    * @brief Functor operator for float properties
    *
-   * @param[in,out] position Current value of the property
-   * @param[in]     inputs Contains the input property used as the parameter for the path
+   * @param[out]  value Current value of the property
+   * @param[in]   inputs Contains the input property used as the parameter for the path
    *
    * @return The value of the linear map at the given parameter.
    */
   void operator()( float& value,
                    const PropertyInputContainer& inputs)
   {
-    size_t valueCount(  mValue.Size() );
+    uint32_t valueCount = static_cast<uint32_t>(  mValue.Size() );
     if( valueCount == 0 )
     {
       //No values.
@@ -84,29 +84,33 @@ struct LinearConstraintFunctor
       float t = (( inputWrapped - mRange.x ) / ( mRange.y-mRange.x ));
 
       //Find min and max values and local t between them
-      size_t min(0);
-      size_t max(0);
+      uint32_t min(0);
+      uint32_t max(0);
       float tLocal(0.0f);
       if( mProgress.Size() < valueCount )
       {
-        float step = 1.0f / (valueCount-1.0f);
-        min = static_cast<int>(t/step);
-        max = min+1;
-        if( min < 0)
+        float step = 1.0f / (static_cast<float>( valueCount ) - 1.0f);
+        float tLocation = t / step;
+        if( tLocation < 0 )
         {
           min = 0;
           max = 1;
         }
-        else if( min >= valueCount-1)
+        else if( tLocation >= static_cast<float>( valueCount-1 ) )
         {
           min = max = valueCount-1;
         }
+        else
+        {
+          min = static_cast<uint32_t>(tLocation);
+          max = min+1;
+        }
 
-        tLocal =(t - min*step) / step;
+        tLocal = (t - static_cast<float>(min)*step) / step;
       }
       else
       {
-        while( t >= mProgress[min] && min < valueCount-1 )
+        while( ( min < valueCount-1 )&&( t >= mProgress[min] ) )
         {
           min++;
         }
@@ -114,7 +118,7 @@ struct LinearConstraintFunctor
         min--;
         max = min+1;
 
-        if( min >= valueCount-1)
+        if( min >= valueCount-1 )
         {
           min = max = valueCount-1;
           tLocal = 0.0f;
@@ -155,66 +159,31 @@ protected:
   /**
    * virtual destructor
    */
-  virtual ~LinearConstrainer();
+  ~LinearConstrainer() override;
 
 private:
 
   /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
-   */
-  virtual unsigned int GetDefaultPropertyCount() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
-   */
-  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
-   */
-  virtual const char* GetDefaultPropertyName(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
-   */
-  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
-   */
-  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
-   */
-  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
-   */
-  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
-   */
-  virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
-
-  /**
    * @copydoc Dali::Internal::Object::SetDefaultProperty()
    */
-  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
+  void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
 
-   /**
+  /**
    * @copydoc Dali::Internal::Object::GetDefaultProperty()
    */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
+  Property::Value GetDefaultProperty( Property::Index index ) const override;
+
+ /**
+  * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
+  */
+ Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const override;
 
 public:
 
   /**
    * @copydoc Dali::PathConstrainer::Apply
    */
-  void Apply( Property target, Property source, const Vector2& range, const Vector2& wrap );
+  void Apply( Property target, Property source, const Vector2& range, const Vector2& wrap ) override;
 
 private:
 
@@ -250,4 +219,4 @@ inline const Internal::LinearConstrainer& GetImplementation(const Dali::LinearCo
 
 } // Dali
 
-#endif //__DALI_INTERNAL_PATH_CONSTRAINER_H__
+#endif // DALI_INTERNAL_PATH_CONSTRAINER_H