Class: GirFFI::ObjectBase

Inherits:
ClassBase show all
Defined in:
lib/gir_ffi/object_base.rb

Overview

Base class for all generated classes of type :object.

Class Method Summary collapse

Methods inherited from ClassBase

_builder, _setup_instance_method, _setup_method, allocate, direct_wrap, ffi_structure, from, gir_ffi_builder, gir_info, setup_and_call, #setup_and_call, setup_instance_method, setup_method

Class Method Details

.constructor_wrap(ptr) ⇒ Object

Wraps a pointer retrieved from a constructor method. Here, it is simply defined as a wrapper around direct_wrap, but, e.g., InitiallyUnowned overrides it to sink the floating object.

Unlike wrap, this method assumes the pointer will always be of the type corresponding to the current class, and never of a subtype.

Parameters:

  • ptr

    Pointer to the object’s C structure

Returns:

  • An object of the current class wrapping the pointer



16
17
18
# File 'lib/gir_ffi/object_base.rb', line 16

def self.constructor_wrap ptr
  direct_wrap ptr
end

.find_property(name) ⇒ GObjectIntrospection::IPropertyInfo

Find property info for the named property.

Parameters:

  • name

    The property’s name

Returns:



33
34
35
# File 'lib/gir_ffi/object_base.rb', line 33

def self.find_property name
  gir_ffi_builder.find_property name
end

.find_signal(name) ⇒ GObjectIntrospection::ISignalInfo

Find signal info for the named signal.

Parameters:

  • name

    The signal’s name

Returns:



44
45
46
# File 'lib/gir_ffi/object_base.rb', line 44

def self.find_signal name
  gir_ffi_builder.find_signal name
end

.wrap(ptr) ⇒ Object

Wrap the passed pointer in an instance of its type’s corresponding class, generally assumed to be a descendant of the current type.



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

def self.wrap ptr
  GirFFI::ArgHelper.object_pointer_to_object ptr
end