module GirFFI::EnumLikeBase

Base module for enums and flags.

Public Instance Methods

copy_value_to_pointer(value, pointer, offset = 0) click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 25
def copy_value_to_pointer(value, pointer, offset = 0)
  pointer.put_int32 offset, to_native(value, nil)
end
get_value_from_pointer(pointer, offset) click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 29
def get_value_from_pointer(pointer, offset)
  from_native pointer.get_int32(offset), nil
end
setup_and_call(method, arguments, &block) click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 33
def setup_and_call(method, arguments, &block)
  result = setup_method method.to_s

  raise "Unable to set up method #{method} in #{self}" unless result

  send method, *arguments, &block
end
size() click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 21
def size
  native_type.size
end
to_callback_ffi_type() click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 45
def to_callback_ffi_type
  :int32
end
to_ffi_type() click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 41
def to_ffi_type
  self
end
to_int(arg) click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 17
def to_int(arg)
  to_native arg, nil
end
wrap(arg) click to toggle source
# File lib/gir_ffi/enum_like_base.rb, line 13
def wrap(arg)
  from_native arg, nil
end