wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / Contact / IPerson.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        IPerson.cpp
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  * ## - Change name to IPerson
24  */
25
26 #include "IPerson.h"
27 #include <Commons/ThreadPool.h>
28 #include "ContactFactory.h"
29 #include <Logger.h>
30
31 namespace DeviceAPI {
32 namespace Contact {
33
34 using namespace WrtDeviceApis::Commons;
35
36 IPerson::IPerson() :
37                 EventRequestReceiver< EventPersonLink >(ThreadEnum::NULL_THREAD),
38                 EventRequestReceiver< EventPersonUnlink >(ThreadEnum::NULL_THREAD),
39                 m_idIsSet(false),
40                 m_displayNameIsSet(false),
41                 m_contactCount(0),
42                 m_contactCountIsSet(false),
43                 m_hasPhoneNumber(false),
44                 m_hasEmail(false),
45                 m_isFavorite(false),
46                 m_photoURIIsSet(false),
47                 m_ringtoneURIIsSet(false),
48                 m_displayContactIdIsSet(false)
49 {
50 }
51
52 IPerson::~IPerson()
53 {
54 }
55
56 void IPerson::link(const EventPersonLinkPtr &event)
57 {
58         //post event to PLATFORM implementation
59         EventRequestReceiver< EventPersonLink >::PostRequest(event);
60 }
61
62 void IPerson::unlink(const EventPersonUnlinkPtr &event)
63 {
64         //post event to PLATFORM implementation
65         EventRequestReceiver< EventPersonUnlink >::PostRequest(event);
66 }
67
68 std::string IPerson::getId() const
69 {
70         return m_id;
71 }
72
73 void IPerson::setId(const std::string value)
74 {
75         m_id = value;
76         m_idIsSet = true;
77 }
78
79 void IPerson::setId(const int value)
80 {
81         std::stringstream oss;
82         oss << value;
83         m_id = oss.str();
84         m_idIsSet = true;
85 }
86
87 void IPerson::unsetId()
88 {
89         m_id = "";
90         m_idIsSet = false;
91 }
92
93 bool IPerson::getIdIsSet() const
94 {
95         return m_idIsSet;
96 }
97
98 std::string IPerson::getDisplayName() const
99 {
100         return m_displayName;
101 }
102
103 void IPerson::setDisplayName(const std::string value)
104 {
105         m_displayName = value;
106         m_displayNameIsSet = true;
107 }
108
109 void IPerson::unsetDisplayName()
110 {
111         m_displayName = "";
112         m_displayNameIsSet = false;
113 }
114
115 bool IPerson::getDisplayNameIsSet() const
116 {
117         return m_displayNameIsSet;
118 }
119
120 long IPerson::getContactCount() const
121 {
122         return m_contactCount;
123 }
124
125 void IPerson::setContactCount(const long value)
126 {
127         m_contactCount = value;
128         m_contactCountIsSet = true;
129 }
130 void IPerson::unsetContactCount()
131 {
132         m_contactCount = 0;
133         m_contactCountIsSet = false;
134 }
135
136 bool IPerson::getContactCountIsSet() const
137 {
138         return m_contactCountIsSet;
139 }
140
141 bool IPerson::getHasPhoneNumber() const
142 {
143         return m_hasPhoneNumber;
144 }
145
146 void IPerson::setHasPhoneNumber(const bool &value)
147 {
148         m_hasPhoneNumber = value;
149 }
150
151 bool IPerson::getHasEmail() const
152 {
153         return m_hasEmail;
154 }
155
156 void IPerson::setHasEmail(const bool &value)
157 {
158         m_hasEmail = value;
159 }
160
161 bool IPerson::getIsFavorite() const
162 {
163         return m_isFavorite;
164 }
165
166 void IPerson::setIsFavorite(const bool &value)
167 {
168         m_isFavorite = value;
169 }
170
171 std::string IPerson::getPhotoURI() const
172 {
173         return m_photoURI;
174 }
175
176 void IPerson::setPhotoURI(const std::string &value)
177 {
178         m_photoURI = value;
179         m_photoURIIsSet = true;
180 }
181
182 void IPerson::unsetPhotoURI()
183 {
184         m_photoURI = "";
185         m_photoURIIsSet = false;
186 }
187
188 bool IPerson::getPhotoURIIsSet() const
189 {
190         return m_photoURIIsSet;
191 }
192
193 std::string IPerson::getPhotoURIRealPath() const
194 {
195         return m_photoURIRealPath;
196 }
197
198 void IPerson::setPhotoURIRealPath(const std::string &value)
199 {
200         m_photoURIRealPath = value;
201 }
202
203 std::string IPerson::getRingtoneURI() const
204 {
205         return m_ringtoneURI;
206 }
207
208 void IPerson::setRingtoneURI(const std::string &value)
209 {
210         m_ringtoneURI = value;
211         m_ringtoneURIIsSet = true;
212 }
213
214 void IPerson::unsetRingtoneURI()
215 {
216         m_ringtoneURI = "";
217         m_ringtoneURIIsSet = false;
218 }
219
220 bool IPerson::getRingtoneURIIsSet() const
221 {
222         return m_ringtoneURIIsSet;
223 }
224
225 std::string IPerson::getRingtoneURIRealPath() const
226 {
227         return m_ringtoneURIRealPath;
228 }
229
230 void IPerson::setRingtoneURIRealPath(const std::string &value)
231 {
232         m_ringtoneURIRealPath = value;
233 }
234
235 std::string IPerson::getDisplayContactId() const
236 {
237         return m_displayContactId;
238 }
239
240 void IPerson::setDisplayContactId(const std::string value)
241 {
242         m_displayContactId = value;
243         m_displayContactIdIsSet = true;
244 }
245
246 void IPerson::setDisplayContactId(const int value)
247 {
248         std::stringstream oss;
249         oss << value;
250         m_displayContactId = oss.str();
251         m_displayContactIdIsSet = true;
252 }
253
254 void IPerson::unsetDisplayContactId()
255 {
256         m_displayContactId = "";
257         m_displayContactIdIsSet = false;
258 }
259
260 bool IPerson::getDisplayContactIdIsSet() const
261 {
262         return m_displayContactIdIsSet;
263 }
264
265 void IPerson::copy(const PersonPtr &person)
266 {
267         m_id = person->m_id;
268         m_idIsSet = person->m_idIsSet;
269
270         m_displayName = person->m_displayName;
271         m_displayNameIsSet = person->m_displayNameIsSet;
272
273         m_contactCount = person->m_contactCount;
274         m_contactCountIsSet = person->m_contactCountIsSet;
275
276         m_hasPhoneNumber = person->m_hasPhoneNumber;
277
278         m_hasEmail = person->m_hasEmail;
279
280         m_isFavorite = person->m_isFavorite;
281
282         m_photoURI = person->m_photoURI;
283         m_photoURIIsSet = person->m_photoURIIsSet;
284         m_photoURIRealPath = person->m_photoURIRealPath;
285
286         m_ringtoneURI = person->m_ringtoneURI;
287         m_ringtoneURIIsSet = person->m_ringtoneURIIsSet;
288         m_ringtoneURIRealPath = person->m_ringtoneURIRealPath;
289
290         m_displayContactId = person->m_displayContactId;
291         m_displayContactIdIsSet = person->m_displayContactIdIsSet;
292 }
293
294 void IPerson::clear()
295 {
296         m_id = "";
297         m_idIsSet = false;
298
299         m_displayName = "";
300         m_displayNameIsSet = false;
301
302         m_contactCount = 0;
303         m_contactCountIsSet = false;
304
305         m_hasPhoneNumber = false;
306
307         m_hasEmail = false;
308
309         m_isFavorite = false;
310
311         m_photoURI = "";
312         m_photoURIIsSet = false;
313         m_photoURIRealPath = "";
314
315         m_ringtoneURI = "";
316         m_ringtoneURIIsSet = false;
317         m_ringtoneURIRealPath = "";
318
319         m_displayContactId = "";
320         m_displayContactIdIsSet = false;
321 }
322
323 } // Contact
324 } // DeviceAPI