class FFIGen::PrimitiveType

Attributes

clang_type[RW]

Public Class Methods

new(clang_type, full_type) click to toggle source
# File lib/ffi_gen.rb, line 207
def initialize(clang_type, full_type)
  @clang_type = clang_type
  @full_type = full_type
end

Public Instance Methods

java_jna_type() click to toggle source
# File lib/ffi_gen/java_output.rb, line 297
def java_jna_type
  if @full_type == 'boolean'
    return 'boolean'
  end
  case @clang_type
  when :void            then "void"
  when :bool            then "boolean"
  when :u_char          then "byte"
  when :u_short         then "short"
  when :u_int           then "int"
  when :u_long          then "NativeLong"
  when :u_long_long     then "long"
  when :char_s, :s_char then "byte"
  when :short           then "short"
  when :int             then "int"
  when :long            then "NativeLong"
  when :long_long       then "long"
  when :float           then "float"
  when :double          then "double"
  end
end
java_name() click to toggle source
# File lib/ffi_gen/java_output.rb, line 281
def java_name
  if @full_type == 'boolean'
    return 'Boolean'
  end
  case @clang_type
  when :void
    "nil"
  when :bool
    "Boolean"
  when :u_char, :u_short, :u_int, :u_long, :u_long_long, :char_s, :s_char, :short, :int, :long, :long_long
    "Integer"
  when :float, :double
    "Float"
  end
end
name() click to toggle source
# File lib/ffi_gen.rb, line 212
def name
  Name.new [@clang_type.to_s]
end
ruby_ffi_type() click to toggle source
# File lib/ffi_gen/ruby_output.rb, line 227
def ruby_ffi_type
  case @clang_type
  when :void            then ":void"
  when :bool            then ":bool"
  when :u_char          then ":uchar"
  when :u_short         then ":ushort"
  when :u_int           then ":uint"
  when :u_long          then ":ulong"
  when :u_long_long     then ":ulong_long"
  when :char_s, :s_char then ":char"
  when :short           then ":short"
  when :int             then ":int"
  when :long            then ":long"
  when :long_long       then ":long_long"
  when :float           then ":float"
  when :double          then ":double"
  end
end
ruby_name() click to toggle source
# File lib/ffi_gen/ruby_output.rb, line 214
def ruby_name
  case @clang_type
  when :void
    "nil"
  when :bool
    "Boolean"
  when :u_char, :u_short, :u_int, :u_long, :u_long_long, :char_s, :s_char, :short, :int, :long, :long_long
    "Integer"
  when :float, :double
    "Float"
  end
end