jameskilton-rice 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. data/COPYING +23 -0
  2. data/Doxyfile +1253 -0
  3. data/Makefile.am +26 -0
  4. data/Makefile.in +749 -0
  5. data/README +879 -0
  6. data/README.mingw +8 -0
  7. data/Rakefile +72 -0
  8. data/aclocal.m4 +891 -0
  9. data/bootstrap +8 -0
  10. data/config.guess +1526 -0
  11. data/config.sub +1658 -0
  12. data/configure +7668 -0
  13. data/configure.ac +52 -0
  14. data/depcomp +589 -0
  15. data/doxygen.ac +314 -0
  16. data/doxygen.am +186 -0
  17. data/extconf.rb +22 -0
  18. data/install-sh +519 -0
  19. data/missing +367 -0
  20. data/post-autoconf.rb +22 -0
  21. data/post-automake.rb +28 -0
  22. data/rice/Address_Registration_Guard.hpp +7 -0
  23. data/rice/Address_Registration_Guard.ipp +34 -0
  24. data/rice/Address_Registration_Guard_defn.hpp +65 -0
  25. data/rice/Allocation_Strategies.hpp +37 -0
  26. data/rice/Arg.hpp +8 -0
  27. data/rice/Arg_impl.hpp +116 -0
  28. data/rice/Arg_operators.cpp +21 -0
  29. data/rice/Arg_operators.hpp +18 -0
  30. data/rice/Array.hpp +220 -0
  31. data/rice/Array.ipp +263 -0
  32. data/rice/Builtin_Object.hpp +8 -0
  33. data/rice/Builtin_Object.ipp +50 -0
  34. data/rice/Builtin_Object_defn.hpp +51 -0
  35. data/rice/Class.cpp +57 -0
  36. data/rice/Class.hpp +8 -0
  37. data/rice/Class.ipp +6 -0
  38. data/rice/Class_defn.hpp +83 -0
  39. data/rice/Constructor.hpp +339 -0
  40. data/rice/Critical_Guard.hpp +40 -0
  41. data/rice/Critical_Guard.ipp +26 -0
  42. data/rice/Data_Object.hpp +8 -0
  43. data/rice/Data_Object.ipp +133 -0
  44. data/rice/Data_Object_defn.hpp +132 -0
  45. data/rice/Data_Type.cpp +21 -0
  46. data/rice/Data_Type.hpp +8 -0
  47. data/rice/Data_Type.ipp +306 -0
  48. data/rice/Data_Type_defn.hpp +219 -0
  49. data/rice/Data_Type_fwd.hpp +12 -0
  50. data/rice/Director.cpp +19 -0
  51. data/rice/Director.hpp +47 -0
  52. data/rice/Enum.hpp +118 -0
  53. data/rice/Enum.ipp +246 -0
  54. data/rice/Exception.cpp +59 -0
  55. data/rice/Exception.hpp +9 -0
  56. data/rice/Exception_Base.hpp +8 -0
  57. data/rice/Exception_Base.ipp +13 -0
  58. data/rice/Exception_Base_defn.hpp +27 -0
  59. data/rice/Exception_defn.hpp +69 -0
  60. data/rice/Hash.hpp +210 -0
  61. data/rice/Hash.ipp +338 -0
  62. data/rice/Identifier.cpp +8 -0
  63. data/rice/Identifier.hpp +50 -0
  64. data/rice/Identifier.ipp +33 -0
  65. data/rice/Jump_Tag.hpp +24 -0
  66. data/rice/Makefile.am +140 -0
  67. data/rice/Makefile.in +740 -0
  68. data/rice/Module.cpp +84 -0
  69. data/rice/Module.hpp +8 -0
  70. data/rice/Module.ipp +6 -0
  71. data/rice/Module_defn.hpp +88 -0
  72. data/rice/Module_impl.hpp +281 -0
  73. data/rice/Module_impl.ipp +348 -0
  74. data/rice/Object.cpp +153 -0
  75. data/rice/Object.hpp +8 -0
  76. data/rice/Object.ipp +19 -0
  77. data/rice/Object_defn.hpp +183 -0
  78. data/rice/Require_Guard.hpp +21 -0
  79. data/rice/String.cpp +94 -0
  80. data/rice/String.hpp +89 -0
  81. data/rice/Struct.cpp +117 -0
  82. data/rice/Struct.hpp +162 -0
  83. data/rice/Struct.ipp +26 -0
  84. data/rice/Symbol.cpp +25 -0
  85. data/rice/Symbol.hpp +66 -0
  86. data/rice/Symbol.ipp +44 -0
  87. data/rice/VM.cpp +92 -0
  88. data/rice/VM.hpp +32 -0
  89. data/rice/config.hpp +44 -0
  90. data/rice/config.hpp.in +43 -0
  91. data/rice/detail/Arguments.hpp +126 -0
  92. data/rice/detail/Auto_Function_Wrapper.hpp +861 -0
  93. data/rice/detail/Auto_Function_Wrapper.ipp +2929 -0
  94. data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
  95. data/rice/detail/Auto_Member_Function_Wrapper.ipp +2326 -0
  96. data/rice/detail/Caster.hpp +63 -0
  97. data/rice/detail/Exception_Handler.hpp +8 -0
  98. data/rice/detail/Exception_Handler.ipp +68 -0
  99. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  100. data/rice/detail/Iterator.hpp +93 -0
  101. data/rice/detail/Not_Copyable.hpp +25 -0
  102. data/rice/detail/Wrapped_Function.hpp +33 -0
  103. data/rice/detail/check_ruby_type.cpp +27 -0
  104. data/rice/detail/check_ruby_type.hpp +23 -0
  105. data/rice/detail/creation_funcs.hpp +37 -0
  106. data/rice/detail/creation_funcs.ipp +36 -0
  107. data/rice/detail/default_allocation_func.hpp +23 -0
  108. data/rice/detail/default_allocation_func.ipp +11 -0
  109. data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
  110. data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
  111. data/rice/detail/demangle.cpp +56 -0
  112. data/rice/detail/demangle.hpp +19 -0
  113. data/rice/detail/env.hpp +19 -0
  114. data/rice/detail/from_ruby.hpp +43 -0
  115. data/rice/detail/from_ruby.ipp +60 -0
  116. data/rice/detail/method_data.cpp +392 -0
  117. data/rice/detail/method_data.cpp.rpp +301 -0
  118. data/rice/detail/method_data.hpp +21 -0
  119. data/rice/detail/mininode.cpp +1220 -0
  120. data/rice/detail/mininode.cpp.rpp +62 -0
  121. data/rice/detail/mininode.hpp +320 -0
  122. data/rice/detail/mininode.hpp.rpp +119 -0
  123. data/rice/detail/node.hpp +13 -0
  124. data/rice/detail/object_call.hpp +85 -0
  125. data/rice/detail/object_call.ipp +147 -0
  126. data/rice/detail/protect.cpp +29 -0
  127. data/rice/detail/protect.hpp +34 -0
  128. data/rice/detail/remove_const.hpp +21 -0
  129. data/rice/detail/ruby.hpp +89 -0
  130. data/rice/detail/ruby_version_code.hpp +6 -0
  131. data/rice/detail/ruby_version_code.hpp.in +6 -0
  132. data/rice/detail/rubysig.hpp +19 -0
  133. data/rice/detail/st.hpp +60 -0
  134. data/rice/detail/to_ruby.hpp +22 -0
  135. data/rice/detail/to_ruby.ipp +37 -0
  136. data/rice/detail/win32.hpp +16 -0
  137. data/rice/detail/wrap_function.hpp +345 -0
  138. data/rice/detail/wrap_function.ipp +531 -0
  139. data/rice/generate_code.rb +1311 -0
  140. data/rice/global_function.hpp +33 -0
  141. data/rice/global_function.ipp +22 -0
  142. data/rice/protect.hpp +91 -0
  143. data/rice/protect.ipp +803 -0
  144. data/rice/ruby_mark.hpp +13 -0
  145. data/rice/ruby_try_catch.hpp +86 -0
  146. data/rice/rubypp.rb +97 -0
  147. data/rice/to_from_ruby.hpp +8 -0
  148. data/rice/to_from_ruby.ipp +299 -0
  149. data/rice/to_from_ruby_defn.hpp +71 -0
  150. data/ruby.ac +150 -0
  151. data/ruby/Makefile.am +1 -0
  152. data/ruby/Makefile.in +497 -0
  153. data/ruby/lib/Makefile.am +3 -0
  154. data/ruby/lib/Makefile.in +374 -0
  155. data/ruby/lib/mkmf-rice.rb.in +209 -0
  156. data/ruby/lib/version.rb +3 -0
  157. data/sample/Makefile.am +47 -0
  158. data/sample/Makefile.in +380 -0
  159. data/sample/enum/extconf.rb +3 -0
  160. data/sample/enum/sample_enum.cpp +54 -0
  161. data/sample/enum/test.rb +8 -0
  162. data/sample/inheritance/animals.cpp +98 -0
  163. data/sample/inheritance/extconf.rb +3 -0
  164. data/sample/inheritance/test.rb +7 -0
  165. data/sample/map/extconf.rb +3 -0
  166. data/sample/map/map.cpp +81 -0
  167. data/sample/map/test.rb +7 -0
  168. data/test/Makefile.am +49 -0
  169. data/test/Makefile.in +603 -0
  170. data/test/test_Address_Registration_Guard.cpp +43 -0
  171. data/test/test_Allocation_Strategies.cpp +77 -0
  172. data/test/test_Array.cpp +241 -0
  173. data/test/test_Builtin_Object.cpp +72 -0
  174. data/test/test_Class.cpp +398 -0
  175. data/test/test_Constructor.cpp +238 -0
  176. data/test/test_Critical_Guard.cpp +51 -0
  177. data/test/test_Data_Object.cpp +275 -0
  178. data/test/test_Data_Type.cpp +121 -0
  179. data/test/test_Director.cpp +225 -0
  180. data/test/test_Enum.cpp +162 -0
  181. data/test/test_Exception.cpp +46 -0
  182. data/test/test_Hash.cpp +195 -0
  183. data/test/test_Identifier.cpp +70 -0
  184. data/test/test_Jump_Tag.cpp +17 -0
  185. data/test/test_Module.cpp +428 -0
  186. data/test/test_Object.cpp +148 -0
  187. data/test/test_String.cpp +94 -0
  188. data/test/test_Struct.cpp +192 -0
  189. data/test/test_Symbol.cpp +63 -0
  190. data/test/test_To_From_Ruby.cpp +263 -0
  191. data/test/test_VM.cpp +26 -0
  192. data/test/test_global_functions.cpp +97 -0
  193. data/test/test_rice.rb +35 -0
  194. data/test/unittest.cpp +136 -0
  195. data/test/unittest.hpp +292 -0
  196. metadata +247 -0
