tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Contact / ContactEmail.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  * @file        ContactEmail.cpp
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @version     0.1
20  */
21
22 #include "ContactEmail.h"
23
24 namespace WrtDeviceApis {
25 namespace Contact {
26 namespace Api {
27
28 ContactEmail::ContactEmail()
29 {
30 }
31
32 ContactEmail::~ContactEmail()
33 {
34 }
35
36 std::string ContactEmail::getEmail() const
37 {
38     return m_email;
39 }
40
41 void ContactEmail::setEmail(const std::string &value)
42 {
43     m_email = value;
44 }
45
46 std::vector<ContactEmail::ContactEmailType> ContactEmail::getTypes() const
47 {
48     return m_types;
49 }
50
51 void ContactEmail::addType(ContactEmailType value)
52 {
53     m_types.push_back(value);
54 }
55
56 void ContactEmail::setTypes(const std::vector<ContactEmailType> value)
57 {
58     m_types = value;
59 }
60
61 bool ContactEmail::isTypeOf(ContactEmailType value) const
62 {
63     return std::find(m_types.begin(), m_types.end(), value) != m_types.end();
64 }
65
66 ContactEmail::ContactEmailType ContactEmail::getTypeFilter() const
67 {
68     return m_types.size() == 0 ? CONTACT_EMAIL_TYPE_PREF : m_types[0];
69 }
70
71 void ContactEmail::setTypeFilter(ContactEmailType value)
72 {
73     m_types.clear();
74     m_types.push_back(value);
75 }
76
77 ContactEmailPtr ContactEmail::clone() const
78 {
79     return ContactEmailPtr(new ContactEmail(*this));
80 }
81
82 }
83 }
84 }