Class: GirFFI::Builders::VFuncBuilder
Overview
Implements the creation of a class representing the implementation of a vfunc. This class will be able to turn a proc into an FFI::Function that can serve as such an implementation in C. The class will be namespaced inside class defining the vfunc.
Instance Attribute Summary
#info
Instance Method Summary
collapse
#build_class, #initialize, #instantiate_class
#get_or_define_class, #get_or_define_module, #optionally_define_constant
Instance Method Details
#argument_ffi_types ⇒ Object
44
45
46
47
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 44
def argument_ffi_types
@argument_ffi_types ||= info.argument_ffi_types
.unshift(receiver_type_info.to_callback_ffi_type)
end
|
#container_class ⇒ Object
36
37
38
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 36
def container_class
@container_class ||= Builder.build_class(container_info)
end
|
#container_info ⇒ Object
40
41
42
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 40
def container_info
@container_info ||= info.container
end
|
#klass ⇒ Object
22
23
24
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 22
def klass
@klass ||= get_or_define_class container_class, @classname, CallbackBase
end
|
#mapping_method_definition ⇒ Object
#receiver_type_info ⇒ Object
32
33
34
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 32
def receiver_type_info
ReceiverTypeInfo.new(container_info)
end
|
#return_ffi_type ⇒ Object
49
50
51
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 49
def return_ffi_type
@return_ffi_type ||= info.return_ffi_type
end
|
#setup_class ⇒ Object
17
18
19
20
|
# File 'lib/gir_ffi/builders/vfunc_builder.rb', line 17
def setup_class
setup_constants
klass.class_eval mapping_method_definition, __FILE__, __LINE__
end
|