rice 4.7.1 → 4.9.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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -1
  3. data/CMakeLists.txt +14 -22
  4. data/CMakePresets.json +203 -75
  5. data/FindRuby.cmake +358 -123
  6. data/bin/rice-doc.rb +58 -141
  7. data/include/rice/api.hpp +261 -0
  8. data/include/rice/rice.hpp +2459 -1693
  9. data/include/rice/stl.hpp +450 -546
  10. data/lib/rice/doc/config.rb +70 -0
  11. data/lib/rice/doc/cpp_reference.rb +1 -4
  12. data/lib/rice/doc/mkdocs.rb +58 -20
  13. data/lib/rice/doc/rice.rb +21 -0
  14. data/lib/rice/doc.rb +1 -0
  15. data/lib/rice/make_rice_headers.rb +7 -0
  16. data/lib/rice/native_registry.rb +5 -10
  17. data/lib/rice/rbs.rb +6 -6
  18. data/lib/rice/version.rb +1 -1
  19. data/lib/rubygems_plugin.rb +12 -9
  20. data/rice/Arg.hpp +12 -6
  21. data/rice/Arg.ipp +14 -7
  22. data/rice/Buffer.ipp +44 -40
  23. data/rice/Callback.hpp +1 -1
  24. data/rice/Callback.ipp +2 -7
  25. data/rice/Constructor.hpp +1 -1
  26. data/rice/Constructor.ipp +11 -11
  27. data/rice/Data_Object.ipp +15 -15
  28. data/rice/Data_Type.hpp +9 -10
  29. data/rice/Data_Type.ipp +33 -31
  30. data/rice/Director.hpp +1 -0
  31. data/rice/Enum.ipp +58 -39
  32. data/rice/Exception.hpp +4 -4
  33. data/rice/Exception.ipp +7 -7
  34. data/rice/NoGVL.hpp +13 -0
  35. data/rice/Reference.hpp +56 -0
  36. data/rice/Reference.ipp +96 -0
  37. data/rice/Return.hpp +4 -1
  38. data/rice/Return.ipp +0 -6
  39. data/rice/cpp_api/Array.hpp +41 -4
  40. data/rice/cpp_api/Array.ipp +105 -9
  41. data/rice/cpp_api/Class.hpp +7 -2
  42. data/rice/cpp_api/Class.ipp +9 -4
  43. data/rice/cpp_api/Hash.ipp +7 -4
  44. data/rice/cpp_api/Module.hpp +4 -4
  45. data/rice/cpp_api/Module.ipp +12 -10
  46. data/rice/cpp_api/Object.hpp +10 -4
  47. data/rice/cpp_api/Object.ipp +20 -12
  48. data/rice/cpp_api/String.hpp +2 -2
  49. data/rice/cpp_api/String.ipp +11 -8
  50. data/rice/cpp_api/Symbol.ipp +7 -7
  51. data/rice/cpp_api/shared_methods.hpp +5 -9
  52. data/rice/detail/Forwards.hpp +18 -0
  53. data/rice/detail/Forwards.ipp +60 -0
  54. data/rice/detail/InstanceRegistry.hpp +0 -2
  55. data/rice/detail/Native.hpp +31 -21
  56. data/rice/detail/Native.ipp +282 -130
  57. data/rice/detail/NativeAttributeGet.hpp +5 -7
  58. data/rice/detail/NativeAttributeGet.ipp +26 -26
  59. data/rice/detail/NativeAttributeSet.hpp +2 -4
  60. data/rice/detail/NativeAttributeSet.ipp +20 -16
  61. data/rice/detail/NativeCallback.hpp +77 -0
  62. data/rice/detail/NativeCallback.ipp +280 -0
  63. data/rice/detail/NativeFunction.hpp +11 -21
  64. data/rice/detail/NativeFunction.ipp +58 -119
  65. data/rice/detail/NativeInvoker.hpp +4 -4
  66. data/rice/detail/NativeInvoker.ipp +7 -7
  67. data/rice/detail/NativeIterator.hpp +2 -4
  68. data/rice/detail/NativeIterator.ipp +18 -14
  69. data/rice/detail/NativeMethod.hpp +10 -20
  70. data/rice/detail/NativeMethod.ipp +54 -114
  71. data/rice/detail/NativeProc.hpp +5 -7
  72. data/rice/detail/NativeProc.ipp +39 -28
  73. data/rice/detail/NativeRegistry.hpp +1 -1
  74. data/rice/detail/NativeRegistry.ipp +29 -0
  75. data/rice/detail/Parameter.hpp +15 -8
  76. data/rice/detail/Parameter.ipp +102 -43
  77. data/rice/detail/Proc.ipp +14 -28
  78. data/rice/detail/RubyType.ipp +2 -53
  79. data/rice/detail/Type.hpp +23 -7
  80. data/rice/detail/Type.ipp +77 -93
  81. data/rice/detail/TypeRegistry.ipp +5 -4
  82. data/rice/detail/Wrapper.hpp +13 -12
  83. data/rice/detail/Wrapper.ipp +97 -44
  84. data/rice/detail/from_ruby.hpp +8 -6
  85. data/rice/detail/from_ruby.ipp +306 -173
  86. data/rice/detail/ruby.hpp +23 -0
  87. data/rice/libc/file.hpp +4 -4
  88. data/rice/rice.hpp +9 -8
  89. data/rice/rice_api/Native.ipp +5 -1
  90. data/rice/rice_api/NativeRegistry.ipp +14 -1
  91. data/rice/rice_api/Parameter.ipp +1 -1
  92. data/rice/ruby_mark.hpp +2 -1
  93. data/rice/stl/complex.ipp +12 -8
  94. data/rice/stl/map.ipp +27 -22
  95. data/rice/stl/monostate.ipp +16 -12
  96. data/rice/stl/multimap.hpp +0 -2
  97. data/rice/stl/multimap.ipp +27 -22
  98. data/rice/stl/optional.ipp +27 -11
  99. data/rice/stl/pair.ipp +5 -5
  100. data/rice/stl/reference_wrapper.ipp +5 -4
  101. data/rice/stl/set.ipp +16 -16
  102. data/rice/stl/shared_ptr.hpp +9 -9
  103. data/rice/stl/shared_ptr.ipp +52 -185
  104. data/rice/stl/string.ipp +18 -18
  105. data/rice/stl/string_view.ipp +1 -1
  106. data/rice/stl/tuple.ipp +15 -36
  107. data/rice/stl/unique_ptr.hpp +9 -3
  108. data/rice/stl/unique_ptr.ipp +86 -120
  109. data/rice/stl/unordered_map.ipp +20 -15
  110. data/rice/stl/variant.ipp +37 -21
  111. data/rice/stl/vector.ipp +41 -36
  112. data/rice/traits/function_traits.hpp +19 -19
  113. data/rice/traits/method_traits.hpp +4 -4
  114. data/rice/traits/rice_traits.hpp +162 -39
  115. data/rice.gemspec +1 -3
  116. data/test/test_Array.cpp +261 -3
  117. data/test/test_Attribute.cpp +6 -3
  118. data/test/test_Buffer.cpp +6 -42
  119. data/test/test_Callback.cpp +77 -23
  120. data/test/test_Data_Object.cpp +1 -1
  121. data/test/test_Data_Type.cpp +21 -22
  122. data/test/test_Director.cpp +2 -4
  123. data/test/test_Enum.cpp +34 -5
  124. data/test/test_File.cpp +9 -5
  125. data/test/test_From_Ruby.cpp +4 -3
  126. data/test/test_GVL.cpp +3 -3
  127. data/test/test_Hash.cpp +1 -1
  128. data/test/test_Inheritance.cpp +14 -14
  129. data/test/test_Iterator.cpp +54 -22
  130. data/test/test_Keep_Alive.cpp +1 -1
  131. data/test/test_Keep_Alive_No_Wrapper.cpp +7 -3
  132. data/test/test_Module.cpp +5 -5
  133. data/test/test_Overloads.cpp +345 -48
  134. data/test/test_Proc.cpp +54 -0
  135. data/test/test_Reference.cpp +181 -0
  136. data/test/test_Self.cpp +2 -2
  137. data/test/test_Stl_Set.cpp +6 -6
  138. data/test/test_Stl_SharedPtr.cpp +172 -33
  139. data/test/test_Stl_String_View.cpp +4 -2
  140. data/test/test_Stl_Tuple.cpp +1 -1
  141. data/test/test_Stl_UniquePtr.cpp +48 -3
  142. data/test/test_Stl_Variant.cpp +6 -14
  143. data/test/test_Stl_Vector.cpp +61 -30
  144. data/test/test_String.cpp +4 -2
  145. data/test/test_Struct.cpp +1 -1
  146. data/test/test_Symbol.cpp +1 -1
  147. data/test/test_To_Ruby.cpp +1 -0
  148. data/test/test_Type.cpp +36 -35
  149. data/test/test_global_functions.cpp +1 -1
  150. data/test/unittest.cpp +1 -1
  151. data/test/unittest.hpp +5 -5
  152. metadata +12 -10
  153. data/rice/Function.hpp +0 -17
  154. data/rice/Function.ipp +0 -13
  155. data/rice/detail/MethodInfo.hpp +0 -48
  156. data/rice/detail/MethodInfo.ipp +0 -99
  157. data/rice/detail/NativeCallbackFFI.hpp +0 -55
  158. data/rice/detail/NativeCallbackFFI.ipp +0 -152
  159. data/rice/detail/NativeCallbackSimple.hpp +0 -30
  160. data/rice/detail/NativeCallbackSimple.ipp +0 -29
@@ -30,13 +30,15 @@ namespace Rice::detail
30
30
  template <typename T>
31
31
  class From_Ruby;
32
32
 
33
- enum class Convertible: uint8_t
33
+ // Overload resolution scoring constants
34
+ struct Convertible
34
35
  {
35
- None = 0b0000,
36
- Narrow = 0b0001,
37
- Cast = 0b0011,
38
- Const = 0b0111,
39
- Exact = 0b1111
36
+ static constexpr double Exact = 1.0; // Perfect type match
37
+ static constexpr double None = 0.0; // Cannot convert
38
+ static constexpr double IntToFloat = 0.5; // Domain change penalty when converting int to float
39
+ static constexpr double SignedToUnsigned = 0.5;// Penalty for signed to unsigned (can't represent negatives)
40
+ static constexpr double FloatToInt = 0.5; // Domain change penalty when converting float to int (lossy)
41
+ static constexpr double ConstMismatch = 0.99; // Penalty for const mismatch
40
42
  };
41
43
  }
42
44