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.



99
100
101
102
103
# File 'lib/rbind/generator_c.rb', line 99

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



105
106
107
# File 'lib/rbind/generator_c.rb', line 105

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

#type_typedef(t) ⇒ Object



109
110
111
# File 'lib/rbind/generator_c.rb', line 109

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

#wrap_conversionsObject



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

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