2 * Copyright (c) 2015 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/internal/event/common/object-impl.h>
27 #include <dali/integration-api/debug.h>
32 BaseHandle::BaseHandle(Dali::BaseObject* handle)
33 : mObjectHandle(handle)
37 BaseHandle::BaseHandle()
41 BaseHandle::~BaseHandle()
45 BaseHandle::BaseHandle(const BaseHandle& handle)
46 : mObjectHandle(handle.mObjectHandle)
50 BaseHandle& BaseHandle::operator=(const BaseHandle& rhs)
54 this->mObjectHandle = rhs.mObjectHandle;
60 bool BaseHandle::DoAction(const std::string& command, const std::vector<Property::Value>& attributes)
62 return GetImplementation(*this).DoAction( command, attributes );
65 const std::string& BaseHandle::GetTypeName() const
67 return GetImplementation(*this).GetTypeName();
70 bool BaseHandle::GetTypeInfo(Dali::TypeInfo& typeInfo) const
72 return GetImplementation(*this).GetTypeInfo(typeInfo);
75 BaseObject& BaseHandle::GetBaseObject()
77 return static_cast<BaseObject&>(*mObjectHandle);
80 const BaseObject& BaseHandle::GetBaseObject() const
82 return static_cast<const BaseObject&>(*mObjectHandle);
85 void BaseHandle::Reset()
90 BaseHandle::operator BaseHandle::BooleanType() const
92 return mObjectHandle ? &BaseHandle::ThisIsSaferThanReturningVoidStar : NULL;
95 bool BaseHandle::operator==(const BaseHandle& rhs) const
97 return this->mObjectHandle == rhs.mObjectHandle;
100 bool BaseHandle::operator!=(const BaseHandle& rhs) const
102 return this->mObjectHandle != rhs.mObjectHandle;
105 Dali::RefObject* BaseHandle::GetObjectPtr() const
107 return mObjectHandle.Get();
110 bool BaseHandle::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )
112 return GetImplementation(*this).DoConnectSignal( connectionTracker, signalName, functor );