Class: FFIGen::ArrayType

Inherits:
Type
  • Object
show all
Defined in:
lib/ffi_gen.rb,
lib/ffi_gen/java_output.rb,
lib/ffi_gen/ruby_output.rb

Instance Method Summary collapse

Constructor Details

#initialize(element_type, constant_size) ⇒ ArrayType

Returns a new instance of ArrayType.



262
263
264
265
# File 'lib/ffi_gen.rb', line 262

def initialize(element_type, constant_size)
  @element_type = element_type
  @constant_size = constant_size
end

Instance Method Details

#java_descriptionObject



377
378
379
# File 'lib/ffi_gen/java_output.rb', line 377

def java_description
  "Array of #{@element_type.java_description}"
end

#java_jna_typeObject



369
370
371
372
373
374
375
# File 'lib/ffi_gen/java_output.rb', line 369

def java_jna_type
  if @constant_size
    "#{@element_type.java_jna_type}[#{@constant_size}]"
  else
    "#{@element_type.java_jna_type}[]"
  end
end

#java_nameObject



365
366
367
# File 'lib/ffi_gen/java_output.rb', line 365

def java_name
  "array"
end

#nameObject



267
268
269
# File 'lib/ffi_gen.rb', line 267

def name
  Name.new ["array"]
end

#ruby_descriptionObject



304
305
306
# File 'lib/ffi_gen/ruby_output.rb', line 304

def ruby_description
  "Array<#{@element_type.ruby_description}>"
end

#ruby_ffi_typeObject



296
297
298
299
300
301
302
# File 'lib/ffi_gen/ruby_output.rb', line 296

def ruby_ffi_type
  if @constant_size
    "[#{@element_type.ruby_ffi_type}, #{@constant_size}]"
  else
    ":pointer"
  end
end

#ruby_nameObject



292
293
294
# File 'lib/ffi_gen/ruby_output.rb', line 292

def ruby_name
  "array"
end