class GirFFI::Builders::FlagsBuilder

Implements the creation of a flags type. The type will be attached to the appropriate namespace module, and will be defined as a bit_mask for FFI.

Public Instance Methods

setup_ffi_type() click to toggle source
# File lib/gir_ffi/builders/flags_builder.rb, line 12
def setup_ffi_type
  optionally_define_constant klass, :BitMask do
    lib.bit_mask(enum_sym, value_spec)
  end
end
superclass() click to toggle source
# File lib/gir_ffi/builders/flags_builder.rb, line 25
def superclass
  FlagsBase
end
value_spec() click to toggle source
# File lib/gir_ffi/builders/flags_builder.rb, line 18
def value_spec
  info.values.map do |vinfo|
    val = GirFFI::ArgHelper.cast_uint32_to_int32(vinfo.value)
    { vinfo.name.to_sym => val }
  end.reduce(:merge)
end