class FFIDB::Exporters::Dart

Code generator for the Dart programming language.

@see dart.dev/guides/libraries/c-interop @see flutter.dev/docs/development/platform-integration/c-interop @see api.dart.dev/dev/dart-ffi/dart-ffi-library.html

Constants

TYPE_MAP
TYPE_MAP_DART

@see dart.dev/guides/language/language-tour

Public Instance Methods

finish() click to toggle source
# File lib/ffidb/exporters/dart.rb, line 33
def finish
  puts self.render_template('dart.erb')
end

Protected Instance Methods

dart_param_type(c_type) click to toggle source

@param [FFIDB::Type] c_type @return [String]

# File lib/ffidb/exporters/dart.rb, line 62
def dart_param_type(c_type)
  case
    when c_type.array?
      "Pointer<#{self.dart_param_type(c_type.array_type)}>"
    when type = TYPE_MAP_DART[self.ffi_param_type(c_type)] then type
    else TYPE_MAP_DART[self.typemap['int']].to_s
  end
end
dart_struct_type(c_type) click to toggle source

@param [FFIDB::Type] c_type @return [String]

# File lib/ffidb/exporters/dart.rb, line 42
def dart_struct_type(c_type)
  case
    when c_type.array? then self.dart_param_type(c_type) # TODO: https://github.com/dart-lang/sdk/issues/35763
    else self.dart_param_type(c_type)
  end
end
ffi_param_type(c_type) click to toggle source

@param [FFIDB::Type] c_type @return [String]

# File lib/ffidb/exporters/dart.rb, line 74
def ffi_param_type(c_type)
  case
    when c_type.array?
      "Pointer<#{self.ffi_param_type(c_type.array_type)}>"
    else self.param_type(c_type)
  end
end
ffi_struct_type(c_type) click to toggle source

@param [FFIDB::Type] c_type @return [String]

# File lib/ffidb/exporters/dart.rb, line 52
def ffi_struct_type(c_type)
  case
    when c_type.array? then self.ffi_param_type(c_type) # TODO: https://github.com/dart-lang/sdk/issues/35763
    else self.ffi_param_type(c_type)
  end
end