class GirFFI::Builder::RegularArgument

Implements argument processing for arguments with direction :in whose type-specific processing is left to FFI (e.g., ints and floats, and objects that implement to_ptr.).

Implements argument processing for arguments with direction :in that are GObjects.

Implements argument processing for UTF8 string arguments with direction :in.

Implements argument processing for void pointer arguments with direction :in.

Implements argument processing for interface arguments with direction :inout (structs, objects, etc.).

Implements argument processing for arguments with direction :out that are neither arrays nor ‘interfaces’.

Public Class Methods

new(var_gen, name, typeinfo, direction) click to toggle source
# File lib/gir_ffi/builder/argument.rb, line 78
def initialize var_gen, name, typeinfo, direction
  super var_gen, name, typeinfo, direction
  @direction = direction
end

Public Instance Methods

inarg() click to toggle source
# File lib/gir_ffi/builder/argument.rb, line 83
def inarg
  if has_input_value?
    @array_arg.nil? ? @name : nil
  end
end
post() click to toggle source
# File lib/gir_ffi/builder/argument.rb, line 105
def post
  result = []
  if has_output_value?
    value = case @direction
            when :inout
              "#{argument_class_name}.wrap(#{output_conversion_arguments})"
            when :out
              "#{callarg}.to_value"
            end
    result << "#{retname} = #{value}"
  end
  result
end
pre() click to toggle source
# File lib/gir_ffi/builder/argument.rb, line 95
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() click to toggle source
# File lib/gir_ffi/builder/argument.rb, line 89
def retname
  if has_output_value?
    @retname ||= @var_gen.new_var
  end
end