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 FSclRelationship.cpp
18 * @brief This is the implementation for Relationship class.
20 * This file contains definitions of @e Relationship class.
23 #include <FBaseSysLog.h>
24 #include <FSclRelationship.h>
25 #include "FScl_RelationshipImpl.h"
27 using namespace Tizen::Base;
29 namespace Tizen { namespace Social
32 Relationship::Relationship(void)
34 __pRelationshipImpl = new (std::nothrow) _RelationshipImpl();
35 SysTryReturnVoidResult(NID_SCL, __pRelationshipImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
38 Relationship::Relationship(const Relationship& rhs)
40 __pRelationshipImpl = new (std::nothrow) _RelationshipImpl(*rhs.__pRelationshipImpl);
41 SysTryReturnVoidResult(NID_SCL, __pRelationshipImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
44 Relationship::~Relationship(void)
46 delete __pRelationshipImpl;
50 Relationship::operator =(const Relationship& rhs)
57 *__pRelationshipImpl = *rhs.__pRelationshipImpl;
63 Relationship::operator ==(const Relationship& rhs) const
65 if (__name != rhs.__name)
70 return *__pRelationshipImpl == *rhs.__pRelationshipImpl;;
74 Relationship::operator !=(const Relationship& rhs) const
76 return !(*this == rhs);
80 Relationship::Equals(const Object& rhs) const
82 const Relationship* pRelationship = dynamic_cast<const Relationship*>(&rhs);
83 if (pRelationship == null)
88 return *this == *pRelationship;
92 Relationship::GetHashCode(void) const
94 return __pRelationshipImpl->GetHashCode();
98 Relationship::GetType(void) const
100 return __pRelationshipImpl->GetType();
104 Relationship::GetRelativeName(void) const
106 return __pRelationshipImpl->GetRelativeName();
110 Relationship::GetLabel(void) const
112 return __pRelationshipImpl->GetLabel();
116 Relationship::SetType(RelationshipType type)
118 __pRelationshipImpl->SetType(type);
122 Relationship::SetRelativeName(const String& name)
124 __pRelationshipImpl->SetRelativeName(name);
128 Relationship::SetLabel(const String& label)
130 __pRelationshipImpl->SetLabel(label);