Class: GirFFI::ArgumentBuilder
- Inherits:
-
BaseArgumentBuilder
- Object
- BaseArgumentBuilder
- GirFFI::ArgumentBuilder
- Defined in:
- lib/gir_ffi/argument_builder.rb
Overview
Implements building pre- and post-processing statements for arguments.
Constant Summary
Constants inherited from BaseArgumentBuilder
BaseArgumentBuilder::KEYWORDS, BaseArgumentBuilder::TAG_TO_WRAPPER_CLASS_MAP
Instance Attribute Summary
Attributes inherited from BaseArgumentBuilder
#array_arg, #length_arg, #name
Instance Method Summary collapse
- #inarg ⇒ Object
-
#initialize(var_gen, arginfo) ⇒ ArgumentBuilder
constructor
A new instance of ArgumentBuilder.
- #post ⇒ Object
- #pre ⇒ Object
- #retname ⇒ Object
Methods inherited from BaseArgumentBuilder
#argument_class_name, #array_size, #callarg, #cleanup, #elm_t, #retval, #safe, #specialized_type_tag, #subtype_tag_or_class_name, #type_info
Constructor Details
#initialize(var_gen, arginfo) ⇒ ArgumentBuilder
Returns a new instance of ArgumentBuilder.
6 7 8 9 |
# File 'lib/gir_ffi/argument_builder.rb', line 6 def initialize var_gen, arginfo super var_gen, arginfo.name, arginfo.argument_type, arginfo.direction @arginfo = arginfo end |
Instance Method Details
#inarg ⇒ Object
11 12 13 14 15 |
# File 'lib/gir_ffi/argument_builder.rb', line 11 def inarg if has_input_value? @array_arg.nil? ? @name : nil end end |
#post ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/gir_ffi/argument_builder.rb', line 33 def post if has_output_value? value = output_value ["#{retname} = #{value}"] else [] end end |
#pre ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/gir_ffi/argument_builder.rb', line 23 def pre pr = [] if has_input_value? pr << fixed_array_size_check if needs_size_check? pr << array_length_assignment if is_array_length_parameter? end pr << set_function_call_argument pr end |
#retname ⇒ Object
17 18 19 20 21 |
# File 'lib/gir_ffi/argument_builder.rb', line 17 def retname if has_output_value? @retname ||= @var_gen.new_var end end |