poppler 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/dependency-check/Rakefile +44 -0
  3. data/lib/poppler.rb +21 -107
  4. data/lib/poppler/annot-callout-line.rb +57 -0
  5. data/lib/poppler/cairo.rb +23 -0
  6. data/lib/poppler/color.rb +36 -0
  7. data/lib/poppler/deprecated.rb +67 -0
  8. data/lib/poppler/document.rb +108 -0
  9. data/lib/poppler/image-mapping.rb +25 -0
  10. data/lib/poppler/index-iter.rb +30 -0
  11. data/lib/poppler/loader.rb +139 -0
  12. data/lib/poppler/page.rb +61 -0
  13. data/lib/poppler/rectangle.rb +40 -0
  14. data/lib/poppler/version.rb +35 -0
  15. data/sample/number-pdf.rb +21 -2
  16. data/sample/pdf2.rb +0 -4
  17. data/sample/pdf2svg.rb +1 -1
  18. data/sample/pdf2text.rb +1 -1
  19. data/sample/pdfcrop.rb +1 -1
  20. data/sample/pdfdiv.rb +1 -1
  21. data/test/fixtures/image.odt +0 -0
  22. data/test/fixtures/image.pdf +0 -0
  23. data/test/fixtures/multiple-pages.odt +0 -0
  24. data/test/fixtures/multiple-pages.pdf +0 -0
  25. data/test/fixtures/text-field.odt +0 -0
  26. data/test/fixtures/text-field.pdf +0 -0
  27. data/test/poppler-test-utils.rb +24 -16
  28. data/test/run-test.rb +26 -4
  29. data/test/test-annotation.rb +76 -0
  30. data/test/{test_color.rb → test-color.rb} +0 -3
  31. data/test/test-constants.rb +16 -0
  32. data/test/{test_document.rb → test-document.rb} +26 -10
  33. data/test/test-page.rb +101 -0
  34. metadata +28 -45
  35. data/README +0 -35
  36. data/ext/poppler/depend +0 -6
  37. data/ext/poppler/extconf.rb +0 -73
  38. data/ext/poppler/poppler.def +0 -2
  39. data/ext/poppler/rbpoppler-action.c +0 -402
  40. data/ext/poppler/rbpoppler-annotation-callout-line.c +0 -127
  41. data/ext/poppler/rbpoppler-annotation-free-text.c +0 -46
  42. data/ext/poppler/rbpoppler-annotation-mapping.c +0 -72
  43. data/ext/poppler/rbpoppler-annotation-markup.c +0 -98
  44. data/ext/poppler/rbpoppler-annotation-text.c +0 -53
  45. data/ext/poppler/rbpoppler-annotation.c +0 -74
  46. data/ext/poppler/rbpoppler-attachment.c +0 -124
  47. data/ext/poppler/rbpoppler-button-field.c +0 -56
  48. data/ext/poppler/rbpoppler-choice-field.c +0 -131
  49. data/ext/poppler/rbpoppler-color.c +0 -107
  50. data/ext/poppler/rbpoppler-document.c +0 -224
  51. data/ext/poppler/rbpoppler-font-info.c +0 -59
  52. data/ext/poppler/rbpoppler-fonts-iter.c +0 -127
  53. data/ext/poppler/rbpoppler-form-field-mapping.c +0 -44
  54. data/ext/poppler/rbpoppler-form-field.c +0 -98
  55. data/ext/poppler/rbpoppler-image-mapping.c +0 -48
  56. data/ext/poppler/rbpoppler-index-iter.c +0 -130
  57. data/ext/poppler/rbpoppler-link-mapping.c +0 -47
  58. data/ext/poppler/rbpoppler-page-transition.c +0 -59
  59. data/ext/poppler/rbpoppler-page.c +0 -322
  60. data/ext/poppler/rbpoppler-private.h +0 -77
  61. data/ext/poppler/rbpoppler-ps-file.c +0 -66
  62. data/ext/poppler/rbpoppler-rectangle.c +0 -92
  63. data/ext/poppler/rbpoppler-text-field.c +0 -91
  64. data/ext/poppler/rbpoppler.c +0 -110
  65. data/ext/poppler/rbpoppler.h +0 -61
  66. data/ext/poppler/rbpopplerconversions.h +0 -105
  67. data/extconf.rb +0 -49
  68. data/test/fixtures/image.png +0 -0
  69. data/test/test_annotation.rb +0 -86
  70. data/test/test_constants.rb +0 -30
  71. data/test/test_page.rb +0 -51
