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
30G_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
39typedef struct _JSCException JSCException;
40typedef struct _JSCExceptionClass JSCExceptionClass;
41typedef struct _JSCExceptionPrivate JSCExceptionPrivate;
42
43typedef struct _JSCContext JSCContext;
44
45struct _JSCException {
46 GObject parent;
47
48 /*< private >*/
49 JSCExceptionPrivate *priv;
50};
51
52struct _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
61JSC_API GType
62jsc_exception_get_type (void);
63
64JSC_API JSCException *
65jsc_exception_new (JSCContext *context,
66 const char *message);
67
68JSC_API JSCException *
69jsc_exception_new_printf (JSCContext *context,
70 const char *format,
71 ...) G_GNUC_PRINTF (2, 3);
72
73JSC_API JSCException *
74jsc_exception_new_vprintf (JSCContext *context,
75 const char *format,
76 va_list args) G_GNUC_PRINTF(2, 0);
77
78JSC_API JSCException *
79jsc_exception_new_with_name (JSCContext *context,
80 const char *name,
81 const char *message);
82
83JSC_API JSCException *
84jsc_exception_new_with_name_printf (JSCContext *context,
85 const char *name,
86 const char *format,
87 ...) G_GNUC_PRINTF (3, 4);
88
89JSC_API JSCException *
90jsc_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
95JSC_API const char *
96jsc_exception_get_name (JSCException *exception);
97
98JSC_API const char *
99jsc_exception_get_message (JSCException *exception);
100
101JSC_API guint
102jsc_exception_get_line_number (JSCException *exception);
103
104JSC_API guint
105jsc_exception_get_column_number (JSCException *exception);
106
107JSC_API const char *
108jsc_exception_get_source_uri (JSCException *exception);
109
110JSC_API const char *
111jsc_exception_get_backtrace_string (JSCException *exception);
112
113JSC_API char *
114jsc_exception_to_string (JSCException *exception);
115
116JSC_API char *
117jsc_exception_report (JSCException *exception);
118
119G_END_DECLS
120
121#endif /* JSCException_h */
122