class GObjectIntrospection::Strv

Represents a null-terminated array of strings. GLib uses this construction, but does not provide any actual functions for this class.

Constants

POINTER_SIZE

Public Class Methods

new(ptr) click to toggle source
# File lib/ffi-gobject_introspection/strv.rb, line 14
def initialize(ptr)
  @ptr = ptr
end
wrap(ptr) click to toggle source
# File lib/ffi-gobject_introspection/strv.rb, line 30
def self.wrap(ptr)
  new ptr
end

Public Instance Methods

each() { |read_string| ... } click to toggle source
# File lib/ffi-gobject_introspection/strv.rb, line 22
def each
  offset = 0
  while (ptr = fetch_ptr offset)
    offset += POINTER_SIZE
    yield ptr.read_string
  end
end
to_ptr() click to toggle source
# File lib/ffi-gobject_introspection/strv.rb, line 18
def to_ptr
  @ptr
end

Private Instance Methods

fetch_ptr(offset) click to toggle source
# File lib/ffi-gobject_introspection/strv.rb, line 36
def fetch_ptr(offset)
  return if @ptr.null?

  ptr = @ptr.get_pointer offset
  ptr unless ptr.null?
end