2 // Copyright (c) 2013 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 FSclAccount.cpp
18 * @brief This is the implementation for Account class.
20 * This file contains definitions of @e Account class.
24 #include <FBaseColIMap.h>
25 #include <FBaseResult.h>
26 #include <FBaseString.h>
27 #include <FBaseSysLog.h>
28 #include <FSclAccount.h>
29 #include "FScl_AccountImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
34 namespace Tizen { namespace Social
37 Account::Account(const String& userName)
39 __pAccountImpl = new (std::nothrow) _AccountImpl(userName);
40 SysTryReturnVoidResult(NID_SCL, __pAccountImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
43 Account::Account(const Account& rhs)
45 __pAccountImpl = new (std::nothrow) _AccountImpl(*rhs.__pAccountImpl);
46 SysTryReturnVoidResult(NID_SCL, __pAccountImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
49 Account::~Account(void)
51 delete __pAccountImpl;
55 Account::operator =(const Account& rhs)
62 *__pAccountImpl = *rhs.__pAccountImpl;
68 Account::Equals(const Object& rhs) const
70 const Account* pAccount = dynamic_cast<const Account*> (&rhs);
77 return __pAccountImpl->Equals(*pAccount->__pAccountImpl);
81 Account::GetHashCode(void) const
83 return __pAccountImpl->GetHashCode();
87 Account::GetId(void) const
89 return __pAccountImpl->GetId();
93 Account::GetAccountProvider(void) const
95 return __pAccountImpl->GetAccountProvider();
99 Account::GetUserName(void) const
101 return __pAccountImpl->GetUserName();
105 Account::GetExtendedDataN(void) const
107 return __pAccountImpl->GetExtendedDataN();
111 Account::SetUserName(const String& userName)
113 result r = __pAccountImpl->SetUserName(userName);
114 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
120 Account::SetExtendedData(const String& key, const String& value)
122 result r = __pAccountImpl->SetExtendedData(key, value);
123 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));