Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.cpp
index 4e50bea..0c1b911 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/public-api/math/radian.h>
 #include <dali/public-api/math/vector2.h>
 
+#include <dali/internal/common/const-string.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/rendering/renderer-impl.h>
 #include <dali/internal/event/animation/constraint-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
 #include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
 
 namespace Dali
 {
-
-Actor::Actor()
-{
-}
+Actor::Actor() = default;
 
 Actor Actor::New()
 {
@@ -45,45 +43,20 @@ Actor Actor::New()
   return Actor(internal.Get());
 }
 
-Actor Actor::DownCast( BaseHandle handle )
+Actor Actor::DownCast(BaseHandle handle)
 {
-  return Actor( dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()) );
+  return Actor(dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()));
 }
 
-Actor::~Actor()
-{
-}
+Actor::~Actor() = default;
 
-Actor::Actor(const Actor& copy)
-: Handle(copy)
-{
-}
+Actor::Actor(const Actor& copy) = default;
 
-Actor& Actor::operator=(const Actor& rhs)
-{
-  BaseHandle::operator=(rhs);
-  return *this;
-}
+Actor& Actor::operator=(const Actor& rhs) = default;
 
-uint32_t Actor::GetId() const
-{
-  return GetImplementation(*this).GetId();
-}
+Actor::Actor(Actor&& rhs) noexcept = default;
 
-bool Actor::IsRoot() const
-{
-  return GetImplementation(*this).IsRoot();
-}
-
-bool Actor::OnStage() const
-{
-  return GetImplementation(*this).OnStage();
-}
-
-bool Actor::IsLayer() const
-{
-  return GetImplementation(*this).IsLayer();
-}
+Actor& Actor::operator=(Actor&& rhs) noexcept = default;
 
 Layer Actor::GetLayer()
 {
@@ -110,22 +83,22 @@ uint32_t Actor::GetChildCount() const
   return GetImplementation(*this).GetChildCount();
 }
 
-Actor Actor::GetChildAt( uint32_t index ) const
+Actor Actor::GetChildAt(uint32_t index) const
 {
-  Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
-  return Actor( child.Get() );
+  Internal::ActorPtr child = GetImplementation(*this).GetChildAt(index);
+  return Actor(child.Get());
 }
 
-Actor Actor::FindChildByName(const std::string& actorName)
+Actor Actor::FindChildByName(std::string_view actorName)
 {
-  Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
-  return Actor( child.Get() );
+  Internal::ActorPtr child = GetImplementation(*this).FindChildByName(Internal::ConstString(actorName));
+  return Actor(child.Get());
 }
 
-Actor Actor::FindChildById( const uint32_t id )
+Actor Actor::FindChildById(const uint32_t id)
 {
-  Internal::ActorPtr child = GetImplementation(*this).FindChildById( id );
-  return Actor( child.Get() );
+  Internal::ActorPtr child = GetImplementation(*this).FindChildById(id);
+  return Actor(child.Get());
 }
 
 Actor Actor::GetParent() const
@@ -135,26 +108,6 @@ Actor Actor::GetParent() const
   return Actor(parent);
 }
 
-void Actor::SetSize(float width, float height)
-{
-  GetImplementation(*this).SetSize(width, height);
-}
-
-void Actor::SetSize(float width, float height, float depth)
-{
-  GetImplementation(*this).SetSize(width, height, depth);
-}
-
-void Actor::SetSize(const Vector2& size)
-{
-  GetImplementation(*this).SetSize( size );
-}
-
-void Actor::SetSize(const Vector3& size)
-{
-  GetImplementation(*this).SetSize( size );
-}
-
 Vector3 Actor::GetTargetSize() const
 {
   return GetImplementation(*this).GetTargetSize();
@@ -165,36 +118,6 @@ Vector3 Actor::GetNaturalSize() const
   return GetImplementation(*this).GetNaturalSize();
 }
 
-void Actor::SetPosition(float x, float y)
-{
-  GetImplementation(*this).SetPosition(x, y);
-}
-
-void Actor::SetPosition(float x, float y, float z)
-{
-  GetImplementation(*this).SetPosition(x, y, z);
-}
-
-void Actor::SetPosition(const Vector3& position)
-{
-  GetImplementation(*this).SetPosition(position);
-}
-
-void Actor::SetX(float x)
-{
-  GetImplementation(*this).SetX(x);
-}
-
-void Actor::SetY(float y)
-{
-  GetImplementation(*this).SetY(y);
-}
-
-void Actor::SetZ(float z)
-{
-  GetImplementation(*this).SetZ(z);
-}
-
 void Actor::TranslateBy(const Vector3& distance)
 {
   GetImplementation(*this).TranslateBy(distance);
@@ -210,21 +133,6 @@ void Actor::RotateBy(const Quaternion& relativeRotation)
   GetImplementation(*this).RotateBy(relativeRotation);
 }
 
-void Actor::SetScale(float scale)
-{
-  GetImplementation(*this).SetScale(scale);
-}
-
-void Actor::SetScale(float scaleX, float scaleY, float scaleZ)
-{
-  GetImplementation(*this).SetScale(scaleX, scaleY, scaleZ);
-}
-
-void Actor::SetScale(const Vector3& scale)
-{
-  GetImplementation(*this).SetScale(scale);
-}
-
 void Actor::ScaleBy(const Vector3& relativeScale)
 {
   GetImplementation(*this).ScaleBy(relativeScale);
@@ -235,88 +143,66 @@ bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float scr
   return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
 }
 
