class GirFFI::Builders::RegisteredTypeBuilder
Base class for type builders building types specified by subtypes of IRegisteredTypeInfo. These are types whose C representation is complex, i.e., a struct or a union.
Public Instance Methods
setup_instance_method(method)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 19 def setup_instance_method(method) method_info = info.find_instance_method method return unless method_info attach_and_define_method method_info, build_class end
setup_method(method)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 13 def setup_method(method) method_info = info.find_method method return unless method_info attach_and_define_method method_info, meta_class end
target_gtype()
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 25 def target_gtype info.g_type end
Private Instance Methods
attach_and_define_method(method_info, modul)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 35 def attach_and_define_method(method_info, modul) method = method_info.safe_name attach_method method_info remove_old_method method, modul define_method method_info method end
attach_method(method_info)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 60 def attach_method(method_info) Builder.attach_ffi_function lib, method_info end
define_method(method_info)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 43 def define_method(method_info) if method_info.constructor? initializer_builder = InitializerBuilder.new(method_info) initializer_name = initializer_builder.method_name.to_sym unless build_class.private_instance_methods(false).include? initializer_name build_class.class_eval initializer_builder.method_definition end build_class.class_eval ConstructorBuilder.new(method_info).method_definition else build_class.class_eval FunctionBuilder.new(method_info).method_definition end end
fields()
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 79 def fields info.fields end
meta_class()
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 31 def meta_class (class << build_class; self; end) end
parent_info()
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 75 def parent_info nil end
remove_old_method(method, modul)
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 56 def remove_old_method(method, modul) modul.class_eval { remove_method method if method_defined? method } end
setup_constants()
click to toggle source
Calls superclass method
GirFFI::BaseTypeBuilder#setup_constants
# File lib/gir_ffi/builders/registered_type_builder.rb, line 70 def setup_constants klass.const_set :G_TYPE, target_gtype super end
stub_methods()
click to toggle source
# File lib/gir_ffi/builders/registered_type_builder.rb, line 64 def stub_methods info.get_methods.each do |minfo| klass.class_eval MethodStubber.new(minfo).method_stub end end