Module: GirFFI::FFIExt::Pointer

Defined in:
lib/gir_ffi/ffi_ext/pointer.rb

Overview

Extensions to FFI::Pointer

Instance Method Summary collapse

Instance Method Details

#to_objectObject

FIXME: Should probably not be here.



16
17
18
19
20
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 16

def to_object
  return nil if null?
  gtype = GObject.type_from_instance_pointer self
  Builder.build_by_gtype(gtype).direct_wrap self
end

#to_ptrObject



7
8
9
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 7

def to_ptr
  self
end

#to_utf8Object



22
23
24
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 22

def to_utf8
  null? ? nil : read_string.force_encoding('utf-8')
end

#zero?Boolean

Returns:



11
12
13
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 11

def zero?
  null?
end