-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// EXTERNAL INCLUDES
#include <typeinfo>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
-#include <dali/internal/event/common/object-impl.h>
#include <dali/integration-api/debug.h>
+#include <dali/internal/event/common/object-impl.h>
namespace Dali
{
-
BaseHandle::BaseHandle(Dali::BaseObject* handle)
: mObjectHandle(handle)
{
}
-BaseHandle::BaseHandle()
-{
-}
+BaseHandle::BaseHandle() = default;
-BaseHandle::~BaseHandle()
-{
-}
+BaseHandle::~BaseHandle() = default;
-BaseHandle::BaseHandle(const BaseHandle& handle)
- : mObjectHandle(handle.mObjectHandle)
-{
-}
+BaseHandle::BaseHandle(const BaseHandle& handle) = default;
-BaseHandle& BaseHandle::operator=(const BaseHandle& rhs)
-{
- if( this != &rhs )
- {
- this->mObjectHandle = rhs.mObjectHandle;
- }
+BaseHandle& BaseHandle::operator=(const BaseHandle& rhs) = default;
- return *this;
-}
+BaseHandle::BaseHandle(BaseHandle&& rhs) = default;
-BaseHandle& BaseHandle::operator=(BaseHandle::NullType* rhs)
-{
- DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
- Reset();
- return *this;
-}
+BaseHandle& BaseHandle::operator=(BaseHandle&& rhs) = default;
-bool BaseHandle::DoAction(const std::string& command, const std::vector<Property::Value>& attributes)
+bool BaseHandle::DoAction(const std::string& command, const Property::Map& attributes)
{
- return GetImplementation(*this).DoAction( command, attributes );
+ return GetImplementation(*this).DoAction(command, attributes);
}
const std::string& BaseHandle::GetTypeName() const
return GetImplementation(*this).GetTypeName();
}
-BaseObject& BaseHandle::GetBaseObject()
+bool BaseHandle::GetTypeInfo(Dali::TypeInfo& typeInfo) const
{
- DALI_ASSERT_ALWAYS( mObjectHandle.Get() && "BaseHandle is empty" );
+ return GetImplementation(*this).GetTypeInfo(typeInfo);
+}
+BaseObject& BaseHandle::GetBaseObject()
+{
return static_cast<BaseObject&>(*mObjectHandle);
}
const BaseObject& BaseHandle::GetBaseObject() const
{
- DALI_ASSERT_ALWAYS(mObjectHandle.Get() && "BaseHandle is empty" );
-
return static_cast<const BaseObject&>(*mObjectHandle);
}
void BaseHandle::Reset()
{
- mObjectHandle = NULL;
+ mObjectHandle = nullptr;
}
-BaseHandle::operator BaseHandle::BooleanType() const
+BaseHandle::operator bool() const
{
- return mObjectHandle ? &BaseHandle::ThisIsSaferThanReturningVoidStar : NULL;
+ return static_cast<bool>(mObjectHandle);
}
bool BaseHandle::operator==(const BaseHandle& rhs) const
return mObjectHandle.Get();
}
-bool BaseHandle::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )
-{
- return GetImplementation(*this).DoConnectSignal( connectionTracker, signalName, functor );
-}
-
-bool operator<(const BaseHandle& lhs, const BaseHandle& rhs)
+bool BaseHandle::DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor)
{
- return lhs.GetObjectPtr() < rhs.GetObjectPtr();
+ return GetImplementation(*this).DoConnectSignal(connectionTracker, signalName, functor);
}
} // namespace Dali