Initialize Tizen 2.3
[framework/web/wrt-plugins-common.git] / src_wearable / CommonsJavaScript / JSDOMException.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 #ifndef WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_DOM_EXCEPTION_H_
17 #define WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_DOM_EXCEPTION_H_
18
19 #include <JavaScriptCore/JavaScript.h>
20 #include <CommonsJavaScript/PrivateObject.h>
21 #include <CommonsJavaScript/DOMExceptionData.h>
22
23 namespace WrtDeviceApis {
24 namespace CommonsJavaScript {
25 class JSDOMException
26 {
27   public:
28     typedef PrivateObjectT<DOMExceptionDataPtr>::Type PrivateObject;
29
30   public:
31     static const unsigned short UNKNOWN_ERR = 0;
32     static const unsigned short INDEX_SIZE_ERR = 1;
33     static const unsigned short DOMSTRING_SIZE_ERR = 2;
34     static const unsigned short HIERARCHY_REQUEST_ERR = 3;
35     static const unsigned short WRONG_DOCUMENT_ERR = 4;
36     static const unsigned short INVALID_CHARACTER_ERR = 5;
37     static const unsigned short NO_DATA_ALLOWED_ERR = 6;
38     static const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
39     static const unsigned short NOT_FOUND_ERR = 8;
40     static const unsigned short NOT_SUPPORTED_ERR = 9;
41     static const unsigned short INUSE_ATTRIBUTE_ERR = 10;
42     static const unsigned short INVALID_STATE_ERR = 11;
43     static const unsigned short SYNTAX_ERR = 12;
44     static const unsigned short INVALID_MODIFICATION_ERR = 13;
45     static const unsigned short NAMESPACE_ERR = 14;
46     static const unsigned short INVALID_ACCESS_ERR = 15;
47     static const unsigned short VALIDATION_ERR = 16;
48     static const unsigned short TYPE_MISMATCH_ERR = 17;
49     static const unsigned short SECURITY_ERR = 18;
50     static const unsigned short NETWORK_ERR = 19;
51     static const unsigned short ABORT_ERR = 20;
52     static const unsigned short TIMEOUT_ERR = 21;
53     static const unsigned short INVALID_VALUES_ERR = 22;
54     static const unsigned short IO_ERR = 100;
55
56     //TODO INVALID_VALUES_ERR has the same error code ??
57     static const unsigned short QUOTA_EXCEEDED_ERR = 22;
58
59   public:
60     static JSClassRef getClassRef();
61     /**
62      * Gets object's class description.
63      */
64     static const JSClassDefinition* getClassInfo();
65
66   private:
67     /**
68      * The callback invoked when an object is first created.
69      */
70     static void initialize(JSContextRef context,
71                            JSObjectRef object);
72
73     /**
74      * The callback invoked when an object is finalized.
75      */
76     static void finalize(JSObjectRef object);
77
78     /**
79      * The callback invoked when getting a property's value.
80      */
81     static bool hasProperty(JSContextRef context,
82                             JSObjectRef object,
83                             JSStringRef propertyName);
84
85     /**
86      * The callback invoked when getting a property's value.
87      */
88     static JSValueRef getProperty(JSContextRef context,
89                                   JSObjectRef object,
90                                   JSStringRef propertyName,
91                                   JSValueRef* exception);
92
93     /**
94      * The callback invoked when getting a property's value.
95      */
96     static JSValueRef getStaticProperty(JSContextRef context,
97                                         JSObjectRef object,
98                                         JSStringRef propertyName,
99                                         JSValueRef* exception);
100
101     static void getPropertyNames(JSContextRef context,
102                                  JSObjectRef object,
103                                  JSPropertyNameAccumulatorRef accumulator);
104
105     /**
106      * The callback invoked when an object is used as the target of an
107      * 'instanceof' expression.
108      */
109     static bool hasInstance(JSContextRef context,
110                             JSObjectRef constructor,
111                             JSValueRef possibleInstance,
112                             JSValueRef* exception);
113
114     /**
115      * This structure contains properties and callbacks that define a type of
116      * object.
117      */
118     static JSClassDefinition m_classInfo;
119
120     /**
121      * This structure describes a statically declared value property.
122      */
123     static JSStaticValue m_properties[];
124
125     static JSClassRef m_classRef;
126 };
127 } // CommonsJavaScript
128 } // WrtDeviceApis
129
130 #endif //
131