Class: Rbind::GeneratorC::ConversionsHelperHDR
Instance Attribute Summary
Attributes inherited from HelperBase
#extern_types, #includes, #name
Instance Method Summary
collapse
Methods inherited from HelperBase
#binding, #wrap_includes
Constructor Details
Returns a new instance of ConversionsHelperHDR.
110
111
112
113
114
|
# File 'lib/rbind/generator_c.rb', line 110
def initialize(name,root,extern_types)
super
@type_conversion = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_conversion.hpp")).read,nil,'-')
@type_typedef = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_typedef.h")).read)
end
|
Instance Method Details
#type_conversion(t) ⇒ Object
116
117
118
|
# File 'lib/rbind/generator_c.rb', line 116
def type_conversion(t)
@type_conversion.result(t.binding)
end
|
#type_typedef(t) ⇒ Object
120
121
122
|
# File 'lib/rbind/generator_c.rb', line 120
def type_typedef(t)
@type_typedef.result(t.binding)
end
|
#wrap_conversions ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# File 'lib/rbind/generator_c.rb', line 124
def wrap_conversions
str = ""
@extern_types.each do |type|
str += type_typedef(type) if type.typedef?
next if type.basic_type?
str += type_conversion(type)
end
@root.each_type do |type|
str += type_typedef(type) if type.typedef?
next if type.basic_type?
str += type_conversion(type)
end
str
end
|