rice 4.6.1 → 4.7.0

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.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/CMakeLists.txt +0 -4
  4. data/Rakefile +2 -8
  5. data/bin/rice-doc.rb +212 -0
  6. data/bin/rice-rbs.rb +93 -0
  7. data/include/rice/rice.hpp +4972 -4015
  8. data/include/rice/stl.hpp +822 -294
  9. data/lib/rice/doc/cpp_reference.rb +166 -0
  10. data/lib/rice/doc/doxygen.rb +294 -0
  11. data/lib/rice/doc/mkdocs.rb +298 -0
  12. data/lib/rice/doc/rice.rb +29 -0
  13. data/lib/rice/doc/ruby.rb +37 -0
  14. data/lib/rice/doc.rb +5 -0
  15. data/lib/{make_rice_headers.rb → rice/make_rice_headers.rb} +3 -0
  16. data/lib/rice/native.rb +18 -0
  17. data/lib/rice/native_registry.rb +21 -0
  18. data/lib/rice/parameter.rb +7 -0
  19. data/lib/rice/rbs.rb +104 -0
  20. data/lib/rice/version.rb +1 -1
  21. data/lib/rice.rb +4 -0
  22. data/lib/rubygems/cmake_builder.rb +24 -27
  23. data/rice/Arg.hpp +4 -4
  24. data/rice/Arg.ipp +4 -4
  25. data/rice/Buffer.hpp +32 -28
  26. data/rice/Buffer.ipp +306 -178
  27. data/rice/Data_Object.ipp +101 -82
  28. data/rice/Data_Type.hpp +5 -7
  29. data/rice/Data_Type.ipp +48 -29
  30. data/rice/Enum.ipp +15 -21
  31. data/rice/Function.hpp +17 -0
  32. data/rice/Function.ipp +13 -0
  33. data/rice/Pointer.hpp +15 -0
  34. data/rice/Pointer.ipp +49 -0
  35. data/rice/Return.hpp +1 -1
  36. data/rice/Return.ipp +2 -2
  37. data/rice/api.hpp +30 -0
  38. data/rice/cpp_api/Array.hpp +2 -2
  39. data/rice/cpp_api/Array.ipp +50 -5
  40. data/rice/cpp_api/Class.hpp +0 -5
  41. data/rice/cpp_api/Class.ipp +19 -0
  42. data/rice/cpp_api/Hash.ipp +20 -0
  43. data/rice/cpp_api/Module.hpp +6 -3
  44. data/rice/cpp_api/Module.ipp +49 -11
  45. data/rice/cpp_api/Object.ipp +31 -2
  46. data/rice/cpp_api/String.hpp +1 -2
  47. data/rice/cpp_api/String.ipp +21 -1
  48. data/rice/cpp_api/Struct.ipp +5 -0
  49. data/rice/cpp_api/Symbol.ipp +34 -0
  50. data/rice/cpp_api/shared_methods.hpp +12 -12
  51. data/rice/detail/MethodInfo.hpp +4 -2
  52. data/rice/detail/MethodInfo.ipp +19 -3
  53. data/rice/detail/ModuleRegistry.hpp +18 -0
  54. data/rice/detail/ModuleRegistry.ipp +25 -0
  55. data/rice/detail/Native.hpp +45 -2
  56. data/rice/detail/Native.ipp +196 -2
  57. data/rice/detail/NativeAttributeGet.hpp +9 -4
  58. data/rice/detail/NativeAttributeGet.ipp +65 -11
  59. data/rice/detail/NativeAttributeSet.hpp +4 -0
  60. data/rice/detail/NativeAttributeSet.ipp +30 -2
  61. data/rice/detail/NativeCallbackFFI.ipp +2 -2
  62. data/rice/detail/NativeCallbackSimple.ipp +1 -1
  63. data/rice/detail/NativeFunction.hpp +11 -49
  64. data/rice/detail/NativeFunction.ipp +82 -379
  65. data/rice/detail/NativeInvoker.hpp +74 -0
  66. data/rice/detail/NativeInvoker.ipp +197 -0
  67. data/rice/detail/NativeIterator.hpp +4 -0
  68. data/rice/detail/NativeIterator.ipp +19 -0
  69. data/rice/detail/NativeMethod.hpp +97 -0
  70. data/rice/detail/NativeMethod.ipp +332 -0
  71. data/rice/detail/NativeProc.hpp +51 -0
  72. data/rice/detail/NativeProc.ipp +133 -0
  73. data/rice/detail/NativeRegistry.hpp +8 -0
  74. data/rice/detail/NativeRegistry.ipp +27 -0
  75. data/rice/detail/Parameter.hpp +47 -0
  76. data/rice/detail/Parameter.ipp +105 -0
  77. data/rice/detail/Proc.ipp +14 -13
  78. data/rice/detail/Registries.hpp +1 -0
  79. data/rice/detail/RubyType.hpp +0 -2
  80. data/rice/detail/RubyType.ipp +15 -33
  81. data/rice/detail/Type.hpp +44 -8
  82. data/rice/detail/Type.ipp +151 -49
  83. data/rice/detail/TypeRegistry.hpp +3 -0
  84. data/rice/detail/TypeRegistry.ipp +17 -27
  85. data/rice/detail/Types.ipp +430 -0
  86. data/rice/detail/Wrapper.hpp +12 -0
  87. data/rice/detail/Wrapper.ipp +45 -2
  88. data/rice/detail/from_ruby.ipp +567 -1073
  89. data/rice/detail/ruby.hpp +1 -0
  90. data/rice/detail/to_ruby.ipp +4 -635
  91. data/rice/libc/file.ipp +3 -6
  92. data/rice/rice.hpp +22 -12
  93. data/rice/rice_api/Arg.hpp +7 -0
  94. data/rice/rice_api/Arg.ipp +9 -0
  95. data/rice/rice_api/ModuleRegistry.hpp +7 -0
  96. data/rice/rice_api/ModuleRegistry.ipp +10 -0
  97. data/rice/rice_api/Native.hpp +7 -0
  98. data/rice/rice_api/Native.ipp +52 -0
  99. data/rice/rice_api/NativeRegistry.hpp +7 -0
  100. data/rice/rice_api/NativeRegistry.ipp +21 -0
  101. data/rice/rice_api/Parameter.hpp +7 -0
  102. data/rice/rice_api/Parameter.ipp +11 -0
  103. data/rice/rice_api/Registries.hpp +6 -0
  104. data/rice/rice_api/Registries.ipp +12 -0
  105. data/rice/rice_api/TypeRegistry.hpp +7 -0
  106. data/rice/rice_api/TypeRegistry.ipp +10 -0
  107. data/rice/stl/complex.ipp +35 -0
  108. data/rice/stl/exception.ipp +20 -7
  109. data/rice/stl/filesystem.hpp +6 -0
  110. data/rice/stl/filesystem.ipp +34 -0
  111. data/rice/stl/map.ipp +13 -21
  112. data/rice/stl/monostate.ipp +37 -1
  113. data/rice/stl/multimap.ipp +17 -24
  114. data/rice/stl/optional.ipp +47 -2
  115. data/rice/stl/pair.ipp +23 -58
  116. data/rice/stl/reference_wrapper.ipp +22 -1
  117. data/rice/stl/set.ipp +17 -9
  118. data/rice/stl/shared_ptr.ipp +44 -17
  119. data/rice/stl/string.ipp +175 -7
  120. data/rice/stl/string_view.ipp +5 -0
  121. data/rice/stl/tuple.ipp +38 -9
  122. data/rice/stl/unique_ptr.ipp +46 -2
  123. data/rice/stl/unordered_map.ipp +13 -21
  124. data/rice/stl/variant.ipp +47 -11
  125. data/rice/stl/vector.ipp +183 -104
  126. data/rice/stl.hpp +1 -0
  127. data/rice/traits/function_traits.hpp +2 -2
  128. data/rice/traits/method_traits.hpp +5 -16
  129. data/rice/traits/rice_traits.hpp +24 -4
  130. data/rice.gemspec +11 -22
  131. data/test/embed_ruby.cpp +0 -3
  132. data/test/test_Array.cpp +38 -38
  133. data/test/test_Attribute.cpp +187 -2
  134. data/test/test_Buffer.cpp +302 -26
  135. data/test/test_Callback.cpp +2 -3
  136. data/test/test_Class.cpp +5 -5
  137. data/test/test_Data_Object.cpp +0 -55
  138. data/test/test_Data_Type.cpp +19 -30
  139. data/test/test_Enum.cpp +4 -46
  140. data/test/test_From_Ruby.cpp +88 -81
  141. data/test/test_GVL.cpp +109 -0
  142. data/test/test_Iterator.cpp +1 -1
  143. data/test/test_Keep_Alive_No_Wrapper.cpp +5 -3
  144. data/test/test_Module.cpp +8 -9
  145. data/test/test_Object.cpp +1 -1
  146. data/test/test_Overloads.cpp +3 -3
  147. data/test/test_Stl_Map.cpp +8 -8
  148. data/test/test_Stl_Multimap.cpp +4 -4
  149. data/test/test_Stl_Pair.cpp +5 -3
  150. data/test/test_Stl_SharedPtr.cpp +24 -12
  151. data/test/test_Stl_Tuple.cpp +1 -1
  152. data/test/test_Stl_UniquePtr.cpp +8 -0
  153. data/test/test_Stl_Unordered_Map.cpp +9 -9
  154. data/test/test_Stl_Variant.cpp +9 -3
  155. data/test/test_Stl_Vector.cpp +118 -13
  156. data/test/test_To_Ruby.cpp +35 -28
  157. data/test/test_Type.cpp +256 -53
  158. data/test/unittest.hpp +35 -0
  159. metadata +66 -34
  160. data/rice/Init.hpp +0 -8
  161. data/rice/Init.ipp +0 -8
  162. data/rice/detail/RubyFunction.hpp +0 -31
  163. data/rice/detail/RubyFunction.ipp +0 -77
  164. data/sample/callbacks/extconf.rb +0 -5
  165. data/sample/callbacks/sample_callbacks.cpp +0 -35
  166. data/sample/callbacks/test.rb +0 -28
  167. data/sample/enum/extconf.rb +0 -5
  168. data/sample/enum/sample_enum.cpp +0 -40
  169. data/sample/enum/test.rb +0 -8
  170. data/sample/inheritance/animals.cpp +0 -82
  171. data/sample/inheritance/extconf.rb +0 -5
  172. data/sample/inheritance/test.rb +0 -7
  173. data/sample/map/extconf.rb +0 -5
  174. data/sample/map/map.cpp +0 -73
  175. data/sample/map/test.rb +0 -7
  176. data/test/ext/t1/Foo.hpp +0 -10
  177. data/test/ext/t1/extconf.rb +0 -4
  178. data/test/ext/t1/t1.cpp +0 -13
  179. data/test/ext/t2/extconf.rb +0 -4
  180. data/test/ext/t2/t2.cpp +0 -11
  181. data/test/ruby/test_callbacks_sample.rb +0 -28
  182. data/test/ruby/test_multiple_extensions.rb +0 -18
  183. data/test/ruby/test_multiple_extensions_same_class.rb +0 -14
  184. data/test/ruby/test_multiple_extensions_with_inheritance.rb +0 -20
  185. /data/test/{test_Stl_Type.cpp → test_Stl_Type_Info.cpp} +0 -0
