rbplusplus 0.9.1 → 1.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 (53) hide show
  1. data/Rakefile +4 -9
  2. data/lib/rbplusplus/builders/allocation_strategy.rb +0 -7
  3. data/lib/rbplusplus/builders/base.rb +11 -5
  4. data/lib/rbplusplus/builders/class.rb +5 -14
  5. data/lib/rbplusplus/builders/const.rb +1 -1
  6. data/lib/rbplusplus/builders/constructor.rb +1 -1
  7. data/lib/rbplusplus/builders/director.rb +13 -13
  8. data/lib/rbplusplus/builders/enumeration.rb +2 -2
  9. data/lib/rbplusplus/builders/helpers/class.rb +17 -2
  10. data/lib/rbplusplus/builders/helpers/implicit_caster.rb +0 -0
  11. data/lib/rbplusplus/builders/implicit_caster.rb +24 -0
  12. data/lib/rbplusplus/builders/instance_variable.rb +4 -4
  13. data/lib/rbplusplus/builders/method_base.rb +8 -7
  14. data/lib/rbplusplus/builders/module.rb +1 -1
  15. data/lib/rbplusplus/logger.rb +13 -4
  16. data/lib/rbplusplus/transformers/class.rb +43 -34
  17. data/lib/rbplusplus/transformers/constructor.rb +30 -0
  18. data/lib/rbplusplus/transformers/function.rb +3 -3
  19. data/lib/rbplusplus/transformers/method.rb +2 -2
  20. data/lib/rbplusplus/transformers/node.rb +10 -17
  21. data/lib/rbplusplus/writers/multiple_files_writer.rb +8 -6
  22. data/lib/rbplusplus.rb +2 -1
  23. data/test/allocation_strategies_test.rb +21 -14
  24. data/test/class_methods_encapsulate_test.rb +25 -25
  25. data/test/class_methods_test.rb +7 -12
  26. data/test/classes_test.rb +36 -40
  27. data/test/compiling_test.rb +23 -19
  28. data/test/constructors_test.rb +5 -5
  29. data/test/custom_code_test.rb +25 -32
  30. data/test/default_arguments_test.rb +38 -42
  31. data/test/director_test.rb +51 -53
  32. data/test/enumerations_test.rb +37 -41
  33. data/test/extension_test.rb +10 -10
  34. data/test/file_writers_test.rb +17 -21
  35. data/test/function_pointer_test.rb +9 -13
  36. data/test/function_pointers_classes_test.rb +7 -11
  37. data/test/functions_test.rb +4 -10
  38. data/test/generated/extconf.rb +2 -2
  39. data/test/headers/alloc_strats.h +3 -1
  40. data/test/headers/implicit_cast.h +107 -0
  41. data/test/headers/to_from_ruby.h +13 -6
  42. data/test/headers/to_from_ruby_source.cpp +2 -2
  43. data/test/implicit_cast_test.rb +67 -0
  44. data/test/modules_test.rb +39 -40
  45. data/test/nested_test.rb +14 -16
  46. data/test/overloading_test.rb +17 -20
  47. data/test/struct_test.rb +4 -6
  48. data/test/subclass_test.rb +10 -12
  49. data/test/test_helper.rb +21 -12
  50. data/test/to_from_ruby_test.rb +7 -1
  51. data/test/wrap_as_test.rb +32 -29
  52. metadata +170 -108
  53. data/lib/rbplusplus/transformers/node_cache.rb +0 -15
data/test/wrap_as_test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- context "Ugly interfaces cleaner" do
3
+ describe "Ugly interfaces cleaner" do
4
4
 
5
5
  specify "should map functions detailed" do
6
6
  node = nil
@@ -37,6 +37,7 @@ context "Ugly interfaces cleaner" do
37
37
  modder = node.namespaces("I_LEARN_C").classes("Modder").wrap_as("Modulus")
38
38
  modder.includes node.namespaces("I_LEARN_C").functions("mod")
39
39
  modder.includes node.namespaces("I_LEARN_C").functions("mod2").wrap_as("method_mod").as_instance_method
40
+ modder.use_constructor(modder.constructors.find(:arguments => []))
40
41
  m.includes modder
41
42
 
42
43
  nc = node.classes("NoConstructor")
@@ -44,62 +45,64 @@ context "Ugly interfaces cleaner" do
44
45
  m.includes nc
