Add void* userdata support for gobjects
[gnome.seed] / libseed / seed-types.h
1 /* -*- mode: C; indent-tabs-mode: t; tab-width: 8; c-basic-offset: 2; -*- */
2
3 /*
4  * This file is part of Seed, the GObject Introspection<->Javascript bindings.
5  *
6  * Seed is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  * Seed is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with Seed.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright (C) Robert Carr 2009 <carrr@rpi.edu>
18  */
19
20 #ifndef _SEED_TYPES_H
21 #define _SEED_TYPES_H
22
23 #include "seed-private.h"
24
25 extern GQuark js_ref_quark;
26
27 JSValueRef seed_value_from_gvalue (JSContextRef ctx,
28                                    GValue * gval, JSValueRef * exception);
29
30 JSValueRef seed_object_get_property (JSContextRef ctx,
31                                      JSObjectRef val, const gchar * name);
32
33 gboolean seed_object_set_property (JSContextRef ctx, JSObjectRef object,
34                                    const gchar * name, JSValueRef value);
35 gboolean seed_gvalue_from_seed_value (JSContextRef ctx,
36                                       JSValueRef val, GType type,
37                                       GValue * gval, JSValueRef * exception);
38
39 gboolean seed_gi_make_argument (JSContextRef ctx,
40                                 JSValueRef value,
41                                 GITypeInfo * type_info,
42                                 GArgument * arg, JSValueRef * exception);
43 JSValueRef seed_gi_argument_make_js (JSContextRef ctx,
44                                      GArgument * arg,
45                                      GITypeInfo * type_info,
46                                      JSValueRef * exception);
47
48 gboolean seed_gi_release_arg (GITransfer transfer,
49                               GITypeInfo * type_info, GArgument * arg);
50
51 gboolean seed_gi_release_in_arg (GITransfer transfer,
52                                  GITypeInfo * type_info, GArgument * arg);
53
54 gboolean seed_value_to_boolean (JSContextRef ctx,
55                                 JSValueRef val, JSValueRef * exception);
56
57 JSValueRef seed_value_from_boolean (JSContextRef ctx,
58                                     gboolean val, JSValueRef * exception);
59
60 guint seed_value_to_uint (JSContextRef ctx,
61                           JSValueRef val, JSValueRef * exception);
62
63 JSValueRef seed_value_from_uint (JSContextRef ctx,
64                                  guint val, JSValueRef * exception);
65
66 gint seed_value_to_int (JSContextRef ctx,
67                         JSValueRef val, JSValueRef * exception);
68
69 JSValueRef seed_value_from_int (JSContextRef ctx,
70                                 gint val, JSValueRef * exception);
71
72 gchar seed_value_to_char (JSContextRef ctx,
73                           JSValueRef val, JSValueRef * exception);
74 JSValueRef seed_value_from_char (JSContextRef ctx,
75                                  gchar val, JSValueRef * exception);
76
77 guchar seed_value_to_uchar (JSContextRef ctx,
78                             JSValueRef val, JSValueRef * exception);
79 JSValueRef seed_value_from_uchar (JSContextRef ctx,
80                                   guchar val, JSValueRef * exception);
81
82 glong seed_value_to_long (JSContextRef ctx,
83                           JSValueRef val, JSValueRef * exception);
84 JSValueRef seed_value_from_long (JSContextRef ctx,
85                                  glong val, JSValueRef * exception);
86
87 gulong seed_value_to_ulong (JSContextRef ctx,
88                             JSValueRef val, JSValueRef * exception);
89 JSValueRef seed_value_from_ulong (JSContextRef ctx,
90                                   gulong val, JSValueRef * exception);
91
92 gint64 seed_value_to_int64 (JSContextRef ctx,
93                             JSValueRef val, JSValueRef * exception);
94 JSValueRef seed_value_from_int64 (JSContextRef ctx,
95                                   gint64 val, JSValueRef * exception);
96
97 guint64 seed_value_to_uint64 (JSContextRef ctx,
98                               JSValueRef val, JSValueRef * exception);
99 JSValueRef seed_value_from_uint64 (JSContextRef ctx,
100                                    guint64 val, JSValueRef * exception);
101
102 gfloat seed_value_to_float (JSContextRef ctx,
103                             JSValueRef val, JSValueRef * exception);
104 JSValueRef seed_value_from_float (JSContextRef ctx,
105                                   gfloat val, JSValueRef * exception);
106
107 gdouble seed_value_to_double (JSContextRef ctx,
108                               JSValueRef val, JSValueRef * exception);
109 JSValueRef seed_value_from_double (JSContextRef ctx,
110                                    gdouble val, JSValueRef * exception);
111
112 gsize seed_value_to_size (JSContextRef ctx,
113                           JSValueRef val, JSValueRef * exception);
114 JSValueRef seed_value_from_size (JSContextRef ctx,
115                                  gsize val, JSValueRef * exception);
116
117 gssize seed_value_to_ssize (JSContextRef ctx,
118                             JSValueRef val, JSValueRef * exception);
119 JSValueRef seed_value_from_ssize (JSContextRef ctx,
120                                   gssize val, JSValueRef * exception);
121
122 gchar *seed_value_to_filename (JSContextRef ctx,
123                                JSValueRef val, JSValueRef * exception);
124 JSValueRef seed_value_from_filename (JSContextRef ctx,
125                                      const gchar * filename,
126                                      JSValueRef * exception);
127
128 gchar *seed_value_to_string (JSContextRef ctx,
129                              JSValueRef val, JSValueRef * exception);
130
131 JSValueRef seed_value_from_string (JSContextRef ctx,
132                                    const gchar * val, JSValueRef * exception);
133
134 time_t seed_value_to_time_t (JSContextRef ctx,
135                              JSValueRef val, JSValueRef * exception);
136
137 JSValueRef seed_value_from_time_t (JSContextRef ctx,
138                                    time_t time, JSValueRef * exception);
139
140 GObject *seed_value_to_object (JSContextRef ctx,
141                                JSValueRef val, JSValueRef * exception);
142 JSValueRef seed_value_from_object (JSContextRef ctx,
143                                    GObject * val, JSValueRef * exception);
144
145 void seed_toggle_ref (gpointer data, GObject * object, gboolean is_last_ref);
146
147 gboolean seed_validate_enum (GIEnumInfo * info, long val);
148
149 JSValueRef
150 seed_value_from_binary_string (JSContextRef ctx,
151                                const gchar * bytes,
152                                gint n_bytes, JSValueRef * exception);
153
154 JSObjectRef seed_make_wrapper_for_type (JSContextRef ctx, GType type);
155
156 #endif