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 {
34 struct LocalStoragePrivateData{
35 WrtDeviceApis::LocalStorage::Api::ILocalStoragePtr istorage;
37 JSObjectRef widgetObject;
44 * This method initializes this in the JS Engine.
46 static const JSClassRef getClassRef();
49 * Gets object's class description.
51 static const JSClassDefinition* getClassInfo();
55 * The callback invoked when an object is first created.
57 static void initialize(JSContextRef context, JSObjectRef object);
60 * The callback invoked when an object is finalized.
62 static void finalize(JSObjectRef object);
65 * This structure contains properties and callbacks
66 * that define a type of object.
68 static JSClassDefinition m_classInfo;
71 * This structure describes a statically declared function.
73 static JSStaticFunction m_function[];
75 static JSStaticValue m_property[];
77 static JSClassRef m_jsClassRef;
79 //Modified functions for Preference object
80 static JSValueRef removeItem(JSContextRef context, JSObjectRef object,
81 JSObjectRef thisObject, size_t argumentCount,
82 const JSValueRef arguments[],
83 JSValueRef* exception);
85 static JSValueRef setItem(JSContextRef context, JSObjectRef object,
86 JSObjectRef thisObject, size_t argumentCount,
87 const JSValueRef arguments[],
88 JSValueRef* exception);
90 static JSValueRef getItem(JSContextRef context, JSObjectRef object,
91 JSObjectRef thisObject, size_t argumentCount,
92 const JSValueRef arguments[],
93 JSValueRef* exception);
95 static JSValueRef clear(JSContextRef context, JSObjectRef object,
96 JSObjectRef thisObject, size_t argumentCount,
97 const JSValueRef arguments[],
98 JSValueRef* exception);
100 static JSValueRef key(JSContextRef context, JSObjectRef object,
101 JSObjectRef thisObject, size_t argumentCount,
102 const JSValueRef arguments[],
103 JSValueRef* exception);
105 static JSValueRef getLength(JSContextRef context,
107 JSStringRef propertyName,
108 JSValueRef* exception);
110 static bool hasProperty(JSContextRef context,
112 JSStringRef propertyName);
114 static JSValueRef getProperty(JSContextRef context,
116 JSStringRef propertyName,
117 JSValueRef* exception);
119 static bool setProperty(JSContextRef context,
121 JSStringRef propertyName,
123 JSValueRef* exception);