Class: Rbind::GeneratorC::TypesHelper

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

Returns a new instance of TypesHelper.



64
65
66
67
# File 'lib/rbind/generator_c.rb', line 64

def initialize(name, root,extern_types)
    super
    @type_wrapper = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_delete.h")).read)
end

Instance Method Details

#cdelete_methodObject



69
70
71
# File 'lib/rbind/generator_c.rb', line 69

def cdelete_method
    @root.cdelete_method
end

#type_wrapper(t) ⇒ Object



73
74
75
# File 'lib/rbind/generator_c.rb', line 73

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

#wrap_typesObject



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rbind/generator_c.rb', line 77

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