// // Copyright (c) 2012 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. // /** * @file FScl_UrlImpl.cpp * @brief This is the implementation for _UrlImpl class. * * This file contains definitions of @e _UrlImpl class. */ #include #include #include #include "FScl_UrlImpl.h" using namespace Tizen::App; using namespace Tizen::Base; namespace Tizen { namespace Social { _UrlImpl::_UrlImpl(void) : __type(URL_TYPE_PERSONAL) { //empty body } _UrlImpl::_UrlImpl(UrlType type, const String& url) : __type(type) , __url(url) { } _UrlImpl::_UrlImpl(const _UrlImpl& rhs) { __type = rhs.__type; __label = rhs.__label; __url = rhs.__url; } _UrlImpl::~_UrlImpl(void) { // empty body. } _UrlImpl& _UrlImpl::operator =(const _UrlImpl& rhs) { if (this == &rhs) { return *this; } __type = rhs.__type; __label = rhs.__label; __url = rhs.__url; return *this; } bool _UrlImpl::operator ==(const _UrlImpl& rhs) const { if (__type == rhs.__type && __label == rhs.__label && __url == rhs.__url) { return true; } return false; } bool _UrlImpl::operator !=(const _UrlImpl& rhs) const { return !(*this == rhs); } bool _UrlImpl::Equals(const Object& rhs) const { const _UrlImpl* pUrl = dynamic_cast(&rhs); if (pUrl == null) { return false; } return (*this == *pUrl); } int _UrlImpl::GetHashCode(void) const { int hashCode = 0; hashCode = __type; hashCode += __label.GetHashCode(); hashCode += __url.GetHashCode(); return hashCode; } UrlType _UrlImpl::GetType(void) const { return __type; } String _UrlImpl::GetUrl(void) const { return __url; } void _UrlImpl::SetType(UrlType type) { __type = type; } result _UrlImpl::SetUrl(const String& url) { SysTryReturn(NID_SCL, !url.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The url is empty", GetErrorMessage(E_INVALID_ARG)); __url = url; return E_SUCCESS; } String _UrlImpl::GetLabel(void) const { return __label; } void _UrlImpl::SetLabel(const String& label) { __label = label; } const _UrlImpl* _UrlImpl::GetInstance(const Url& url) { return url.__pUrlImpl; } _UrlImpl* _UrlImpl::GetInstance(Url& url) { return url.__pUrlImpl; } }} // Tizen::Social