Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / JSContactEmailAddress.h
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        JSContactEmailAddress.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief       Declaration of the JSContactEmailAddress class
22  */
23
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_EMAIL_ADDRESS_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_EMAIL_ADDRESS_H_
26
27 #include <JavaScriptCore/JavaScript.h>
28 #include <dpl/shared_ptr.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <Commons/IEvent.h>
31 #include <API/Contact/ContactEmailAddress.h>
32
33 namespace TizenApis {
34 namespace Tizen1_0 {
35 namespace Contact {
36
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactEmailAddressPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactEmailAddressPriv;
38
39 class JSContactEmailAddress {
40 public:
41         /*
42         * This initializes this JS class in the JS Engine.
43         */
44         static JSClassRef getClassRef();
45
46         static JSValueRef createJSObject(JSContextRef context,
47                         const std::string email = "",
48                         const TizenApis::Api::Contact::ContactEmailAddressTypeArrayPtr types = TizenApis::Api::Contact::ContactEmailAddressTypeArrayPtr(new TizenApis::Api::Contact::ContactEmailAddressTypeArray()));
49
50         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
51
52         static TizenApis::Api::Contact::ContactEmailAddressPtr getContactEmailAddress(JSContextRef context, JSValueRef value);
53
54 private:
55    /**
56         * The callback invoked when an object is first created.
57         */
58         static void Initialize(JSContextRef context, JSObjectRef object);
59
60    /**
61         * The callback invoked when an object is finalized.
62         */
63         static void Finalize(JSObjectRef object);
64
65    /**
66         * This structure contains properties and callbacks that define a type of object.
67         */
68         static JSClassDefinition m_classInfo;
69
70    /**
71         * This structure describes a statically declared function property.
72         */
73         static JSStaticFunction m_functions[];
74
75         /**
76          * This member variable contains the initialization values for the static properties of this class.
77          * The values are given according to the data structure JSPropertySpec
78          */
79         static JSStaticValue m_property[];
80
81         static JSClassRef m_classRef;
82
83         static TizenApis::Api::Contact::ContactEmailAddressPtr getPrivData(JSObjectRef object);
84
85         static JSValueRef getEmail(JSContextRef context,
86                         JSObjectRef object,
87                         JSStringRef propertyName,
88                         JSValueRef* exception);
89
90         static bool setEmail(JSContextRef context,
91                         JSObjectRef object,
92                         JSStringRef propertyName,
93                         JSValueRef value,
94                         JSValueRef* exception);
95
96         static JSValueRef getTypes(JSContextRef context,
97                         JSObjectRef object,
98                         JSStringRef propertyName,
99                         JSValueRef* exception);
100
101         static bool setTypes(JSContextRef context,
102                         JSObjectRef object,
103                         JSStringRef propertyName,
104                         JSValueRef value,
105                         JSValueRef* exception);
106 };
107
108 } // Contact
109 } // Tizen1_0
110 } // TizenApis
111
112 #endif // _TIZEN_CONTACT_JS_CONTACT_EMAIL_ADDRESS_H_