45
46
 
46
47
  m.includes node.classes("Outside")
47
- node.classes("Outside").includes node.classes("Inside")
48
+ inside = node.classes("Inside")
49
+ inside.use_constructor(inside.constructors.find(:arguments => []))
50
+ node.classes("Outside").includes inside
48
51
  end
49
52
  end
50
53
 
51
54
  require 'ui'
52
55
 
53
- should.raise NoMethodError do
56
+ lambda do
54
57
  ui_ignore()
55
- end
58
+ end.should raise_error(NoMethodError)
56
59
 
57
- should.raise NoMethodError do
60
+ lambda do
58
61
  ui_add(1,2)
59
- end
62
+ end.should raise_error(NoMethodError)
60
63
 
61
- should.not.raise NoMethodError do
64
+ lambda do
62
65
  UI::Math::add(1,2).should == 3
63
- end
66
+ end.should_not raise_error(NoMethodError)
64
67
 
65
- should.raise NoMethodError do
68
+ lambda do
66
69
  ui_subtract(2,1)
67
- end
70
+ end.should raise_error(NoMethodError)
68
71
 
69
- should.not.raise NoMethodError do
72
+ lambda do
70
73
  UI::Math::subtract(2,1).should == 1
71
- end
74
+ end.should_not raise_error(NoMethodError)
72
75
 
73
- should.raise NameError do
76
+ lambda do
74
77
  C_UIVector.new
75
- end
78
+ end.should raise_error(NameError)
76
79
 
77
- should.not.raise NameError do
80
+ lambda do
78
81
  v = UI::Vector.new
79
82
  v.x = 3
80
83
  v.x.should == 3
81
- end
84
+ end.should_not raise_error(NameError)
82
85
 
83
- should.raise NameError do
86
+ lambda do
84
87
  UI::DMath::divide(1.0,2.0)
85
- end
88
+ end.should raise_error(NameError)
86
89
 
87
- should.not.raise NoMethodError do
88
- UI::Modulus.mod(3,2).should.equal 1
89
- end
90
+ lambda do
91
+ UI::Modulus.mod(3,2).should == 1
92
+ end.should_not raise_error(NameError)
90
93
 
91
- UI::Modulus.new.method_mod(4, 3).should.equal 1
94
+ UI::Modulus.new.method_mod(4, 3).should == 1
92
95
 
93
- should.not.raise NoMethodError do
94
- UI::Math::divide(2,1).should.equal 2
95
- end
96
+ lambda do
97
+ UI::Math::divide(2,1).should == 2
98
+ end.should_not raise_error(NoMethodError)
96
99
 
97
- should.raise TypeError do
100
+ lambda do
98
101
  UI::NoConstructor.new
99
- end
102
+ end.should raise_error(TypeError)
100
103
 
101
- should.not.raise NoMethodError do
104
+ lambda do
102
105
  UI::Outside::Inside.new
103
- end
106
+ end.should_not raise_error(NoMethodError)
104
107
  end
105
108
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbplusplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ version: "1.0"
5
10
  platform: ruby
6
11
  authors:
7
12
  - Jason Roelofs
@@ -9,52 +14,43 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-14 00:00:00 -05:00
17
+ date: 2010-08-30 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rbgccxml
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: "0.9"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: rice
28
+ hash: 15
29
+ segments:
30
+ - 1
31
+ - 0
32
+ version: "1.0"
27
33
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 1.3.0
34
- version:
34
+ version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: test-unit
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "="
42
- - !ruby/object:Gem::Version
43
- version: 1.2.3
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: mocha
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
36
+ name: rice
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
50
40
  requirements:
51
41
  - - ~>
52
42
  - !ruby/object:Gem::Version
53
- version: "0.9"
54
- version:
43
+ hash: 7
44
+ segments:
45
+ - 1
46
+ - 4
47
+ - 0
48
+ version: 1.4.0
49
+ type: :runtime
50
+ version_requirements: *id002
55
51
  description: |
56
52
  Rb++ combines the powerful query interface of rbgccxml and the Rice library to
57
- make Ruby wrapping extensions easier to write than ever.
53
+ make Ruby wrapping extensions of C++ libraries easier to write than ever.
58
54
 
59
55
  email: jameskilton@gmail.com
60
56
  executables: []