@@ -42,32 +42,6 @@ namespace Rice
42
42
  Arg* arg_ = nullptr;
43
43
  };
44
44
 
45
- template<>
46
- class To_Ruby<bool*>
47
- {
48
- public:
49
- To_Ruby() = default;
50
-
51
- explicit To_Ruby(Arg* arg) : arg_(arg)
52
- {
53
- }
54
-
55
- VALUE convert(bool* data)
56
- {
57
- Buffer<bool> buffer(data);
58
- Data_Object<Buffer<bool>> dataObject(std::move(buffer));
59
- return dataObject.value();
60
- }
61
-
62
- VALUE convert(const bool* data)
63
- {
64
- return this->convert((bool*)data);
65
- }
66
-
67
- private:
68
- Arg* arg_ = nullptr;
69
- };
70
-
71
45
  template<bool N>
72
46
  class To_Ruby<bool[N]>
73
47
  {
@@ -144,32 +118,6 @@ namespace Rice
144
118
  Arg* arg_ = nullptr;
145
119
  };
146
120
 
147
- template<>
148
- class To_Ruby<int*>
149
- {
150
- public:
151
- To_Ruby() = default;
152
-
153
- explicit To_Ruby(Arg* arg) : arg_(arg)
154
- {
155
- }
156
-
157
- VALUE convert(int* data)
158
- {
159
- Buffer<int> buffer(data);
160
- Data_Object<Buffer<int>> dataObject(std::move(buffer));
161
- return dataObject.value();
162
- }
163
-
164
- VALUE convert(const int* data)
165
- {
166
- return this->convert((int*)data);
167
- }
168
-
169
- private:
170
- Arg* arg_ = nullptr;
171
- };
172
-
173
121
  template<int N>
