Module: GirFFI::FFIExt::Pointer

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

Instance Method Summary collapse

Instance Method Details

#to_objectObject



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

def to_object
  gtype = GObject.type_from_instance_pointer self
  wrap_by_gtype gtype
end

#to_ptrObject



4
5
6
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 4

def to_ptr
  self
end

#to_utf8Object



24
25
26
# File 'lib/gir_ffi/ffi_ext/pointer.rb', line 24

def to_utf8
  null? ? nil : read_string
end

#to_valueObject



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

def to_value
  self
end

#wrap_by_gtype(gtype) ⇒ Object



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

def wrap_by_gtype gtype
  return nil if self.null?
  klass = Builder.build_by_gtype gtype
  klass.direct_wrap self
end