@@ -66,46 +62,104 @@ extra_rdoc_files: []
66
62
  files:
67
63
  - TODO
68
64
  - Rakefile
69
- - lib/rbplusplus.rb
70
- - lib/rbplusplus/transformers/node_cache.rb
71
- - lib/rbplusplus/transformers/rbgccxml.rb
72
- - lib/rbplusplus/transformers/function.rb
73
- - lib/rbplusplus/transformers/node.rb
74
- - lib/rbplusplus/transformers/namespace.rb
75
- - lib/rbplusplus/transformers/method.rb
76
- - lib/rbplusplus/transformers/class.rb
77
- - lib/rbplusplus/rbplusplus.rb
78
- - lib/rbplusplus/writers/base.rb
79
- - lib/rbplusplus/writers/multiple_files_writer.rb
80
- - lib/rbplusplus/writers/extension.rb
81
- - lib/rbplusplus/writers/single_file_writer.rb
82
- - lib/rbplusplus/extension.rb
83
- - lib/rbplusplus/builders/method_base.rb
65
+ - lib/inflections.rb
66
+ - lib/inflector.rb
67
+ - lib/jamis.rb
84
68
  - lib/rbplusplus/builders/allocation_strategy.rb
85
- - lib/rbplusplus/builders/director_method.rb
86
- - lib/rbplusplus/builders/module_function.rb
87
- - lib/rbplusplus/builders/static_method.rb
88
69
  - lib/rbplusplus/builders/base.rb
89
- - lib/rbplusplus/builders/enumeration.rb
70
+ - lib/rbplusplus/builders/class.rb
90
71
  - lib/rbplusplus/builders/const.rb
91
- - lib/rbplusplus/builders/helpers/enumeration.rb
92
- - lib/rbplusplus/builders/helpers/module.rb
93
- - lib/rbplusplus/builders/helpers/class.rb
94
- - lib/rbplusplus/builders/extension.rb
95
- - lib/rbplusplus/builders/instance_variable.rb
72
+ - lib/rbplusplus/builders/const_converter.rb
96
73
  - lib/rbplusplus/builders/constructor.rb
97
74
  - lib/rbplusplus/builders/director.rb
98
- - lib/rbplusplus/builders/module.rb
75
+ - lib/rbplusplus/builders/director_method.rb
76
+ - lib/rbplusplus/builders/enumeration.rb
77
+ - lib/rbplusplus/builders/extension.rb
78
+ - lib/rbplusplus/builders/global_function.rb
79
+ - lib/rbplusplus/builders/helpers/class.rb
80
+ - lib/rbplusplus/builders/helpers/enumeration.rb
81
+ - lib/rbplusplus/builders/helpers/implicit_caster.rb
82
+ - lib/rbplusplus/builders/helpers/module.rb
83
+ - lib/rbplusplus/builders/implicit_caster.rb
99
84
  - lib/rbplusplus/builders/include.rb
85
+ - lib/rbplusplus/builders/instance_variable.rb
100
86
  - lib/rbplusplus/builders/method.rb
101
- - lib/rbplusplus/builders/global_function.rb
102
- - lib/rbplusplus/builders/const_converter.rb
103
- - lib/rbplusplus/builders/class.rb
104
- - lib/rbplusplus/module.rb
87
+ - lib/rbplusplus/builders/method_base.rb
88
+ - lib/rbplusplus/builders/module.rb
89
+ - lib/rbplusplus/builders/module_function.rb
90
+ - lib/rbplusplus/builders/static_method.rb
91
+ - lib/rbplusplus/extension.rb
105
92
  - lib/rbplusplus/logger.rb
