2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FScl_ImAddressImpl.cpp
19 * @brief This is the implementation for _ImAddressImpl class.
21 * This file contains definitions of @e _ImAddressImpl class.
24 #include <FSclImAddress.h>
25 #include <FApp_AppInfo.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_ImAddressImpl.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Social
35 extern const wchar_t IM_ADDRESS_AIM[] = L"AIM";
36 extern const wchar_t IM_ADDRESS_GOOGLE_TALK[] = L"Google Talk";
37 extern const wchar_t IM_ADDRESS_ICQ[] = L"ICQ";
38 extern const wchar_t IM_ADDRESS_JABBER[] = L"Jabber";
39 extern const wchar_t IM_ADDRESS_MSN[] = L"MSN";
40 extern const wchar_t IM_ADDRESS_QQ[] = L"QQ";
41 extern const wchar_t IM_ADDRESS_SKYPE[] = L"Skype";
42 extern const wchar_t IM_ADDRESS_YAHOO[] = L"Yahoo";
44 _ImAddressImpl::_ImAddressImpl(void)
49 _ImAddressImpl::_ImAddressImpl(const String& serviceProviderName, const String& imAddress)
50 : __serviceProviderName(serviceProviderName)
51 , __imAddress(imAddress)
56 _ImAddressImpl::_ImAddressImpl(const _ImAddressImpl& rhs)
58 __serviceProviderName = rhs.__serviceProviderName;
59 __imAddress = rhs.__imAddress;
62 _ImAddressImpl::~_ImAddressImpl(void)
68 _ImAddressImpl::operator =(const _ImAddressImpl& rhs)
75 __serviceProviderName = rhs.__serviceProviderName;
76 __imAddress = rhs.__imAddress;
82 _ImAddressImpl::operator ==(const _ImAddressImpl& rhs) const
84 if (__serviceProviderName == rhs.__serviceProviderName && __imAddress == rhs.__imAddress)
93 _ImAddressImpl::operator !=(const _ImAddressImpl& rhs) const
95 return !(*this == rhs);
99 _ImAddressImpl::Equals(const Object& rhs) const
101 const _ImAddressImpl* pImAddress = dynamic_cast<const _ImAddressImpl*>(&rhs);
102 if (pImAddress == null)
107 return (*this == *pImAddress);
111 _ImAddressImpl::GetHashCode(void) const
115 hashCode = __serviceProviderName.GetHashCode();
116 hashCode += __imAddress.GetHashCode();
122 _ImAddressImpl::GetServiceProviderName(void) const
124 return __serviceProviderName;
128 _ImAddressImpl::GetImAddress(void) const
134 _ImAddressImpl::SetServiceProviderName(const String& serviceProviderName)
136 __serviceProviderName = serviceProviderName;
140 _ImAddressImpl::SetImAddress(const String& imAddress)
142 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));
144 __imAddress = imAddress;
149 const _ImAddressImpl*
150 _ImAddressImpl::GetInstance(const ImAddress& imAddress)
152 return imAddress.__pImAddressImpl;
156 _ImAddressImpl::GetInstance(ImAddress& imAddress)
158 return imAddress.__pImAddressImpl;