use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / update / common / animatable-property.h
index 94730ad..a586a0d 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H
+#define DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H
 
 /*
- * Copyright (c) 2018 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.
@@ -77,7 +77,7 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatablePropertyBase()
+  ~AnimatablePropertyBase() override
   {}
 
 protected: // for derived classes
@@ -103,7 +103,7 @@ public: // From PropertyBase
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
    */
-  virtual bool IsClean() const
+  bool IsClean() const override
   {
     return ( CLEAN_FLAG == mDirtyFlags );
   }
@@ -111,7 +111,7 @@ public: // From PropertyBase
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
    */
-  virtual bool InputInitialized() const
+  bool InputInitialized() const override
   {
     return true; // Animatable properties are always valid
   }
@@ -144,14 +144,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<bool>();
   }
@@ -159,7 +159,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -172,7 +172,7 @@ public:
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::GetBoolean()
    */
-  virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
+  const bool& GetBoolean( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -205,7 +205,7 @@ public:
     // false + false does not change value, true + false does not either
     if( delta && !mValue[bufferIndex] )
     {
-      mValue[bufferIndex] += delta;
+      mValue[bufferIndex] = delta;
 
       OnSet();
     }
@@ -274,7 +274,7 @@ public:
    */
   void BakeRelative(BufferIndex bufferIndex, bool delta)
   {
-    mValue[bufferIndex] += delta;
+    mValue[bufferIndex] = mValue[bufferIndex] || delta;
     mBaseValue = mValue[bufferIndex];
 
     OnBake();
@@ -317,14 +317,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<int>();
   }
@@ -332,7 +332,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -345,7 +345,7 @@ public:
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::GetInteger()
    */
-  virtual const int& GetInteger( BufferIndex bufferIndex ) const
+  const int& GetInteger( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -498,14 +498,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<float>();
   }
@@ -513,7 +513,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -526,7 +526,7 @@ public:
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::GetFloat()
    */
-  virtual const float& GetFloat( BufferIndex bufferIndex ) const
+  const float& GetFloat( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -680,14 +680,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Vector2>();
   }
@@ -695,7 +695,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -708,7 +708,7 @@ public:
   /**
    * @copydoc Dali::PropertyInput::GetVector2()
    */
-  virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
+  const Vector2& GetVector2( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -952,14 +952,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Vector3>();
   }
@@ -967,7 +967,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -980,7 +980,7 @@ public:
   /**
    * @copydoc Dali::PropertyInput::GetVector3()
    */
-  virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
+  const Vector3& GetVector3( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -1278,14 +1278,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Vector4>();
   }
@@ -1293,7 +1293,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -1306,7 +1306,7 @@ public:
   /**
    * @copydoc Dali::PropertyInput::GetVector4()
    */
-  virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
+  const Vector4& GetVector4( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -1663,14 +1663,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Quaternion>();
   }
@@ -1678,7 +1678,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -1691,7 +1691,7 @@ public:
   /**
    * @copydoc Dali::PropertyInput::GetQuaternion()
    */
-  virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
+  const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -1822,14 +1822,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Matrix>();
   }
@@ -1837,7 +1837,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -1850,7 +1850,7 @@ public:
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix()
    */
-  virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
+  const Matrix& GetMatrix( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -1985,14 +1985,14 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatableProperty()
+  ~AnimatableProperty() override
   {
   }
 
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
    */
-  virtual Dali::Property::Type GetType() const
+  Dali::Property::Type GetType() const override
   {
     return Dali::PropertyTypes::Get<Matrix3>();
   }
@@ -2000,7 +2000,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyBase::ResetToBaseValue()
    */
-  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
   {
     if (CLEAN_FLAG != mDirtyFlags)
     {
@@ -2013,7 +2013,7 @@ public:
   /**
    * @copydoc Dali::Internal::PropertyInputImpl::GetMatrix3()
    */
-  virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
+  const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const override
   {
     return mValue[ bufferIndex ];
   }
@@ -2134,7 +2134,7 @@ void BakeMessage( EventThreadServices& eventThreadServices,
                   const SceneGraph::AnimatableProperty<T>& property,
                   typename ParameterType< T >::PassingType newValue )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, T > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, T>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2150,7 +2150,7 @@ void BakeRelativeMessage( EventThreadServices& eventThreadServices,
                           const SceneGraph::AnimatableProperty<T>& property,
                           const T& delta )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, const T& > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, const T&>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2166,7 +2166,7 @@ void SetXComponentMessage( EventThreadServices& eventThreadServices,
                            const SceneGraph::AnimatableProperty<T>& property,
                            typename ParameterType< float >::PassingType newValue )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2182,7 +2182,7 @@ void SetYComponentMessage( EventThreadServices& eventThreadServices,
                            const SceneGraph::AnimatableProperty<T>& property,
                            typename ParameterType< float >::PassingType newValue )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2198,7 +2198,7 @@ void SetZComponentMessage( EventThreadServices& eventThreadServices,
                            const SceneGraph::AnimatableProperty<T>& property,
                            typename ParameterType< float >::PassingType newValue )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2214,7 +2214,7 @@ void SetWComponentMessage( EventThreadServices& eventThreadServices,
                            const SceneGraph::AnimatableProperty<T>& property,
                            typename ParameterType< float >::PassingType newValue )
 {
-  typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
+  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -2229,4 +2229,4 @@ void SetWComponentMessage( EventThreadServices& eventThreadServices,
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H