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

Instance Method Summary collapse

Methods inherited from BaseArgumentBuilder

#argument_class_name, #array_length_idx, #array_length_parameter?, #call_argument_name, #closure=, #closure?, #closure_idx, #destroy_idx, #destroy_notifier?, #direction, #helper_argument?, #initialize, #mark_as_destroy_notifier, #name, #new_variable, #ownership_transfer, #safe, #specialized_type_tag, #type_info

Constructor Details

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

Instance Method Details

#capture_variable_nameObject



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

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

#has_return_value_name?Boolean

Returns:



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

def has_return_value_name?
  relevant? && !array_arg
end

#post_converted_nameObject



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

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

#relevant?Boolean

Returns:



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

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

#return_value_nameObject



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

def return_value_name
  post_converted_name if has_return_value_name?
end

#void_return_value?Boolean

Returns:



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

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