Merge "Export internal APIs needed by samsung-socil" into tizen_2.1
[framework/osp/social.git] / src / FSclRelationship.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17 * @file         FSclRelationship.cpp
18 * @brief        This is the implementation for Relationship class.
19 *
20 * This file contains definitions of @e Relationship class.
21 */
22
23 #include <FBaseSysLog.h>
24 #include <FSclRelationship.h>
25 #include "FScl_RelationshipImpl.h"
26
27 using namespace Tizen::Base;
28
29 namespace Tizen { namespace Social
30 {
31
32 Relationship::Relationship(void)
33 {
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));
36 }
37
38 Relationship::Relationship(const Relationship& rhs)
39 {
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));
42 }
43
44 Relationship::~Relationship(void)
45 {
46         delete __pRelationshipImpl;
47 }
48
49 Relationship&
50 Relationship::operator =(const Relationship& rhs)
51 {
52         if (this == &rhs)
53         {
54                 return *this;
55         }
56
57         *__pRelationshipImpl = *rhs.__pRelationshipImpl;
58
59         return *this;
60 }
61
62 bool
63 Relationship::operator ==(const Relationship& rhs) const
64 {
65         if (__name != rhs.__name)
66         {
67                 return false;
68         }
69
70         return *__pRelationshipImpl == *rhs.__pRelationshipImpl;;
71 }
72
73 bool
74 Relationship::operator !=(const Relationship& rhs) const
75 {
76         return !(*this == rhs);
77 }
78
79 bool
80 Relationship::Equals(const Object& rhs) const
81 {
82         const Relationship* pRelationship = dynamic_cast<const Relationship*>(&rhs);
83         if (pRelationship == null)
84         {
85                 return false;
86         }
87
88         return *this == *pRelationship;
89 }
90
91 int
92 Relationship::GetHashCode(void) const
93 {
94         return __pRelationshipImpl->GetHashCode();
95 }
96
97 RelationshipType
98 Relationship::GetType(void) const
99 {
100         return __pRelationshipImpl->GetType();
101 }
102
103 String
104 Relationship::GetRelativeName(void) const
105 {
106         return __pRelationshipImpl->GetRelativeName();
107 }
108
109 String
110 Relationship::GetLabel(void) const
111 {
112         return __pRelationshipImpl->GetLabel();
113 }
114
115 void
116 Relationship::SetType(RelationshipType type)
117 {
118         __pRelationshipImpl->SetType(type);
119 }
120
121 void
122 Relationship::SetRelativeName(const String& name)
123 {
124         __pRelationshipImpl->SetRelativeName(name);
125 }
126
127 void
128 Relationship::SetLabel(const String& label)
129 {
130         __pRelationshipImpl->SetLabel(label);
131 }
132
133 }} // Tizen::Social