Class: Rbind::GeneratorC::ConversionsHelper
Instance Attribute Summary
Attributes inherited from HelperBase
#extern_types, #includes, #name
Instance Method Summary
collapse
Methods inherited from HelperBase
#binding, #wrap_includes
Constructor Details
#initialize(name, root, extern_types) ⇒ ConversionsHelper
141
142
143
144
|
# File 'lib/rbind/generator_c.rb', line 141
def initialize(name,root,extern_types)
super
@type_conversion = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_conversion.cc")).read,nil,'-')
end
|
Instance Method Details
#type_conversion(t) ⇒ Object
146
147
148
|
# File 'lib/rbind/generator_c.rb', line 146
def type_conversion(t)
@type_conversion.result(t.binding)
end
|
#wrap_conversions ⇒ Object
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/rbind/generator_c.rb', line 150
def wrap_conversions
str = ""
@extern_types.each do |type|
next if type.basic_type?
str += type_conversion(type)
end
@root.each_type do |type|
next if type.basic_type?
str += type_conversion(type)
end
str
end
|