@@ -1,59 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library 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 GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #include "rbpoppler-private.h"
22
-
23
- #define RG_TARGET_NAMESPACE cFontInfo
24
-
25
- static VALUE RG_TARGET_NAMESPACE;
26
-
27
- static ID id_valid;
28
-
29
- static VALUE
30
- rg_initialize(VALUE self, VALUE document)
31
- {
32
- G_INITIALIZE(self, poppler_font_info_new(RVAL2POPPLERDOCUMENT(document)));
33
- return Qnil;
34
- }
35
-
36
- static VALUE
37
- rg_scan(VALUE self, VALUE n_pages)
38
- {
39
- VALUE rb_iter = Qnil;
40
- PopplerFontsIter *iter;
41
-
42
- if (poppler_font_info_scan(RVAL2FONTINFO(self), NUM2INT(n_pages), &iter)) {
43
- rb_iter = POPPLERFONTSITER2RVAL(iter);
44
- rb_ivar_set(rb_iter, id_valid, Qtrue);
45
- poppler_fonts_iter_free(iter);
46
- }
47
- return rb_iter;
48
- }
49
-
50
- void
51
- Init_poppler_font_info(VALUE mPoppler)
52
- {
53
- id_valid = rb_intern("valid?");
54
-
55
- RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONT_INFO, "FontInfo", mPoppler);
56
-
57
- RG_DEF_METHOD(initialize, 1);
58
- RG_DEF_METHOD(scan, 1);
59
- }
@@ -1,127 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library 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 GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #include "rbpoppler-private.h"
22
-
23
- #define RG_TARGET_NAMESPACE cFontsIter
24
-
25
- #define CHECK_FITER_IS_VALID(iter) do { \
26
- if (!RVAL2CBOOL(rg_valid_p(iter))) \
27
- return Qnil; \
28
- } while (0)
29
-
30
- static ID id_valid;
31
-
32
- static VALUE
33
- rg_valid_p(VALUE self)
34
- {
35
- return rb_ivar_get(self, id_valid);
36
- }
37
-
38
- static VALUE
39
- rg_name(VALUE self)
40
- {
41
- CHECK_FITER_IS_VALID(self);
42
- return CSTR2RVAL(poppler_fonts_iter_get_name(RVAL2POPPLERFONTSITER(self)));
43
- }
44
-
45
- static VALUE
46
- rg_full_name(VALUE self)
47
- {
48
- CHECK_FITER_IS_VALID(self);
49
- return CSTR2RVAL(poppler_fonts_iter_get_full_name(RVAL2POPPLERFONTSITER(self)));
50
- }
51
-
52
- static VALUE
53
- rg_file_name(VALUE self)
54
- {
55
- CHECK_FITER_IS_VALID(self);
56
- return CSTR2RVAL(poppler_fonts_iter_get_file_name(RVAL2POPPLERFONTSITER(self)));
57
- }
58
-
59
- static VALUE
60
- rg_font_type(VALUE self)
61
- {
62
- CHECK_FITER_IS_VALID(self);
63
- return POPPLERFONTTYPE2RVAL(poppler_fonts_iter_get_font_type(RVAL2POPPLERFONTSITER(self)));
64
- }
65
-
66
- static VALUE
67
- rg_embedded_p(VALUE self)
68
- {
69
- CHECK_FITER_IS_VALID(self);
70
- return CBOOL2RVAL(poppler_fonts_iter_is_embedded(RVAL2POPPLERFONTSITER(self)));
71
- }
72
-
73
- static VALUE
74
- rg_subset_p(VALUE self)
75
- {
76
- CHECK_FITER_IS_VALID(self);
77
- return CBOOL2RVAL(poppler_fonts_iter_is_subset(RVAL2POPPLERFONTSITER(self)));
78
- }
79
-
80
- static VALUE
81
- rg_next(VALUE self)
82
- {
83
- if (poppler_fonts_iter_next(RVAL2POPPLERFONTSITER(self))) {
84
- return Qtrue;
85
- } else {
86
- rb_ivar_set(self, id_valid, Qfalse);
87
- return Qfalse;
88
- }
89
- }
90
-
91
- static VALUE
92
- rg_each(VALUE self)
93
- {
94
- PopplerFontsIter *iter;
95
-
96
- CHECK_FITER_IS_VALID(self);
97
- iter = RVAL2POPPLERFONTSITER(self);
98
- do {
99
- rb_yield(self);
100
- } while (poppler_fonts_iter_next(iter));
101
- rb_ivar_set(self, id_valid, Qfalse);
102
-
103
- return self;
104
- }
105
-
106
- void
107
- Init_poppler_fonts_iter(VALUE mPoppler)
108
- {
109
- VALUE RG_TARGET_NAMESPACE;
110
-
111
- id_valid = rb_intern("valid?");
112
-
113
- RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONTS_ITER, "FontsIter", mPoppler);
114
-
115
- rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
116
-
117
- RG_DEF_METHOD(name, 0);
118
- RG_DEF_METHOD(full_name, 0);
119
- RG_DEF_METHOD(file_name, 0);
120
- RG_DEF_METHOD(font_type, 0);
121
- RG_DEF_METHOD_P(embedded, 0);
122
- RG_DEF_METHOD_P(subset, 0);
123
- RG_DEF_METHOD(next, 0);
124
-
125
- RG_DEF_METHOD_P(valid, 0);
126
- RG_DEF_METHOD(each, 0);
127
- }
@@ -1,44 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library 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 GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #include "rbpoppler-private.h"
22
-
23
- #define RG_TARGET_NAMESPACE cFormFieldMapping
24
-
25
- DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area,
26
- RVAL2POPPLERFORMFIELDMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
27
- DEF_ACCESSOR(form_field_mapping, field, RVAL2POPPLERFORMFIELDMAPPING,
28
- POPPLERFORMFIELD2RVAL, RVAL2POPPLERFORMFIELD)
29
-
30
- void
31
- Init_poppler_form_field_mapping(VALUE mPoppler)
32
- {
33
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING,
34
- "FormFieldMapping", mPoppler);
35
-
36
- rbg_define_method(RG_TARGET_NAMESPACE, "area", form_field_mapping_get_area, 0);
37
- rbg_define_method(RG_TARGET_NAMESPACE, "field", form_field_mapping_get_field,
38
- 0);
39
-
40
- rbg_define_method(RG_TARGET_NAMESPACE, "set_area",
41
- form_field_mapping_set_area, 1);
42
- rbg_define_method(RG_TARGET_NAMESPACE, "set_field",
43
- form_field_mapping_set_field, 1);
44
- }
@@ -1,98 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008 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 "rbpoppler-private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cFormField
25
- #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj)
26
-
27
- static VALUE cButtonField, cTextField, cChoiceField;
28
- static VALUE cUnknownField, cSignatureField;
29
-
30
- VALUE
31
- rb_poppler_ruby_object_from_form_field(PopplerFormField *field)
32
- {
33
- VALUE obj;
34
-
35
- obj = rbgobj_ruby_object_from_instance2(field, FALSE);
36
- if (NIL_P(obj)) {
37
- switch (poppler_form_field_get_field_type(field)) {
38
- case POPPLER_FORM_FIELD_UNKNOWN:
39
- obj = rbgobj_create_object(cUnknownField);
40
- break;
41
- case POPPLER_FORM_FIELD_BUTTON:
42
- obj = rbgobj_create_object(cButtonField);
43
- break;
44
- case POPPLER_FORM_FIELD_TEXT:
45
- obj = rbgobj_create_object(cTextField);
46
- break;
47
- case POPPLER_FORM_FIELD_CHOICE:
48
- obj = rbgobj_create_object(cChoiceField);
49
- break;
50
- case POPPLER_FORM_FIELD_SIGNATURE:
51
- obj = rbgobj_create_object(cSignatureField);
52
- break;
53
- }
54
- g_object_ref(field);
55
- G_INITIALIZE(obj, (gpointer)field);
56
- }
57
-
58
- return obj;
59
- }
60
-
61
- static VALUE
62
- rg_id(VALUE self)
63
- {
64
- return INT2NUM(poppler_form_field_get_id(_SELF(self)));
65
- }
66
-
67
- static VALUE
68
- rg_font_size(VALUE self)
69
- {
70
- return rb_float_new(poppler_form_field_get_font_size(_SELF(self)));
71
- }
72
-
73
- static VALUE
74
- rg_read_only_p(VALUE self)
75
- {
76
- return CBOOL2RVAL(poppler_form_field_is_read_only(_SELF(self)));
77
- }
78
-
79
- void
80
- Init_poppler_form_field(VALUE mPoppler)
81
- {
82
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler);
83
- cUnknownField = rb_define_class_under(mPoppler, "UnknownField", RG_TARGET_NAMESPACE);
84
- cSignatureField = rb_define_class_under(mPoppler, "SignatureField",
85
- RG_TARGET_NAMESPACE);
86
-
87
- RG_DEF_METHOD(id, 0);
88
- RG_DEF_METHOD(font_size, 0);
89
- RG_DEF_METHOD_P(read_only, 0);
90
-
91
- Init_poppler_button_field(mPoppler, RG_TARGET_NAMESPACE);
92
- Init_poppler_text_field(mPoppler, RG_TARGET_NAMESPACE);
93
- Init_poppler_choice_field(mPoppler, RG_TARGET_NAMESPACE);
94
-
95
- cButtonField = rb_const_get(mPoppler, rb_intern("ButtonField"));
96
- cTextField = rb_const_get(mPoppler, rb_intern("TextField"));
97
- cChoiceField = rb_const_get(mPoppler, rb_intern("ChoiceField"));
98
- }
@@ -1,48 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library 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 GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #include "rbpoppler-private.h"
22
-
23
- #define RG_TARGET_NAMESPACE cImageMapping
24
-
25
- DEF_ACCESSOR_WITH_SETTER(image_mapping, area,
26
- RVAL2POPPLERIMAGEMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
27
- DEF_ACCESSOR(image_mapping, image_id, RVAL2POPPLERIMAGEMAPPING, INT2NUM, NUM2INT)
28
- static VALUE
29
- rg_image(VALUE self)
30
- {
31
- return rb_funcall(rb_iv_get(self, "@page"), rb_intern("get_image"),
32
- 1, INT2NUM(RVAL2POPPLERIMAGEMAPPING(self)->image_id));
33
- }
34
-
35
- void
36
- Init_poppler_image_mapping(VALUE mPoppler)
37
- {
38
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING,
39
- "ImageMapping", mPoppler);
40
-
41
- rbg_define_method(RG_TARGET_NAMESPACE, "area", image_mapping_get_area, 0);
42
- rbg_define_method(RG_TARGET_NAMESPACE, "image_id", image_mapping_get_image_id, 0);
43
- RG_DEF_METHOD(image, 0);
44
-
45
- rbg_define_method(RG_TARGET_NAMESPACE, "set_area", image_mapping_set_area, 1);
46
- rbg_define_method(RG_TARGET_NAMESPACE, "set_image_id",
47
- image_mapping_set_image_id, 1);
48
- }
@@ -1,130 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library 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 GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #include "rbpoppler-private.h"
22
-
23
- #define RG_TARGET_NAMESPACE cIndexIter
24
-
25
- static VALUE RG_TARGET_NAMESPACE;
26
-
27
- static ID id_valid;
28
-
29
- /* Interface for getting the Index of a poppler_document */
30
- #define CHECK_IITER_IS_VALID(iter) do { \
31
- if (!RVAL2CBOOL(rg_valid_p(iter))) \
32
- return Qnil; \
33
- } while (0)
34
-
35
- static VALUE
36
- rg_valid_p(VALUE self)
37
- {
38
- return rb_ivar_get(self, id_valid);
39
- }
40
-
41
- static VALUE
42
- rg_initialize(VALUE self, VALUE document)
43
- {
44
- PopplerIndexIter *iter;
45
- iter = poppler_index_iter_new(RVAL2POPPLERDOCUMENT(document));
46
- G_INITIALIZE(self, iter);
47
- rb_ivar_set(self, id_valid, CBOOL2RVAL(iter));
48
- return Qnil;
49
- }
50
-
51
- static VALUE
52
- rg_child(VALUE self)
53
- {
54
- PopplerIndexIter *child;
55
- VALUE rb_child;
56
-
57
- CHECK_IITER_IS_VALID(self);
58
- child = poppler_index_iter_get_child(RVAL2POPPLERINDEXITER(self));
59
- if (!child)
60
- return Qnil;
61
-
62
- rb_child = POPPLERINDEXITER2RVAL(child);
63
- rb_ivar_set(rb_child, id_valid, CBOOL2RVAL(child));
64
- poppler_index_iter_free(child);
65
- return rb_child;
66
- }
67
-
68
- static VALUE
69
- rg_open_p(VALUE self)
70
- {
71
- CHECK_IITER_IS_VALID(self);
72
- return CBOOL2RVAL(poppler_index_iter_is_open(RVAL2POPPLERINDEXITER(self)));
73
- }
74
-
75
- #ifndef HAVE_TYPE_POPPLERACTIONANY
76
- static VALUE
77
- rg_action(VALUE self)
78
- {
79
- CHECK_IITER_IS_VALID(self);
80
- return POPPLERACTION2RVAL(poppler_index_iter_get_action(RVAL2POPPLERINDEXITER(self)));
81
- }
82
- #endif
83
-
84
- static VALUE
85
- rg_next(VALUE self)
86
- {
87
- if (poppler_index_iter_next(RVAL2POPPLERINDEXITER(self))) {
88
- return Qtrue;
89
- } else {
90
- rb_ivar_set(self, id_valid, Qfalse);
91
- return Qfalse;
92
- }
93
- }
94
-
95
- static VALUE
96
- rg_each(VALUE self)
97
- {
98
- PopplerIndexIter *iter;
99
-
100
- CHECK_IITER_IS_VALID(self);
101
- iter = RVAL2POPPLERINDEXITER(self);
102
- do {
103
- rb_yield(self);
104
- } while (poppler_index_iter_next(iter));
105
- rb_ivar_set(self, id_valid, Qfalse);
106
-
107
- return self;
108
- }
109
-
110
- void
111
- Init_poppler_index_iter(VALUE mPoppler)
112
- {
113
- id_valid = rb_intern("valid?");
114
-
115
- RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_INDEX_ITER, "IndexIter", mPoppler);
116
-
117
- /* Interface for getting the Index of a poppler_document */
118
- rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
119
-
120
- RG_DEF_METHOD(initialize, 1);
121
- RG_DEF_METHOD(child, 0);
122
- RG_DEF_METHOD_P(open, 0);
123
- #ifndef HAVE_TYPE_POPPLERACTIONANY
124
- RG_DEF_METHOD(action, 0);
125
- #endif
126
- RG_DEF_METHOD(next, 0);
127
-
128
- RG_DEF_METHOD_P(valid, 0);
129
- RG_DEF_METHOD(each, 0);
130
- }