Class: GirFFI::Builders::ArgumentBuilder
Overview
Implements building pre- and post-processing statements for arguments.
Constant Summary
BaseArgumentBuilder::KEYWORDS
Instance Attribute Summary
#arginfo, #array_arg, #length_arg, #related_callback_builder
Instance Method Summary
collapse
#argument_class_name, #array_length_idx, #array_length_parameter?, #call_argument_name, #closure_idx, #destroy_idx, #destroy_notifier?, #direction, #helper_argument?, #initialize, #mark_as_destroy_notifier, #mark_as_user_data, #name, #new_variable, #ownership_transfer, #safe, #specialized_type_tag, #type_info, #user_data?
Instance Method Details
#allow_none? ⇒ Boolean
22
23
24
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 22
def allow_none?
arginfo.may_be_null?
end
|
#block_argument? ⇒ Boolean
18
19
20
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 18
def block_argument?
specialized_type_tag == :callback
end
|
#capture_variable_name ⇒ Object
38
39
40
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 38
def capture_variable_name
nil
end
|
#method_argument_name ⇒ Object
14
15
16
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 14
def method_argument_name
name if has_input_value? && !helper_argument?
end
|
#post_conversion ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 55
def post_conversion
if direction == :error
["GirFFI::ArgHelper.check_error(#{call_argument_name})"]
elsif has_post_conversion?
value = output_value
["#{post_converted_name} = #{value}"]
else
[]
end
end
|
#post_converted_name ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 26
def post_converted_name
@post_converted_name ||= if has_post_conversion?
new_variable
else
call_argument_name
end
end
|
#pre_conversion ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 42
def pre_conversion
case direction
when :in
pre_conversion_in
when :inout
pre_conversion_inout
when :out
pre_conversion_out
when :error
pre_conversion_error
end
end
|
#return_value_name ⇒ Object
34
35
36
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 34
def return_value_name
post_converted_name if has_output_value? && !array_length_parameter?
end
|