upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Common / JSTizenException.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 JSTIZENEXCEPTION_H_
18 #define JSTIZENEXCEPTION_H_
19
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22
23 #include "TizenExceptionData.h"
24
25 namespace TizenApis {
26
27         namespace Commons {
28
29                 /**
30                  * @deprecated
31                  * TizenException is deprecated. use JSWebAPIError instead.
32                 */
33                 class JSTizenException {
34                         public:
35                                 typedef  WrtDeviceApis::CommonsJavaScript::PrivateObjectT<TizenExceptionDataPtr>::Type PrivateObject;
36
37                         public:
38                                 static const std::string UNKNOWN_ERROR;
39                                 static const std::string TYPE_MISMATCH_ERROR;
40                                 static const std::string INVALID_VALUES_ERROR;
41                                 static const std::string TIMEOUT_ERROR;
42                                 static const std::string IO_ERROR;
43                                 static const std::string NOT_SUPPORTED_ERROR;
44                                 static const std::string PERMISSION_DENIED_ERROR;
45                                 static const std::string NOT_FOUND_ERROR;
46                                 static const std::string SERVICE_NOT_AVAILABLE;
47                                 static const std::string NETWORK_ERROR;
48                           public:
49                                 static JSClassRef getClassRef();
50
51                                 static const JSClassDefinition* getClassInfo();
52
53                         private:
54                                 /**
55                                  * The callback invoked when an object is first created.
56                                  */
57                                 static void initialize(JSContextRef context, JSObjectRef object);
58
59                                 /**
60                                  * The callback invoked when an object is finalized.
61                                  */
62                                 static void finalize(JSObjectRef object);
63
64                                 /**
65                                  * The callback invoked when getting a property's value.
66                                  */
67                                 static bool hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName);
68
69                                 /**
70                                  * The callback invoked when getting a property's value.
71                                  */
72                                 static JSValueRef getStaticProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
73
74                                 /**
75                                  * The callback invoked when an object is used as the target of an 'instanceof' expression.
76                                  */
77                                 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
78
79                                 /**
80                                  * This structure contains properties and callbacks that define a type of object.
81                                  */
82                                 static JSClassDefinition m_classInfo;
83
84                                 /**
85                                  * This structure describes a statically declared value property.
86                                  */
87                                 static JSStaticValue m_properties[];
88
89                                 static JSClassRef m_classRef;
90                 };
91
92         }
93
94 }
95
96 #endif /* JSTIZENEXCEPTION_H_ */