174
122
  class To_Ruby<int[N]>
175
123
  {
@@ -190,32 +138,6 @@ namespace Rice
190
138
  Arg* arg_ = nullptr;
191
139
  };
192
140
 
193
- template<>
194
- class To_Ruby<int**>
195
- {
196
- public:
197
- To_Ruby() = default;
198
-
199
- explicit To_Ruby(Arg* arg) : arg_(arg)
200
- {
201
- }
202
-
203
- VALUE convert(int** data)
204
- {
205
- Buffer<int*> buffer(data);
206
- Data_Object<Buffer<int*>> dataObject(std::move(buffer));
207
- return dataObject.value();
208
- }
209
-
210
- VALUE convert(const int** data)
211
- {
212
- return this->convert((int**)data);
213
- }
214
-
215
- private:
216
- Arg* arg_ = nullptr;
217
- };
218
-
219
141
  // =========== unsigned int ============
220
142
  template<>
221
143
  class To_Ruby<unsigned int>
@@ -263,32 +185,6 @@ namespace Rice
263
185
  Arg* arg_ = nullptr;
264
186
  };
265
187
 
266
- template<>
267
- class To_Ruby<unsigned int*>
268
- {
269
- public:
270
- To_Ruby() = default;
271
-
272
- explicit To_Ruby(Arg* arg) : arg_(arg)
273
- {
274
- }
275
-
276
- VALUE convert(unsigned int* data)
277
- {
278
- Buffer<unsigned int> buffer(data);
279
- Data_Object<Buffer<unsigned int>> dataObject(std::move(buffer));
280
- return dataObject.value();
281
- }
282
-
283
- VALUE convert(const unsigned int* data)
284
- {
285
- return this->convert((unsigned int*)data);
286
- }
287
-
288
- private:
289
- Arg* arg_ = nullptr;
290
- };
291
-
292
188
  template<int N>