-void Actor::SetKeyboardFocusable( bool focusable )
-{
-  GetImplementation(*this).SetKeyboardFocusable(focusable);
-}
-
-bool Actor::IsKeyboardFocusable() const
-{
-  return GetImplementation(*this).IsKeyboardFocusable();
-}
-
 void Actor::Raise()
 {
-  GetImplementation( *this ).Raise();
+  GetImplementation(*this).Raise();
 }
 
 void Actor::Lower()
 {
-  GetImplementation( *this ).Lower();
+  GetImplementation(*this).Lower();
 }
 
 void Actor::RaiseToTop()
 {
-  GetImplementation( *this ).RaiseToTop();
+  GetImplementation(*this).RaiseToTop();
 }
 
 void Actor::LowerToBottom()
 {
-  GetImplementation( *this ).LowerToBottom();
-}
-
-void Actor::RaiseAbove( Actor target )
-{
-  GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
+  GetImplementation(*this).LowerToBottom();
 }
 
-void Actor::LowerBelow( Actor target )
+void Actor::RaiseAbove(Actor target)
 {
-  GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
+  GetImplementation(*this).RaiseAbove(GetImplementation(target));
 }
 
-void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+void Actor::LowerBelow(Actor target)
 {
-  GetImplementation(*this).SetResizePolicy( policy, dimension );
+  GetImplementation(*this).LowerBelow(GetImplementation(target));
 }
 
-ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
+void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
 {
-  return GetImplementation(*this).GetResizePolicy( dimension );
+  GetImplementation(*this).SetResizePolicy(policy, dimension);
 }
 
-float Actor::GetHeightForWidth( float width )
+ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const
 {
-  return GetImplementation(*this).GetHeightForWidth( width );
+  return GetImplementation(*this).GetResizePolicy(dimension);
 }
 
-float Actor::GetWidthForHeight( float height )
+float Actor::GetHeightForWidth(float width)
 {
-  return GetImplementation(*this).GetWidthForHeight( height );
+  return GetImplementation(*this).GetHeightForWidth(width);
 }
 
-float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+float Actor::GetWidthForHeight(float height)
 {
-  return GetImplementation(*this).GetRelayoutSize( dimension );
+  return GetImplementation(*this).GetWidthForHeight(height);
 }
 
-int32_t Actor::GetHierarchyDepth()
+float Actor::GetRelayoutSize(Dimension::Type dimension) const
 {
-  return GetImplementation(*this).GetHierarchyDepth();
+  return GetImplementation(*this).GetRelayoutSize(dimension);
 }
 
-Actor::TouchSignalType& Actor::TouchedSignal()
+Actor::TouchEventSignalType& Actor::TouchedSignal()
 {
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
-
   return GetImplementation(*this).TouchedSignal();
 }
 
-Actor::TouchDataSignalType& Actor::TouchSignal()
-{
-  return GetImplementation( *this ).TouchSignal();
-}
-
 Actor::HoverSignalType& Actor::HoveredSignal()
 {
   return GetImplementation(*this).HoveredSignal();
@@ -327,19 +213,19 @@ Actor::WheelEventSignalType& Actor::WheelEventSignal()
   return GetImplementation(*this).WheelEventSignal();
 }
 
-Actor::OnStageSignalType& Actor::OnStageSignal()
+Actor::OnSceneSignalType& Actor::OnSceneSignal()
 {
-  return GetImplementation(*this).OnStageSignal();
+  return GetImplementation(*this).OnSceneSignal();
 }
 
-Actor::OffStageSignalType& Actor::OffStageSignal()
+Actor::OffSceneSignalType& Actor::OffSceneSignal()
 {
-  return GetImplementation(*this).OffStageSignal();
+  return GetImplementation(*this).OffSceneSignal();
 }
 
-uint32_t Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer(Renderer& renderer)
 {
-  return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
+  return GetImplementation(*this).AddRenderer(GetImplementation(renderer));
 }
 
 uint32_t Actor::GetRendererCount() const
@@ -347,20 +233,20 @@ uint32_t Actor::GetRendererCount() const
   return GetImplementation(*this).GetRendererCount();
 }
 
-Renderer Actor::GetRendererAt( uint32_t index )
+Renderer Actor::GetRendererAt(uint32_t index)
 {
-  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
-  return Renderer( renderer.Get() );
+  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt(index);
+  return Renderer(renderer.Get());
 }
 
-void Actor::RemoveRenderer( Renderer& renderer )
+void Actor::RemoveRenderer(Renderer& renderer)
 {
-  GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
+  GetImplementation(*this).RemoveRenderer(GetImplementation(renderer));
 }
 
-void Actor::RemoveRenderer( uint32_t index )
+void Actor::RemoveRenderer(uint32_t index)
 {
-  GetImplementation(*this).RemoveRenderer( index );
+  GetImplementation(*this).RemoveRenderer(index);
 }
 
 Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
@@ -370,7 +256,7 @@ Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
 
 Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
 {
-  return GetImplementation( *this ).LayoutDirectionChangedSignal();
+  return GetImplementation(*this).LayoutDirectionChangedSignal();
 }
 
 Actor::Actor(Internal::Actor* internal)