Class: Rbind::GeneratorC::TypesHelperHDR

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

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

Returns a new instance of TypesHelperHDR.



35
36
37
38
39
# File 'lib/rbind/generator_c.rb', line 35

def initialize(name, root,extern_types)
    raise "wrong type #{root}" unless root.is_a? RDataType
    super
    @type_wrapper = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_wrapper.h")).read,nil,"-")
end

Instance Method Details

#cdelete_methodObject



41
42
43
# File 'lib/rbind/generator_c.rb', line 41

def cdelete_method
    @root.cdelete_method
end

#type_wrapper(t) ⇒ Object



45
46
47
# File 'lib/rbind/generator_c.rb', line 45

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

#wrap_typesObject



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rbind/generator_c.rb', line 49

def wrap_types
    str = ""
    @extern_types.each do |type|
        next if type.basic_type?
        str += type_wrapper(type)
    end
    @root.each_type do |type|
        next if type.basic_type?
        str += type_wrapper(type)
    end
    str
end