Sha256: 0cce57d79b6bf805707baf06d3cfda0b14ac7c2782a29c381cbc856c27d5c00c
Contents?: true
Size: 804 Bytes
Versions: 3
Compression:
Stored size: 804 Bytes
Contents
require 'gir_ffi/class_base' module GirFFI # Base class for generated classes representing boxed types. class BoxedBase < ClassBase extend FFI::DataConverter def self.native_type FFI::Type::Struct.new(self::Struct) end def self.to_ffi_type self end def self.to_native(value, _context) value.struct end def self.get_value_from_pointer(pointer, offset) pointer + offset end 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 def initialize @struct = self.class::Struct.new end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.8.6 | lib/gir_ffi/boxed_base.rb |
gir_ffi-0.8.5 | lib/gir_ffi/boxed_base.rb |
gir_ffi-0.8.4 | lib/gir_ffi/boxed_base.rb |