293
189
  class To_Ruby<unsigned int[N]>
294
190
  {
@@ -309,32 +205,6 @@ namespace Rice
309
205
  Arg* arg_ = nullptr;
310
206
  };
311
207
 
312
- template<>
313
- class To_Ruby<unsigned int**>
314
- {
315
- public:
316
- To_Ruby() = default;
317
-
318
- explicit To_Ruby(Arg* arg) : arg_(arg)
319
- {
320
- }
321
-
322
- VALUE convert(unsigned int** data)
323
- {
324
- Buffer<unsigned int*> buffer(data);
325
- Data_Object<Buffer<unsigned int*>> dataObject(std::move(buffer));
326
- return dataObject.value();
327
- }
328
-
329
- VALUE convert(const unsigned int** data)
330
- {
331
- return this->convert((unsigned int**)data);
332
- }
333
-
334
- private:
335
- Arg* arg_ = nullptr;
336
- };
337
-
338
208
  // =========== char ============
339
209
  template<>
340
210
  class To_Ruby<char>
@@ -452,32 +322,6 @@ namespace Rice
452
322
  Arg* arg_ = nullptr;
453
323
  };
454
324
 
455
- template<>
456
- class To_Ruby<char**>
457
- {
458
- public:
459
- To_Ruby() = default;
460
-
461
- explicit To_Ruby(Arg* arg) : arg_(arg)
462
- {
463
- }
464
-
465
- VALUE convert(char** data)
466
- {
467
- Buffer<char*> buffer(data);
468
- Data_Object<Buffer<char*>> dataObject(std::move(buffer));
469
- return dataObject.value();
470
- }
471
-
472
- VALUE convert(const char** data)
473
- {
474
- return this->convert((char**)data);
475
- }
476
-
477
- private:
478
- Arg* arg_ = nullptr;
479
- };
480
-
481
325
  // =========== unsigned char ============
482
326
  template<>
483
327
  class To_Ruby<unsigned char>
@@ -517,8 +361,8 @@ namespace Rice
517
361
  Arg* arg_ = nullptr;
518
362
  };
519
363
 
