Class: GirFFI::Builders::FieldBuilder::GetterArgumentBuilder
- Inherits:
-
BaseArgumentBuilder
- Object
- BaseArgumentBuilder
- GirFFI::Builders::FieldBuilder::GetterArgumentBuilder
- Defined in:
- lib/gir_ffi/builders/field_builder.rb
Overview
Convertor for fields for field getters. Used when building getter methods.
Constant Summary
Constants inherited from BaseArgumentBuilder
Instance Attribute Summary collapse
-
#array_length_idx ⇒ Object
readonly
Returns the value of attribute array_length_idx.
Attributes inherited from BaseArgumentBuilder
#arginfo, #array_arg, #length_arg, #related_callback_builder
Instance Method Summary collapse
- #capture_variable_name ⇒ Object
-
#initialize(var_gen, field_argument_info, field_info, array_length_idx: -1)) ⇒ GetterArgumentBuilder
constructor
A new instance of GetterArgumentBuilder.
- #post_conversion ⇒ Object
- #post_converted_name ⇒ Object
- #pre_conversion ⇒ Object
- #return_value_name ⇒ Object
Methods inherited from BaseArgumentBuilder
#argument_class_name, #array_length_parameter?, #call_argument_name, #closure_idx, #destroy_idx, #destroy_notifier?, #direction, #helper_argument?, #mark_as_destroy_notifier, #mark_as_user_data, #name, #new_variable, #ownership_transfer, #safe, #specialized_type_tag, #type_info, #user_data?
Constructor Details
#initialize(var_gen, field_argument_info, field_info, array_length_idx: -1)) ⇒ GetterArgumentBuilder
Returns a new instance of GetterArgumentBuilder.
19 20 21 22 23 24 25 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 19 def initialize(var_gen, field_argument_info, field_info, array_length_idx: -1) super(var_gen, field_argument_info) @field_info = field_info @length_arg = NullArgumentBuilder.new @array_length_idx = array_length_idx end |
Instance Attribute Details
#array_length_idx ⇒ Object (readonly)
Returns the value of attribute array_length_idx.
17 18 19 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 17 def array_length_idx @array_length_idx end |
Instance Method Details
#capture_variable_name ⇒ Object
34 35 36 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 34 def capture_variable_name nil end |
#post_conversion ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 50 def post_conversion if has_post_conversion? ["#{post_converted_name} = #{post_convertor.conversion}"] else [] end end |
#post_converted_name ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 38 def post_converted_name @post_converted_name ||= if has_post_conversion? new_variable else end end |
#pre_conversion ⇒ Object
27 28 29 30 31 32 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 27 def pre_conversion [ "#{field_ptr} = @struct.to_ptr", "#{} = #{pointer_to_value_conversion}" ] end |
#return_value_name ⇒ Object
46 47 48 |
# File 'lib/gir_ffi/builders/field_builder.rb', line 46 def return_value_name post_converted_name end |