rice 4.7.1 → 4.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/CMakeLists.txt +14 -22
- data/CMakePresets.json +203 -75
- data/FindRuby.cmake +358 -123
- data/bin/rice-doc.rb +56 -141
- data/include/rice/api.hpp +248 -0
- data/include/rice/rice.hpp +2237 -1657
- data/include/rice/stl.hpp +346 -443
- data/lib/rice/doc/config.rb +70 -0
- data/lib/rice/doc/cpp_reference.rb +1 -4
- data/lib/rice/doc/mkdocs.rb +58 -20
- data/lib/rice/doc/rice.rb +20 -0
- data/lib/rice/doc.rb +1 -0
- data/lib/rice/make_rice_headers.rb +7 -0
- data/lib/rice/native_registry.rb +2 -2
- data/lib/rice/rbs.rb +2 -2
- data/lib/rice/version.rb +1 -1
- data/lib/rubygems_plugin.rb +12 -9
- data/rice/Arg.hpp +12 -6
- data/rice/Arg.ipp +14 -7
- data/rice/Buffer.ipp +44 -40
- data/rice/Callback.hpp +1 -1
- data/rice/Callback.ipp +2 -7
- data/rice/Constructor.hpp +1 -1
- data/rice/Constructor.ipp +11 -11
- data/rice/Data_Object.ipp +15 -15
- data/rice/Data_Type.hpp +9 -10
- data/rice/Data_Type.ipp +22 -25
- data/rice/Director.hpp +1 -0
- data/rice/Enum.ipp +58 -39
- data/rice/Exception.hpp +4 -4
- data/rice/Exception.ipp +7 -7
- data/rice/NoGVL.hpp +13 -0
- data/rice/Reference.hpp +56 -0
- data/rice/Reference.ipp +96 -0
- data/rice/Return.hpp +4 -1
- data/rice/Return.ipp +0 -6
- data/rice/cpp_api/Array.hpp +41 -4
- data/rice/cpp_api/Array.ipp +105 -9
- data/rice/cpp_api/Class.hpp +2 -2
- data/rice/cpp_api/Class.ipp +4 -4
- data/rice/cpp_api/Hash.ipp +7 -4
- data/rice/cpp_api/Module.hpp +4 -4
- data/rice/cpp_api/Module.ipp +12 -10
- data/rice/cpp_api/Object.hpp +4 -4
- data/rice/cpp_api/Object.ipp +15 -12
- data/rice/cpp_api/String.hpp +2 -2
- data/rice/cpp_api/String.ipp +11 -8
- data/rice/cpp_api/Symbol.ipp +7 -7
- data/rice/cpp_api/shared_methods.hpp +5 -9
- data/rice/detail/InstanceRegistry.hpp +0 -2
- data/rice/detail/Native.hpp +31 -21
- data/rice/detail/Native.ipp +282 -130
- data/rice/detail/NativeAttributeGet.hpp +5 -7
- data/rice/detail/NativeAttributeGet.ipp +26 -26
- data/rice/detail/NativeAttributeSet.hpp +2 -4
- data/rice/detail/NativeAttributeSet.ipp +20 -16
- data/rice/detail/NativeCallback.hpp +77 -0
- data/rice/detail/NativeCallback.ipp +280 -0
- data/rice/detail/NativeFunction.hpp +11 -21
- data/rice/detail/NativeFunction.ipp +58 -119
- data/rice/detail/NativeInvoker.hpp +4 -4
- data/rice/detail/NativeInvoker.ipp +7 -7
- data/rice/detail/NativeIterator.hpp +2 -4
- data/rice/detail/NativeIterator.ipp +18 -14
- data/rice/detail/NativeMethod.hpp +10 -20
- data/rice/detail/NativeMethod.ipp +54 -114
- data/rice/detail/NativeProc.hpp +5 -7
- data/rice/detail/NativeProc.ipp +39 -28
- data/rice/detail/NativeRegistry.hpp +0 -1
- data/rice/detail/Parameter.hpp +15 -8
- data/rice/detail/Parameter.ipp +102 -43
- data/rice/detail/Proc.ipp +14 -28
- data/rice/detail/RubyType.ipp +2 -53
- data/rice/detail/Type.hpp +23 -7
- data/rice/detail/Type.ipp +73 -93
- data/rice/detail/TypeRegistry.ipp +5 -4
- data/rice/detail/Wrapper.hpp +1 -1
- data/rice/detail/Wrapper.ipp +18 -10
- data/rice/detail/from_ruby.hpp +8 -6
- data/rice/detail/from_ruby.ipp +306 -173
- data/rice/detail/ruby.hpp +23 -0
- data/rice/libc/file.hpp +4 -4
- data/rice/rice.hpp +6 -8
- data/rice/rice_api/Native.ipp +5 -1
- data/rice/rice_api/Parameter.ipp +1 -1
- data/rice/ruby_mark.hpp +2 -1
- data/rice/stl/complex.ipp +12 -8
- data/rice/stl/map.ipp +27 -22
- data/rice/stl/monostate.ipp +16 -12
- data/rice/stl/multimap.hpp +0 -2
- data/rice/stl/multimap.ipp +27 -22
- data/rice/stl/optional.ipp +27 -11
- data/rice/stl/pair.ipp +5 -5
- data/rice/stl/reference_wrapper.ipp +5 -4
- data/rice/stl/set.ipp +16 -16
- data/rice/stl/shared_ptr.hpp +0 -16
- data/rice/stl/shared_ptr.ipp +34 -190
- data/rice/stl/string.ipp +18 -18
- data/rice/stl/string_view.ipp +1 -1
- data/rice/stl/tuple.ipp +15 -36
- data/rice/stl/unique_ptr.ipp +18 -8
- data/rice/stl/unordered_map.ipp +20 -15
- data/rice/stl/variant.ipp +37 -21
- data/rice/stl/vector.ipp +41 -36
- data/rice/traits/function_traits.hpp +19 -19
- data/rice/traits/method_traits.hpp +4 -4
- data/rice/traits/rice_traits.hpp +162 -39
- data/rice.gemspec +1 -3
- data/test/test_Array.cpp +261 -3
- data/test/test_Attribute.cpp +6 -3
- data/test/test_Buffer.cpp +6 -42
- data/test/test_Callback.cpp +77 -23
- data/test/test_Data_Object.cpp +1 -1
- data/test/test_Data_Type.cpp +21 -22
- data/test/test_Director.cpp +2 -4
- data/test/test_Enum.cpp +34 -5
- data/test/test_File.cpp +9 -5
- data/test/test_From_Ruby.cpp +4 -3
- data/test/test_GVL.cpp +3 -3
- data/test/test_Hash.cpp +1 -1
- data/test/test_Iterator.cpp +54 -22
- data/test/test_Keep_Alive.cpp +1 -1
- data/test/test_Keep_Alive_No_Wrapper.cpp +1 -1
- data/test/test_Module.cpp +5 -5
- data/test/test_Overloads.cpp +345 -48
- data/test/test_Proc.cpp +54 -0
- data/test/test_Reference.cpp +181 -0
- data/test/test_Self.cpp +2 -2
- data/test/test_Stl_Set.cpp +6 -6
- data/test/test_Stl_SharedPtr.cpp +54 -30
- data/test/test_Stl_String_View.cpp +4 -2
- data/test/test_Stl_Tuple.cpp +1 -1
- data/test/test_Stl_Variant.cpp +6 -14
- data/test/test_Stl_Vector.cpp +61 -30
- data/test/test_String.cpp +4 -2
- data/test/test_Struct.cpp +1 -1
- data/test/test_Symbol.cpp +1 -1
- data/test/test_To_Ruby.cpp +1 -0
- data/test/test_Type.cpp +36 -35
- data/test/test_global_functions.cpp +1 -1
- data/test/unittest.cpp +1 -1
- data/test/unittest.hpp +5 -5
- metadata +10 -10
- data/rice/Function.hpp +0 -17
- data/rice/Function.ipp +0 -13
- data/rice/detail/MethodInfo.hpp +0 -48
- data/rice/detail/MethodInfo.ipp +0 -99
- data/rice/detail/NativeCallbackFFI.hpp +0 -55
- data/rice/detail/NativeCallbackFFI.ipp +0 -152
- data/rice/detail/NativeCallbackSimple.hpp +0 -30
- data/rice/detail/NativeCallbackSimple.ipp +0 -29
data/test/test_Stl_Vector.cpp
CHANGED
|
@@ -18,7 +18,7 @@ TEARDOWN(Vector)
|
|
|
18
18
|
{
|
|
19
19
|
rb_gc_start();
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
namespace
|
|
23
23
|
{
|
|
24
24
|
class MyClass
|
|
@@ -65,7 +65,7 @@ TESTCASE(StringVector)
|
|
|
65
65
|
result = vec.call("last");
|
|
66
66
|
ASSERT_EQUAL("four", detail::From_Ruby<std::string>().convert(result));
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
TESTCASE(StringVectorData)
|
|
70
70
|
{
|
|
71
71
|
Module m = define_module("Testing");
|
|
@@ -282,24 +282,24 @@ TESTCASE(Slice)
|
|
|
282
282
|
|
|
283
283
|
Array result = vec.call("[]", 3, 1);
|
|
284
284
|
std::vector<std::int32_t> slice = result.to_vector<int32_t>();
|
|
285
|
-
ASSERT_EQUAL(
|
|
285
|
+
ASSERT_EQUAL(1u, slice.size());
|
|
286
286
|
ASSERT_EQUAL(10, slice[0]);
|
|
287
287
|
|
|
288
288
|
result = vec.call("[]", 3, 2);
|
|
289
289
|
slice = result.to_vector<int32_t>();
|
|
290
|
-
ASSERT_EQUAL(
|
|
290
|
+
ASSERT_EQUAL(2u, slice.size());
|
|
291
291
|
ASSERT_EQUAL(10, slice[0]);
|
|
292
292
|
ASSERT_EQUAL(11, slice[1]);
|
|
293
293
|
|
|
294
294
|
result = vec.call("[]", 4, 10);
|
|
295
295
|
slice = result.to_vector<int32_t>();
|
|
296
|
-
ASSERT_EQUAL(
|
|
296
|
+
ASSERT_EQUAL(2u, slice.size());
|
|
297
297
|
ASSERT_EQUAL(11, slice[0]);
|
|
298
298
|
ASSERT_EQUAL(12, slice[1]);
|
|
299
299
|
|
|
300
300
|
result = vec.call("[]", -1, 2);
|
|
301
301
|
slice = result.to_vector<int32_t>();
|
|
302
|
-
ASSERT_EQUAL(
|
|
302
|
+
ASSERT_EQUAL(1u, slice.size());
|
|
303
303
|
ASSERT_EQUAL(12, slice[0]);
|
|
304
304
|
}
|
|
305
305
|
|
|
@@ -528,7 +528,7 @@ TESTCASE(NotDefaultConstructable)
|
|
|
528
528
|
ASSERT_EQUAL(Qnil, result.value());
|
|
529
529
|
|
|
530
530
|
result = vec.call("length");
|
|
531
|
-
ASSERT_EQUAL(
|
|
531
|
+
ASSERT_EQUAL(0u, detail::From_Ruby<size_t>().convert(result));
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
TESTCASE(NotPrintable)
|
|
@@ -591,16 +591,47 @@ TESTCASE(Comparable)
|
|
|
591
591
|
|
|
592
592
|
Object result = vec.call("delete", Comparable(1));
|
|
593
593
|
Comparable comparable = detail::From_Ruby<Comparable>().convert(result);
|
|
594
|
-
ASSERT_EQUAL(
|
|
594
|
+
ASSERT_EQUAL(1u, comparable.value_);
|
|
595
595
|
|
|
596
596
|
result = vec.call("length");
|
|
597
|
-
ASSERT_EQUAL(
|
|
597
|
+
ASSERT_EQUAL(2u, detail::From_Ruby<size_t>().convert(result));
|
|
598
598
|
|
|
599
599
|
result = vec.call("include?", Comparable(2));
|
|
600
600
|
ASSERT_EQUAL(Qtrue, result.value());
|
|
601
601
|
|
|
602
602
|
result = vec.call("index", Comparable(3));
|
|
603
|
-
ASSERT_EQUAL(
|
|
603
|
+
ASSERT_EQUAL(1u, detail::From_Ruby<size_t>().convert(result.value()));
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
TESTCASE(ComparableEqual)
|
|
607
|
+
{
|
|
608
|
+
define_class<Comparable>("IsComparable").
|
|
609
|
+
define_constructor(Constructor<Comparable, uint32_t>());
|
|
610
|
+
|
|
611
|
+
Comparable comparable1a(1);
|
|
612
|
+
Comparable comparable1b(1);
|
|
613
|
+
Comparable comparable2(2);
|
|
614
|
+
|
|
615
|
+
Class c = define_vector<Comparable>("ComparableVector");
|
|
616
|
+
|
|
617
|
+
Object vec1 = c.call("new");
|
|
618
|
+
Object vec2 = c.call("new");
|
|
619
|
+
Object vec3 = c.call("new");
|
|
620
|
+
|
|
621
|
+
Object result = vec1.call("eql?", vec2);
|
|
622
|
+
ASSERT_EQUAL(Qtrue, result.value());
|
|
623
|
+
|
|
624
|
+
vec1.call("push", comparable1a);
|
|
625
|
+
result = vec1.call("==", vec2);
|
|
626
|
+
ASSERT_EQUAL(Qfalse, result.value());
|
|
627
|
+
|
|
628
|
+
vec2.call("push", comparable1b);
|
|
629
|
+
result = vec1.call("==", vec2);
|
|
630
|
+
ASSERT_EQUAL(Qtrue, result.value());
|
|
631
|
+
|
|
632
|
+
vec3.call("push", comparable2);
|
|
633
|
+
result = vec1.call("==", vec3);
|
|
634
|
+
ASSERT_EQUAL(Qfalse, result.value());
|
|
604
635
|
}
|
|
605
636
|
|
|
606
637
|
namespace
|
|
@@ -612,7 +643,7 @@ namespace
|
|
|
612
643
|
{
|
|
613
644
|
};
|
|
614
645
|
|
|
615
|
-
std::string operator==(const ComparableButNotBool&
|
|
646
|
+
std::string operator==(const ComparableButNotBool&)
|
|
616
647
|
{
|
|
617
648
|
return "not a boolean";
|
|
618
649
|
}
|
|
@@ -658,7 +689,7 @@ TESTCASE(DefaultConstructable)
|
|
|
658
689
|
ASSERT_EQUAL(Qnil, result.value());
|
|
659
690
|
|
|
660
691
|
result = vec.call("length");
|
|
661
|
-
ASSERT_EQUAL(
|
|
692
|
+
ASSERT_EQUAL(0u, detail::From_Ruby<size_t>().convert(result));
|
|
662
693
|
}
|
|
663
694
|
|
|
664
695
|
TESTCASE(Printable)
|
|
@@ -798,7 +829,7 @@ TESTCASE(ToArray)
|
|
|
798
829
|
vector.to_a)";
|
|
799
830
|
|
|
800
831
|
Array array = m.module_eval(code);
|
|
801
|
-
ASSERT_EQUAL(
|
|
832
|
+
ASSERT_EQUAL(3, array.size());
|
|
802
833
|
|
|
803
834
|
ASSERT_EQUAL("abc", detail::From_Ruby<std::string>().convert(array[0].value()));
|
|
804
835
|
ASSERT_EQUAL("def", detail::From_Ruby<std::string>().convert(array[1].value()));
|
|
@@ -842,17 +873,17 @@ TESTCASE(ArrayToVector)
|
|
|
842
873
|
std::string code = "array_to_vector([7, 9, 1_000_000], [49.0, 78.0, 999.0], %w[one two three])";
|
|
843
874
|
m.module_eval(code);
|
|
844
875
|
|
|
845
|
-
ASSERT_EQUAL(
|
|
876
|
+
ASSERT_EQUAL(3u, ints.size());
|
|
846
877
|
ASSERT_EQUAL(7, ints[0]);
|
|
847
878
|
ASSERT_EQUAL(9, ints[1]);
|
|
848
879
|
ASSERT_EQUAL(1'000'000, ints[2]);
|
|
849
880
|
|
|
850
|
-
ASSERT_EQUAL(
|
|
881
|
+
ASSERT_EQUAL(3u, floats.size());
|
|
851
882
|
ASSERT_EQUAL(49.0, floats[0]);
|
|
852
883
|
ASSERT_EQUAL(78.0, floats[1]);
|
|
853
884
|
ASSERT_EQUAL(999.0, floats[2]);
|
|
854
885
|
|
|
855
|
-
ASSERT_EQUAL(
|
|
886
|
+
ASSERT_EQUAL(3u, strings.size());
|
|
856
887
|
ASSERT_EQUAL("one", strings[0]);
|
|
857
888
|
ASSERT_EQUAL("two", strings[1]);
|
|
858
889
|
ASSERT_EQUAL("three", strings[2]);
|
|
@@ -867,17 +898,17 @@ TESTCASE(ArrayToVectorRefs)
|
|
|
867
898
|
std::string code = "array_to_vector_refs([8, 10, 1_000_001], [50.0, 79.0, 1_000.0], %w[eleven twelve thirteen])";
|
|
868
899
|
m.module_eval(code);
|
|
869
900
|
|
|
870
|
-
ASSERT_EQUAL(
|
|
901
|
+
ASSERT_EQUAL(3u, ints.size());
|
|
871
902
|
ASSERT_EQUAL(8, ints[0]);
|
|
872
903
|
ASSERT_EQUAL(10, ints[1]);
|
|
873
904
|
ASSERT_EQUAL(1'000'001, ints[2]);
|
|
874
905
|
|
|
875
|
-
ASSERT_EQUAL(
|
|
906
|
+
ASSERT_EQUAL(3u, floats.size());
|
|
876
907
|
ASSERT_EQUAL(50.0, floats[0]);
|
|
877
908
|
ASSERT_EQUAL(79.0, floats[1]);
|
|
878
909
|
ASSERT_EQUAL(1'000.0, floats[2]);
|
|
879
910
|
|
|
880
|
-
ASSERT_EQUAL(
|
|
911
|
+
ASSERT_EQUAL(3u, strings.size());
|
|
881
912
|
ASSERT_EQUAL("eleven", strings[0]);
|
|
882
913
|
ASSERT_EQUAL("twelve", strings[1]);
|
|
883
914
|
ASSERT_EQUAL("thirteen", strings[2]);
|
|
@@ -892,17 +923,17 @@ TESTCASE(ArrayToVectorPointers)
|
|
|
892
923
|
std::string code = "array_to_vector_pointers([9, 11, 1_000_002], [51.0, 80.0, 1_001.0], %w[fourteen fifteen sixteen])";
|
|
893
924
|
m.module_eval(code);
|
|
894
925
|
|
|
895
|
-
ASSERT_EQUAL(
|
|
926
|
+
ASSERT_EQUAL(3u, ints.size());
|
|
896
927
|
ASSERT_EQUAL(9, ints[0]);
|
|
897
928
|
ASSERT_EQUAL(11, ints[1]);
|
|
898
929
|
ASSERT_EQUAL(1'000'002, ints[2]);
|
|
899
930
|
|
|
900
|
-
ASSERT_EQUAL(
|
|
931
|
+
ASSERT_EQUAL(3u, floats.size());
|
|
901
932
|
ASSERT_EQUAL(51.0, floats[0]);
|
|
902
933
|
ASSERT_EQUAL(80.0, floats[1]);
|
|
903
934
|
ASSERT_EQUAL(1'001.0, floats[2]);
|
|
904
935
|
|
|
905
|
-
ASSERT_EQUAL(
|
|
936
|
+
ASSERT_EQUAL(3u, strings.size());
|
|
906
937
|
ASSERT_EQUAL("fourteen", strings[0]);
|
|
907
938
|
ASSERT_EQUAL("fifteen", strings[1]);
|
|
908
939
|
ASSERT_EQUAL("sixteen", strings[2]);
|
|
@@ -962,11 +993,11 @@ namespace
|
|
|
962
993
|
static inline std::vector<std::string> instance_{ "one", "two", "three" };
|
|
963
994
|
};
|
|
964
995
|
|
|
965
|
-
|
|
996
|
+
/* std::ostream& operator<<(std::ostream& stream, const std::vector<std::string>& vector)
|
|
966
997
|
{
|
|
967
|
-
stream <<
|
|
998
|
+
stream << vector;
|
|
968
999
|
return stream;
|
|
969
|
-
}
|
|
1000
|
+
}*/
|
|
970
1001
|
|
|
971
1002
|
void createFactoryClass()
|
|
972
1003
|
{
|
|
@@ -1104,7 +1135,7 @@ TESTCASE(StringPointerVector)
|
|
|
1104
1135
|
|
|
1105
1136
|
Module m(rb_mKernel);
|
|
1106
1137
|
Data_Object<std::vector<std::string*>> vec = m.call("vector_of_string_pointers");
|
|
1107
|
-
ASSERT_EQUAL(
|
|
1138
|
+
ASSERT_EQUAL(2u, vec->size());
|
|
1108
1139
|
|
|
1109
1140
|
std::string expected("Hello");
|
|
1110
1141
|
std::string* actual = (*vec)[0];
|
|
@@ -1149,7 +1180,7 @@ TESTCASE(MyClass2PointerVector)
|
|
|
1149
1180
|
|
|
1150
1181
|
Module m(rb_mKernel);
|
|
1151
1182
|
Data_Object<std::vector<MyClass2*>> result = m.call("vector_of_myclass2_pointers");
|
|
1152
|
-
ASSERT_EQUAL(
|
|
1183
|
+
ASSERT_EQUAL(1u, result->size());
|
|
1153
1184
|
|
|
1154
1185
|
MyClass2* pMyClass = (*result)[0];
|
|
1155
1186
|
ASSERT_EQUAL("Hello MyClass2", pMyClass->name);
|
|
@@ -1157,17 +1188,17 @@ TESTCASE(MyClass2PointerVector)
|
|
|
1157
1188
|
|
|
1158
1189
|
namespace
|
|
1159
1190
|
{
|
|
1160
|
-
bool typeCheckValue(std::vector<std::string>
|
|
1191
|
+
bool typeCheckValue(std::vector<std::string>)
|
|
1161
1192
|
{
|
|
1162
1193
|
return true;
|
|
1163
1194
|
}
|
|
1164
1195
|
|
|
1165
|
-
bool typeCheckRef(std::vector<std::string>&
|
|
1196
|
+
bool typeCheckRef(std::vector<std::string>&)
|
|
1166
1197
|
{
|
|
1167
1198
|
return true;
|
|
1168
1199
|
}
|
|
1169
1200
|
|
|
1170
|
-
bool typeCheckPtr(std::vector<std::string>*
|
|
1201
|
+
bool typeCheckPtr(std::vector<std::string>*)
|
|
1171
1202
|
{
|
|
1172
1203
|
return true;
|
|
1173
1204
|
}
|
data/test/test_String.cpp
CHANGED
|
@@ -118,10 +118,12 @@ TESTCASE(intern)
|
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
120
|
namespace {
|
|
121
|
-
void testStringArg(Object
|
|
121
|
+
void testStringArg(Object, String)
|
|
122
|
+
{
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
TESTCASE(use_string_in_wrapped_function)
|
|
126
|
+
TESTCASE(use_string_in_wrapped_function)
|
|
127
|
+
{
|
|
126
128
|
define_global_function("test_string_arg", &testStringArg);
|
|
127
129
|
}
|
data/test/test_Struct.cpp
CHANGED
data/test/test_Symbol.cpp
CHANGED
data/test/test_To_Ruby.cpp
CHANGED
data/test/test_Type.cpp
CHANGED
|
@@ -41,83 +41,84 @@ TESTCASE(FindGroup)
|
|
|
41
41
|
{
|
|
42
42
|
std::string name = "class std::vector<class cv::Vec<unsigned char, 2>, class std::allocator<class cv::Vec<unsigned char, 2> > >";
|
|
43
43
|
|
|
44
|
-
detail::
|
|
45
|
-
|
|
44
|
+
detail::TypeIndexParser parser(typeid(int), true);
|
|
45
|
+
|
|
46
|
+
std::string group = parser.findGroup(name, 0);
|
|
46
47
|
ASSERT_EQUAL("<class cv::Vec<unsigned char, 2>, class std::allocator<class cv::Vec<unsigned char, 2> > >", group.c_str());
|
|
47
48
|
|
|
48
|
-
group =
|
|
49
|
+
group = parser.findGroup(name, 18);
|
|
49
50
|
ASSERT_EQUAL("<unsigned char, 2>", group.c_str());
|
|
50
51
|
|
|
51
|
-
group =
|
|
52
|
+
group = parser.findGroup(name, 49);
|
|
52
53
|
ASSERT_EQUAL("<class cv::Vec<unsigned char, 2> >", group.c_str());
|
|
53
54
|
|
|
54
55
|
ASSERT_EXCEPTION_CHECK(
|
|
55
56
|
std::runtime_error,
|
|
56
|
-
|
|
57
|
+
parser.findGroup(name, 48),
|
|
57
58
|
ASSERT_EQUAL("Unbalanced Group", ex.what())
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
TESTCASE(SimplifiedName)
|
|
62
63
|
{
|
|
63
|
-
detail::
|
|
64
|
-
std::string className =
|
|
64
|
+
detail::TypeIndexParser typeIndexParser1(typeid(char*));
|
|
65
|
+
std::string className = typeIndexParser1.simplifiedName();
|
|
65
66
|
ASSERT_EQUAL("char*", className.c_str());
|
|
66
67
|
|
|
67
|
-
detail::
|
|
68
|
-
className =
|
|
68
|
+
detail::TypeIndexParser typeIndexParser2(typeid(char**));
|
|
69
|
+
className = typeIndexParser2.simplifiedName();
|
|
69
70
|
ASSERT_EQUAL("char**", className.c_str());
|
|
70
71
|
|
|
71
|
-
detail::
|
|
72
|
-
className =
|
|
72
|
+
detail::TypeIndexParser typeIndexParser3(typeid(double));
|
|
73
|
+
className = typeIndexParser3.simplifiedName();
|
|
73
74
|
ASSERT_EQUAL("double", className.c_str());
|
|
74
75
|
|
|
75
|
-
detail::
|
|
76
|
-
className =
|
|
76
|
+
detail::TypeIndexParser typeIndexParser4(typeid(double*));
|
|
77
|
+
className = typeIndexParser4.simplifiedName();
|
|
77
78
|
ASSERT_EQUAL("double*", className.c_str());
|
|
78
79
|
|
|
79
|
-
detail::
|
|
80
|
-
className =
|
|
80
|
+
detail::TypeIndexParser typeIndexParser5(typeid(std::string));
|
|
81
|
+
className = typeIndexParser5.simplifiedName();
|
|
81
82
|
ASSERT_EQUAL("std::string", className.c_str());
|
|
82
83
|
|
|
83
|
-
detail::
|
|
84
|
-
className =
|
|
84
|
+
detail::TypeIndexParser typeIndexParser6(typeid(std::wstring));
|
|
85
|
+
className = typeIndexParser6.simplifiedName();
|
|
85
86
|
ASSERT_EQUAL("std::wstring", className.c_str());
|
|
86
87
|
|
|
87
|
-
detail::
|
|
88
|
-
className =
|
|
88
|
+
detail::TypeIndexParser typeIndexParser7(typeid(std::vector<std::string>));
|
|
89
|
+
className = typeIndexParser7.simplifiedName();
|
|
89
90
|
ASSERT_EQUAL("std::vector<std::string>", className.c_str());
|
|
90
91
|
|
|
91
|
-
detail::
|
|
92
|
-
className =
|
|
92
|
+
detail::TypeIndexParser typeIndexParser8(typeid(std::vector<std::wstring>));
|
|
93
|
+
className = typeIndexParser8.simplifiedName();
|
|
93
94
|
ASSERT_EQUAL("std::vector<std::wstring>", className.c_str());
|
|
94
95
|
|
|
95
|
-
detail::
|
|
96
|
-
className =
|
|
96
|
+
detail::TypeIndexParser typeIndexParser9(typeid(std::vector<double*>));
|
|
97
|
+
className = typeIndexParser9.simplifiedName();
|
|
97
98
|
ASSERT_EQUAL("std::vector<double*>", className.c_str());
|
|
98
99
|
|
|
99
|
-
detail::
|
|
100
|
-
className =
|
|
100
|
+
detail::TypeIndexParser typeIndexParser10(typeid(std::vector<double**>));
|
|
101
|
+
className = typeIndexParser10.simplifiedName();
|
|
101
102
|
ASSERT_EQUAL("std::vector<double**>", className.c_str());
|
|
102
103
|
|
|
103
|
-
detail::
|
|
104
|
-
className =
|
|
104
|
+
detail::TypeIndexParser typeIndexParser11(typeid(Outer::Inner::Vec1));
|
|
105
|
+
className = typeIndexParser11.simplifiedName();
|
|
105
106
|
ASSERT_EQUAL("std::vector<std::complex<float>>", className.c_str());
|
|
106
107
|
|
|
107
|
-
detail::
|
|
108
|
-
className =
|
|
108
|
+
detail::TypeIndexParser typeIndexParser12(typeid(Outer::Inner::Vec2));
|
|
109
|
+
className = typeIndexParser12.simplifiedName();
|
|
109
110
|
ASSERT_EQUAL("std::vector<unsigned char*>", className.c_str());
|
|
110
111
|
|
|
111
|
-
detail::
|
|
112
|
-
className =
|
|
112
|
+
detail::TypeIndexParser typeIndexParser13(typeid(Outer::Inner::Vec3));
|
|
113
|
+
className = typeIndexParser13.simplifiedName();
|
|
113
114
|
ASSERT_EQUAL("std::vector<Outer::Inner::SomeClass>", className.c_str());
|
|
114
115
|
|
|
115
|
-
detail::
|
|
116
|
-
className =
|
|
116
|
+
detail::TypeIndexParser typeIndexParser14(typeid(Outer::Inner::Map1));
|
|
117
|
+
className = typeIndexParser14.simplifiedName();
|
|
117
118
|
ASSERT_EQUAL("std::map<std::string, std::vector<std::complex<float>>>", className.c_str());
|
|
118
119
|
|
|
119
|
-
detail::
|
|
120
|
-
className =
|
|
120
|
+
detail::TypeIndexParser typeIndexParser15(typeid(Outer::Inner::UnorderedMap1));
|
|
121
|
+
className = typeIndexParser15.simplifiedName();
|
|
121
122
|
ASSERT_EQUAL("std::unordered_map<std::string, std::complex<float>>", className.c_str());
|
|
122
123
|
}
|
|
123
124
|
|
data/test/unittest.cpp
CHANGED
data/test/unittest.hpp
CHANGED
|
@@ -268,11 +268,11 @@ void assert_in_delta(
|
|
|
268
268
|
T const& expected,
|
|
269
269
|
U const& actual,
|
|
270
270
|
V const& delta,
|
|
271
|
-
std::string const
|
|
272
|
-
std::string const
|
|
273
|
-
std::string const
|
|
274
|
-
std::string const
|
|
275
|
-
size_t
|
|
271
|
+
std::string const&,
|
|
272
|
+
std::string const&,
|
|
273
|
+
std::string const&,
|
|
274
|
+
std::string const&,
|
|
275
|
+
size_t)
|
|
276
276
|
{
|
|
277
277
|
// Negative deltas don't make sense; treat as failure for clarity.
|
|
278
278
|
if (delta < 0)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Brannan
|
|
@@ -79,11 +79,13 @@ files:
|
|
|
79
79
|
- Rakefile
|
|
80
80
|
- bin/rice-doc.rb
|
|
81
81
|
- bin/rice-rbs.rb
|
|
82
|
+
- include/rice/api.hpp
|
|
82
83
|
- include/rice/rice.hpp
|
|
83
84
|
- include/rice/stl.hpp
|
|
84
85
|
- lib/mkmf-rice.rb
|
|
85
86
|
- lib/rice.rb
|
|
86
87
|
- lib/rice/doc.rb
|
|
88
|
+
- lib/rice/doc/config.rb
|
|
87
89
|
- lib/rice/doc/cpp_reference.rb
|
|
88
90
|
- lib/rice/doc/doxygen.rb
|
|
89
91
|
- lib/rice/doc/mkdocs.rb
|
|
@@ -118,14 +120,15 @@ files:
|
|
|
118
120
|
- rice/Enum.ipp
|
|
119
121
|
- rice/Exception.hpp
|
|
120
122
|
- rice/Exception.ipp
|
|
121
|
-
- rice/Function.hpp
|
|
122
|
-
- rice/Function.ipp
|
|
123
123
|
- rice/JumpException.hpp
|
|
124
124
|
- rice/JumpException.ipp
|
|
125
125
|
- rice/MemoryView.hpp
|
|
126
126
|
- rice/MemoryView.ipp
|
|
127
|
+
- rice/NoGVL.hpp
|
|
127
128
|
- rice/Pointer.hpp
|
|
128
129
|
- rice/Pointer.ipp
|
|
130
|
+
- rice/Reference.hpp
|
|
131
|
+
- rice/Reference.ipp
|
|
129
132
|
- rice/Return.hpp
|
|
130
133
|
- rice/Return.ipp
|
|
131
134
|
- rice/api.hpp
|
|
@@ -158,8 +161,6 @@ files:
|
|
|
158
161
|
- rice/detail/HandlerRegistry.ipp
|
|
159
162
|
- rice/detail/InstanceRegistry.hpp
|
|
160
163
|
- rice/detail/InstanceRegistry.ipp
|
|
161
|
-
- rice/detail/MethodInfo.hpp
|
|
162
|
-
- rice/detail/MethodInfo.ipp
|
|
163
164
|
- rice/detail/ModuleRegistry.hpp
|
|
164
165
|
- rice/detail/ModuleRegistry.ipp
|
|
165
166
|
- rice/detail/Native.hpp
|
|
@@ -168,10 +169,8 @@ files:
|
|
|
168
169
|
- rice/detail/NativeAttributeGet.ipp
|
|
169
170
|
- rice/detail/NativeAttributeSet.hpp
|
|
170
171
|
- rice/detail/NativeAttributeSet.ipp
|
|
171
|
-
- rice/detail/
|
|
172
|
-
- rice/detail/
|
|
173
|
-
- rice/detail/NativeCallbackSimple.hpp
|
|
174
|
-
- rice/detail/NativeCallbackSimple.ipp
|
|
172
|
+
- rice/detail/NativeCallback.hpp
|
|
173
|
+
- rice/detail/NativeCallback.ipp
|
|
175
174
|
- rice/detail/NativeFunction.hpp
|
|
176
175
|
- rice/detail/NativeFunction.ipp
|
|
177
176
|
- rice/detail/NativeInvoker.hpp
|
|
@@ -308,6 +307,7 @@ files:
|
|
|
308
307
|
- test/test_Overloads.cpp
|
|
309
308
|
- test/test_Ownership.cpp
|
|
310
309
|
- test/test_Proc.cpp
|
|
310
|
+
- test/test_Reference.cpp
|
|
311
311
|
- test/test_Self.cpp
|
|
312
312
|
- test/test_Stl_Exception.cpp
|
|
313
313
|
- test/test_Stl_Map.cpp
|
|
@@ -357,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
357
357
|
- !ruby/object:Gem::Version
|
|
358
358
|
version: '0'
|
|
359
359
|
requirements: []
|
|
360
|
-
rubygems_version:
|
|
360
|
+
rubygems_version: 4.0.2
|
|
361
361
|
specification_version: 4
|
|
362
362
|
summary: Ruby Interface for C++ Extensions
|
|
363
363
|
test_files: []
|
data/rice/Function.hpp
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#ifndef Rice__Function__hpp_
|
|
2
|
-
#define Rice__Function__hpp_
|
|
3
|
-
|
|
4
|
-
namespace Rice
|
|
5
|
-
{
|
|
6
|
-
class Function
|
|
7
|
-
{
|
|
8
|
-
public:
|
|
9
|
-
Function& setNoGvl();
|
|
10
|
-
bool isNoGvl() const;
|
|
11
|
-
|
|
12
|
-
private:
|
|
13
|
-
bool isNoGvl_ = false;
|
|
14
|
-
};
|
|
15
|
-
} // Rice
|
|
16
|
-
|
|
17
|
-
#endif // Rice__Function__hpp_
|
data/rice/Function.ipp
DELETED
data/rice/detail/MethodInfo.hpp
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#ifndef Rice__MethodInfo__hpp_
|
|
2
|
-
#define Rice__MethodInfo__hpp_
|
|
3
|
-
|
|
4
|
-
#include <vector>
|
|
5
|
-
|
|
6
|
-
namespace Rice
|
|
7
|
-
{
|
|
8
|
-
class MethodInfo
|
|
9
|
-
{
|
|
10
|
-
public:
|
|
11
|
-
MethodInfo() = default;
|
|
12
|
-
|
|
13
|
-
template <typename...Arg_Ts>
|
|
14
|
-
MethodInfo(size_t argCount, const Arg_Ts&...args);
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Add a defined Arg to this list of Arguments
|
|
18
|
-
*/
|
|
19
|
-
void addArg(const Arg& arg);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get argument by position
|
|
23
|
-
*/
|
|
24
|
-
Arg* arg(size_t pos);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get argument by name
|
|
28
|
-
*/
|
|
29
|
-
Arg* arg(std::string name);
|
|
30
|
-
|
|
31
|
-
int argCount();
|
|
32
|
-
Return* returnInfo();
|
|
33
|
-
Function* function();
|
|
34
|
-
|
|
35
|
-
// Iterator support
|
|
36
|
-
std::vector<Arg>::iterator begin();
|
|
37
|
-
std::vector<Arg>::iterator end();
|
|
38
|
-
|
|
39
|
-
private:
|
|
40
|
-
template <typename Arg_T>
|
|
41
|
-
void processArg(const Arg_T& arg);
|
|
42
|
-
|
|
43
|
-
std::vector<Arg> args_;
|
|
44
|
-
Return returnInfo_;
|
|
45
|
-
Function function_;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
#endif // Rice__MethodInfo__hpp_
|