520
- template<>
521
- class To_Ruby<unsigned char*>
364
+ template<int N>
365
+ class To_Ruby<unsigned char[N]>
522
366
  {
523
367
  public:
524
368
  To_Ruby() = default;
@@ -527,26 +371,6 @@ namespace Rice
527
371
  {
528
372
  }
529
373
 
530
- VALUE convert(unsigned char* data)
531
- {
532
- Buffer<unsigned char> buffer(data);
533
- Data_Object<Buffer<unsigned char>> dataObject(std::move(buffer));
534
- return dataObject.value();
535
- }
536
-
537
- VALUE convert(const unsigned char* data)
538
- {
539
- return this->convert((unsigned char*)data);
540
- }
541
-
542
- private:
543
- Arg* arg_ = nullptr;
544
- };
545
-
546
- template<int N>
547
- class To_Ruby<unsigned char[N]>
548
- {
549
- public:
550
374
  VALUE convert(unsigned char data[N])
551
375
  {
552
376
  Buffer<unsigned char> buffer(data, N);
@@ -557,32 +381,6 @@ namespace Rice
557
381
  Arg* arg_ = nullptr;
558
382
  };
559
383
 
560
- template<>
561
- class To_Ruby<unsigned char**>
562
- {
563
- public:
564
- To_Ruby() = default;
565
-
566
- explicit To_Ruby(Arg* arg) : arg_(arg)
567
- {
568
- }
569
-
570
- VALUE convert(unsigned char** data)
571
- {
572
- Buffer<unsigned char*> buffer(data);
573
- Data_Object<Buffer<unsigned char*>> dataObject(std::move(buffer));
574
- return dataObject.value();
575
- }
576
-
577
- VALUE convert(const unsigned char** data)
578
- {
579
- return this->convert((unsigned char**)data);
580
- }
581
-
582
- private:
583
- Arg* arg_ = nullptr;
584
- };
585
-
586
384
  // =========== signed char ============
587
385
  template<>
588
386
  class To_Ruby<signed char>
@@ -622,32 +420,6 @@ namespace Rice
622
420
  Arg* arg_ = nullptr;
623
421
  };
624
422
 
625
- template<>
626
- class To_Ruby<signed char*>
627
- {
628
- public:
629
- To_Ruby() = default;
630
-
631
- explicit To_Ruby(Arg* arg) : arg_(arg)
632
- {
633
- }
634
-
635
- VALUE convert(signed char* data)
636
- {
637
- Buffer<signed char> buffer(data);
638
- Data_Object<Buffer<signed char>> dataObject(std::move(buffer));
639
- return dataObject.value();
640
- }
641
-
642
- VALUE convert(const signed char* data)
643
- {
644
- return this->convert((signed char*)data);
645
- }
646
-
647
- private:
648
- Arg* arg_ = nullptr;
649
- };
650
-
651
423
  template<int N>
652
424
  class To_Ruby<signed char[N]>
653
425
  {
@@ -668,32 +440,6 @@ namespace Rice
668
440
  Arg* arg_ = nullptr;
669
441
  };
670
442
 
671
- template<>
672
- class To_Ruby<signed char**>
673
- {
674
- public:
675
- To_Ruby() = default;
676
-
677
- explicit To_Ruby(Arg* arg) : arg_(arg)
678
- {
679
- }
680
-
681
- VALUE convert(signed char** data)
682
- {
683
- Buffer<signed char*> buffer(data);
684
- Data_Object<Buffer<signed char*>> dataObject(std::move(buffer));
685
- return dataObject.value();
686
- }
687
-
688
- VALUE convert(const signed char** data)
689
- {
690
- return this->convert((signed char**)data);
691
- }
692
-
693
- private:
694
- Arg* arg_ = nullptr;
695
- };
696
-
697
443
  // =========== double ============
698
444
  template<>
699
445
  class To_Ruby<double>
@@ -733,27 +479,6 @@ namespace Rice
733
479
  Arg* arg_ = nullptr;
734
480
  };
735
481
 
736
- template<>
737
- class To_Ruby<double*>
738
- {
739
- public:
740
- To_Ruby() = default;
741
-
742
- explicit To_Ruby(Arg* arg) : arg_(arg)
743
- {
744
- }
745
-
746
- VALUE convert(double* data)
747
- {
748
- Buffer<double> buffer(data);
749
- Data_Object<Buffer<double>> dataObject(std::move(buffer));
750
- return dataObject.value();
751
- }
752
-
753
- private:
754
- Arg* arg_ = nullptr;
755
- };
756
-
757
482
  template<int N>
758
483
  class To_Ruby<double[N]>
759
484
  {
@@ -774,32 +499,6 @@ namespace Rice
774
499
  Arg* arg_ = nullptr;
775
500
  };
776
501
 
777
- template<>
778
- class To_Ruby<double**>
779
- {
780
- public:
781
- To_Ruby() = default;
782
-
783
- explicit To_Ruby(Arg* arg) : arg_(arg)
784
- {
785
- }
786
-
787
- VALUE convert(double** data)
788
- {
789
- Buffer<double*> buffer(data);
790
- Data_Object<Buffer<double*>> dataObject(std::move(buffer));
791
- return dataObject.value();
792
- }
793
-
794
- VALUE convert(const double** data)
795
- {
796
- return this->convert((double**)data);
797
- }
798
-
799
- private:
800
- Arg* arg_ = nullptr;
801
- };
802
-
803
502
  // =========== float ============
804
503
  template<>
