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 FSclCategory.cpp
19 * @brief This is the implementation for Category class.
21 * This file contains definitions of @e Category class.
24 #include <FBaseSysLog.h>
25 #include <FSclCategory.h>
26 #include "FScl_CategoryImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
31 namespace Tizen { namespace Social
34 Category::Category(void)
35 : Record(RECORD_TYPE_CATEGORY)
37 __pCategoryImpl = new (std::nothrow) _CategoryImpl();
38 SysTryReturnVoidResult(NID_SCL, __pCategoryImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
41 Category::Category(const Category& rhs)
44 __pCategoryImpl = new (std::nothrow) _CategoryImpl(*rhs.__pCategoryImpl);
45 SysTryReturnVoidResult(NID_SCL, __pCategoryImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
48 Category::~Category(void)
50 delete __pCategoryImpl;
54 Category::operator =(const Category& rhs)
61 Record::operator =(rhs);
63 *__pCategoryImpl = *rhs.__pCategoryImpl;
69 Category::Equals(const Object& rhs) const
71 const Category* pCategory = dynamic_cast<const Category*>(&rhs);
72 if (pCategory == null)
77 if (GetRecordId() == INVALID_RECORD_ID)
82 if (GetRecordId() == pCategory->GetRecordId())
91 Category::GetHashCode(void) const
97 Category::GetAddressbookId(void) const
99 return __pCategoryImpl->GetAddressbookId();
103 Category::AddMember(RecordId contactId)
105 result r = __pCategoryImpl->AddMember(contactId);
106 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
112 Category::GetMemberCount(void) const
114 return __pCategoryImpl->GetMemberCount();
118 Category::GetName(void) const
120 return __pCategoryImpl->GetName();
124 Category::HasMember(RecordId contactId) const
126 bool hasMember = __pCategoryImpl->HasMember(contactId);
128 result r = GetLastResult();
129 SysTryReturn(NID_SCL, !IsFailed(r), hasMember, r, "[%s] Propagating.", GetErrorMessage(r));
135 Category::RemoveMember(RecordId contactId)
137 result r = __pCategoryImpl->RemoveMember(contactId);
138 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
144 Category::SetName(const String& name)
146 result r = __pCategoryImpl->SetName(name);
147 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
153 Category::SetRingtonePath(const String& filePath)
155 result r = __pCategoryImpl->SetRingtonePath(filePath);
156 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
162 Category::GetRingtonePath(void) const
164 return __pCategoryImpl->GetRingtonePath();
168 Category::SetThumbnail(const String& filePath)
170 result r = __pCategoryImpl->SetThumbnail(filePath);
171 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
177 Category::GetThumbnailPath(void) const
179 return __pCategoryImpl->GetThumbnailPath();
183 Category::IsDefault(void) const
185 return __pCategoryImpl->IsDefault();