5e966ccc8c8148a8b1152368cba016a65eb51461
[framework/web/wrt-plugins-tizen.git] / src / Tizen / JSAttributeFilter.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        JSAttributeFilter.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief       Declaration of the JSAttributeFilter class
23  */
24
25 #ifndef _TIZEN_TIZEN_JS_ATTRIBUTE_FILTER_H_
26 #define _TIZEN_TIZEN_JS_ATTRIBUTE_FILTER_H_
27
28 #include <JavaScriptCore/JavaScript.h>
29 #include <dpl/shared_ptr.h>
30 #include <CommonsJavaScript/PrivateObject.h>
31 #include <Commons/IEvent.h>
32 #include "AttributeFilter.h"
33
34 namespace DeviceAPI {\rnamespace Tizen {
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<DeviceAPI::Tizen::AttributeFilterPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSAttributeFilterPriv;
37
38 class JSAttributeFilter {
39 public:
40         /*
41          * This initializes this JS class in the JS Engine.
42          */
43         static JSClassRef getClassRef();
44
45         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
46
47         static DeviceAPI::Tizen::AttributeFilterPtr getAttributeFilter(JSContextRef context, JSValueRef value);
48
49         static JSObjectRef createJSObject(JSContextRef context, DeviceAPI::Tizen::AttributeFilterPtr privateData);
50
51 private:
52         /**
53          * The callback invoked when an object is first created.
54          */
55         static void Initialize(JSContextRef context, JSObjectRef object);
56
57         /**
58          * The callback invoked when an object is finalized.
59          */
60         static void Finalize(JSObjectRef object);
61
62         /**
63          * This structure contains properties and callbacks that define a type of object.
64          */
65         static JSClassDefinition m_classInfo;
66
67         /**
68          * This structure describes a statically declared function property.
69          */
70         static JSStaticFunction m_functions[];
71
72         /**
73          * This member variable contains the initialization values for the static properties of this class.
74          * The values are given according to the data structure JSPropertySpec
75          */
76         static JSStaticValue m_property[];
77
78         static JSClassRef m_classRef;
79
80         static DeviceAPI::Tizen::AttributeFilterPtr getPrivData(JSObjectRef object);
81
82         static JSObjectRef constructor(JSContextRef context,
83                         JSObjectRef constructor,
84                         size_t argumentCount,
85                         const JSValueRef arguments[],
86                         JSValueRef* exception);
87
88         static JSValueRef getAttributeName(JSContextRef context,
89                         JSObjectRef object,
90                         JSStringRef propertyName,
91                         JSValueRef* exception);
92
93         static bool setAttributeName(JSContextRef context,
94                         JSObjectRef object,
95                         JSStringRef propertyName,
96                         JSValueRef value,
97                         JSValueRef* exception);
98
99         static JSValueRef getMatchFlag(JSContextRef context,
100                         JSObjectRef object,
101                         JSStringRef propertyName,
102                         JSValueRef* exception);
103
104         static bool setMatchFlag(JSContextRef context,
105                         JSObjectRef object,
106                         JSStringRef propertyName,
107                         JSValueRef value,
108                         JSValueRef* exception);
109
110         static JSValueRef getMatchValue(JSContextRef context,
111                         JSObjectRef object,
112                         JSStringRef propertyName,
113                         JSValueRef* exception);
114
115         static bool setMatchValue(JSContextRef context,
116                         JSObjectRef object,
117                         JSStringRef propertyName,
118                         JSValueRef value,
119                         JSValueRef* exception);
120 };
121
122 } // Tizen
123 } // DeviceAPI
124
125
126 #endif // _TIZEN_TIZEN_JS_ATTRIBUTE_FILTER_H_