ff3855de8340dca0636979d7eb6c95638dbae21b
[framework/web/wrt-plugins-tizen.git] / src / Contact / ContactEmailAddress.h
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        ContactEmailAddress.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  */
24
25 #ifndef _API_CONTACT_CONTACT_EMAIL_ADDRESS_H_
26 #define _API_CONTACT_CONTACT_EMAIL_ADDRESS_H_
27
28 #include <algorithm>
29 #include <vector>
30 #include <string>
31 #include <dpl/shared_ptr.h>
32 #include "ContactTypes.h"
33 #include <JavaScriptCore/JavaScript.h>
34
35 namespace DeviceAPI {
36 namespace Contact {
37
38 class ContactEmailAddress;
39 typedef DPL::SharedPtr<ContactEmailAddress> ContactEmailAddressPtr;
40
41 typedef std::vector<ContactEmailAddressPtr> ContactEmailAddressArray;
42 typedef DPL::SharedPtr<ContactEmailAddressArray> ContactEmailAddressArrayPtr;
43
44 typedef std::vector<ContactEmailAddressType> ContactEmailAddressTypeArray;
45 typedef DPL::SharedPtr<ContactEmailAddressTypeArray> ContactEmailAddressTypeArrayPtr;
46
47 class ContactEmailAddress
48 {
49 public:
50         ContactEmailAddress();
51         ~ContactEmailAddress();
52
53         std::string getEmail() const;
54         void setEmail(const std::string &value);
55         void unsetEmail();
56         bool getEmailIsSet() const;
57
58         bool getIsDefault() const;
59         void setIsDefault(const bool &value);
60
61         ContactEmailAddressTypeArrayPtr getTypes() const;
62         void setTypes(const ContactEmailAddressTypeArrayPtr &value);
63         void addType(ContactEmailAddressType value);
64         bool isTypeOf(ContactEmailAddressType value) const;
65         int getTypesNum() const;
66
67         void clear();
68         ContactEmailAddressPtr clone() const;
69
70         void setTypesJSArray(bool value, JSObjectRef initValue);
71         JSValueRef getTypesJSArray();
72         JSObjectRef getTypesJSObj();
73         bool IsTypesSetJSArray() const;
74         void resetTypesJSObj();
75
76         void setContext(JSContextRef contextRef);
77         JSContextRef getContext();
78
79 private:
80         std::string     m_email;
81         bool            m_emailIsSet;
82
83         bool            m_isDefault;
84
85         ContactEmailAddressTypeArrayPtr m_types;
86
87         bool is_typesSetJSArray;
88         JSValueRef m_typesJsValue;
89         JSObjectRef m_typesObj;
90
91         JSContextRef m_context;
92 };
93
94 } // Contact
95 } // DeviceAPI
96
97 #endif // _API_CONTACT_CONTACT_EMAIL_ADDRESS_H_