2 // Copyright (c) 2012 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.
17 * @file FScl_ImAddressImpl.cpp
18 * @brief This is the implementation for _ImAddressImpl class.
20 * This file contains definitions of @e _ImAddressImpl class.
23 #include <FSclImAddress.h>
24 #include <FApp_AppInfo.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_ImAddressImpl.h"
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Social
34 extern const wchar_t IM_ADDRESS_AIM[] = L"AIM";
35 extern const wchar_t IM_ADDRESS_GOOGLE_TALK[] = L"Google Talk";
36 extern const wchar_t IM_ADDRESS_ICQ[] = L"ICQ";
37 extern const wchar_t IM_ADDRESS_JABBER[] = L"Jabber";
38 extern const wchar_t IM_ADDRESS_MSN[] = L"MSN";
39 extern const wchar_t IM_ADDRESS_QQ[] = L"QQ";
40 extern const wchar_t IM_ADDRESS_SKYPE[] = L"Skype";
41 extern const wchar_t IM_ADDRESS_YAHOO[] = L"Yahoo";
42 extern const wchar_t IM_ADDRESS_IRC[] = L"IRC";
43 extern const wchar_t IM_ADDRESS_FACEBOOK[] = L"Facebook";
45 _ImAddressImpl::_ImAddressImpl(void)
50 _ImAddressImpl::_ImAddressImpl(const String& serviceProviderName, const String& imAddress)
51 : __serviceProviderName(serviceProviderName)
52 , __imAddress(imAddress)
57 _ImAddressImpl::_ImAddressImpl(const _ImAddressImpl& rhs)
59 __serviceProviderName = rhs.__serviceProviderName;
60 __imAddress = rhs.__imAddress;
63 _ImAddressImpl::~_ImAddressImpl(void)
69 _ImAddressImpl::operator =(const _ImAddressImpl& rhs)
76 __serviceProviderName = rhs.__serviceProviderName;
77 __imAddress = rhs.__imAddress;
83 _ImAddressImpl::operator ==(const _ImAddressImpl& rhs) const
85 if (__serviceProviderName == rhs.__serviceProviderName && __imAddress == rhs.__imAddress)
94 _ImAddressImpl::operator !=(const _ImAddressImpl& rhs) const
96 return !(*this == rhs);
100 _ImAddressImpl::Equals(const Object& rhs) const
102 const _ImAddressImpl* pImAddress = dynamic_cast<const _ImAddressImpl*>(&rhs);
103 if (pImAddress == null)
108 return (*this == *pImAddress);
112 _ImAddressImpl::GetHashCode(void) const
116 hashCode = __serviceProviderName.GetHashCode();
117 hashCode += __imAddress.GetHashCode();
123 _ImAddressImpl::GetServiceProviderName(void) const
125 return __serviceProviderName;
129 _ImAddressImpl::GetImAddress(void) const
135 _ImAddressImpl::SetServiceProviderName(const String& serviceProviderName)
137 __serviceProviderName = serviceProviderName;
141 _ImAddressImpl::SetImAddress(const String& imAddress)
143 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));
145 __imAddress = imAddress;
150 const _ImAddressImpl*
151 _ImAddressImpl::GetInstance(const ImAddress& imAddress)
153 return imAddress.__pImAddressImpl;
157 _ImAddressImpl::GetInstance(ImAddress& imAddress)
159 return imAddress.__pImAddressImpl;