Sha256: 36b39b11758cf28a1d6f6afd551e161ec01c360d2c06b8945b7fd532b0ecf9a8
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true require 'gir_ffi/class_base' module GirFFI # Base class for all generated classes of type :object. class ObjectBase < ClassBase extend FFI::DataConverter def object_class self.class.object_class end def self.native_type FFI::Type::POINTER end def self.to_ffi_type self end def self.to_native(it, _) it.to_ptr end def self.get_value_from_pointer(pointer, offset = 0) pointer.get_pointer offset end def self.copy_value_to_pointer(value, pointer, offset = 0) pointer.put_pointer offset, value.to_ptr end # Wrap the passed pointer in an instance of its type's corresponding class, # generally assumed to be a descendant of the current type. def self.wrap(ptr) ptr.to_object end def self.copy_from(val) val.ref if val end # # Find property info for the named property. # # @param name The property's name # # @return [GObjectIntrospection::IPropertyInfo] The property's info # 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. # # @param name The signal's name # # @return [GObjectIntrospection::ISignalInfo] The signal's info # def self.find_signal(name) gir_ffi_builder.find_signal name or raise GirFFI::SignalNotFoundError.new(name, self) end 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 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.12.1 | lib/gir_ffi/object_base.rb |
gir_ffi-0.11.4 | lib/gir_ffi/object_base.rb |
gir_ffi-0.11.3 | lib/gir_ffi/object_base.rb |
gir_ffi-0.11.2 | lib/gir_ffi/object_base.rb |