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 FSclCategory.cpp
18 * @brief This is the implementation for Category class.
20 * This file contains definitions of @e Category class.
23 #include <FBaseSysLog.h>
24 #include <FSclCategory.h>
25 #include "FScl_CategoryImpl.h"
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Collection;
30 namespace Tizen { namespace Social
33 Category::Category(void)
34 : Record(RECORD_TYPE_CATEGORY)
36 __pCategoryImpl = new (std::nothrow) _CategoryImpl();
37 SysTryReturnVoidResult(NID_SCL, __pCategoryImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
40 Category::Category(const Category& rhs)
43 __pCategoryImpl = new (std::nothrow) _CategoryImpl(*rhs.__pCategoryImpl);
44 SysTryReturnVoidResult(NID_SCL, __pCategoryImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
47 Category::~Category(void)
49 delete __pCategoryImpl;
53 Category::operator =(const Category& rhs)
60 Record::operator =(rhs);
62 *__pCategoryImpl = *rhs.__pCategoryImpl;
68 Category::Equals(const Object& rhs) const
70 const Category* pCategory = dynamic_cast<const Category*>(&rhs);
71 if (pCategory == null)
76 if (GetRecordId() == INVALID_RECORD_ID)
81 if (GetRecordId() != pCategory->GetRecordId())
86 return __pCategoryImpl->Equals(*pCategory->__pCategoryImpl);
90 Category::GetHashCode(void) const
96 Category::GetAddressbookId(void) const
98 return __pCategoryImpl->GetAddressbookId();
102 Category::AddMember(RecordId contactId)
104 result r = __pCategoryImpl->AddMember(contactId);
105 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
111 Category::GetMemberCount(void) const
113 return __pCategoryImpl->GetMemberCount();
117 Category::GetName(void) const
119 return __pCategoryImpl->GetName();
123 Category::HasMember(RecordId contactId) const
125 bool hasMember = __pCategoryImpl->HasMember(contactId);
127 result r = GetLastResult();
128 SysTryReturn(NID_SCL, !IsFailed(r), hasMember, r, "[%s] Propagating.", GetErrorMessage(r));
134 Category::RemoveMember(RecordId contactId)
136 result r = __pCategoryImpl->RemoveMember(contactId);
137 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
143 Category::SetName(const String& name)
145 result r = __pCategoryImpl->SetName(name);
146 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
152 Category::SetRingtonePath(const String& filePath)
154 result r = __pCategoryImpl->SetRingtonePath(filePath);
155 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
161 Category::GetRingtonePath(void) const
163 return __pCategoryImpl->GetRingtonePath();
167 Category::SetThumbnail(const String& filePath)
169 result r = __pCategoryImpl->SetThumbnail(filePath);
170 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
176 Category::GetThumbnailPath(void) const
178 return __pCategoryImpl->GetThumbnailPath();
182 Category::IsDefault(void) const
184 return __pCategoryImpl->IsDefault();
188 Category::IsReadOnly(void) const
190 return __pCategoryImpl->IsReadOnly();
194 Category::GetExtraDataN(void) const
196 return __pCategoryImpl->GetExtraDataN();