Class: GirFFI::ObjectBase
- Inherits:
-
ClassBase
show all
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/gir_ffi/object_base.rb
Overview
Base class for all generated classes of type :object.
Constant Summary
Constants inherited
from ClassBase
ClassBase::GIR_FFI_BUILDER
Instance Attribute Summary
Attributes inherited from ClassBase
#struct
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from ClassBase
#==, direct_wrap, from, #setup_and_call, setup_and_call, setup_instance_method, setup_method, try_in_ancestors
#gtype
Methods included from TypeBase
#gir_ffi_builder, #gir_info
Class Method Details
.copy_from(val) ⇒ Object
39
40
41
|
# File 'lib/gir_ffi/object_base.rb', line 39
def self.copy_from(val)
val.ref if val
end
|
.copy_value_to_pointer(value, pointer, offset = 0) ⇒ Object
29
30
31
|
# File 'lib/gir_ffi/object_base.rb', line 29
def self.copy_value_to_pointer(value, pointer, offset = 0)
pointer.put_pointer offset, value.to_ptr
end
|
Find property info for the named property.
50
51
52
53
|
# File 'lib/gir_ffi/object_base.rb', line 50
def self.find_property(name)
gir_ffi_builder.find_property name or
raise GirFFI::PropertyNotFoundError.new(name, self)
end
|
Find signal info for the named signal.
62
63
64
65
|
# File 'lib/gir_ffi/object_base.rb', line 62
def self.find_signal(name)
gir_ffi_builder.find_signal name or
raise GirFFI::SignalNotFoundError.new(name, self)
end
|
.get_value_from_pointer(pointer, offset = 0) ⇒ Object
25
26
27
|
# File 'lib/gir_ffi/object_base.rb', line 25
def self.get_value_from_pointer(pointer, offset = 0)
pointer.get_pointer offset
end
|
.native_type ⇒ Object
13
14
15
|
# File 'lib/gir_ffi/object_base.rb', line 13
def self.native_type
FFI::Type::POINTER
end
|
.object_class ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/gir_ffi/object_base.rb', line 67
def self.object_class
@object_class ||=
begin
ptr = GObject::Lib.g_type_class_ref(gtype)
gir_ffi_builder.object_class_struct.wrap ptr
end
end
|
.to_ffi_type ⇒ Object
17
18
19
|
# File 'lib/gir_ffi/object_base.rb', line 17
def self.to_ffi_type
self
end
|
.to_native(it, _) ⇒ Object
21
22
23
|
# File 'lib/gir_ffi/object_base.rb', line 21
def self.to_native(it, _)
it.to_ptr
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.
35
36
37
|
# File 'lib/gir_ffi/object_base.rb', line 35
def self.wrap(ptr)
ptr.to_object
end
|
Instance Method Details
#object_class ⇒ Object
9
10
11
|
# File 'lib/gir_ffi/object_base.rb', line 9
def object_class
self.class.object_class
end
|