Class: GirFFI::StructBase
- Inherits:
-
ClassBase
show all
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/gir_ffi/struct_base.rb
Overview
Base class for generated classes representing GLib structs.
Constant Summary
Constants inherited
from ClassBase
ClassBase::GIR_FFI_BUILDER
Instance Attribute Summary
Attributes inherited from ClassBase
#struct
Class Method Summary
collapse
Methods inherited from ClassBase
#==, _allocate, constructor_wrap, direct_wrap, from, #setup_and_call, setup_and_call, setup_instance_method, setup_method, try_in_ancestors, wrap
#get_gtype
Methods included from TypeBase
#gir_ffi_builder, #gir_info
Class Method Details
.copy_value_to_pointer(value, pointer, offset = 0) ⇒ Object
24
25
26
27
|
# File 'lib/gir_ffi/struct_base.rb', line 24
def self.copy_value_to_pointer value, pointer, offset=0
size = self::Struct.size
pointer.put_bytes offset, value.to_ptr.read_bytes(size), 0, size
end
|
.get_value_from_pointer(pointer) ⇒ Object
20
21
22
|
# File 'lib/gir_ffi/struct_base.rb', line 20
def self.get_value_from_pointer pointer
pointer.to_ptr
end
|
.native_type ⇒ Object
8
9
10
|
# File 'lib/gir_ffi/struct_base.rb', line 8
def self.native_type
FFI::Type::Struct.new(self::Struct)
end
|
.to_ffitype ⇒ Object
12
13
14
|
# File 'lib/gir_ffi/struct_base.rb', line 12
def self.to_ffitype
self
end
|
.to_native(value, _context) ⇒ Object
16
17
18
|
# File 'lib/gir_ffi/struct_base.rb', line 16
def self.to_native value, _context
value.struct
end
|