rice 4.6.0 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/CMakeLists.txt +0 -4
- data/Rakefile +2 -8
- data/bin/rice-doc.rb +212 -0
- data/bin/rice-rbs.rb +93 -0
- data/include/rice/rice.hpp +5221 -4009
- data/include/rice/stl.hpp +822 -295
- data/lib/rice/doc/cpp_reference.rb +166 -0
- data/lib/rice/doc/doxygen.rb +294 -0
- data/lib/rice/doc/mkdocs.rb +298 -0
- data/lib/rice/doc/rice.rb +29 -0
- data/lib/rice/doc/ruby.rb +37 -0
- data/lib/rice/doc.rb +5 -0
- data/lib/{make_rice_headers.rb → rice/make_rice_headers.rb} +3 -0
- data/lib/rice/native.rb +18 -0
- data/lib/rice/native_registry.rb +21 -0
- data/lib/rice/parameter.rb +7 -0
- data/lib/rice/rbs.rb +104 -0
- data/lib/rice/version.rb +1 -1
- data/lib/rice.rb +4 -0
- data/lib/rubygems/cmake_builder.rb +24 -27
- data/rice/Arg.hpp +4 -4
- data/rice/Arg.ipp +4 -4
- data/rice/Buffer.hpp +77 -28
- data/rice/Buffer.ipp +500 -183
- data/rice/Data_Object.ipp +101 -82
- data/rice/Data_Type.hpp +7 -6
- data/rice/Data_Type.ipp +77 -47
- data/rice/Enum.ipp +15 -21
- data/rice/Function.hpp +17 -0
- data/rice/Function.ipp +13 -0
- data/rice/Pointer.hpp +15 -0
- data/rice/Pointer.ipp +49 -0
- data/rice/Return.hpp +1 -1
- data/rice/Return.ipp +2 -2
- data/rice/api.hpp +30 -0
- data/rice/cpp_api/Array.hpp +2 -2
- data/rice/cpp_api/Array.ipp +50 -5
- data/rice/cpp_api/Class.hpp +0 -5
- data/rice/cpp_api/Class.ipp +19 -0
- data/rice/cpp_api/Hash.ipp +20 -0
- data/rice/cpp_api/Module.hpp +6 -3
- data/rice/cpp_api/Module.ipp +49 -11
- data/rice/cpp_api/Object.ipp +31 -2
- data/rice/cpp_api/String.hpp +1 -2
- data/rice/cpp_api/String.ipp +21 -1
- data/rice/cpp_api/Struct.ipp +5 -0
- data/rice/cpp_api/Symbol.ipp +34 -0
- data/rice/cpp_api/shared_methods.hpp +12 -12
- data/rice/detail/MethodInfo.hpp +4 -2
- data/rice/detail/MethodInfo.ipp +19 -3
- data/rice/detail/ModuleRegistry.hpp +18 -0
- data/rice/detail/ModuleRegistry.ipp +25 -0
- data/rice/detail/Native.hpp +45 -2
- data/rice/detail/Native.ipp +196 -2
- data/rice/detail/NativeAttributeGet.hpp +9 -4
- data/rice/detail/NativeAttributeGet.ipp +73 -8
- data/rice/detail/NativeAttributeSet.hpp +4 -0
- data/rice/detail/NativeAttributeSet.ipp +33 -23
- data/rice/detail/NativeCallbackFFI.ipp +3 -2
- data/rice/detail/NativeCallbackSimple.ipp +1 -1
- data/rice/detail/NativeFunction.hpp +11 -49
- data/rice/detail/NativeFunction.ipp +83 -379
- data/rice/detail/NativeInvoker.hpp +74 -0
- data/rice/detail/NativeInvoker.ipp +197 -0
- data/rice/detail/NativeIterator.hpp +4 -0
- data/rice/detail/NativeIterator.ipp +19 -0
- data/rice/detail/NativeMethod.hpp +97 -0
- data/rice/detail/NativeMethod.ipp +332 -0
- data/rice/detail/NativeProc.hpp +51 -0
- data/rice/detail/NativeProc.ipp +133 -0
- data/rice/detail/NativeRegistry.hpp +8 -0
- data/rice/detail/NativeRegistry.ipp +27 -0
- data/rice/detail/Parameter.hpp +47 -0
- data/rice/detail/Parameter.ipp +105 -0
- data/rice/detail/Proc.ipp +14 -13
- data/rice/detail/Registries.hpp +1 -0
- data/rice/detail/RubyType.hpp +0 -2
- data/rice/detail/RubyType.ipp +15 -33
- data/rice/detail/Type.hpp +44 -8
- data/rice/detail/Type.ipp +150 -49
- data/rice/detail/TypeRegistry.hpp +3 -0
- data/rice/detail/TypeRegistry.ipp +17 -27
- data/rice/detail/Types.ipp +430 -0
- data/rice/detail/Wrapper.hpp +12 -0
- data/rice/detail/Wrapper.ipp +45 -2
- data/rice/detail/from_ruby.ipp +567 -1073
- data/rice/detail/ruby.hpp +1 -0
- data/rice/detail/to_ruby.ipp +4 -635
- data/rice/libc/file.ipp +3 -6
- data/rice/rice.hpp +22 -12
- data/rice/rice_api/Arg.hpp +7 -0
- data/rice/rice_api/Arg.ipp +9 -0
- data/rice/rice_api/ModuleRegistry.hpp +7 -0
- data/rice/rice_api/ModuleRegistry.ipp +10 -0
- data/rice/rice_api/Native.hpp +7 -0
- data/rice/rice_api/Native.ipp +52 -0
- data/rice/rice_api/NativeRegistry.hpp +7 -0
- data/rice/rice_api/NativeRegistry.ipp +21 -0
- data/rice/rice_api/Parameter.hpp +7 -0
- data/rice/rice_api/Parameter.ipp +11 -0
- data/rice/rice_api/Registries.hpp +6 -0
- data/rice/rice_api/Registries.ipp +12 -0
- data/rice/rice_api/TypeRegistry.hpp +7 -0
- data/rice/rice_api/TypeRegistry.ipp +10 -0
- data/rice/stl/complex.ipp +35 -0
- data/rice/stl/exception.ipp +20 -7
- data/rice/stl/filesystem.hpp +6 -0
- data/rice/stl/filesystem.ipp +34 -0
- data/rice/stl/map.ipp +13 -21
- data/rice/stl/monostate.ipp +37 -1
- data/rice/stl/multimap.ipp +17 -24
- data/rice/stl/optional.ipp +47 -2
- data/rice/stl/pair.ipp +23 -58
- data/rice/stl/reference_wrapper.ipp +22 -1
- data/rice/stl/set.ipp +17 -9
- data/rice/stl/shared_ptr.ipp +44 -17
- data/rice/stl/string.ipp +175 -7
- data/rice/stl/string_view.ipp +5 -0
- data/rice/stl/tuple.ipp +38 -9
- data/rice/stl/unique_ptr.ipp +46 -2
- data/rice/stl/unordered_map.ipp +13 -21
- data/rice/stl/variant.ipp +47 -11
- data/rice/stl/vector.ipp +182 -104
- data/rice/stl.hpp +1 -0
- data/rice/traits/attribute_traits.hpp +6 -6
- data/rice/traits/function_traits.hpp +2 -2
- data/rice/traits/method_traits.hpp +5 -16
- data/rice/traits/rice_traits.hpp +36 -4
- data/rice.gemspec +11 -22
- data/test/embed_ruby.cpp +0 -3
- data/test/test_Array.cpp +38 -38
- data/test/test_Attribute.cpp +244 -10
- data/test/test_Buffer.cpp +344 -13
- data/test/test_Callback.cpp +2 -3
- data/test/test_Class.cpp +5 -5
- data/test/test_Data_Object.cpp +0 -55
- data/test/test_Data_Type.cpp +19 -30
- data/test/test_Enum.cpp +4 -46
- data/test/test_From_Ruby.cpp +89 -82
- data/test/test_GVL.cpp +109 -0
- data/test/test_Iterator.cpp +1 -1
- data/test/test_Keep_Alive_No_Wrapper.cpp +5 -3
- data/test/test_Module.cpp +8 -9
- data/test/test_Object.cpp +1 -1
- data/test/test_Overloads.cpp +3 -3
- data/test/test_Stl_Map.cpp +8 -8
- data/test/test_Stl_Multimap.cpp +4 -4
- data/test/test_Stl_Pair.cpp +5 -3
- data/test/test_Stl_SharedPtr.cpp +24 -12
- data/test/test_Stl_Tuple.cpp +1 -1
- data/test/test_Stl_UniquePtr.cpp +8 -0
- data/test/test_Stl_Unordered_Map.cpp +9 -9
- data/test/test_Stl_Variant.cpp +9 -3
- data/test/test_Stl_Vector.cpp +118 -13
- data/test/test_To_Ruby.cpp +35 -28
- data/test/test_Type.cpp +256 -53
- data/test/unittest.hpp +35 -0
- metadata +66 -34
- data/rice/Init.hpp +0 -8
- data/rice/Init.ipp +0 -8
- data/rice/detail/RubyFunction.hpp +0 -31
- data/rice/detail/RubyFunction.ipp +0 -76
- data/sample/callbacks/extconf.rb +0 -5
- data/sample/callbacks/sample_callbacks.cpp +0 -35
- data/sample/callbacks/test.rb +0 -28
- data/sample/enum/extconf.rb +0 -5
- data/sample/enum/sample_enum.cpp +0 -40
- data/sample/enum/test.rb +0 -8
- data/sample/inheritance/animals.cpp +0 -82
- data/sample/inheritance/extconf.rb +0 -5
- data/sample/inheritance/test.rb +0 -7
- data/sample/map/extconf.rb +0 -5
- data/sample/map/map.cpp +0 -73
- data/sample/map/test.rb +0 -7
- data/test/ext/t1/Foo.hpp +0 -10
- data/test/ext/t1/extconf.rb +0 -4
- data/test/ext/t1/t1.cpp +0 -13
- data/test/ext/t2/extconf.rb +0 -4
- data/test/ext/t2/t2.cpp +0 -11
- data/test/ruby/test_callbacks_sample.rb +0 -28
- data/test/ruby/test_multiple_extensions.rb +0 -18
- data/test/ruby/test_multiple_extensions_same_class.rb +0 -14
- data/test/ruby/test_multiple_extensions_with_inheritance.rb +0 -20
- /data/test/{test_Stl_Type.cpp → test_Stl_Type_Info.cpp} +0 -0
data/rice/Arg.ipp
CHANGED
|
@@ -70,14 +70,14 @@ namespace Rice
|
|
|
70
70
|
return this->isOwner_;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
inline Arg& Arg::
|
|
73
|
+
inline Arg& Arg::setBuffer()
|
|
74
74
|
{
|
|
75
|
-
this->
|
|
75
|
+
this->isBuffer_ = true;
|
|
76
76
|
return *this;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
inline bool Arg::
|
|
79
|
+
inline bool Arg::isBuffer()
|
|
80
80
|
{
|
|
81
|
-
return this->
|
|
81
|
+
return this->isBuffer_;
|
|
82
82
|
}
|
|
83
83
|
} // Rice
|
data/rice/Buffer.hpp
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
|
|
4
4
|
namespace Rice
|
|
5
5
|
{
|
|
6
|
+
template<typename T, typename = void>
|
|
7
|
+
class Buffer;
|
|
8
|
+
|
|
6
9
|
template<typename T>
|
|
7
|
-
class Buffer
|
|
10
|
+
class Buffer<T, std::enable_if_t<!std::is_pointer_v<T> && !std::is_void_v<T>>>
|
|
8
11
|
{
|
|
9
12
|
public:
|
|
10
|
-
using type = T;
|
|
11
|
-
|
|
12
13
|
Buffer(T* pointer);
|
|
13
14
|
Buffer(T* pointer, size_t size);
|
|
14
15
|
Buffer(VALUE value);
|
|
16
|
+
Buffer(VALUE value, size_t size);
|
|
15
17
|
|
|
16
18
|
~Buffer();
|
|
17
19
|
|
|
@@ -20,16 +22,16 @@ namespace Rice
|
|
|
20
22
|
|
|
21
23
|
Buffer& operator=(const Buffer& other) = delete;
|
|
22
24
|
Buffer& operator=(Buffer&& other);
|
|
25
|
+
T& operator[](size_t index);
|
|
23
26
|
|
|
24
27
|
T* ptr();
|
|
25
28
|
T& reference();
|
|
26
|
-
|
|
29
|
+
T* release();
|
|
27
30
|
|
|
28
31
|
size_t size() const;
|
|
29
|
-
void setSize(size_t value);
|
|
30
32
|
|
|
31
33
|
// Ruby API
|
|
32
|
-
|
|
34
|
+
VALUE toString() const;
|
|
33
35
|
|
|
34
36
|
VALUE bytes() const;
|
|
35
37
|
VALUE bytes(size_t count) const;
|
|
@@ -37,31 +39,70 @@ namespace Rice
|
|
|
37
39
|
Array toArray() const;
|
|
38
40
|
Array toArray(size_t count) const;
|
|
39
41
|
|
|
40
|
-
T get(size_t index) const;
|
|
41
|
-
void set(size_t index, T value);
|
|
42
|
-
|
|
43
42
|
bool isOwner() const;
|
|
44
43
|
void setOwner(bool value);
|
|
45
44
|
|
|
46
45
|
private:
|
|
47
|
-
void
|
|
48
|
-
void
|
|
46
|
+
void fromBuiltinType(VALUE value, size_t size);
|
|
47
|
+
void fromWrappedType(VALUE value, size_t size);
|
|
49
48
|
|
|
50
49
|
bool m_owner = false;
|
|
51
50
|
size_t m_size = 0;
|
|
52
|
-
// std::unique_ptr would be
|
|
53
|
-
T*
|
|
51
|
+
// std::unique_ptr would be great but std::unique_ptr<void> isn't allowed. Mutable is needed to
|
|
52
|
+
// support const T* buffers
|
|
53
|
+
mutable T* m_buffer = nullptr;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
template<typename T>
|
|
57
|
-
class Buffer<T
|
|
57
|
+
class Buffer<T*, std::enable_if_t<!detail::is_wrapped_v<T>>>
|
|
58
58
|
{
|
|
59
59
|
public:
|
|
60
|
-
|
|
60
|
+
Buffer(T** pointer);
|
|
61
|
+
Buffer(T** pointer, size_t size);
|
|
62
|
+
Buffer(VALUE value);
|
|
63
|
+
Buffer(VALUE value, size_t size);
|
|
64
|
+
|
|
65
|
+
~Buffer();
|
|
66
|
+
|
|
67
|
+
Buffer(const Buffer& other) = delete;
|
|
68
|
+
Buffer(Buffer&& other);
|
|
69
|
+
|
|
70
|
+
Buffer& operator=(const Buffer& other) = delete;
|
|
71
|
+
Buffer& operator=(Buffer&& other);
|
|
72
|
+
|
|
73
|
+
T* operator[](size_t index);
|
|
74
|
+
|
|
75
|
+
T** ptr();
|
|
76
|
+
T** release();
|
|
77
|
+
|
|
78
|
+
size_t size() const;
|
|
79
|
+
|
|
80
|
+
// Ruby API
|
|
81
|
+
VALUE toString() const;
|
|
82
|
+
|
|
83
|
+
VALUE bytes() const;
|
|
84
|
+
VALUE bytes(size_t count) const;
|
|
85
|
+
|
|
86
|
+
Array toArray() const;
|
|
87
|
+
Array toArray(size_t count) const;
|
|
88
|
+
|
|
89
|
+
void setOwner(bool value);
|
|
90
|
+
bool isOwner() const;
|
|
61
91
|
|
|
92
|
+
private:
|
|
93
|
+
bool m_owner = false;
|
|
94
|
+
size_t m_size = 0;
|
|
95
|
+
T** m_buffer = nullptr;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
template<typename T>
|
|
99
|
+
class Buffer<T*, std::enable_if_t<detail::is_wrapped_v<T>>>
|
|
100
|
+
{
|
|
101
|
+
public:
|
|
62
102
|
Buffer(T** pointer);
|
|
63
103
|
Buffer(T** pointer, size_t size);
|
|
64
104
|
Buffer(VALUE value);
|
|
105
|
+
Buffer(VALUE value, size_t size);
|
|
65
106
|
|
|
66
107
|
~Buffer();
|
|
67
108
|
|
|
@@ -71,16 +112,15 @@ namespace Rice
|
|
|
71
112
|
Buffer& operator=(const Buffer& other) = delete;
|
|
72
113
|
Buffer& operator=(Buffer&& other);
|
|
73
114
|
|
|
74
|
-
|
|
115
|
+
T* operator[](size_t index);
|
|
75
116
|
|
|
76
117
|
T** ptr();
|
|
77
|
-
|
|
118
|
+
T** release();
|
|
78
119
|
|
|
79
120
|
size_t size() const;
|
|
80
|
-
void setSize(size_t value);
|
|
81
121
|
|
|
82
122
|
// Ruby API
|
|
83
|
-
|
|
123
|
+
VALUE toString() const;
|
|
84
124
|
|
|
85
125
|
VALUE bytes() const;
|
|
86
126
|
VALUE bytes(size_t count) const;
|
|
@@ -94,30 +134,39 @@ namespace Rice
|
|
|
94
134
|
private:
|
|
95
135
|
bool m_owner = false;
|
|
96
136
|
size_t m_size = 0;
|
|
97
|
-
T**
|
|
98
|
-
std::vector<Buffer<T>> m_inner;
|
|
137
|
+
T** m_buffer = nullptr;
|
|
99
138
|
};
|
|
100
139
|
|
|
101
|
-
template
|
|
102
|
-
class Buffer<
|
|
140
|
+
template<typename T>
|
|
141
|
+
class Buffer<T, std::enable_if_t<std::is_void_v<T>>>
|
|
103
142
|
{
|
|
104
143
|
public:
|
|
105
|
-
Buffer(
|
|
144
|
+
Buffer(T* pointer);
|
|
145
|
+
Buffer(VALUE value);
|
|
146
|
+
Buffer(VALUE value, size_t size);
|
|
147
|
+
|
|
106
148
|
Buffer(const Buffer& other) = delete;
|
|
107
149
|
Buffer(Buffer&& other);
|
|
108
150
|
|
|
109
151
|
Buffer& operator=(const Buffer& other) = delete;
|
|
110
152
|
Buffer& operator=(Buffer&& other);
|
|
111
153
|
|
|
112
|
-
|
|
154
|
+
size_t size() const;
|
|
155
|
+
|
|
156
|
+
VALUE bytes(size_t count) const;
|
|
157
|
+
VALUE bytes() const;
|
|
158
|
+
|
|
159
|
+
T* ptr();
|
|
160
|
+
T* release();
|
|
113
161
|
|
|
114
162
|
private:
|
|
115
|
-
|
|
163
|
+
bool m_owner = false;
|
|
164
|
+
size_t m_size = 0;
|
|
165
|
+
T* m_buffer = nullptr;
|
|
116
166
|
};
|
|
117
167
|
|
|
118
168
|
template<typename T>
|
|
119
169
|
Data_Type<Buffer<T>> define_buffer(std::string klassName = "");
|
|
120
|
-
|
|
121
|
-
void define_fundamental_buffer_types();
|
|
122
170
|
}
|
|
171
|
+
|
|
123
172
|
#endif // Rice__Buffer__hpp_
|