Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / JSContact.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        JSContact.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief       Declaration of the JSContact class
22  */
23
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_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/Contact.h>
32
33 namespace TizenApis {
34 namespace Tizen1_0 {
35 namespace Contact {
36
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactPriv;
38
39 class JSContact {
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                         // FIXME fix this value
48                         );
49
50         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
51
52         static TizenApis::Api::Contact::ContactPtr getContact(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::ContactPtr getPrivData(JSObjectRef object);
84
85         static JSValueRef getId(JSContextRef context,
86                         JSObjectRef object,
87                         JSStringRef propertyName,
88                         JSValueRef* exception);
89
90         static JSValueRef getReadOnly(JSContextRef context,
91                         JSObjectRef object,
92                         JSStringRef propertyName,
93                         JSValueRef* exception);
94
95         static JSValueRef getLastUpdated(JSContextRef context,
96                         JSObjectRef object,
97                         JSStringRef propertyName,
98                         JSValueRef* exception);
99 };
100
101 } // Contact
102 } // Tizen1_0
103 } // TizenApis
104
105 #endif // _TIZEN_CONTACT_JS_CONTACT_H_