Class: GirFFI::Builders::CallbackArgumentBuilder
Overview
Convertor for arguments for ruby callbacks. Used when building the argument mapper for callbacks.
Constant Summary
BaseArgumentBuilder::KEYWORDS
Instance Attribute Summary
#arginfo, #array_arg, #length_arg
Instance Method Summary
collapse
#argument_class_name, #array_length_idx, #closure=, #closure?, #direction, #initialize, #name, #new_variable, #safe, #specialized_type_tag, #type_info
Instance Method Details
#call_argument_name ⇒ Object
28
29
30
31
32
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 28
def call_argument_name
if [:in, :inout].include? direction
pre_converted_name unless array_arg
end
end
|
#capture_variable_name ⇒ Object
34
35
36
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 34
def capture_variable_name
result_name if [:out, :inout].include? direction unless array_arg
end
|
#method_argument_name ⇒ Object
11
12
13
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 11
def method_argument_name
@method_argument_name ||= name || new_variable
end
|
#out_parameter_name ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 19
def out_parameter_name
@out_parameter_name ||=
if direction == :inout
new_variable
else
pre_converted_name
end
end
|
#post_conversion ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 51
def post_conversion
case direction
when :out, :inout
[outgoing_post_conversion]
when :error
[
"rescue => #{result_name}",
outgoing_post_conversion,
'end'
]
else
[]
end
end
|
#pre_conversion ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 38
def pre_conversion
case direction
when :in
[ingoing_pre_conversion]
when :out
[out_parameter_preparation]
when :inout
[out_parameter_preparation, ingoing_pre_conversion]
when :error
[out_parameter_preparation, 'begin']
end
end
|
#pre_converted_name ⇒ Object
15
16
17
|
# File 'lib/gir_ffi/builders/callback_argument_builder.rb', line 15
def pre_converted_name
@pre_converted_name ||= new_variable
end
|