Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / object / handle.cpp
index d765582..45f8fcd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -33,26 +33,22 @@ Handle::Handle(Dali::Internal::Object* handle)
 {
 }
 
-Handle::Handle()
-{
-}
+Handle::Handle() = default;
 
 Handle Handle::New()
 {
   return Handle(Internal::Object::New().Get());
 }
 
-Handle::~Handle()
-{
-}
+Handle::~Handle() = default;
 
 Handle::Handle(const Handle& handle) = default;
 
 Handle& Handle::operator=(const Handle& rhs) = default;
 
-Handle::Handle(Handle&& rhs) = default;
+Handle::Handle(Handle&& rhs) noexcept = default;
 
-Handle& Handle::operator=(Handle&& rhs) = default;
+Handle& Handle::operator=(Handle&& rhs) noexcept = default;
 
 Handle Handle::DownCast(BaseHandle handle)
 {
@@ -71,7 +67,7 @@ uint32_t Handle::GetPropertyCount() const
 
 std::string Handle::GetPropertyName(Property::Index index) const
 {
-  return GetImplementation(*this).GetPropertyName(index);
+  return std::string(GetImplementation(*this).GetPropertyName(index));
 }
 
 Property::Index Handle::GetPropertyIndex(Property::Key key) const
@@ -104,19 +100,34 @@ void Handle::SetProperty(Property::Index index, Property::Value propertyValue)
   GetImplementation(*this).SetProperty(index, std::move(propertyValue));
 }
 
-Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue)
+void Handle::ReserveCustomProperties(int propertyCount)
+{
+  GetImplementation(*this).ReserveCustomProperties(propertyCount);
+}
+
+Property::Index Handle::RegisterProperty(std::string_view name, Property::Value propertyValue)
+{
+  return GetImplementation(*this).RegisterProperty(name, std::move(propertyValue));
+}
+
+Property::Index Handle::RegisterProperty(Property::Index key, std::string_view name, Property::Value propertyValue)
+{
+  return GetImplementation(*this).RegisterProperty(name, key, std::move(propertyValue), true);
+}
+
+Property::Index Handle::RegisterProperty(std::string_view name, Property::Value propertyValue, Property::AccessMode accessMode)
 {
-  return GetImplementation(*this).RegisterProperty(std::move(name), std::move(propertyValue));
+  return GetImplementation(*this).RegisterProperty(name, std::move(propertyValue), accessMode);
 }
 
-Property::Index Handle::RegisterProperty(Property::Index key, std::string name, Property::Value propertyValue)
+Property::Index Handle::RegisterUniqueProperty(std::string_view name, Property::Value propertyValue)
 {
-  return GetImplementation(*this).RegisterProperty(std::move(name), key, std::move(propertyValue));
+  return GetImplementation(*this).RegisterProperty(name, Property::INVALID_KEY, std::move(propertyValue), false);
 }
 
-Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
+Property::Index Handle::RegisterUniqueProperty(Property::Index key, std::string_view name, Property::Value propertyValue)
 {
-  return GetImplementation(*this).RegisterProperty(std::move(name), std::move(propertyValue), accessMode);
+  return GetImplementation(*this).RegisterProperty(name, key, std::move(propertyValue), false);
 }
 
 Property::Value Handle::GetProperty(Property::Index index) const