class GObject::Value

Overrides for GValue, GObject's generic value container structure.

Constants

CLASS_TO_GTYPE_MAP
METHOD_MAP

Public Class Methods

copy_value_to_pointer(value, pointer, offset = 0) click to toggle source
# File lib/ffi-gobject/value.rb, line 64
def self.copy_value_to_pointer(value, pointer, offset = 0)
  target = wrap(pointer + offset)
  target.init(value.current_gtype)
  Lib.g_value_copy value, target unless value.uninitialized?
end
for_gtype(gtype) click to toggle source
# File lib/ffi-gobject/value.rb, line 50
def self.for_gtype(gtype)
  new.tap do |it|
    it.init gtype
  end
end
from(val) click to toggle source
# File lib/ffi-gobject/value.rb, line 41
def self.from(val)
  case val
  when self
    val
  else
    wrap_ruby_value val
  end
end
wrap_instance(instance) click to toggle source

TODO: Combine with wrap_ruby_value

# File lib/ffi-gobject/value.rb, line 57
def self.wrap_instance(instance)
  new.tap do |it|
    it.init GObject.type_from_instance instance
    it.set_instance instance
  end
end
wrap_ruby_value(val) click to toggle source

TODO: Give more generic name

# File lib/ffi-gobject/value.rb, line 37
def self.wrap_ruby_value(val)
  new.tap { |gv| gv.__send__ :set_ruby_value, val }
end