class GirFFI::BoxedBase
Base class for generated classes representing boxed types.
Public Class Methods
copy_value_to_pointer(value, pointer, offset = 0)
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 24 def self.copy_value_to_pointer(value, pointer, offset = 0) size = self::Struct.size bytes = if value value.to_ptr.read_bytes(size) else "\x00" * size end pointer.put_bytes offset, bytes, 0, size end
get_value_from_pointer(pointer, offset)
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 20 def self.get_value_from_pointer(pointer, offset) pointer + offset end
native_type()
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 8 def self.native_type FFI::Type::Struct.new(self::Struct) end
new()
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 34 def initialize @struct = self.class::Struct.new end
to_ffi_type()
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 12 def self.to_ffi_type self end
to_native(value, _context)
click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 16 def self.to_native(value, _context) value.struct end