2 // Open Service Platform
3 // Copyright (c) 2013 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 FSclAccount.cpp
19 * @brief This is the implementation for Account class.
21 * This file contains definitions of @e Account class.
25 #include <FBaseColIMap.h>
26 #include <FBaseResult.h>
27 #include <FBaseString.h>
28 #include <FBaseSysLog.h>
29 #include <FSclAccount.h>
30 #include "FScl_AccountImpl.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
35 namespace Tizen { namespace Social
38 Account::Account(const String& userName)
40 __pAccountImpl = new (std::nothrow) _AccountImpl(userName);
41 SysTryReturnVoidResult(NID_SCL, __pAccountImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
44 Account::Account(const Account& rhs)
46 __pAccountImpl = new (std::nothrow) _AccountImpl(*rhs.__pAccountImpl);
47 SysTryReturnVoidResult(NID_SCL, __pAccountImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
50 Account::~Account(void)
52 delete __pAccountImpl;
56 Account::operator =(const Account& rhs)
63 *__pAccountImpl = *rhs.__pAccountImpl;
69 Account::Equals(const Object& rhs) const
71 const Account* pAccount = dynamic_cast<const Account*> (&rhs);
78 return __pAccountImpl->Equals(*pAccount->__pAccountImpl);
82 Account::GetHashCode(void) const
84 return __pAccountImpl->GetHashCode();
88 Account::GetId(void) const
90 return __pAccountImpl->GetId();
94 Account::GetAccountProvider(void) const
96 return __pAccountImpl->GetAccountProvider();
100 Account::GetUserName(void) const
102 return __pAccountImpl->GetUserName();
106 Account::GetExtendedDataN(void) const
108 return __pAccountImpl->GetExtendedDataN();
112 Account::SetUserName(const String& userName)
114 result r = __pAccountImpl->SetUserName(userName);
115 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
121 Account::SetExtendedData(const String& key, const String& value)
123 result r = __pAccountImpl->SetExtendedData(key, value);
124 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));