Class: GirFFI::ReturnValueBuilder

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

Overview

Implements building post-processing statements for return values.

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

Methods inherited from BaseArgumentBuilder

#argument_class_name, #array_size, #callarg, #cleanup, #elm_t, #pre, #safe, #specialized_type_tag, #subtype_tag_or_class_name, #type_info

Constructor Details

#initialize(var_gen, type_info, is_constructor) ⇒ ReturnValueBuilder

Returns a new instance of ReturnValueBuilder.



6
7
8
9
# File 'lib/gir_ffi/return_value_builder.rb', line 6

def initialize var_gen, type_info, is_constructor
  super var_gen, nil, type_info, :return
  @is_constructor = is_constructor
end

Instance Method Details

#cvarObject

TODO: Rename



24
25
26
# File 'lib/gir_ffi/return_value_builder.rb', line 24

def cvar
  callarg unless is_void_return_value?
end

#inargObject



19
20
21
# File 'lib/gir_ffi/return_value_builder.rb', line 19

def inarg
  nil
end

#postObject



11
12
13
14
15
16
17
# File 'lib/gir_ffi/return_value_builder.rb', line 11

def post
  if has_conversion?
    [ "#{retname} = #{post_conversion}" ]
  else
    []
  end
end

#retvalObject



28
29
30
31
32
33
34
35
36
# File 'lib/gir_ffi/return_value_builder.rb', line 28

def retval
  if has_conversion?
    super
  elsif is_void_return_value?
    nil
  else
    callarg
  end
end