Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Contact / Contact.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 /**
18  * @file        Contact.cpp
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief
22  */
23
24 #include "Contact.h"
25
26 namespace TizenApis {
27 namespace Api {
28 namespace Contact {
29
30 Contact::Contact() :
31                 m_readOnly(false),
32                 m_idIsSet(false),
33                 m_readOnlyIsSet(false),
34                 m_lastUpdatedIsSet(false)
35 {
36 }
37
38 Contact::Contact(const ContactProperties &contactProperties) :
39                 ContactProperties(contactProperties),
40                 m_readOnly(false),
41                 m_idIsSet(false),
42                 m_readOnlyIsSet(false),
43                 m_lastUpdatedIsSet(false)
44 {
45 }
46
47 Contact::~Contact()
48 {
49 }
50
51 std::string Contact::getId() const
52 {
53         return m_id;
54 }
55
56 void Contact::setId(const std::string value)
57 {
58         m_id = value;
59         m_idIsSet = true;
60 }
61
62 bool Contact::getIdIsSet() const
63 {
64         return m_idIsSet;
65 }
66
67 void Contact::setId(const int value)
68 {
69         std::stringstream oss;
70         oss << value;
71         m_id = oss.str();
72         m_idIsSet = true;
73 }
74
75 bool Contact::getReadOnly() const
76 {
77         return m_readOnly;
78 }
79
80 void Contact::setReadOnly(const bool &value)
81 {
82         m_readOnly = value;
83         m_readOnlyIsSet = true;
84 }
85
86 bool Contact::getReadOnlyIsSet() const
87 {
88         return m_readOnlyIsSet;
89 }
90
91 std::tm Contact::getLastUpdated() const
92 {
93         return m_lastUpdated;
94 }
95
96 void Contact::setLastUpdated(const std::tm &value)
97 {
98         m_lastUpdated = value;
99         m_lastUpdatedIsSet = true;
100 }
101
102 bool Contact::getLastUpdatedIsSet() const
103 {
104         return m_lastUpdatedIsSet;
105 }
106
107 void Contact::clear()
108 {
109         LogDebug("entered");
110         //clear all fields
111         ContactProperties::clear();
112         m_id.clear();
113         m_readOnly = false;
114         m_idIsSet = false;
115         m_readOnlyIsSet = false;
116 }
117
118 ContactPtr Contact::clone()
119 {
120         // TODO
121         //clone object
122         //use defaul copy constructor
123         ContactPtr result(new Contact(*this));
124         return result;
125 }
126
127 } // Contact
128 } // Api
129 } // TizenApis