gio2 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +26 -9
- data/ext/gio2/extconf.rb +38 -28
- data/ext/gio2/rb-gio2-pollable-source.c +59 -0
- data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
- data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
- data/extconf.rb +22 -6
- data/lib/gio2.rb +38 -143
- data/lib/gio2/deprecated.rb +16 -0
- data/lib/gio2/inet-address.rb +33 -0
- data/lib/gio2/input-stream.rb +39 -0
- data/lib/gio2/loader.rb +244 -0
- data/lib/gio2/output-stream.rb +24 -0
- data/lib/gio2/pollable-input-stream.rb +51 -0
- data/lib/gio2/pollable-output-stream.rb +32 -0
- data/lib/gio2/resources.rb +62 -0
- data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
- data/test/fixture/resource/Rakefile +32 -0
- data/test/fixture/resource/logo.png +0 -0
- data/test/fixture/resource/ruby-gio2.gresource +0 -0
- data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
- data/test/gio2-test-utils.rb +21 -0
- data/test/gio2-test-utils/fixture.rb +24 -0
- data/test/gio2-test-utils/socket-client.rb +59 -0
- data/test/run-test.rb +45 -9
- data/test/test-buffered-input-stream.rb +23 -0
- data/test/test-charset-converter.rb +23 -0
- data/test/test-content-type.rb +31 -0
- data/test/test-data-input-stream.rb +21 -0
- data/test/test-file-enumerator.rb +26 -0
- data/test/test-file-monitor.rb +33 -0
- data/test/test-file.rb +28 -0
- data/test/test-inet-address.rb +34 -0
- data/test/test-input-stream.rb +36 -0
- data/test/test-output-stream.rb +39 -0
- data/test/test-pollable-input-stream.rb +54 -0
- data/test/test-pollable-output-stream.rb +53 -0
- data/test/test-resources.rb +58 -0
- metadata +49 -107
- data/README +0 -34
- data/ext/gio2/depend +0 -11
- data/ext/gio2/gio2.def +0 -2
- data/ext/gio2/gio2.h +0 -30
- data/ext/gio2/rbgio.c +0 -133
- data/ext/gio2/rbgio2.h +0 -158
- data/ext/gio2/rbgio2conversions.h +0 -154
- data/ext/gio2/rbgio2private.h +0 -148
- data/ext/gio2/rbgioappinfo.c +0 -317
- data/ext/gio2/rbgioapplaunchcontext.c +0 -81
- data/ext/gio2/rbgioasyncinitable.c +0 -246
- data/ext/gio2/rbgioasyncresult.c +0 -41
- data/ext/gio2/rbgiobufferedinputstream.c +0 -167
- data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
- data/ext/gio2/rbgiocancellable.c +0 -180
- data/ext/gio2/rbgiocharsetconverter.c +0 -57
- data/ext/gio2/rbgiocontenttype.c +0 -131
- data/ext/gio2/rbgioconverter.c +0 -113
- data/ext/gio2/rbgioconverterinputstream.c +0 -43
- data/ext/gio2/rbgioconverteroutputstream.c +0 -43
- data/ext/gio2/rbgiodatainputstream.c +0 -309
- data/ext/gio2/rbgiodataoutputstream.c +0 -186
- data/ext/gio2/rbgiodesktopappinfo.c +0 -87
- data/ext/gio2/rbgiodrive.c +0 -266
- data/ext/gio2/rbgioemblem.c +0 -52
- data/ext/gio2/rbgioemblemedicon.c +0 -65
- data/ext/gio2/rbgiofile.c +0 -2045
- data/ext/gio2/rbgiofileattribute.c +0 -114
- data/ext/gio2/rbgiofileattributeinfo.c +0 -86
- data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
- data/ext/gio2/rbgiofileattributematcher.c +0 -95
- data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
- data/ext/gio2/rbgiofileenumerator.c +0 -166
- data/ext/gio2/rbgiofileicon.c +0 -41
- data/ext/gio2/rbgiofileinfo.c +0 -617
- data/ext/gio2/rbgiofileinputstream.c +0 -91
- data/ext/gio2/rbgiofileiostream.c +0 -98
- data/ext/gio2/rbgiofilemonitor.c +0 -46
- data/ext/gio2/rbgiofilenamecompleter.c +0 -73
- data/ext/gio2/rbgiofileoutputstream.c +0 -98
- data/ext/gio2/rbgiofilterinputstream.c +0 -28
- data/ext/gio2/rbgioicon.c +0 -69
- data/ext/gio2/rbgioinetaddress.c +0 -118
- data/ext/gio2/rbgioinetsocketaddress.c +0 -41
- data/ext/gio2/rbgioinitable.c +0 -199
- data/ext/gio2/rbgioinputstream.c +0 -341
- data/ext/gio2/rbgioio.c +0 -73
- data/ext/gio2/rbgioiomodule.c +0 -45
- data/ext/gio2/rbgioiomodules.c +0 -47
- data/ext/gio2/rbgioioscheduler.c +0 -102
- data/ext/gio2/rbgioioschedulerjob.c +0 -121
- data/ext/gio2/rbgioiostream.c +0 -107
- data/ext/gio2/rbgioloadableicon.c +0 -92
- data/ext/gio2/rbgiomemoryinputstream.c +0 -67
- data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
- data/ext/gio2/rbgiomount.c +0 -286
- data/ext/gio2/rbgiomountoperation.c +0 -53
- data/ext/gio2/rbgionetworkaddress.c +0 -59
- data/ext/gio2/rbgionetworkservice.c +0 -45
- data/ext/gio2/rbgiooutputstream.c +0 -331
- data/ext/gio2/rbgioresolver.c +0 -230
- data/ext/gio2/rbgioseekable.c +0 -91
- data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
- data/ext/gio2/rbgiosocket.c +0 -390
- data/ext/gio2/rbgiosocketaddress.c +0 -34
- data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
- data/ext/gio2/rbgiosocketclient.c +0 -207
- data/ext/gio2/rbgiosocketconnectable.c +0 -41
- data/ext/gio2/rbgiosocketconnection.c +0 -66
- data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
- data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
- data/ext/gio2/rbgiosocketlistener.c +0 -246
- data/ext/gio2/rbgiosocketservice.c +0 -66
- data/ext/gio2/rbgiosrvtarget.c +0 -76
- data/ext/gio2/rbgiotcpconnection.c +0 -28
- data/ext/gio2/rbgiothemedicon.c +0 -83
- data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
- data/ext/gio2/rbgiotlscertificate.c +0 -89
- data/ext/gio2/rbgiounixconnection.c +0 -71
- data/ext/gio2/rbgiounixfdlist.c +0 -115
- data/ext/gio2/rbgiounixfdmessage.c +0 -74
- data/ext/gio2/rbgiounixinputstream.c +0 -51
- data/ext/gio2/rbgiounixmount.c +0 -164
- data/ext/gio2/rbgiounixmountmonitor.c +0 -65
- data/ext/gio2/rbgiounixmountpoint.c +0 -136
- data/ext/gio2/rbgiounixmountpoints.c +0 -58
- data/ext/gio2/rbgiounixmounts.c +0 -58
- data/ext/gio2/rbgiounixoutputstream.c +0 -51
- data/ext/gio2/rbgiounixsocketaddress.c +0 -69
- data/ext/gio2/rbgiovfs.c +0 -84
- data/ext/gio2/rbgiovolume.c +0 -193
- data/ext/gio2/rbgiovolumemonitor.c +0 -77
- data/ext/gio2/rbgiozlibcompressor.c +0 -52
- data/ext/gio2/rbgiozlibdecompressor.c +0 -45
- data/ext/gio2/util.c +0 -303
- data/test/test_bufferedinputstream.rb +0 -9
- data/test/test_charsetconverter.rb +0 -9
- data/test/test_datainputstream.rb +0 -7
- data/test/test_fileenumerator.rb +0 -8
- data/test/test_filemonitor.rb +0 -17
- data/test/test_inetaddress.rb +0 -8
@@ -1,43 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cConverterInputStream
|
25
|
-
#define _SELF(value) RVAL2GCONVERTERINPUTSTREAM(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self, VALUE base_stream, VALUE converter)
|
29
|
-
{
|
30
|
-
G_INITIALIZE(self,
|
31
|
-
g_converter_input_stream_new(RVAL2GINPUTSTREAM(base_stream),
|
32
|
-
RVAL2GCONVERTER(converter)));
|
33
|
-
|
34
|
-
return Qnil;
|
35
|
-
}
|
36
|
-
|
37
|
-
void
|
38
|
-
Init_gconverterinputstream(VALUE mGio)
|
39
|
-
{
|
40
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CONVERTER_INPUT_STREAM, "ConverterInputStream", mGio);
|
41
|
-
|
42
|
-
RG_DEF_METHOD(initialize, 2);
|
43
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cConverterOutputStream
|
25
|
-
#define _SELF(value) RVAL2GCONVERTEROUTPUTSTREAM(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(VALUE self, VALUE base_stream, VALUE converter)
|
29
|
-
{
|
30
|
-
G_INITIALIZE(self,
|
31
|
-
g_converter_output_stream_new(RVAL2GOUTPUTSTREAM(base_stream),
|
32
|
-
RVAL2GCONVERTER(converter)));
|
33
|
-
|
34
|
-
return Qnil;
|
35
|
-
}
|
36
|
-
|
37
|
-
void
|
38
|
-
Init_gconverteroutputstream(VALUE mGio)
|
39
|
-
{
|
40
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CONVERTER_OUTPUT_STREAM, "ConverterOutputStream", mGio);
|
41
|
-
|
42
|
-
RG_DEF_METHOD(initialize, 2);
|
43
|
-
}
|
@@ -1,309 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cDataInputStream
|
25
|
-
#define _SELF(value) RVAL2GDATAINPUTSTREAM(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(int argc, VALUE *argv, VALUE self)
|
29
|
-
{
|
30
|
-
VALUE base_stream, byte_order, newline_type;
|
31
|
-
|
32
|
-
rb_scan_args(argc, argv, "12", &base_stream, &byte_order, &newline_type);
|
33
|
-
|
34
|
-
G_INITIALIZE(self, g_data_input_stream_new(RVAL2GINPUTSTREAM(base_stream)));
|
35
|
-
|
36
|
-
if (!NIL_P(byte_order))
|
37
|
-
g_data_input_stream_set_byte_order(_SELF(self),
|
38
|
-
RVAL2GDATASTREAMBYTEORDER(byte_order));
|
39
|
-
|
40
|
-
if (!NIL_P(newline_type))
|
41
|
-
g_data_input_stream_set_newline_type(_SELF(self),
|
42
|
-
RVAL2GDATASTREAMNEWLINETYPE(newline_type));
|
43
|
-
|
44
|
-
return Qnil;
|
45
|
-
}
|
46
|
-
|
47
|
-
static VALUE
|
48
|
-
rg_read_byte(int argc, VALUE *argv, VALUE self)
|
49
|
-
{
|
50
|
-
VALUE cancellable;
|
51
|
-
GError *error = NULL;
|
52
|
-
guchar value;
|
53
|
-
|
54
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
55
|
-
value = g_data_input_stream_read_byte(_SELF(self),
|
56
|
-
RVAL2GCANCELLABLE(cancellable),
|
57
|
-
&error);
|
58
|
-
if (error != NULL)
|
59
|
-
rbgio_raise_error(error);
|
60
|
-
|
61
|
-
return GUCHAR2RVAL(value);
|
62
|
-
}
|
63
|
-
|
64
|
-
static VALUE
|
65
|
-
rg_read_int16(int argc, VALUE *argv, VALUE self)
|
66
|
-
{
|
67
|
-
VALUE cancellable;
|
68
|
-
GError *error = NULL;
|
69
|
-
gint16 value;
|
70
|
-
|
71
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
72
|
-
value = g_data_input_stream_read_int16(_SELF(self),
|
73
|
-
RVAL2GCANCELLABLE(cancellable),
|
74
|
-
&error);
|
75
|
-
if (error != NULL)
|
76
|
-
rbgio_raise_error(error);
|
77
|
-
|
78
|
-
return GINT162RVAL(value);
|
79
|
-
}
|
80
|
-
|
81
|
-
static VALUE
|
82
|
-
rg_read_uint16(int argc, VALUE *argv, VALUE self)
|
83
|
-
{
|
84
|
-
VALUE cancellable;
|
85
|
-
GError *error = NULL;
|
86
|
-
guint16 value;
|
87
|
-
|
88
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
89
|
-
value = g_data_input_stream_read_uint16(_SELF(self),
|
90
|
-
RVAL2GCANCELLABLE(cancellable),
|
91
|
-
&error);
|
92
|
-
if (error != NULL)
|
93
|
-
rbgio_raise_error(error);
|
94
|
-
|
95
|
-
return GUINT162RVAL(value);
|
96
|
-
}
|
97
|
-
|
98
|
-
static VALUE
|
99
|
-
rg_read_int32(int argc, VALUE *argv, VALUE self)
|
100
|
-
{
|
101
|
-
VALUE cancellable;
|
102
|
-
GError *error = NULL;
|
103
|
-
gint32 value;
|
104
|
-
|
105
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
106
|
-
value = g_data_input_stream_read_int32(_SELF(self),
|
107
|
-
RVAL2GCANCELLABLE(cancellable),
|
108
|
-
&error);
|
109
|
-
if (error != NULL)
|
110
|
-
rbgio_raise_error(error);
|
111
|
-
|
112
|
-
return GINT322RVAL(value);
|
113
|
-
}
|
114
|
-
|
115
|
-
static VALUE
|
116
|
-
rg_read_uint32(int argc, VALUE *argv, VALUE self)
|
117
|
-
{
|
118
|
-
VALUE cancellable;
|
119
|
-
GError *error = NULL;
|
120
|
-
guint32 value;
|
121
|
-
|
122
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
123
|
-
value = g_data_input_stream_read_uint32(_SELF(self),
|
124
|
-
RVAL2GCANCELLABLE(cancellable),
|
125
|
-
&error);
|
126
|
-
if (error != NULL)
|
127
|
-
rbgio_raise_error(error);
|
128
|
-
|
129
|
-
return GUINT322RVAL(value);
|
130
|
-
}
|
131
|
-
|
132
|
-
static VALUE
|
133
|
-
rg_read_int64(int argc, VALUE *argv, VALUE self)
|
134
|
-
{
|
135
|
-
VALUE cancellable;
|
136
|
-
GError *error = NULL;
|
137
|
-
gint64 value;
|
138
|
-
|
139
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
140
|
-
value = g_data_input_stream_read_int64(_SELF(self),
|
141
|
-
RVAL2GCANCELLABLE(cancellable),
|
142
|
-
&error);
|
143
|
-
if (error != NULL)
|
144
|
-
rbgio_raise_error(error);
|
145
|
-
|
146
|
-
return GINT642RVAL(value);
|
147
|
-
}
|
148
|
-
|
149
|
-
static VALUE
|
150
|
-
rg_read_uint64(int argc, VALUE *argv, VALUE self)
|
151
|
-
{
|
152
|
-
VALUE cancellable;
|
153
|
-
GError *error = NULL;
|
154
|
-
guint64 value;
|
155
|
-
|
156
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
157
|
-
value = g_data_input_stream_read_uint64(_SELF(self),
|
158
|
-
RVAL2GCANCELLABLE(cancellable),
|
159
|
-
&error);
|
160
|
-
if (error != NULL)
|
161
|
-
rbgio_raise_error(error);
|
162
|
-
|
163
|
-
return GUINT642RVAL(value);
|
164
|
-
}
|
165
|
-
|
166
|
-
static VALUE
|
167
|
-
rg_read_line(int argc, VALUE *argv, VALUE self)
|
168
|
-
{
|
169
|
-
VALUE cancellable;
|
170
|
-
gsize length;
|
171
|
-
GError *error;
|
172
|
-
char *line;
|
173
|
-
|
174
|
-
rb_scan_args(argc, argv, "01", &cancellable);
|
175
|
-
line = g_data_input_stream_read_line(_SELF(self),
|
176
|
-
&length,
|
177
|
-
RVAL2GCANCELLABLE(cancellable),
|
178
|
-
&error);
|
179
|
-
if (error != NULL)
|
180
|
-
rbgio_raise_error(error);
|
181
|
-
|
182
|
-
return CSTR2RVAL_TAINTED_FREE(line, length);
|
183
|
-
}
|
184
|
-
|
185
|
-
static VALUE
|
186
|
-
rg_read_line_async(int argc, VALUE *argv, VALUE self)
|
187
|
-
{
|
188
|
-
VALUE rbio_priority, rbcancellable, block;
|
189
|
-
int io_priority;
|
190
|
-
GCancellable *cancellable;
|
191
|
-
|
192
|
-
rb_scan_args(argc, argv, "02&", &rbio_priority, &rbcancellable, &block);
|
193
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
194
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
195
|
-
SAVE_BLOCK(block);
|
196
|
-
g_data_input_stream_read_line_async(_SELF(self),
|
197
|
-
io_priority,
|
198
|
-
cancellable,
|
199
|
-
rbgio_async_ready_callback,
|
200
|
-
(gpointer)block);
|
201
|
-
|
202
|
-
return self;
|
203
|
-
}
|
204
|
-
|
205
|
-
static VALUE
|
206
|
-
rg_read_line_finish(VALUE self, VALUE result)
|
207
|
-
{
|
208
|
-
GError *error = NULL;
|
209
|
-
gsize length;
|
210
|
-
char *line;
|
211
|
-
|
212
|
-
line = g_data_input_stream_read_line_finish(_SELF(self),
|
213
|
-
RVAL2GASYNCRESULT(result),
|
214
|
-
&length,
|
215
|
-
&error);
|
216
|
-
if (error != NULL)
|
217
|
-
rbgio_raise_error(error);
|
218
|
-
|
219
|
-
return CSTR2RVAL_TAINTED_FREE(line, length);
|
220
|
-
}
|
221
|
-
|
222
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
223
|
-
static VALUE
|
224
|
-
rg_read_upto(int argc, VALUE *argv, VALUE self)
|
225
|
-
{
|
226
|
-
VALUE rbstop_chars, cancellable;
|
227
|
-
const char *stop_chars;
|
228
|
-
gsize length;
|
229
|
-
GError *error;
|
230
|
-
char *string;
|
231
|
-
|
232
|
-
rb_scan_args(argc, argv, "11", &rbstop_chars, &cancellable);
|
233
|
-
stop_chars = RVAL2CSTR(rbstop_chars);
|
234
|
-
string = g_data_input_stream_read_upto(_SELF(self),
|
235
|
-
stop_chars,
|
236
|
-
RSTRING_LEN(rbstop_chars),
|
237
|
-
&length,
|
238
|
-
RVAL2GCANCELLABLE(cancellable),
|
239
|
-
&error);
|
240
|
-
if (error != NULL)
|
241
|
-
rbgio_raise_error(error);
|
242
|
-
|
243
|
-
return CSTR2RVAL_TAINTED_FREE(string, length);
|
244
|
-
}
|
245
|
-
|
246
|
-
static VALUE
|
247
|
-
rg_read_upto_async(int argc, VALUE *argv, VALUE self)
|
248
|
-
{
|
249
|
-
VALUE rbstop_chars, rbcancellable, rbio_priority, block;
|
250
|
-
const char *stop_chars;
|
251
|
-
int io_priority;
|
252
|
-
GCancellable *cancellable;
|
253
|
-
|
254
|
-
rb_scan_args(argc, argv, "12&", &rbstop_chars, &rbio_priority, &rbcancellable, &block);
|
255
|
-
stop_chars = RVAL2CSTR(rbstop_chars);
|
256
|
-
io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
|
257
|
-
cancellable = RVAL2GCANCELLABLE(rbcancellable);
|
258
|
-
SAVE_BLOCK(block);
|
259
|
-
g_data_input_stream_read_upto_async(_SELF(self),
|
260
|
-
stop_chars,
|
261
|
-
RSTRING_LEN(rbstop_chars),
|
262
|
-
io_priority,
|
263
|
-
cancellable,
|
264
|
-
rbgio_async_ready_callback,
|
265
|
-
(gpointer)block);
|
266
|
-
|
267
|
-
return self;
|
268
|
-
}
|
269
|
-
|
270
|
-
static VALUE
|
271
|
-
rg_read_upto_finish(VALUE self, VALUE result)
|
272
|
-
{
|
273
|
-
GError *error = NULL;
|
274
|
-
gsize length;
|
275
|
-
char *string;
|
276
|
-
|
277
|
-
string = g_data_input_stream_read_upto_finish(_SELF(self),
|
278
|
-
RVAL2GASYNCRESULT(result),
|
279
|
-
&length,
|
280
|
-
&error);
|
281
|
-
if (error != NULL)
|
282
|
-
rbgio_raise_error(error);
|
283
|
-
|
284
|
-
return CSTR2RVAL_TAINTED_FREE(string, length);
|
285
|
-
}
|
286
|
-
#endif
|
287
|
-
|
288
|
-
void
|
289
|
-
Init_gdatainputstream(VALUE mGio)
|
290
|
-
{
|
291
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DATA_INPUT_STREAM, "DataInputStream", mGio);
|
292
|
-
|
293
|
-
RG_DEF_METHOD(initialize, -1);
|
294
|
-
RG_DEF_METHOD(read_byte, -1);
|
295
|
-
RG_DEF_METHOD(read_int16, -1);
|
296
|
-
RG_DEF_METHOD(read_uint16, -1);
|
297
|
-
RG_DEF_METHOD(read_int32, -1);
|
298
|
-
RG_DEF_METHOD(read_uint32, -1);
|
299
|
-
RG_DEF_METHOD(read_int64, -1);
|
300
|
-
RG_DEF_METHOD(read_uint64, -1);
|
301
|
-
RG_DEF_METHOD(read_line, -1);
|
302
|
-
RG_DEF_METHOD(read_line_async, -1);
|
303
|
-
RG_DEF_METHOD(read_line_finish, 1);
|
304
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
305
|
-
RG_DEF_METHOD(read_upto, -1);
|
306
|
-
RG_DEF_METHOD(read_upto_async, -1);
|
307
|
-
RG_DEF_METHOD(read_upto_finish, 1);
|
308
|
-
#endif
|
309
|
-
}
|
@@ -1,186 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgio2private.h"
|
23
|
-
|
24
|
-
#define RG_TARGET_NAMESPACE cDataOutputStream
|
25
|
-
#define _SELF(value) RVAL2GDATAOUTPUTSTREAM(value)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_initialize(int argc, VALUE *argv, VALUE self)
|
29
|
-
{
|
30
|
-
VALUE base_stream,
|
31
|
-
byte_order;
|
32
|
-
|
33
|
-
rb_scan_args(argc, argv, "11", &base_stream, &byte_order);
|
34
|
-
|
35
|
-
G_INITIALIZE(self, g_data_output_stream_new(RVAL2GOUTPUTSTREAM(base_stream)));
|
36
|
-
|
37
|
-
if (!NIL_P(byte_order))
|
38
|
-
g_data_output_stream_set_byte_order(_SELF(self),
|
39
|
-
RVAL2GDATASTREAMBYTEORDER(byte_order));
|
40
|
-
|
41
|
-
return Qnil;
|
42
|
-
}
|
43
|
-
|
44
|
-
static VALUE
|
45
|
-
rg_put_byte(int argc, VALUE *argv, VALUE self)
|
46
|
-
{
|
47
|
-
VALUE value, cancellable;
|
48
|
-
GError *error = NULL;
|
49
|
-
|
50
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
51
|
-
if (!g_data_output_stream_put_byte(_SELF(self),
|
52
|
-
RVAL2GUCHAR(value),
|
53
|
-
RVAL2GCANCELLABLE(cancellable),
|
54
|
-
&error))
|
55
|
-
rbgio_raise_error(error);
|
56
|
-
|
57
|
-
return self;
|
58
|
-
}
|
59
|
-
|
60
|
-
static VALUE
|
61
|
-
rg_put_int16(int argc, VALUE *argv, VALUE self)
|
62
|
-
{
|
63
|
-
VALUE value, cancellable;
|
64
|
-
GError *error = NULL;
|
65
|
-
|
66
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
67
|
-
if (!g_data_output_stream_put_int16(_SELF(self),
|
68
|
-
RVAL2GINT16(value),
|
69
|
-
RVAL2GCANCELLABLE(cancellable),
|
70
|
-
&error))
|
71
|
-
rbgio_raise_error(error);
|
72
|
-
|
73
|
-
return self;
|
74
|
-
}
|
75
|
-
|
76
|
-
static VALUE
|
77
|
-
rg_put_uint16(int argc, VALUE *argv, VALUE self)
|
78
|
-
{
|
79
|
-
VALUE value, cancellable;
|
80
|
-
GError *error = NULL;
|
81
|
-
|
82
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
83
|
-
if (!g_data_output_stream_put_uint16(_SELF(self),
|
84
|
-
RVAL2GUINT16(value),
|
85
|
-
RVAL2GCANCELLABLE(cancellable),
|
86
|
-
&error))
|
87
|
-
rbgio_raise_error(error);
|
88
|
-
|
89
|
-
return self;
|
90
|
-
}
|
91
|
-
|
92
|
-
static VALUE
|
93
|
-
rg_put_int32(int argc, VALUE *argv, VALUE self)
|
94
|
-
{
|
95
|
-
VALUE value, cancellable;
|
96
|
-
GError *error = NULL;
|
97
|
-
|
98
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
99
|
-
if (!g_data_output_stream_put_int32(_SELF(self),
|
100
|
-
RVAL2GINT32(value),
|
101
|
-
RVAL2GCANCELLABLE(cancellable),
|
102
|
-
&error))
|
103
|
-
rbgio_raise_error(error);
|
104
|
-
|
105
|
-
return self;
|
106
|
-
}
|
107
|
-
|
108
|
-
static VALUE
|
109
|
-
rg_put_uint32(int argc, VALUE *argv, VALUE self)
|
110
|
-
{
|
111
|
-
VALUE value, cancellable;
|
112
|
-
GError *error = NULL;
|
113
|
-
|
114
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
115
|
-
if (!g_data_output_stream_put_uint32(_SELF(self),
|
116
|
-
RVAL2GINT32(value),
|
117
|
-
RVAL2GCANCELLABLE(cancellable),
|
118
|
-
&error))
|
119
|
-
rbgio_raise_error(error);
|
120
|
-
|
121
|
-
return self;
|
122
|
-
}
|
123
|
-
|
124
|
-
static VALUE
|
125
|
-
rg_put_int64(int argc, VALUE *argv, VALUE self)
|
126
|
-
{
|
127
|
-
VALUE value, cancellable;
|
128
|
-
GError *error = NULL;
|
129
|
-
|
130
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
131
|
-
if (!g_data_output_stream_put_int64(_SELF(self),
|
132
|
-
RVAL2GINT64(value),
|
133
|
-
RVAL2GCANCELLABLE(cancellable),
|
134
|
-
&error))
|
135
|
-
rbgio_raise_error(error);
|
136
|
-
|
137
|
-
return self;
|
138
|
-
}
|
139
|
-
|
140
|
-
static VALUE
|
141
|
-
rg_put_uint64(int argc, VALUE *argv, VALUE self)
|
142
|
-
{
|
143
|
-
VALUE value, cancellable;
|
144
|
-
GError *error = NULL;
|
145
|
-
|
146
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
147
|
-
if (!g_data_output_stream_put_uint64(_SELF(self),
|
148
|
-
RVAL2GUINT64(value),
|
149
|
-
RVAL2GCANCELLABLE(cancellable),
|
150
|
-
&error))
|
151
|
-
rbgio_raise_error(error);
|
152
|
-
|
153
|
-
return self;
|
154
|
-
}
|
155
|
-
|
156
|
-
static VALUE
|
157
|
-
rg_put_string(int argc, VALUE *argv, VALUE self)
|
158
|
-
{
|
159
|
-
VALUE value, cancellable;
|
160
|
-
GError *error = NULL;
|
161
|
-
|
162
|
-
rb_scan_args(argc, argv, "11", &value, &cancellable);
|
163
|
-
if (!g_data_output_stream_put_string(_SELF(self),
|
164
|
-
RVAL2CSTR(value),
|
165
|
-
RVAL2GCANCELLABLE(cancellable),
|
166
|
-
&error))
|
167
|
-
rbgio_raise_error(error);
|
168
|
-
|
169
|
-
return self;
|
170
|
-
}
|
171
|
-
|
172
|
-
void
|
173
|
-
Init_gdataoutputstream(VALUE mGio)
|
174
|
-
{
|
175
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DATA_OUTPUT_STREAM, "DataOutputStream", mGio);
|
176
|
-
|
177
|
-
RG_DEF_METHOD(initialize, -1);
|
178
|
-
RG_DEF_METHOD(put_byte, -1);
|
179
|
-
RG_DEF_METHOD(put_int16, -1);
|
180
|
-
RG_DEF_METHOD(put_uint16, -1);
|
181
|
-
RG_DEF_METHOD(put_int32, -1);
|
182
|
-
RG_DEF_METHOD(put_uint32, -1);
|
183
|
-
RG_DEF_METHOD(put_int64, -1);
|
184
|
-
RG_DEF_METHOD(put_uint64, -1);
|
185
|
-
RG_DEF_METHOD(put_string, -1);
|
186
|
-
}
|