805
504
  class To_Ruby<float>
@@ -839,27 +538,6 @@ namespace Rice
839
538
  Arg* arg_ = nullptr;
840
539
  };
841
540
 
842
- template<>
843
- class To_Ruby<float*>
844
- {
845
- public:
846
- To_Ruby() = default;
847
-
848
- explicit To_Ruby(Arg* arg) : arg_(arg)
849
- {
850
- }
851
-
852
- VALUE convert(float* data)
853
- {
854
- Buffer<float> buffer(data);
855
- Data_Object<Buffer<float>> dataObject(std::move(buffer));
856
- return dataObject.value();
857
- }
858
-
859
- private:
860
- Arg* arg_ = nullptr;
861
- };
862
-
863
541
  template<int N>
864
542
  class To_Ruby<float[N]>
865
543
  {
@@ -880,32 +558,6 @@ namespace Rice
880
558
  Arg* arg_ = nullptr;
881
559
  };
882
560
 
883
- template<>
884
- class To_Ruby<float**>
885
- {
886
- public:
887
- To_Ruby() = default;
888
-
889
- explicit To_Ruby(Arg* arg) : arg_(arg)
890
- {
891
- }
892
-
893
- VALUE convert(float** data)
894
- {
895
- Buffer<float*> buffer(data);
896
- Data_Object<Buffer<float*>> dataObject(std::move(buffer));
897
- return dataObject.value();
898
- }
899
-
900
- VALUE convert(const float** data)
901
- {
902
- return this->convert((float**)data);
903
- }
904
-
905
- private:
906
- Arg* arg_ = nullptr;
907
- };
908
-
909
561
  // =========== long ============
910
562
  template<>
911
563
  class To_Ruby<long>
@@ -945,27 +597,6 @@ namespace Rice
945
597
  Arg* arg_ = nullptr;
946
598
  };
947
599
 
948
- template<>
949
- class To_Ruby<long*>
950
- {
951
- public:
952
- To_Ruby() = default;
953
-
954
- explicit To_Ruby(Arg* arg) : arg_(arg)
955
- {
956
- }
957
-
958
- VALUE convert(long* data)
959
- {
960
- Buffer<long> buffer(data);
961
- Data_Object<Buffer<long>> dataObject(std::move(buffer));
962
- return dataObject.value();
963
- }
964
-
965
- private:
966
- Arg* arg_ = nullptr;
967
- };
968
-
969
600
  template<int N>
970
601
  class To_Ruby<long[N]>
971
602
  {
@@ -986,32 +617,6 @@ namespace Rice
986
617
  Arg* arg_ = nullptr;
987
618
  };
988
619
 
989
- template<>
990
- class To_Ruby<long**>
991
- {
992
- public:
993
- To_Ruby() = default;
994
-
995
- explicit To_Ruby(Arg* arg) : arg_(arg)
996
- {
997
- }
998
-
999
- VALUE convert(long** data)
1000
- {
1001
- Buffer<long*> buffer(data);
1002
- Data_Object<Buffer<long*>> dataObject(std::move(buffer));
1003
- return dataObject.value();
1004
- }
1005
-
1006
- VALUE convert(const long** data)
1007
- {
1008
- return this->convert((long**)data);
1009
- }
1010
-
1011
- private:
1012
- Arg* arg_ = nullptr;
1013
- };
1014
-
1015
620
  // =========== unsigned long ============
1016
621
  template<>
1017
622
  class To_Ruby<unsigned long>
@@ -1065,27 +670,6 @@ namespace Rice
1065
670
  Arg* arg_ = nullptr;
1066
671
  };
1067
672
 
1068
- template<>
1069
- class To_Ruby<unsigned long*>
1070
- {
1071
- public:
1072
- To_Ruby() = default;
1073
-
1074
- explicit To_Ruby(Arg* arg) : arg_(arg)
1075
- {
1076
- }
1077
-
1078
- VALUE convert(unsigned long* data)
1079
- {
1080
- Buffer<unsigned long> buffer(data);
1081
- Data_Object<Buffer<unsigned long>> dataObject(std::move(buffer));
1082
- return dataObject.value();
1083
- }
1084
-
1085
- private:
1086
- Arg* arg_ = nullptr;
1087
- };
1088
-
1089
673
  template<int N>
1090
674
  class To_Ruby<unsigned long[N]>
1091
675
  {
@@ -1106,32 +690,6 @@ namespace Rice
1106
690
  Arg* arg_ = nullptr;
1107
691
  };
1108
692
 