106
- - lib/inflector.rb
107
- - lib/inflections.rb
108
- - lib/jamis.rb
93
+ - lib/rbplusplus/module.rb
94
+ - lib/rbplusplus/rbplusplus.rb
95
+ - lib/rbplusplus/transformers/class.rb
96
+ - lib/rbplusplus/transformers/constructor.rb
97
+ - lib/rbplusplus/transformers/function.rb
98
+ - lib/rbplusplus/transformers/method.rb
99
+ - lib/rbplusplus/transformers/namespace.rb
100
+ - lib/rbplusplus/transformers/node.rb
101
+ - lib/rbplusplus/transformers/rbgccxml.rb
102
+ - lib/rbplusplus/writers/base.rb
103
+ - lib/rbplusplus/writers/extension.rb
104
+ - lib/rbplusplus/writers/multiple_files_writer.rb
105
+ - lib/rbplusplus/writers/single_file_writer.rb
106
+ - lib/rbplusplus.rb
107
+ - test/allocation_strategies_test.rb
108
+ - test/class_methods_encapsulate_test.rb
109
+ - test/class_methods_test.rb
110
+ - test/classes_test.rb
111
+ - test/compiling_test.rb
112
+ - test/constructors_test.rb
113
+ - test/custom_code_test.rb
114
+ - test/default_arguments_test.rb
115
+ - test/director_test.rb
116
+ - test/enumerations_test.rb
117
+ - test/extension_test.rb
118
+ - test/file_writers_test.rb
119
+ - test/function_pointer_test.rb
120
+ - test/function_pointers_classes_test.rb
121
+ - test/functions_test.rb
122
+ - test/generated/extconf.rb
123
+ - test/implicit_cast_test.rb
124
+ - test/modules_test.rb
125
+ - test/nested_test.rb
126
+ - test/overloading_test.rb
127
+ - test/struct_test.rb
128
+ - test/subclass_test.rb
129
+ - test/test_helper.rb
130
+ - test/to_from_ruby_test.rb
131
+ - test/wrap_as_test.rb
132
+ - test/headers/Adder.cpp
133
+ - test/headers/Adder.h
134
+ - test/headers/alloc_strats.h
135
+ - test/headers/class_methods.h
136
+ - test/headers/code/custom_to_from_ruby.cpp
137
+ - test/headers/code/custom_to_from_ruby.hpp
138
+ - test/headers/complex_static_methods.h
139
+ - test/headers/constructors.h
140
+ - test/headers/default_arguments.h
141
+ - test/headers/director.h
142
+ - test/headers/empty.h
143
+ - test/headers/enums.h
144
+ - test/headers/external_mapping.h
145
+ - test/headers/external_mapping_rice.h
146
+ - test/headers/function_pointers.h
147
+ - test/headers/function_pointers_class.h
148
+ - test/headers/functions.h
149
+ - test/headers/implicit_cast.h
150
+ - test/headers/include/helper.h
151
+ - test/headers/needs_code.h
152
+ - test/headers/nested_classes.h
153
+ - test/headers/nested_struct.h
154
+ - test/headers/overload.h
155
+ - test/headers/requires_define.h
156
+ - test/headers/subclass.h
157
+ - test/headers/Subtracter.hpp
158
+ - test/headers/to_from_ruby.h
159
+ - test/headers/to_from_ruby_source.cpp
160
+ - test/headers/ugly_interface.h
161
+ - test/headers/ugly_interface_ns.h
162
+ - test/headers/with_includes.h
109
163
  has_rdoc: true
110
164
  homepage: http://rbplusplus.rubyforge.org
111
165
  licenses: []
@@ -116,76 +170,84 @@ rdoc_options: []
116
170
  require_paths:
117
171
  - lib
118
172
  required_ruby_version: !ruby/object:Gem::Requirement
173
+ none: false
119
174
  requirements:
120
175
  - - ">="
121
176
  - !ruby/object:Gem::Version
177
+ hash: 3
178
+ segments:
179
+ - 0
122
180
  version: "0"
123
- version:
124
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
+ none: false
125
183
  requirements:
126
184
  - - ">="
127
185
  - !ruby/object:Gem::Version
186
+ hash: 3
187
+ segments:
188
+ - 0
128
189
  version: "0"
129
- version:
130
190
  requirements: []
131
191
 
132
192
  rubyforge_project: rbplusplus
133
- rubygems_version: 1.3.5
193
+ rubygems_version: 1.3.7
134
194
  signing_key:
135
195
  specification_version: 3
136
196
  summary: Ruby library to generate Rice wrapper code
137
197
  test_files:
198
+ - test/allocation_strategies_test.rb
199
+ - test/class_methods_encapsulate_test.rb
200
+ - test/class_methods_test.rb
201
+ - test/classes_test.rb
202
+ - test/compiling_test.rb
203
+ - test/constructors_test.rb
204
+ - test/custom_code_test.rb
205
+ - test/default_arguments_test.rb
206
+ - test/director_test.rb
138
207
  - test/enumerations_test.rb
