Class: Rbind::GeneratorC::ConversionsHelperHDR

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) ⇒ ConversionsHelperHDR

Returns a new instance of ConversionsHelperHDR.



101
102
103
104
105
# File 'lib/rbind/generator_c.rb', line 101

def initialize(name,root)
    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



107
108
109
# File 'lib/rbind/generator_c.rb', line 107

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

#type_typedef(t) ⇒ Object



111
112
113
# File 'lib/rbind/generator_c.rb', line 111

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

#wrap_conversionsObject



115
116
117
118
119
120
121
122
123
# File 'lib/rbind/generator_c.rb', line 115

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