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, #initialize, 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_value_to_pointer(value, pointer, offset = 0) ⇒ Object
28
29
30
|
# File 'lib/gir_ffi/object_base.rb', line 28
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.
45
46
47
48
|
# File 'lib/gir_ffi/object_base.rb', line 45
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.
57
58
59
60
|
# File 'lib/gir_ffi/object_base.rb', line 57
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
24
25
26
|
# File 'lib/gir_ffi/object_base.rb', line 24
def self.get_value_from_pointer(pointer, offset = 0)
pointer.get_pointer offset
end
|
.native_type ⇒ Object
12
13
14
|
# File 'lib/gir_ffi/object_base.rb', line 12
def self.native_type
FFI::Type::POINTER
end
|
.object_class ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/gir_ffi/object_base.rb', line 62
def self.object_class
@object_class ||=
begin
ptr = GObject.type_class_ref(gtype).to_ptr
gir_ffi_builder.object_class_struct.wrap ptr
end
end
|
.to_ffi_type ⇒ Object
16
17
18
|
# File 'lib/gir_ffi/object_base.rb', line 16
def self.to_ffi_type
self
end
|
.to_native(it, _) ⇒ Object
20
21
22
|
# File 'lib/gir_ffi/object_base.rb', line 20
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.
34
35
36
|
# File 'lib/gir_ffi/object_base.rb', line 34
def self.wrap(ptr)
ptr.to_object
end
|
Instance Method Details
#object_class ⇒ Object
8
9
10
|
# File 'lib/gir_ffi/object_base.rb', line 8
def object_class
self.class.object_class
end
|