@@ -0,0 +1,65 @@
1
+ #ifndef Rice__Address_Registration_Guard_defn__hpp_
2
+ #define Rice__Address_Registration_Guard_defn__hpp_
3
+
4
+ #include "Object_defn.hpp"
5
+ #include "detail/ruby.hpp"
6
+ #include "detail/Not_Copyable.hpp"
7
+
8
+ namespace Rice
9
+ {
10
+
11
+ //! A guard to register a given address with the GC.
12
+ /*! Calls rb_gc_register_address upon construction and
13
+ * rb_gc_unregister_address upon destruction.
14
+ * For example:
15
+ * \code
16
+ * Class Foo
17
+ * {
18
+ * public:
19
+ * Foo()
20
+ * : string_(rb_str_new2())
21
+ * , guard_(&string_);
22
+ *
23
+ * private:
24
+ * VALUE string_;
25
+ * Address_Registration_Guard guard_;
26
+ * };
27
+ * \endcode
28
+ */
29
+ class Address_Registration_Guard
30
+ : private detail::Not_Copyable
31
+ {
32
+ public:
33
+ //! Register an address with the GC.
34
+ /* \param address The address to register with the GC. The address
35
+ * must point to a valid ruby object (RObject).
36
+ */
37
+ Address_Registration_Guard(VALUE * address);
38
+
39
+ //! Register an Object with the GC.
40
+ /*! \param object The Object to register with the GC. The object must
41
+ * not be destroyed before the Address_Registration_Guard is
42
+ * destroyed.
43
+ */
44
+ Address_Registration_Guard(Object * object);
45
+
46
+ //! Unregister an address/Object with the GC.
47
+ /*! Destruct an Address_Registration_Guard. The address registered
48
+ * with the Address_Registration_Guard when it was constructed will
49
+ * be unregistered from the GC.
50
+ */
51
+ ~Address_Registration_Guard();
52
+
53
+ //! Get the address that is registered with the GC.
54
+ VALUE * address() const;
55
+
56
+ //! Swap with another Address_Registration_Guard.
57
+ void swap(Address_Registration_Guard & other);
58
+
59
+ private:
60
+ VALUE * address_;
61
+ };
62
+
63
+ } // namespace Rice
64
+
65
+ #endif // Rice__Address_Registration_Guard_defn__hpp_
@@ -0,0 +1,37 @@
1
+ #ifndef Rice__Default_Allocation_Strategy__hpp_
2
+ #define Rice__Default_Allocation_Strategy__hpp_
3
+
4
+ #include "detail/ruby.hpp"
5
+
6
+ /*! \file
7
+ * \brief Strategies for allocation/deallocation of objects.
8
+ */
9
+
10
+ namespace Rice
11
+ {
12
+
13
+ template<typename T>
14
+ struct Default_Allocation_Strategy
15
+ {
16
+ //! Allocate an object using operator new.
17
+ static T * allocate() { return new T; }
18
+
19
+ //! Delete obj using the delete operator.
20
+ static void free(T * obj) { delete obj; }
21
+ };
22
+
23
+ template<typename T>
24
+ struct Xmalloc_Allocation_Strategy
25
+ {
26
+ //! Allocate an array of objects using operator new and xmalloc.
27
+ static T * allocate() { T * obj = static_cast<T *>(::xmalloc(sizeof(T))); new(obj) T; return obj; }
28
+
29
+ //! Delete obj by calling the destructor explicitly and calling xfree.
30
+ static void free(T * obj) { obj->~T(); ::xfree(obj); }
31
+ };
32
+
33
+ // TODO: array allocation
34
+
35
+ } // namespace Rice
36
+
37
+ #endif // Rice__Default_Allocation_Strategy__hpp_
data/rice/Arg.hpp ADDED
@@ -0,0 +1,8 @@
1
+ #ifndef Rice__Arg__hpp_
2
+ #define Rice__Arg__hpp_
3
+
4
+ #include "Arg_impl.hpp"
5
+ #include "detail/Arguments.hpp"
6
+ #include "Arg_operators.hpp"
7
+
8
+ #endif // Rice__Arg__hpp_
data/rice/Arg_impl.hpp ADDED
@@ -0,0 +1,116 @@
1
+ #ifndef Rice__Arg_Impl_hpp_
2
+ #define Rice__Arg_Impl_hpp_
3
+
4
+ namespace Rice {
5
+
6
+ /**
7
+ * Arg is how you define the details of the arguments
8
+ * a given method takes. Inspired by how Boost.Python handles
9
+ * keyword and default arguments, the syntax is simple:
10
+ *
11
+ * define_method("method", method, (Arg("arg1"), Arg("arg2") = 3, Arg("arg3") = true))
12
+ *
13
+ * This is simply saying that the method ::method takes three arguments
14
+ * (arg1, arg2, arg3) and that arg2 defaults to 2 and arg3 defaults to true.
15
+ */
16
+ class Arg
17
+ {
18
+ public:
19
+ /**
20
+ * Initialize the Arg with the name of the argument.
21
+ * We require the name of the argument because 1) it makes code
22
+ * easier to read and 2) hopefully Ruby gets keyword arguments
23
+ * in the future and this means Rice will be ready for it.
24
+ */
25
+ Arg(const char* name)
26
+ : name_(name)
27
+ , defaultValue(0)
28
+ {}
29
+
30
+ Arg(const Arg& other)
31
+ : name_(other.name()),
32
+ defaultValue(other.defaultValue ? other.defaultValue->clone() : 0)
33
+ {}
34
+
35
+ virtual ~Arg()
36
+ {
37
+ }
38
+
39
+ /**
40
+ * Set the default value for this argument.
41
+ * If this isn't called on this Arg, then this
42
+ * Arg is required in the method call
43
+ */
44
+ template<typename Arg_Type>
45
+ Arg& operator=(Arg_Type const& val)
46
+ {
47
+ defaultValue = new type<Arg_Type>(val);
48
+ return *this;
49
+ }
50
+
51
+ /**
52
+ * Does this argument have a default value on it?
53
+ */
54
+ bool hasDefaultValue() const {
55
+ return defaultValue != 0;
56
+ }
57
+
58
+ /**
59
+ * Get the default value of this argument,
60
+ * if one exists
61
+ */
62
+ template<typename Arg_Type>
63
+ Arg_Type& getDefaultValue() const
64
+ {
65
+ return static_cast< type<Arg_Type>* >(defaultValue)->held;
66
+ }
67
+
68
+ const char* name() const
69
+ {
70
+ return name_;
71
+ }
72
+
73
+ private:
74
+
75
+ /** Name of the argument */
76
+ const char* name_;
77
+
78
+ /**
79
+ * The following is a stripped down version of
80
+ * Boost.Any.
81
+ */
82
+
83
+ class type_base
84
+ {
85
+ public:
86
+ virtual ~type_base() {}
87
+ virtual type_base* clone() const = 0;
88
+ };
89
+
90
+ template<typename Type>
91
+ class type : public type_base
92
+ {
93
+ public:
94
+ type(const Type & value)
95
+ :held(value)
96
+ {}
97
+
98
+ virtual ~type() { }
99
+
100
+ virtual type_base* clone() const
101
+ {
102
+ return new type(held);
103
+ }
104
+
105
+ Type held;
106
+ };
107
+
108
+ public:
109
+
110
+ /** Our saved default value */
111
+ type_base* defaultValue;
112
+ };
113
+
114
+ }
115
+
116
+ #endif // Rice__Arg_Impl_hpp_
@@ -0,0 +1,21 @@
1
+ #include "Arg_impl.hpp"
2
+ #include "detail/Arguments.hpp"
3
+ #include "Arg_operators.hpp"
4
+
5
+ namespace Rice {
6
+
7
+ Arguments* operator,(const Arg& arg1, const Arg& arg2)
8
+ {
9
+ Arguments* a = new Arguments();
10
+ a->add(&arg1);
11
+ a->add(&arg2);
12
+ return a;
13
+ }
14
+
15
+ Arguments* operator,(Arguments* arguments, const Arg& arg)
16
+ {
17
+ arguments->add(&arg);
18
+ return arguments;
19
+ }
20
+
21
+ }
@@ -0,0 +1,18 @@
1
+ #ifndef Rice__Arg_Operators_hpp_
2
+ #define Rice__Arg_Operators_hpp_
3
+
4
+ namespace Rice
5
+ {
6
+
7
+ /**
8
+ * Comma operators to take a list of Arg objects
9
+ * and build up a single Argument object used
10
+ * later in method dispatch
11
+ */
12
+ Arguments* operator,(const Arg& arg1, const Arg& arg2);
13
+
14
+ Arguments* operator,(Arguments* arguments, const Arg& arg);
15
+
16
+ }
17
+
18
+ #endif // Rice__Arg_Operators_hpp_
data/rice/Array.hpp ADDED
@@ -0,0 +1,220 @@
1
+ #ifndef Rice__Array__hpp_
2
+ #define Rice__Array__hpp_
3
+
4
+ #include "Builtin_Object.hpp"
5
+ #include "to_from_ruby_defn.hpp"
6
+ #include "detail/ruby.hpp"
7
+ #include <iterator>
8
+
9
+ namespace Rice
10
+ {
11
+
12
+ //! A wrapper for the ruby Array class.
13
+ /*! This class provides a C++-style interface to ruby's Array class and
14
+ * its associated rb_ary_* functions.
15
+ * Example:
16
+ * \code
17
+ * Array a;
18
+ * a.push(String("some string"));
19
+ * a.push(42);
20
+ * \endcode
21
+ */
22
+ class Array
23
+ : public Builtin_Object<RArray, T_ARRAY>
24
+ {
25
+ public:
26
+ //! Construct a new array
27
+ Array();
28
+
29
+ //! Wrap an existing array
30
+ /*! \param v a ruby object, which must be of type T_ARRAY.
31
+ */
32
+ Array(Object v);
33
+
34
+ //! Wrap an existing array
35
+ /*! \param v a ruby object, which must be of type T_ARRAY.
36
+ */
37
+ Array(VALUE v);
38
+
39
+ //! Construct an array from a sequence.
40
+ /*! \param begin an iterator to the beginning of the sequence.
41
+ * \param end an iterator to the end of the sequence.
42
+ */
43
+ template<typename Iter_T>
44
+ Array(Iter_T begin, Iter_T end);
45
+
46
+ //! Construct an Array from a C array.
47
+ /*! \param a a C array of type T and size n.
48
+ */
49
+ template<typename T, size_t n>
50
+ Array(T const (& a)[n]);
51
+
52
+ public:
53
+ //! Return the size of the array.
54
+ size_t size() const;
55
+
56
+ //! Return the element at the given index.
57
+ /*! \param index The index of the desired element. The index may be
58
+ * negative, to indicate an offset from the end of the array. If the
59
+ * index is out of bounds, this function has undefined behavior.
60
+ * \return the element at the given index.
61
+ */
62
+ Object operator[](ptrdiff_t index) const;
63
+
64
+ private:
65
+ //! A helper class so array[index]=value can work.
66
+ class Proxy;
67
+
68
+ public:
69
+ //! Return a reference to the element at the given index.
70
+ /*! \param index The index of the desired element. The index may be
71
+ * negative, to indicate an offset from the end of the array. If the
72
+ * index is out of bounds, this function has undefined behavior.
73
+ * \return the element at the given index.
74
+ */
75
+ Proxy operator[](ptrdiff_t index);
76
+
77
+ //! Push an element onto the end of the array
78
+ /*! \param v an object to push onto the array.
79
+ * \return the object which was pushed onto the array.
80
+ */
81
+ template<typename T>
82
+ Object push(T const & obj);
83
+
84
+ //! Pop an element from the end of the array
85
+ /*! \return the object which was popped from the array, or Qnil if
86
+ * the array was empty.
87
+ */
88
+ Object pop();
89
+
90
+ //! Unshift an element onto the beginning of the array
91
+ /*! \param v an object to unshift onto the array.
92
+ * \return the object which was unshifted onto the array.
93
+ */
94
+ template<typename T>
95
+ Object unshift(T const & obj);
96
+
97
+ //! Shift an element from the beginning of the array
98
+ /*! \return the object which was shifted from the array.
99
+ */
100
+ Object shift();
101
+
102
+ //! Return a pointer to the beginning of the underlying C array.
103
+ //! Use with caution!
104
+ /*! \return a pointer to the beginning of the array.
105
+ */
106
+ VALUE * to_c_array();
107
+
108
+ private:
109
+ template<typename Array_Ref_T, typename Value_T>
110
+ class Iterator;
111
+
112
+ size_t position_of(ptrdiff_t index) const;
113
+
114
+ public:
115
+ //! An iterator.
116
+ typedef Iterator<Array &, Proxy> iterator;
117
+
118
+ //! A const iterator.
119
+ typedef Iterator<Array const &, Object> const_iterator;
120
+
121
+ //! Return an iterator to the beginning of the array.
122
+ iterator begin();
123
+
124
+ //! Return a const iterator to the beginning of the array.
125
+ const_iterator begin() const;
126
+
127
+ //! Return an iterator to the end of the array.
128
+ iterator end();
129
+
130
+ //! Return a const iterator to the end of the array.
131
+ const_iterator end() const;
132
+ };
133
+
134
+ //! A helper class so array[index]=value can work.
135
+ class Array::Proxy
136
+ {
137
+ public:
138
+ //! Construct a new Proxy
139
+ Proxy(Array array, size_t index);
140
+
141
+ //! Implicit conversion to Object.
142
+ operator Object() const;
143
+
144
+ //! Explicit conversion to VALUE.
145
+ VALUE value() const;
146
+
147
+ //! Assignment operator.
148
+ template<typename T>
149
+ Object operator=(T const & value);
150
+
151
+ private:
152
+ Array array_;
153
+ size_t index_;
154
+ };
155
+
156
+ //! A helper class for implementing iterators for a Array.
157
+ // TODO: This really should be a random-access iterator.
158
+ template<typename Array_Ref_T, typename Value_T>
159
+ class Array::Iterator
160
+ : public std::iterator<
161
+ std::forward_iterator_tag,
162
+ Value_T, // Type
163
+ ptrdiff_t, // Distance type
164
+ Object *, // Pointer type
165
+ Value_T &> // Reference type
166
+ {
167
+ public:
168
+ Iterator(Array_Ref_T array, size_t index);
169
+
170
+ template<typename Array_Ref_T_, typename Value_T_>
171
+ Iterator(Iterator<Array_Ref_T_, Value_T_> const & rhs);
172
+
173
+ template<typename Array_Ref_T_, typename Value_T_>
174
+ Iterator & operator=(Iterator<Array_Ref_T_, Value_T_> const & rhs);
175
+
176
+ Iterator & operator++();
177
+ Iterator operator++(int);
178
+ Value_T operator*();
179
+ Object * operator->();
180
+
181
+ template<typename Array_Ref_T_, typename Value_T_>
182
+ bool operator==(Iterator<Array_Ref_T_, Value_T_> const & rhs) const;
183
+
184
+ template<typename Array_Ref_T_, typename Value_T_>
185
+ bool operator!=(Iterator<Array_Ref_T_, Value_T_> const & rhs) const;
186
+
187
+ // Causes ICE on g++ 3.3.3
188
+ // template<typename Array_Ref_T_, typename Value_T_>
189
+ // friend class Iterator;
190
+
191
+ Array_Ref_T array() const;
192
+ size_t index() const;
193
+
194
+ private:
195
+ Array_Ref_T array_;
196
+ size_t index_;
197
+
198
+ Object tmp_;
199
+ };
200
+
201
+ } // namespace Rice
202
+
203
+ template<>
204
+ inline
205
+ Rice::Array from_ruby<Rice::Array>(Rice::Object x)
206
+ {
207
+ return Rice::Array(x);
208
+ }
209
+
210
+ template<>
211
+ inline
212
+ Rice::Object to_ruby<Rice::Array>(Rice::Array const & x)
213
+ {
214
+ return x;
215
+ }
216
+
217
+ #include "Array.ipp"
218
+
219
+ #endif // Rice__Array__hpp_
220
+