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.
17 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_INFORMATION_H_
18 #define TIZENAPIS_TIZEN_JS_APPLICATION_INFORMATION_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <dpl/shared_ptr.h>
23 #include <API/Application/ApplicationInformation.h>
27 namespace Application {
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<Api::Application::ApplicationInformationPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationInformationPriv;
31 class JSApplicationInformation {
34 * This initializes this JS class in the JS Engine.
36 static JSClassRef getClassRef();
38 static JSValueRef createJSObject(JSContextRef context,
39 const std::string &name,
40 const std::string &package,
41 const std::string &iconPath,
42 const std::string &version);
44 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
46 static Api::Application::ApplicationInformationPtr
47 getApplicationInformation(JSContextRef context, JSValueRef value);
51 * The callback invoked when an object is first created.
53 static void initialize(JSContextRef context, JSObjectRef object);
56 * The callback invoked when an object is finalized.
58 static void finalize(JSObjectRef object);
61 * This structure contains properties and callbacks that define a type of object.
63 static JSClassDefinition m_classInfo;
66 * This structure describes a statically declared function property.
68 static JSStaticFunction m_functions[];
71 * This member variable contains the initialization values for the static properties of this class.
72 * The values are given according to the data structure JSPropertySpec
74 static JSStaticValue m_property[];
76 static JSClassRef m_classRef;
78 static Api::Application::ApplicationInformationPtr getPrivData(JSObjectRef object);
80 static JSValueRef getName(JSContextRef context,
82 JSStringRef propertyName,
83 JSValueRef* exception);
85 static bool setName(JSContextRef context,
87 JSStringRef propertyName,
89 JSValueRef* exception);
91 static JSValueRef getPackage(JSContextRef context,
93 JSStringRef propertyName,
94 JSValueRef* exception);
96 static bool setPackage(JSContextRef context,
98 JSStringRef propertyName,
100 JSValueRef* exception);
102 static JSValueRef getIconPath(JSContextRef context,
104 JSStringRef propertyName,
105 JSValueRef* exception);
107 static bool setIconPath(JSContextRef context,
109 JSStringRef propertyName,
111 JSValueRef* exception);
113 static JSValueRef getVersion(JSContextRef context,
115 JSStringRef propertyName,
116 JSValueRef* exception);
118 static bool setVersion(JSContextRef context,
120 JSStringRef propertyName,
122 JSValueRef* exception);