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