Class: GirFFI::Builders::StructBuilder

Inherits:
BoxedBuilder show all
Defined in:
lib/gir_ffi/builders/struct_builder.rb

Overview

Implements the creation of a class representing a Struct.

Instance Attribute Summary

Attributes inherited from GirFFI::BaseTypeBuilder

#info

Instance Method Summary collapse

Methods included from WithLayout

#layout_specification

Methods inherited from RegisteredTypeBuilder

#setup_instance_method, #setup_method, #target_gtype

Methods inherited from GirFFI::BaseTypeBuilder

#build_class, #initialize, #instantiate_class

Methods included from GirFFI::BuilderHelper

#get_or_define_class, #get_or_define_module, #optionally_define_constant

Constructor Details

This class inherits a constructor from GirFFI::BaseTypeBuilder

Instance Method Details

#layout_superclassObject



8
9
10
# File 'lib/gir_ffi/builders/struct_builder.rb', line 8

def layout_superclass
  FFI::Struct
end

#superclassObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gir_ffi/builders/struct_builder.rb', line 12

def superclass
  if info.gtype_struct?
    # HACK: Inheritance chain is not expressed in GObject's code correctly.
    if info.full_type_name == 'GObject::InitiallyUnownedClass'
      return GObject::ObjectClass
    else
      type = fields.first.field_type
      return type.tag_or_class if type.tag == :interface
    end
  end

  StructBase
end