Class: GirFFI::Builders::BaseReturnValueBuilder

Inherits:
BaseArgumentBuilder show all
Defined in:
lib/gir_ffi/builders/base_return_value_builder.rb

Overview

Implements building post-processing statements for return values of callbacks.

Constant Summary

Constants inherited from BaseArgumentBuilder

GirFFI::Builders::BaseArgumentBuilder::KEYWORDS

Instance Attribute Summary

Attributes inherited from BaseArgumentBuilder

#arginfo, #array_arg, #length_arg, #related_callback_builder

Instance Method Summary collapse

Methods inherited from BaseArgumentBuilder

#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?

Constructor Details

This class inherits a constructor from GirFFI::Builders::BaseArgumentBuilder

Instance Method Details

#capture_variable_nameObject



14
15
16
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 14

def capture_variable_name
  @capture_variable_name ||= new_variable if relevant?
end

#has_return_value_name?Boolean

Returns:



34
35
36
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 34

def has_return_value_name?
  relevant? && !array_arg
end

#post_converted_nameObject



18
19
20
21
22
23
24
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 18

def post_converted_name
  @post_converted_name ||= if has_post_conversion?
                             new_variable
                           else
                             capture_variable_name
                           end
end

#relevant?Boolean

Returns:



10
11
12
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 10

def relevant?
  !void_return_value? && !arginfo.skip?
end

#return_value_nameObject



26
27
28
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 26

def return_value_name
  post_converted_name if has_return_value_name?
end

#void_return_value?Boolean

Returns:



30
31
32
# File 'lib/gir_ffi/builders/base_return_value_builder.rb', line 30

def void_return_value?
  specialized_type_tag == :void && !type_info.pointer?
end