1 | /* |
2 | * Copyright (C) 2018 Igalia S.L. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | * Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #if !defined(__JSC_H_INSIDE__) && !defined(JSC_COMPILATION) && !defined(WEBKIT2_COMPILATION) |
21 | #error "Only <jsc/jsc.h> can be included directly." |
22 | #endif |
23 | |
24 | #ifndef JSCException_h |
25 | #define JSCException_h |
26 | |
27 | #include <glib-object.h> |
28 | #include <jsc/JSCDefines.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | #define JSC_TYPE_EXCEPTION (jsc_exception_get_type()) |
33 | #define JSC_EXCEPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JSC_TYPE_EXCEPTION, JSCException)) |
34 | #define JSC_IS_EXCEPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JSC_TYPE_EXCEPTION)) |
35 | #define JSC_EXCEPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JSC_TYPE_EXCEPTION, JSCExceptionClass)) |
36 | #define JSC_IS_EXCEPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JSC_TYPE_EXCEPTION)) |
37 | #define JSC_EXCEPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JSC_TYPE_EXCEPTION, JSCExceptionClass)) |
38 | |
39 | typedef struct _JSCException JSCException; |
40 | typedef struct _JSCExceptionClass JSCExceptionClass; |
41 | typedef struct _JSCExceptionPrivate JSCExceptionPrivate; |
42 | |
43 | typedef struct _JSCContext JSCContext; |
44 | |
45 | struct _JSCException { |
46 | GObject parent; |
47 | |
48 | /*< private >*/ |
49 | JSCExceptionPrivate *priv; |
50 | }; |
51 | |
52 | struct _JSCExceptionClass { |
53 | GObjectClass parent_class; |
54 | |
55 | void (*_jsc_reserved0) (void); |
56 | void (*_jsc_reserved1) (void); |
57 | void (*_jsc_reserved2) (void); |
58 | void (*_jsc_reserved3) (void); |
59 | }; |
60 | |
61 | JSC_API GType |
62 | jsc_exception_get_type (void); |
63 | |
64 | JSC_API JSCException * |
65 | jsc_exception_new (JSCContext *context, |
66 | const char *message); |
67 | |
68 | JSC_API JSCException * |
69 | jsc_exception_new_printf (JSCContext *context, |
70 | const char *format, |
71 | ...) G_GNUC_PRINTF (2, 3); |
72 | |
73 | JSC_API JSCException * |
74 | jsc_exception_new_vprintf (JSCContext *context, |
75 | const char *format, |
76 | va_list args) G_GNUC_PRINTF(2, 0); |
77 | |
78 | JSC_API JSCException * |
79 | jsc_exception_new_with_name (JSCContext *context, |
80 | const char *name, |
81 | const char *message); |
82 | |
83 | JSC_API JSCException * |
84 | jsc_exception_new_with_name_printf (JSCContext *context, |
85 | const char *name, |
86 | const char *format, |
87 | ...) G_GNUC_PRINTF (3, 4); |
88 | |
89 | JSC_API JSCException * |
90 | jsc_exception_new_with_name_vprintf (JSCContext *context, |
91 | const char *name, |
92 | const char *format, |
93 | va_list args) G_GNUC_PRINTF (3, 0); |
94 | |
95 | JSC_API const char * |
96 | jsc_exception_get_name (JSCException *exception); |
97 | |
98 | JSC_API const char * |
99 | jsc_exception_get_message (JSCException *exception); |
100 | |
101 | JSC_API guint |
102 | jsc_exception_get_line_number (JSCException *exception); |
103 | |
104 | JSC_API guint |
105 | jsc_exception_get_column_number (JSCException *exception); |
106 | |
107 | JSC_API const char * |
108 | jsc_exception_get_source_uri (JSCException *exception); |
109 | |
110 | JSC_API const char * |
111 | jsc_exception_get_backtrace_string (JSCException *exception); |
112 | |
113 | JSC_API char * |
114 | jsc_exception_to_string (JSCException *exception); |
115 | |
116 | JSC_API char * |
117 | jsc_exception_report (JSCException *exception); |
118 | |
119 | G_END_DECLS |
120 | |
121 | #endif /* JSCException_h */ |
122 | |