2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file JSPreferences.h
19 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
24 #ifndef _WRT_PLUGIN_JS_WIDGET_PREFERENCES_H_
25 #define _WRT_PLUGIN_JS_WIDGET_PREFERENCES_H_
27 #include <JavaScriptCore/JavaScript.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include <LocalStorage/ILocalStorage.h>
31 namespace WrtPlugins {
33 struct LocalStoragePrivateData {
34 WrtDeviceApis::LocalStorage::Api::ILocalStoragePtr istorage;
36 JSObjectRef widgetObject;
43 * This method initializes this in the JS Engine.
45 static JSClassRef getClassRef();
48 * Gets object's class description.
50 static const JSClassDefinition* getClassInfo();
54 * The callback invoked when an object is first created.
56 static void initialize(JSContextRef context, JSObjectRef object);
59 * The callback invoked when an object is finalized.
61 static void finalize(JSObjectRef object);
64 * This structure contains properties and callbacks
65 * that define a type of object.
67 static JSClassDefinition m_classInfo;
70 * This structure describes a statically declared function.
72 static JSStaticFunction m_function[];
74 static JSStaticValue m_property[];
76 static JSClassRef m_jsClassRef;
78 //Modified functions for Preference object
79 static JSValueRef removeItem(JSContextRef context, JSObjectRef object,
80 JSObjectRef thisObject, size_t argumentCount,
81 const JSValueRef arguments[],
82 JSValueRef* exception);
84 static JSValueRef setItem(JSContextRef context, JSObjectRef object,
85 JSObjectRef thisObject, size_t argumentCount,
86 const JSValueRef arguments[],
87 JSValueRef* exception);
89 static JSValueRef getItem(JSContextRef context, JSObjectRef object,
90 JSObjectRef thisObject, size_t argumentCount,
91 const JSValueRef arguments[],
92 JSValueRef* exception);
94 static JSValueRef clear(JSContextRef context, JSObjectRef object,
95 JSObjectRef thisObject, size_t argumentCount,
96 const JSValueRef arguments[],
97 JSValueRef* exception);
99 static JSValueRef key(JSContextRef context, JSObjectRef object,
100 JSObjectRef thisObject, size_t argumentCount,
101 const JSValueRef arguments[],
102 JSValueRef* exception);
104 static JSValueRef getLength(JSContextRef context,
106 JSStringRef propertyName,
107 JSValueRef* exception);
109 static bool hasProperty(JSContextRef context,
111 JSStringRef propertyName);
113 static JSValueRef getProperty(JSContextRef context,
115 JSStringRef propertyName,
116 JSValueRef* exception);
118 static bool setProperty(JSContextRef context,
120 JSStringRef propertyName,
122 JSValueRef* exception);