Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Alarm / JSAlarmRelative.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 #ifndef _JS_TIZEN_ALARMRELATIVE
18 #define _JS_TIZEN_ALARMRELATIVE
19
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Application/IApplication.h>
23 #include "AlarmRelative.h"
24
25 namespace TizenApis {
26 namespace Tizen1_0 {
27 namespace Alarm {
28
29 using namespace TizenApis::Api::Alarm;
30
31 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<AlarmRelativePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSAlarmRelativePriv;
32
33 class JSAlarmRelative {
34 public:
35     static const JSClassDefinition* getClassInfo();
36     static const JSClassRef getClassRef();
37     static JSValueRef createJSObject(JSContextRef context, const int id);
38     static JSValueRef createJSObject(JSContextRef context, struct tm date, AlarmRecurrencePtr ptr);
39     static JSValueRef createJSObject(JSContextRef context, int delay, AlarmRecurrencePtr ptr);
40     static JSValueRef createJSObject(JSContextRef context, struct tm date);
41     static JSValueRef createJSObject(JSContextRef context, int delay, int dummy);
42     static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
43     
44
45 protected:
46     static void initialize(JSContextRef context, JSObjectRef object);
47     static void finalize(JSObjectRef object);
48     static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
49     static JSValueRef getNextScheduledDate(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
50     
51 private:
52     static Api::Alarm::AlarmRelativePtr getPrivData(JSObjectRef object);
53    
54     static JSValueRef getId(JSContextRef context,
55                                         JSObjectRef object,
56                                         JSStringRef propertyName,
57                                         JSValueRef* exception);
58
59     static JSValueRef getRecurrenceRule(JSContextRef context,
60                                                 JSObjectRef object,
61                                                 JSStringRef propertyName,
62                                                 JSValueRef* exception);
63
64     static JSClassDefinition m_jsClassInfo;
65     static JSClassRef m_jsClassRef;
66     static JSStaticFunction m_function[];
67     static JSStaticValue m_property[];
68
69 };
70
71 }// Alarm
72 } // Tizen1_0
73 } // TizenApis
74
75 #endif