class GObjectIntrospection::IRepository

The Gobject Introspection Repository. This class is the point of access to the introspection typelibs. This class wraps the GIRepository struct.

Constants

TYPEMAP

Map info type to class. Default is IBaseInfo. SMELL: This doesn't really belong here, since it is used by IBaseInfo and descendants as well.

Public Class Methods

default() click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 62
def self.default
  instance
end
new() click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 56
def initialize
  @gobj = Lib.g_irepository_get_default
end
prepend_search_path(path) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 66
def self.prepend_search_path(path)
  Lib.g_irepository_prepend_search_path path
end
type_tag_to_string(type) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 70
def self.type_tag_to_string(type)
  Lib.g_type_tag_to_string type
end
wrap_ibaseinfo_pointer(ptr) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 121
def self.wrap_ibaseinfo_pointer(ptr)
  return nil if ptr.null?
  type = Lib.g_base_info_get_type ptr
  klass = TYPEMAP[type]
  klass.wrap ptr
end

Public Instance Methods

dependencies(namespace) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 107
def dependencies(namespace)
  strv_p = Lib.g_irepository_get_dependencies(@gobj, namespace)
  strv = GLib::Strv.new strv_p
  strv.to_a
end
find_by_gtype(gtype) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 102
def find_by_gtype(gtype)
  raise ArgumentError, "Type #{gtype} is not a valid type" if gtype == 0
  wrap_info Lib.g_irepository_find_by_gtype(@gobj, gtype)
end
find_by_name(namespace, name) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 98
def find_by_name(namespace, name)
  wrap_info Lib.g_irepository_find_by_name(@gobj, namespace, name)
end
info(namespace, index) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 87
def info(namespace, index)
  wrap_info Lib.g_irepository_get_info(@gobj, namespace, index)
end
infos(namespace) click to toggle source

Utility method

# File lib/ffi-gobject_introspection/i_repository.rb, line 92
def infos(namespace)
  (0..(n_infos(namespace) - 1)).map do |idx|
    info namespace, idx
  end
end
n_infos(namespace) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 83
def n_infos(namespace)
  Lib.g_irepository_get_n_infos @gobj, namespace
end
require(namespace, version = nil, flags = 0) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 74
def require(namespace, version = nil, flags = 0)
  errpp = FFI::MemoryPointer.new(:pointer).write_pointer nil

  Lib.g_irepository_require @gobj, namespace, version, flags, errpp

  errp = errpp.read_pointer
  raise GError.new(errp).message unless errp.null?
end
shared_library(namespace) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 113
def shared_library(namespace)
  Lib.g_irepository_get_shared_library @gobj, namespace
end
version(namespace) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 117
def version(namespace)
  Lib.g_irepository_get_version @gobj, namespace
end

Private Instance Methods

wrap_info(ptr) click to toggle source
# File lib/ffi-gobject_introspection/i_repository.rb, line 130
def wrap_info(ptr)
  self.class.wrap_ibaseinfo_pointer ptr
end