ovirt-engine-sdk 4.0.1 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGES.adoc +684 -0
- data/README.adoc +729 -32
- data/ext/ovirtsdk4c/extconf.rb +31 -5
- data/ext/ovirtsdk4c/ov_error.c +9 -2
- data/ext/ovirtsdk4c/ov_error.h +3 -1
- data/ext/ovirtsdk4c/ov_http_client.c +1218 -0
- data/ext/ovirtsdk4c/ov_http_client.h +75 -0
- data/ext/ovirtsdk4c/ov_http_request.c +397 -0
- data/ext/ovirtsdk4c/ov_http_request.h +54 -0
- data/ext/ovirtsdk4c/ov_http_response.c +210 -0
- data/ext/ovirtsdk4c/ov_http_response.h +41 -0
- data/ext/ovirtsdk4c/ov_http_transfer.c +91 -0
- data/ext/ovirtsdk4c/ov_http_transfer.h +47 -0
- data/ext/ovirtsdk4c/ov_module.h +2 -2
- data/ext/ovirtsdk4c/ov_string.c +43 -0
- data/ext/ovirtsdk4c/ov_string.h +25 -0
- data/ext/ovirtsdk4c/ov_xml_reader.c +115 -99
- data/ext/ovirtsdk4c/ov_xml_reader.h +20 -3
- data/ext/ovirtsdk4c/ov_xml_writer.c +95 -77
- data/ext/ovirtsdk4c/ov_xml_writer.h +18 -3
- data/ext/ovirtsdk4c/ovirtsdk4c.c +10 -2
- data/lib/ovirtsdk4/connection.rb +695 -0
- data/lib/ovirtsdk4/errors.rb +70 -0
- data/lib/ovirtsdk4/probe.rb +324 -0
- data/lib/ovirtsdk4/reader.rb +74 -40
- data/lib/ovirtsdk4/readers.rb +3325 -976
- data/lib/ovirtsdk4/service.rb +439 -48
- data/lib/ovirtsdk4/services.rb +29365 -21180
- data/lib/ovirtsdk4/type.rb +20 -6
- data/lib/ovirtsdk4/types.rb +15048 -3198
- data/lib/ovirtsdk4/version.rb +1 -1
- data/lib/ovirtsdk4/writer.rb +108 -13
- data/lib/ovirtsdk4/writers.rb +1373 -294
- data/lib/ovirtsdk4.rb +4 -2
- metadata +88 -36
- data/lib/ovirtsdk4/http.rb +0 -548
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2015-
|
2
|
+
Copyright (c) 2015-2017 Red Hat, Inc.
|
3
3
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
you may not use this file except in compliance with the License.
|
@@ -30,63 +30,79 @@ limitations under the License.
|
|
30
30
|
/* Class: */
|
31
31
|
VALUE ov_xml_reader_class;
|
32
32
|
|
33
|
-
|
33
|
+
/* Method identifiers: */
|
34
34
|
static ID READ_ID;
|
35
35
|
static ID STRING_IO_ID;
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
xmlTextReaderPtr reader;
|
40
|
-
bool closed;
|
41
|
-
} ov_xml_reader_object;
|
42
|
-
|
43
|
-
static void ov_xml_reader_check_closed(ov_xml_reader_object* object) {
|
44
|
-
if (object->closed) {
|
37
|
+
static void ov_xml_reader_check_closed(ov_xml_reader_object* ptr) {
|
38
|
+
if (ptr->closed) {
|
45
39
|
rb_raise(ov_error_class, "The reader is already closed");
|
46
40
|
}
|
47
41
|
}
|
48
42
|
|
49
|
-
static void ov_xml_reader_mark(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
43
|
+
static void ov_xml_reader_mark(void* vptr) {
|
44
|
+
ov_xml_reader_object* ptr;
|
45
|
+
|
46
|
+
ptr = vptr;
|
47
|
+
rb_gc_mark(ptr->io);
|
54
48
|
}
|
55
49
|
|
56
|
-
static void ov_xml_reader_free(
|
50
|
+
static void ov_xml_reader_free(void* vptr) {
|
51
|
+
ov_xml_reader_object* ptr;
|
52
|
+
|
53
|
+
/* Get the pointer: */
|
54
|
+
ptr = vptr;
|
55
|
+
|
57
56
|
/* Free the libxml reader: */
|
58
|
-
if (!
|
59
|
-
if (
|
60
|
-
xmlFreeTextReader(
|
57
|
+
if (!ptr->closed) {
|
58
|
+
if (ptr->reader != NULL) {
|
59
|
+
xmlFreeTextReader(ptr->reader);
|
61
60
|
}
|
62
|
-
|
63
|
-
|
61
|
+
ptr->reader = NULL;
|
62
|
+
ptr->closed = true;
|
64
63
|
}
|
65
64
|
|
66
65
|
/* Free this object: */
|
67
|
-
xfree(
|
66
|
+
xfree(ptr);
|
68
67
|
}
|
69
68
|
|
69
|
+
rb_data_type_t ov_xml_reader_type = {
|
70
|
+
.wrap_struct_name = "OVXMLREADER",
|
71
|
+
.function = {
|
72
|
+
.dmark = ov_xml_reader_mark,
|
73
|
+
.dfree = ov_xml_reader_free,
|
74
|
+
.dsize = NULL,
|
75
|
+
.reserved = { NULL, NULL }
|
76
|
+
},
|
77
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
78
|
+
.parent = NULL,
|
79
|
+
.data = NULL,
|
80
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
81
|
+
#endif
|
82
|
+
};
|
83
|
+
|
70
84
|
static VALUE ov_xml_reader_alloc(VALUE klass) {
|
71
|
-
ov_xml_reader_object*
|
85
|
+
ov_xml_reader_object* ptr;
|
72
86
|
|
73
|
-
|
74
|
-
|
75
|
-
|
87
|
+
ptr = ALLOC(ov_xml_reader_object);
|
88
|
+
ptr->io = Qnil;
|
89
|
+
ptr->reader = NULL;
|
90
|
+
ptr->closed = false;
|
91
|
+
return TypedData_Wrap_Struct(klass, &ov_xml_reader_type, ptr);
|
76
92
|
}
|
77
93
|
|
78
94
|
static int ov_xml_reader_callback(void *context, char *buffer, int length) {
|
79
95
|
VALUE data;
|
80
|
-
ov_xml_reader_object*
|
96
|
+
ov_xml_reader_object* ptr;
|
81
97
|
|
82
98
|
/* Do nothing if the reader is already closed: */
|
83
|
-
|
84
|
-
if (
|
99
|
+
ptr = (ov_xml_reader_object*) context;
|
100
|
+
if (ptr->closed) {
|
85
101
|
return -1;
|
86
102
|
}
|
87
103
|
|
88
104
|
/* Read from the Ruby IO object, and copy the result to the buffer: */
|
89
|
-
data = rb_funcall(
|
105
|
+
data = rb_funcall(ptr->io, READ_ID, 1, INT2NUM(length));
|
90
106
|
if (NIL_P(data)) {
|
91
107
|
return 0;
|
92
108
|
}
|
@@ -107,20 +123,20 @@ static VALUE ov_xml_reader_create_string_io(VALUE text) {
|
|
107
123
|
|
108
124
|
static VALUE ov_xml_reader_initialize(VALUE self, VALUE io) {
|
109
125
|
VALUE io_class;
|
110
|
-
int rc
|
111
|
-
ov_xml_reader_object*
|
126
|
+
int rc;
|
127
|
+
ov_xml_reader_object* ptr;
|
112
128
|
|
113
129
|
/* Get the pointer to the object: */
|
114
|
-
|
130
|
+
ov_xml_reader_ptr(self, ptr);
|
115
131
|
|
116
132
|
/* The parameter of the constructor can be a string or an IO object. If it is a string then we need to create aa
|
117
133
|
IO object to read from it. */
|
118
134
|
io_class = rb_class_of(io);
|
119
135
|
if (io_class == rb_cString) {
|
120
|
-
|
136
|
+
ptr->io = ov_xml_reader_create_string_io(io);
|
121
137
|
}
|
122
138
|
else if (io_class == rb_cIO) {
|
123
|
-
|
139
|
+
ptr->io = io;
|
124
140
|
}
|
125
141
|
else {
|
126
142
|
rb_raise(
|
@@ -131,16 +147,16 @@ static VALUE ov_xml_reader_initialize(VALUE self, VALUE io) {
|
|
131
147
|
}
|
132
148
|
|
133
149
|
/* Clear the closed flag: */
|
134
|
-
|
150
|
+
ptr->closed = false;
|
135
151
|
|
136
152
|
/* Create the libxml reader: */
|
137
|
-
|
138
|
-
if (
|
153
|
+
ptr->reader = xmlReaderForIO(ov_xml_reader_callback, NULL, ptr, NULL, NULL, 0);
|
154
|
+
if (ptr->reader == NULL) {
|
139
155
|
rb_raise(ov_error_class, "Can't create reader");
|
140
156
|
}
|
141
157
|
|
142
158
|
/* Move the cursor to the first node: */
|
143
|
-
rc = xmlTextReaderRead(
|
159
|
+
rc = xmlTextReaderRead(ptr->reader);
|
144
160
|
if (rc == -1) {
|
145
161
|
rb_raise(ov_error_class, "Can't read first node");
|
146
162
|
}
|
@@ -150,11 +166,11 @@ static VALUE ov_xml_reader_initialize(VALUE self, VALUE io) {
|
|
150
166
|
|
151
167
|
static VALUE ov_xml_reader_read(VALUE self) {
|
152
168
|
int rc = 0;
|
153
|
-
ov_xml_reader_object*
|
169
|
+
ov_xml_reader_object* ptr;
|
154
170
|
|
155
|
-
|
156
|
-
ov_xml_reader_check_closed(
|
157
|
-
rc = xmlTextReaderRead(
|
171
|
+
ov_xml_reader_ptr(self, ptr);
|
172
|
+
ov_xml_reader_check_closed(ptr);
|
173
|
+
rc = xmlTextReaderRead(ptr->reader);
|
158
174
|
if (rc == 0) {
|
159
175
|
return Qfalse;
|
160
176
|
}
|
@@ -168,13 +184,13 @@ static VALUE ov_xml_reader_read(VALUE self) {
|
|
168
184
|
static VALUE ov_xml_reader_forward(VALUE self) {
|
169
185
|
int c_type = 0;
|
170
186
|
int rc = 0;
|
171
|
-
ov_xml_reader_object
|
187
|
+
ov_xml_reader_object* ptr;
|
172
188
|
|
173
|
-
|
174
|
-
ov_xml_reader_check_closed(
|
189
|
+
ov_xml_reader_ptr(self, ptr);
|
190
|
+
ov_xml_reader_check_closed(ptr);
|
175
191
|
|
176
192
|
for (;;) {
|
177
|
-
c_type = xmlTextReaderNodeType(
|
193
|
+
c_type = xmlTextReaderNodeType(ptr->reader);
|
178
194
|
if (c_type == -1) {
|
179
195
|
rb_raise(ov_error_class, "Can't get current node type");
|
180
196
|
}
|
@@ -185,7 +201,7 @@ static VALUE ov_xml_reader_forward(VALUE self) {
|
|
185
201
|
return Qfalse;
|
186
202
|
}
|
187
203
|
else {
|
188
|
-
rc = xmlTextReaderRead(
|
204
|
+
rc = xmlTextReaderRead(ptr->reader);
|
189
205
|
if (rc == -1) {
|
190
206
|
rb_raise(ov_error_class, "Can't move to next node");
|
191
207
|
}
|
@@ -195,12 +211,12 @@ static VALUE ov_xml_reader_forward(VALUE self) {
|
|
195
211
|
|
196
212
|
static VALUE ov_xml_reader_node_name(VALUE self) {
|
197
213
|
VALUE name;
|
198
|
-
const xmlChar* c_name
|
199
|
-
ov_xml_reader_object*
|
214
|
+
const xmlChar* c_name;
|
215
|
+
ov_xml_reader_object* ptr;
|
200
216
|
|
201
|
-
|
202
|
-
ov_xml_reader_check_closed(
|
203
|
-
c_name = xmlTextReaderConstName(
|
217
|
+
ov_xml_reader_ptr(self, ptr);
|
218
|
+
ov_xml_reader_check_closed(ptr);
|
219
|
+
c_name = xmlTextReaderConstName(ptr->reader);
|
204
220
|
if (c_name == NULL) {
|
205
221
|
return Qnil;
|
206
222
|
}
|
@@ -209,12 +225,12 @@ static VALUE ov_xml_reader_node_name(VALUE self) {
|
|
209
225
|
}
|
210
226
|
|
211
227
|
static VALUE ov_xml_reader_empty_element(VALUE self) {
|
212
|
-
int c_empty
|
213
|
-
ov_xml_reader_object*
|
228
|
+
int c_empty;
|
229
|
+
ov_xml_reader_object* ptr;
|
214
230
|
|
215
|
-
|
216
|
-
ov_xml_reader_check_closed(
|
217
|
-
c_empty = xmlTextReaderIsEmptyElement(
|
231
|
+
ov_xml_reader_ptr(self, ptr);
|
232
|
+
ov_xml_reader_check_closed(ptr);
|
233
|
+
c_empty = xmlTextReaderIsEmptyElement(ptr->reader);
|
218
234
|
if (c_empty == -1) {
|
219
235
|
rb_raise(ov_error_class, "Can't check if current element is empty");
|
220
236
|
}
|
@@ -223,14 +239,14 @@ static VALUE ov_xml_reader_empty_element(VALUE self) {
|
|
223
239
|
|
224
240
|
static VALUE ov_xml_reader_get_attribute(VALUE self, VALUE name) {
|
225
241
|
VALUE value;
|
226
|
-
ov_xml_reader_object*
|
227
|
-
xmlChar* c_name
|
228
|
-
xmlChar* c_value
|
242
|
+
ov_xml_reader_object* ptr;
|
243
|
+
xmlChar* c_name;
|
244
|
+
xmlChar* c_value;
|
229
245
|
|
230
|
-
|
231
|
-
ov_xml_reader_check_closed(
|
246
|
+
ov_xml_reader_ptr(self, ptr);
|
247
|
+
ov_xml_reader_check_closed(ptr);
|
232
248
|
c_name = (xmlChar*) StringValueCStr(name);
|
233
|
-
c_value = xmlTextReaderGetAttribute(
|
249
|
+
c_value = xmlTextReaderGetAttribute(ptr->reader, c_name);
|
234
250
|
if (c_value == NULL) {
|
235
251
|
return Qnil;
|
236
252
|
}
|
@@ -241,17 +257,17 @@ static VALUE ov_xml_reader_get_attribute(VALUE self, VALUE name) {
|
|
241
257
|
|
242
258
|
static VALUE ov_xml_reader_read_element(VALUE self) {
|
243
259
|
VALUE value;
|
244
|
-
int c_empty
|
245
|
-
int c_type
|
246
|
-
int rc
|
247
|
-
ov_xml_reader_object
|
248
|
-
xmlChar
|
260
|
+
int c_empty;
|
261
|
+
int c_type;
|
262
|
+
int rc;
|
263
|
+
ov_xml_reader_object* ptr;
|
264
|
+
xmlChar* c_value;
|
249
265
|
|
250
|
-
|
251
|
-
ov_xml_reader_check_closed(
|
266
|
+
ov_xml_reader_ptr(self, ptr);
|
267
|
+
ov_xml_reader_check_closed(ptr);
|
252
268
|
|
253
269
|
/* Check the type of the current node: */
|
254
|
-
c_type = xmlTextReaderNodeType(
|
270
|
+
c_type = xmlTextReaderNodeType(ptr->reader);
|
255
271
|
if (c_type == -1) {
|
256
272
|
rb_raise(ov_error_class, "Can't get current node type");
|
257
273
|
}
|
@@ -260,7 +276,7 @@ static VALUE ov_xml_reader_read_element(VALUE self) {
|
|
260
276
|
}
|
261
277
|
|
262
278
|
/* Check if the current node is empty: */
|
263
|
-
c_empty = xmlTextReaderIsEmptyElement(
|
279
|
+
c_empty = xmlTextReaderIsEmptyElement(ptr->reader);
|
264
280
|
if (c_empty == -1) {
|
265
281
|
rb_raise(ov_error_class, "Can't check if current element is empty");
|
266
282
|
}
|
@@ -271,7 +287,7 @@ static VALUE ov_xml_reader_read_element(VALUE self) {
|
|
271
287
|
c_value = NULL;
|
272
288
|
}
|
273
289
|
else {
|
274
|
-
c_value = xmlTextReaderReadString(
|
290
|
+
c_value = xmlTextReaderReadString(ptr->reader);
|
275
291
|
if (c_value == NULL) {
|
276
292
|
c_value = xmlCharStrdup("");
|
277
293
|
if (c_value == NULL) {
|
@@ -281,7 +297,7 @@ static VALUE ov_xml_reader_read_element(VALUE self) {
|
|
281
297
|
}
|
282
298
|
|
283
299
|
/* Move to the next element: */
|
284
|
-
rc = xmlTextReaderNext(
|
300
|
+
rc = xmlTextReaderNext(ptr->reader);
|
285
301
|
if (rc == -1) {
|
286
302
|
if (c_value != NULL) {
|
287
303
|
xmlFree(c_value);
|
@@ -301,14 +317,14 @@ static VALUE ov_xml_reader_read_element(VALUE self) {
|
|
301
317
|
static VALUE ov_xml_reader_read_elements(VALUE self) {
|
302
318
|
VALUE element;
|
303
319
|
VALUE list;
|
304
|
-
int c_empty
|
305
|
-
int c_type
|
306
|
-
int rc
|
307
|
-
ov_xml_reader_object*
|
320
|
+
int c_empty;
|
321
|
+
int c_type;
|
322
|
+
int rc;
|
323
|
+
ov_xml_reader_object* ptr;
|
308
324
|
|
309
325
|
/* Get the pointer to the object and check that it isn't closed: */
|
310
|
-
|
311
|
-
ov_xml_reader_check_closed(
|
326
|
+
ov_xml_reader_ptr(self, ptr);
|
327
|
+
ov_xml_reader_check_closed(ptr);
|
312
328
|
|
313
329
|
/* This method assumes that the reader is positioned at the element that contains the values to read. For example
|
314
330
|
if the XML document is the following:
|
@@ -319,7 +335,7 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
319
335
|
</list>
|
320
336
|
|
321
337
|
The reader should be positioned at the <list> element. The first thing we need to do is to check: */
|
322
|
-
c_type = xmlTextReaderNodeType(
|
338
|
+
c_type = xmlTextReaderNodeType(ptr->reader);
|
323
339
|
if (c_type == -1) {
|
324
340
|
rb_raise(ov_error_class, "Can't get current node type");
|
325
341
|
}
|
@@ -329,14 +345,14 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
329
345
|
|
330
346
|
/* If we are indeed positioned at the first element, then we need to check if it is empty, <list/>, as we will
|
331
347
|
need this lter, after discarding the element: */
|
332
|
-
c_empty = xmlTextReaderIsEmptyElement(
|
348
|
+
c_empty = xmlTextReaderIsEmptyElement(ptr->reader);
|
333
349
|
if (c_empty == -1) {
|
334
350
|
rb_raise(ov_error_class, "Can't check if current element is empty");
|
335
351
|
}
|
336
352
|
|
337
353
|
/* Now we need to discard the current element, as we are interested only in the nested <value>...</value>
|
338
354
|
elements: */
|
339
|
-
rc = xmlTextReaderRead(
|
355
|
+
rc = xmlTextReaderRead(ptr->reader);
|
340
356
|
if (rc == -1) {
|
341
357
|
rb_raise(ov_error_class, "Can't move to next node");
|
342
358
|
}
|
@@ -351,7 +367,7 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
351
367
|
|
352
368
|
/* Process the nested elements: */
|
353
369
|
for (;;) {
|
354
|
-
c_type = xmlTextReaderNodeType(
|
370
|
+
c_type = xmlTextReaderNodeType(ptr->reader);
|
355
371
|
if (c_type == -1) {
|
356
372
|
rb_raise(ov_error_class, "Can't get current node type");
|
357
373
|
}
|
@@ -363,7 +379,7 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
363
379
|
break;
|
364
380
|
}
|
365
381
|
else {
|
366
|
-
rc = xmlTextReaderNext(
|
382
|
+
rc = xmlTextReaderNext(ptr->reader);
|
367
383
|
if (rc == -1) {
|
368
384
|
rb_raise(ov_error_class, "Can't move to the next node");
|
369
385
|
}
|
@@ -373,7 +389,7 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
373
389
|
/* Once all the nested <value>...</value> elements are processed the reader will be positioned at the closing
|
374
390
|
</list> element, or at the end of the document. If it is the closing element then we need to discard it. */
|
375
391
|
if (c_type == XML_READER_TYPE_END_ELEMENT) {
|
376
|
-
rc = xmlTextReaderRead(
|
392
|
+
rc = xmlTextReaderRead(ptr->reader);
|
377
393
|
if (rc == -1) {
|
378
394
|
rb_raise(ov_error_class, "Can't move to next node");
|
379
395
|
}
|
@@ -383,12 +399,12 @@ static VALUE ov_xml_reader_read_elements(VALUE self) {
|
|
383
399
|
}
|
384
400
|
|
385
401
|
static VALUE ov_xml_reader_next_element(VALUE self) {
|
386
|
-
int rc
|
387
|
-
ov_xml_reader_object*
|
402
|
+
int rc;
|
403
|
+
ov_xml_reader_object* ptr;
|
388
404
|
|
389
|
-
|
390
|
-
ov_xml_reader_check_closed(
|
391
|
-
rc = xmlTextReaderNext(
|
405
|
+
ov_xml_reader_ptr(self, ptr);
|
406
|
+
ov_xml_reader_check_closed(ptr);
|
407
|
+
rc = xmlTextReaderNext(ptr->reader);
|
392
408
|
if (rc == 0) {
|
393
409
|
return Qfalse;
|
394
410
|
}
|
@@ -399,13 +415,13 @@ static VALUE ov_xml_reader_next_element(VALUE self) {
|
|
399
415
|
}
|
400
416
|
|
401
417
|
static VALUE ov_xml_reader_close(VALUE self) {
|
402
|
-
ov_xml_reader_object*
|
418
|
+
ov_xml_reader_object* ptr;
|
403
419
|
|
404
|
-
|
405
|
-
ov_xml_reader_check_closed(
|
406
|
-
xmlFreeTextReader(
|
407
|
-
|
408
|
-
|
420
|
+
ov_xml_reader_ptr(self, ptr);
|
421
|
+
ov_xml_reader_check_closed(ptr);
|
422
|
+
xmlFreeTextReader(ptr->reader);
|
423
|
+
ptr->reader = NULL;
|
424
|
+
ptr->closed = true;
|
409
425
|
return Qnil;
|
410
426
|
}
|
411
427
|
|
@@ -414,7 +430,7 @@ void ov_xml_reader_define(void) {
|
|
414
430
|
rb_require("stringio");
|
415
431
|
|
416
432
|
/* Define the class: */
|
417
|
-
ov_xml_reader_class = rb_define_class_under(ov_module, "XmlReader",
|
433
|
+
ov_xml_reader_class = rb_define_class_under(ov_module, "XmlReader", rb_cData);
|
418
434
|
|
419
435
|
/* Define the constructor: */
|
420
436
|
rb_define_alloc_func(ov_xml_reader_class, ov_xml_reader_alloc);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2015-
|
2
|
+
Copyright (c) 2015-2017 Red Hat, Inc.
|
3
3
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
you may not use this file except in compliance with the License.
|
@@ -17,10 +17,27 @@ limitations under the License.
|
|
17
17
|
#ifndef __OV_XML_READER_H__
|
18
18
|
#define __OV_XML_READER_H__
|
19
19
|
|
20
|
-
|
20
|
+
#include <ruby.h>
|
21
|
+
|
22
|
+
#include <libxml/xmlreader.h>
|
23
|
+
#include <stdbool.h>
|
24
|
+
|
25
|
+
/* Data type and class: */
|
26
|
+
extern rb_data_type_t ov_xml_reader_type;
|
21
27
|
extern VALUE ov_xml_reader_class;
|
22
28
|
|
23
|
-
|
29
|
+
/* Content: */
|
30
|
+
typedef struct {
|
31
|
+
VALUE io;
|
32
|
+
xmlTextReaderPtr reader;
|
33
|
+
bool closed;
|
34
|
+
} ov_xml_reader_object;
|
35
|
+
|
36
|
+
/* Macro to get the pointer: */
|
37
|
+
#define ov_xml_reader_ptr(object, ptr) \
|
38
|
+
TypedData_Get_Struct((object), ov_xml_reader_object, &ov_xml_reader_type, (ptr))
|
39
|
+
|
40
|
+
/* Initialization function: */
|
24
41
|
extern void ov_xml_reader_define(void);
|
25
42
|
|
26
43
|
#endif
|