class GirFFI::Builders::RegisteredTypeBuilder

Base class for type builders building types specified by subtypes of IRegisteredTypeInfo. These are types whose C representation is complex, i.e., a struct or a union.

Private Instance Methods

fields() click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 41
def fields
  info.fields
end
parent() click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 37
def parent
  nil
end
provide_constructor() click to toggle source

FIXME: Only used in some of the subclases. Make mixin?

# File lib/gir_ffi/builders/registered_type_builder.rb, line 29
def provide_constructor
  return if info.find_method 'new'

  (class << @klass; self; end).class_eval {
    alias_method :new, :_allocate
  }
end
setup_gtype_getter() click to toggle source

TODO: Rename the created method, or use a constant. FIXME: Only used in some of the subclases. Make mixin?

# File lib/gir_ffi/builders/registered_type_builder.rb, line 18
def setup_gtype_getter
  gtype = target_gtype
  return if gtype.nil?
  @klass.instance_eval "
    def self.get_gtype
      #{gtype}
    end
  "
end
superclass() click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 45
def superclass
  ClassBase
end
target_gtype() click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 12
def target_gtype
  info.g_type
end