Class: GirFFI::Builders::CallbackBuilder
Overview
Implements the creation of a callback type. The type will be attached to the appropriate namespace module, and will be defined as a callback for FFI.
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
37
38
39
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 37
def argument_ffi_types
@argument_ffi_types ||= @info.argument_ffi_types
end
|
#callback_sym ⇒ Object
33
34
35
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 33
def callback_sym
@classname.to_sym
end
|
#klass ⇒ Object
25
26
27
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 25
def klass
@klass ||= get_or_define_class namespace_module, @classname, CallbackBase
end
|
#mapping_method_definition ⇒ Object
#return_ffi_type ⇒ Object
41
42
43
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 41
def return_ffi_type
@return_ffi_type ||= @info.return_ffi_type
end
|
#setup_callback ⇒ Object
19
20
21
22
23
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 19
def setup_callback
optionally_define_constant klass, :Callback do
lib.callback callback_sym, argument_ffi_types, return_ffi_type
end
end
|
#setup_class ⇒ Object
13
14
15
16
17
|
# File 'lib/gir_ffi/builders/callback_builder.rb', line 13
def setup_class
setup_callback
setup_constants
klass.class_eval mapping_method_definition, __FILE__, __LINE__
end
|