Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / JSContactOrganization.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        JSContactOrganization.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief       Declaration of the JSContactOrganization class
22  */
23
24 #ifndef _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_H_
25 #define _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_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/ContactOrganization.h>
32
33 namespace TizenApis {
34 namespace Tizen1_0 {
35 namespace Contact {
36
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::ContactOrganizationPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSContactOrganizationPriv;
38
39 class JSContactOrganization {
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& name,
48                         const std::string& department,
49                         const std::string& office,
50                         const std::string& title,
51                         const std::string& role,
52                         const std::string& logoURI);
53
54         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
55
56         static TizenApis::Api::Contact::ContactOrganizationPtr getContactOrganization(JSContextRef context, JSValueRef value);
57
58 private:
59    /**
60         * The callback invoked when an object is first created.
61         */
62         static void Initialize(JSContextRef context, JSObjectRef object);
63
64    /**
65         * The callback invoked when an object is finalized.
66         */
67         static void Finalize(JSObjectRef object);
68
69    /**
70         * This structure contains properties and callbacks that define a type of object.
71         */
72         static JSClassDefinition m_classInfo;
73
74    /**
75         * This structure describes a statically declared function property.
76         */
77         static JSStaticFunction m_functions[];
78
79         /**
80          * This member variable contains the initialization values for the static properties of this class.
81          * The values are given according to the data structure JSPropertySpec
82          */
83         static JSStaticValue m_property[];
84
85         static JSClassRef m_classRef;
86
87         static TizenApis::Api::Contact::ContactOrganizationPtr getPrivData(JSObjectRef object);
88
89         static JSValueRef getName(JSContextRef context,
90                         JSObjectRef object,
91                         JSStringRef propertyName,
92                         JSValueRef* exception);
93
94         static bool setName(JSContextRef context,
95                         JSObjectRef object,
96                         JSStringRef propertyName,
97                         JSValueRef value,
98                         JSValueRef* exception);
99
100         static JSValueRef getDepartment(JSContextRef context,
101                         JSObjectRef object,
102                         JSStringRef propertyName,
103                         JSValueRef* exception);
104
105         static bool setDepartment(JSContextRef context,
106                         JSObjectRef object,
107                         JSStringRef propertyName,
108                         JSValueRef value,
109                         JSValueRef* exception);
110
111         static JSValueRef getOffice(JSContextRef context,
112                         JSObjectRef object,
113                         JSStringRef propertyName,
114                         JSValueRef* exception);
115
116         static bool setOffice(JSContextRef context,
117                         JSObjectRef object,
118                         JSStringRef propertyName,
119                         JSValueRef value,
120                         JSValueRef* exception);
121
122         static JSValueRef getTitle(JSContextRef context,
123                         JSObjectRef object,
124                         JSStringRef propertyName,
125                         JSValueRef* exception);
126
127         static bool setTitle(JSContextRef context,
128                         JSObjectRef object,
129                         JSStringRef propertyName,
130                         JSValueRef value,
131                         JSValueRef* exception);
132
133         static JSValueRef getRole(JSContextRef context,
134                         JSObjectRef object,
135                         JSStringRef propertyName,
136                         JSValueRef* exception);
137
138         static bool setRole(JSContextRef context,
139                         JSObjectRef object,
140                         JSStringRef propertyName,
141                         JSValueRef value,
142                         JSValueRef* exception);
143
144         static JSValueRef getLogoURI(JSContextRef context,
145                         JSObjectRef object,
146                         JSStringRef propertyName,
147                         JSValueRef* exception);
148
149         static bool setLogoURI(JSContextRef context,
150                         JSObjectRef object,
151                         JSStringRef propertyName,
152                         JSValueRef value,
153                         JSValueRef* exception);
154 };
155
156 } // Contact
157 } // Tizen1_0
158 } // TizenApis
159
160 #endif // _TIZEN_CONTACT_JS_CONTACT_ORGANIZATION_H_