Sha256: 6bf108a83f83f715afa480d85de9911a7b86338da33b4ed35af8603dbb023810

Contents?: true

Size: 703 Bytes

Versions: 3

Compression:

Stored size: 703 Bytes

Contents

require 'gir_ffi/builders/boxed_builder'
require 'gir_ffi/struct_base'

module GirFFI
  module Builders
    # Implements the creation of a class representing a Struct.
    class StructBuilder < BoxedBuilder
      def layout_superclass
        FFI::Struct
      end

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 lib/gir_ffi/builders/struct_builder.rb
gir_ffi-0.9.1 lib/gir_ffi/builders/struct_builder.rb
gir_ffi-0.9.0 lib/gir_ffi/builders/struct_builder.rb