139
- - test/subclass_test.rb
208
+ - test/extension_test.rb
209
+ - test/file_writers_test.rb
140
210
  - test/function_pointer_test.rb
211
+ - test/function_pointers_classes_test.rb
212
+ - test/functions_test.rb
141
213
  - test/generated/extconf.rb
142
- - test/director_test.rb
214
+ - test/implicit_cast_test.rb
215
+ - test/modules_test.rb
216
+ - test/nested_test.rb
217
+ - test/overloading_test.rb
143
218
  - test/struct_test.rb
144
- - test/functions_test.rb
145
- - test/class_methods_encapsulate_test.rb
146
- - test/compiling_test.rb
147
- - test/file_writers_test.rb
219
+ - test/subclass_test.rb
148
220
  - test/test_helper.rb
149
- - test/custom_code_test.rb
150
- - test/modules_test.rb
151
- - test/allocation_strategies_test.rb
152
- - test/extension_test.rb
153
221
  - test/to_from_ruby_test.rb
154
- - test/class_methods_test.rb
155
- - test/constructors_test.rb
156
- - test/default_arguments_test.rb
157
- - test/overloading_test.rb
158
222
  - test/wrap_as_test.rb
159
- - test/nested_test.rb
160
- - test/classes_test.rb
161
- - test/function_pointers_classes_test.rb
162
- - test/headers/function_pointers.h
163
- - test/headers/external_mapping.h
164
- - test/headers/subclass.h
165
- - test/headers/complex_static_methods.h
166
- - test/headers/needs_code.h
167
- - test/headers/class_methods.h
168
- - test/headers/empty.h
169
- - test/headers/functions.h
170
- - test/headers/function_pointers_class.h
223
+ - test/headers/Adder.cpp
171
224
  - test/headers/Adder.h
225
+ - test/headers/alloc_strats.h
226
+ - test/headers/class_methods.h
227
+ - test/headers/code/custom_to_from_ruby.cpp
228
+ - test/headers/code/custom_to_from_ruby.hpp
229
+ - test/headers/complex_static_methods.h
230
+ - test/headers/constructors.h
231
+ - test/headers/default_arguments.h
172
232
  - test/headers/director.h
173
- - test/headers/nested_classes.h
233
+ - test/headers/empty.h
234
+ - test/headers/enums.h
235
+ - test/headers/external_mapping.h
174
236
  - test/headers/external_mapping_rice.h
175
- - test/headers/default_arguments.h
176
- - test/headers/ugly_interface_ns.h
177
- - test/headers/requires_define.h
178
- - test/headers/constructors.h
179
- - test/headers/code/custom_to_from_ruby.hpp
180
- - test/headers/code/custom_to_from_ruby.cpp
181
- - test/headers/to_from_ruby.h
182
- - test/headers/with_includes.h
237
+ - test/headers/function_pointers.h
238
+ - test/headers/function_pointers_class.h
239
+ - test/headers/functions.h
240
+ - test/headers/implicit_cast.h
183
241
  - test/headers/include/helper.h
184
- - test/headers/enums.h
242
+ - test/headers/needs_code.h
243
+ - test/headers/nested_classes.h
244
+ - test/headers/nested_struct.h
185
245
  - test/headers/overload.h
186
- - test/headers/ugly_interface.h
187
- - test/headers/alloc_strats.h
246
+ - test/headers/requires_define.h
247
+ - test/headers/subclass.h
188
248
  - test/headers/Subtracter.hpp
249
+ - test/headers/to_from_ruby.h
189
250
  - test/headers/to_from_ruby_source.cpp
190
- - test/headers/nested_struct.h
191
- - test/headers/Adder.cpp
251
+ - test/headers/ugly_interface.h
252
+ - test/headers/ugly_interface_ns.h
253
+ - test/headers/with_includes.h
@@ -1,15 +0,0 @@
1
- module RbPlusPlus
2
- class NodeCache #:nodoc:
3
- # Retrieves or initializes a node's information cache
4
- def self.get(node)
5
- demangled = node.attributes['id']
6
- @@nodes ||= {}
7
- @@nodes[demangled] ||= {}
8
- end
9
-
10
- # Clears out the cache
11
- def self.clear
12
- @@nodes = {}
13
- end
14
- end
15
- end