1109
- template<>
1110
- class To_Ruby<unsigned long**>
1111
- {
1112
- public:
1113
- To_Ruby() = default;
1114
-
1115
- explicit To_Ruby(Arg* arg) : arg_(arg)
1116
- {
1117
- }
1118
-
1119
- VALUE convert(unsigned long** data)
1120
- {
1121
- Buffer<unsigned long*> buffer(data);
1122
- Data_Object<Buffer<unsigned long*>> dataObject(std::move(buffer));
1123
- return dataObject.value();
1124
- }
1125
-
1126
- VALUE convert(const unsigned long** data)
1127
- {
1128
- return this->convert((unsigned long**)data);
1129
- }
1130
-
1131
- private:
1132
- Arg* arg_ = nullptr;
1133
- };
1134
-
1135
693
  // =========== long long ============
1136
694
  template<>
1137
695
  class To_Ruby<long long>
@@ -1171,27 +729,6 @@ namespace Rice
1171
729
  Arg* arg_ = nullptr;
1172
730
  };
1173
731
 
1174
- template<>
1175
- class To_Ruby<long long*>
1176
- {
1177
- public:
1178
- To_Ruby() = default;
1179
-
1180
- explicit To_Ruby(Arg* arg) : arg_(arg)
1181
- {
1182
- }
1183
-
1184
- VALUE convert(long long* data)
1185
- {
1186
- Buffer<long long> buffer(data);
1187
- Data_Object<Buffer<long long>> dataObject(std::move(buffer));
1188
- return dataObject.value();
1189
- }
1190
-
1191
- private:
1192
- Arg* arg_ = nullptr;
1193
- };
1194
-
1195
732
  template<int N>
1196
733
  class To_Ruby<long long[N]>
1197
734
  {
@@ -1212,32 +749,6 @@ namespace Rice
1212
749
  Arg* arg_ = nullptr;
1213
750
  };
1214
751
 
1215
- template<>
1216
- class To_Ruby<long long**>
1217
- {
1218
- public:
1219
- To_Ruby() = default;
1220
-
1221
- explicit To_Ruby(Arg* arg) : arg_(arg)
1222
- {
1223
- }
1224
-
1225
- VALUE convert(long long** data)
1226
- {
1227
- Buffer<long long*> buffer(data);
1228
- Data_Object<Buffer<long long*>> dataObject(std::move(buffer));
1229
- return dataObject.value();
1230
- }
1231
-
1232
- VALUE convert(const long long** data)
1233
- {
1234
- return this->convert((long long**)data);
1235
- }
1236
-
1237
- private:
1238
- Arg* arg_ = nullptr;
1239
- };
1240
-
1241
752
  // =========== unsigned long long ============
1242
753
  template<>
1243
754
  class To_Ruby<unsigned long long>
@@ -1302,27 +813,6 @@ namespace Rice
1302
813
  Arg* arg_ = nullptr;
1303
814
  };
1304
815
 
1305
- template<>
1306
- class To_Ruby<unsigned long long*>
1307
- {
1308
- public:
1309
- To_Ruby() = default;
1310
-
1311
- explicit To_Ruby(Arg* arg) : arg_(arg)
1312
- {
1313
- }
1314
-
1315
- VALUE convert(unsigned long long* data)
1316
- {
1317
- Buffer<unsigned long long> buffer(data);
1318
- Data_Object<Buffer<unsigned long long>> dataObject(std::move(buffer));
1319
- return dataObject.value();
1320
- }
1321
-
1322
- private:
1323
- Arg* arg_ = nullptr;
1324
- };
1325
-
1326
816
  template<int N>
1327
817
  class To_Ruby<unsigned long long[N]>
1328
818
  {
@@ -1343,32 +833,6 @@ namespace Rice
1343
833
  Arg* arg_ = nullptr;
1344
834
  };
1345
835
 
1346
- template<>
1347
- class To_Ruby<unsigned long long**>
1348
- {
1349
- public:
1350
- To_Ruby() = default;
1351
-
1352
- explicit To_Ruby(Arg* arg) : arg_(arg)
1353
- {
1354
- }
1355
-
1356
- VALUE convert(unsigned long long** data)
1357
- {
1358
- Buffer<unsigned long long*> buffer(data);
1359
- Data_Object<Buffer<unsigned long long*>> dataObject(std::move(buffer));
1360
- return dataObject.value();
1361
- }
1362
-
1363
- VALUE convert(const unsigned long long** data)
1364
- {
1365
- return this->convert((unsigned long long**)data);
1366
- }
1367
-
1368
- private:
1369
- Arg* arg_ = nullptr;
1370
- };
1371
-
1372
836
  // =========== short ============
