2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/object/type-registry.h>
26 #include <dali/integration-api/debug.h>
27 #include <dali/internal/event/common/object-impl.h>
31 BaseHandle::BaseHandle(Dali::BaseObject* handle)
32 : mObjectHandle(handle)
36 BaseHandle::BaseHandle()
40 BaseHandle::~BaseHandle()
44 BaseHandle::BaseHandle(const BaseHandle& handle) = default;
46 BaseHandle& BaseHandle::operator=(const BaseHandle& rhs) = default;
48 BaseHandle::BaseHandle(BaseHandle&& rhs) = default;
50 BaseHandle& BaseHandle::operator=(BaseHandle&& rhs) = default;
52 bool BaseHandle::DoAction(const std::string& command, const Property::Map& attributes)
54 return GetImplementation(*this).DoAction(command, attributes);
57 const std::string& BaseHandle::GetTypeName() const
59 return GetImplementation(*this).GetTypeName();
62 bool BaseHandle::GetTypeInfo(Dali::TypeInfo& typeInfo) const
64 return GetImplementation(*this).GetTypeInfo(typeInfo);
67 BaseObject& BaseHandle::GetBaseObject()
69 return static_cast<BaseObject&>(*mObjectHandle);
72 const BaseObject& BaseHandle::GetBaseObject() const
74 return static_cast<const BaseObject&>(*mObjectHandle);
77 void BaseHandle::Reset()
79 mObjectHandle = nullptr;
82 BaseHandle::operator BaseHandle::BooleanType() const
84 return mObjectHandle ? &BaseHandle::ThisIsSaferThanReturningVoidStar : nullptr;
87 bool BaseHandle::operator==(const BaseHandle& rhs) const
89 return this->mObjectHandle == rhs.mObjectHandle;
92 bool BaseHandle::operator!=(const BaseHandle& rhs) const
94 return this->mObjectHandle != rhs.mObjectHandle;
97 Dali::RefObject* BaseHandle::GetObjectPtr() const
99 return mObjectHandle.Get();
102 bool BaseHandle::DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor)
104 return GetImplementation(*this).DoConnectSignal(connectionTracker, signalName, functor);