Class: Rbind::GeneratorC::ConversionsHelper

Inherits:
HelperBase
  • Object
show all
Defined in:
lib/rbind/generator_c.rb

Instance Attribute Summary

Attributes inherited from HelperBase

#includes, #name

Instance Method Summary collapse

Methods inherited from HelperBase

#binding, #wrap_includes

Constructor Details

#initialize(name, root) ⇒ ConversionsHelper

Returns a new instance of ConversionsHelper.



125
126
127
128
# File 'lib/rbind/generator_c.rb', line 125

def initialize(name,root)
    super
    @type_conversion = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_conversion.cc")).read,nil,'-')
end

Instance Method Details

#check_type?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/rbind/generator_c.rb', line 134

def check_type?
    type_check?
end

#type_conversion(t) ⇒ Object



130
131
132
# File 'lib/rbind/generator_c.rb', line 130

def type_conversion(t)
    @type_conversion.result(t.binding)
end

#wrap_conversionsObject



138
139
140
141
142
143
144
145
# File 'lib/rbind/generator_c.rb', line 138

def wrap_conversions
    str = ""
    @root.each_type do |type|
        next if type.basic_type?
        str += type_conversion(type)
    end
    str
end