// // 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_ImAddressImpl.cpp * @brief This is the implementation for _ImAddressImpl class. * * This file contains definitions of @e _ImAddressImpl class. */ #include #include #include #include "FScl_ImAddressImpl.h" using namespace Tizen::App; using namespace Tizen::Base; namespace Tizen { namespace Social { extern const wchar_t IM_ADDRESS_AIM[] = L"AIM"; extern const wchar_t IM_ADDRESS_GOOGLE_TALK[] = L"Google Talk"; extern const wchar_t IM_ADDRESS_ICQ[] = L"ICQ"; extern const wchar_t IM_ADDRESS_JABBER[] = L"Jabber"; extern const wchar_t IM_ADDRESS_MSN[] = L"MSN"; extern const wchar_t IM_ADDRESS_QQ[] = L"QQ"; extern const wchar_t IM_ADDRESS_SKYPE[] = L"Skype"; extern const wchar_t IM_ADDRESS_YAHOO[] = L"Yahoo"; extern const wchar_t IM_ADDRESS_IRC[] = L"IRC"; extern const wchar_t IM_ADDRESS_FACEBOOK[] = L"Facebook"; _ImAddressImpl::_ImAddressImpl(void) { //empty body } _ImAddressImpl::_ImAddressImpl(const String& serviceProviderName, const String& imAddress) : __serviceProviderName(serviceProviderName) , __imAddress(imAddress) { //empty body } _ImAddressImpl::_ImAddressImpl(const _ImAddressImpl& rhs) { __serviceProviderName = rhs.__serviceProviderName; __imAddress = rhs.__imAddress; } _ImAddressImpl::~_ImAddressImpl(void) { // empty body. } _ImAddressImpl& _ImAddressImpl::operator =(const _ImAddressImpl& rhs) { if (this == &rhs) { return *this; } __serviceProviderName = rhs.__serviceProviderName; __imAddress = rhs.__imAddress; return *this; } bool _ImAddressImpl::operator ==(const _ImAddressImpl& rhs) const { if (__serviceProviderName == rhs.__serviceProviderName && __imAddress == rhs.__imAddress) { return true; } return false; } bool _ImAddressImpl::operator !=(const _ImAddressImpl& rhs) const { return !(*this == rhs); } bool _ImAddressImpl::Equals(const Object& rhs) const { const _ImAddressImpl* pImAddress = dynamic_cast(&rhs); if (pImAddress == null) { return false; } return (*this == *pImAddress); } int _ImAddressImpl::GetHashCode(void) const { int hashCode = 0; hashCode = __serviceProviderName.GetHashCode(); hashCode += __imAddress.GetHashCode(); return hashCode; } String _ImAddressImpl::GetServiceProviderName(void) const { return __serviceProviderName; } String _ImAddressImpl::GetImAddress(void) const { return __imAddress; } void _ImAddressImpl::SetServiceProviderName(const String& serviceProviderName) { __serviceProviderName = serviceProviderName; } result _ImAddressImpl::SetImAddress(const String& imAddress) { SysTryReturn(NID_SCL, !imAddress.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The imAddress is an empty string.", GetErrorMessage(E_INVALID_ARG)); __imAddress = imAddress; return E_SUCCESS; } const _ImAddressImpl* _ImAddressImpl::GetInstance(const ImAddress& imAddress) { return imAddress.__pImAddressImpl; } _ImAddressImpl* _ImAddressImpl::GetInstance(ImAddress& imAddress) { return imAddress.__pImAddressImpl; } }} // Tizen::Social