Sha256: ae411977c8fe91af8e93b8c838f497a6ee65d4e5b2a7b909a3498e208db49ce4
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module GirFFI module Builder module Type # Implements the creation of classes representing types with layout, # i.e., :union, :struct, :object. module WithLayout private # TODO: Move to client classes. def setup_class setup_layout setup_constants stub_methods setup_gtype_getter end def setup_layout spec = layout_specification @structklass.class_eval { layout(*spec) } end def layout_specification fields = info.fields if fields.empty? if parent return [:parent, superclass.const_get(:Struct), 0] else return [:dummy, :char, 0] end end fields.inject([]) do |spec, finfo| spec + [ finfo.name.to_sym, itypeinfo_to_ffitype_for_struct(finfo.field_type), finfo.offset ] end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.1.0 | lib/gir_ffi/builder/type/with_layout.rb |
gir_ffi-0.0.14 | lib/gir_ffi/builder/type/with_layout.rb |