1373
837
  template<>
1374
838
  class To_Ruby<short>
@@ -1416,27 +880,6 @@ namespace Rice
1416
880
  Arg* arg_ = nullptr;
1417
881
  };
1418
882
 
1419
- template<>
1420
- class To_Ruby<short*>
1421
- {
1422
- public:
1423
- To_Ruby() = default;
1424
-
1425
- explicit To_Ruby(Arg* arg) : arg_(arg)
1426
- {
1427
- }
1428
-
1429
- VALUE convert(short* data)
1430
- {
1431
- Buffer<short> buffer(data);
1432
- Data_Object<Buffer<short>> dataObject(std::move(buffer));
1433
- return dataObject.value();
1434
- }
1435
-
1436
- private:
1437
- Arg* arg_ = nullptr;
1438
- };
1439
-
1440
883
  template<int N>
1441
884
  class To_Ruby<short[N]>
1442
885
  {
@@ -1457,32 +900,6 @@ namespace Rice
1457
900
  Arg* arg_ = nullptr;
1458
901
  };
1459
902
 
1460
- template<>
1461
- class To_Ruby<short**>
1462
- {
1463
- public:
1464
- To_Ruby() = default;
1465
-
1466
- explicit To_Ruby(Arg* arg) : arg_(arg)
1467
- {
1468
- }
1469
-
1470
- VALUE convert(short** data)
1471
- {
1472
- Buffer<short*> buffer(data);
1473
- Data_Object<Buffer<short*>> dataObject(std::move(buffer));
1474
- return dataObject.value();
1475
- }
1476
-
1477
- VALUE convert(const short** data)
1478
- {
1479
- return this->convert((short**)data);
1480
- }
1481
-
1482
- private:
1483
- Arg* arg_ = nullptr;
1484
- };
1485
-
1486
903
  // =========== unsigned short ============
1487
904
  template<>
1488
905
  class To_Ruby<unsigned short>
@@ -1530,27 +947,6 @@ namespace Rice
1530
947
  Arg* arg_ = nullptr;
1531
948
  };
1532
949
 
1533
- template<>
1534
- class To_Ruby<unsigned short*>
1535
- {
1536
- public:
1537
- To_Ruby() = default;
1538
-
1539
- explicit To_Ruby(Arg* arg) : arg_(arg)
1540
- {
1541
- }
1542
-
1543
- VALUE convert(unsigned short* data)
1544
- {
1545
- Buffer<unsigned short> buffer(data);
1546
- Data_Object<Buffer<unsigned short>> dataObject(std::move(buffer));
1547
- return dataObject.value();
1548
- }
1549
-
1550
- private:
1551
- Arg* arg_ = nullptr;
1552
- };
1553
-
1554
950
  template<int N>
1555
951
  class To_Ruby<unsigned short[N]>
1556
952
  {
@@ -1571,32 +967,6 @@ namespace Rice
1571
967
  Arg* arg_ = nullptr;
1572
968
  };
1573
969
 
1574
- template<>
1575
- class To_Ruby<unsigned short**>
1576
- {
1577
- public:
1578
- To_Ruby() = default;
1579
-
1580
- explicit To_Ruby(Arg* arg) : arg_(arg)
1581
- {
1582
- }
1583
-
1584
- VALUE convert(unsigned short** data)
1585
- {
1586
- Buffer<unsigned short*> buffer(data);
1587
- Data_Object<Buffer<unsigned short*>> dataObject(std::move(buffer));
1588
- return dataObject.value();
1589
- }
1590
-
1591
- VALUE convert(const unsigned short** data)
1592
- {
1593
- return this->convert((unsigned short**)data);
1594
- }
1595
-
1596
- private:
1597
- Arg* arg_ = nullptr;
1598
- };
1599
-
1600
970
  // =========== std::nullptr_t ============
1601
971
  template<>
1602
972
  class To_Ruby<std::nullptr_t>
@@ -1660,9 +1030,8 @@ namespace Rice
1660
1030
  }
1661
1031
  else
1662
1032
  {
1663
- Buffer<void> buffer(data);
1664
- Data_Object<Buffer<void>> dataObject(std::move(buffer));
1665
- return dataObject.value();
1033
+ bool isOwner = this->arg_ && this->arg_->isOwner();
1034
+ return detail::wrap(Data_Type<Pointer<void>>::klass(), Data_Type<Pointer<void>>::ruby_data_type(), data, isOwner);
1666
1035
  }
1667
1036
  }
1668
1037