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.



246
247
248
249
# File 'lib/ffi_gen.rb', line 246

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

Instance Method Details

#java_descriptionObject



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

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

#java_jna_typeObject



258
259
260
261
262
263
264
# File 'lib/ffi_gen/java_output.rb', line 258

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

#java_nameObject



254
255
256
# File 'lib/ffi_gen/java_output.rb', line 254

def java_name
  "array"
end

#nameObject



251
252
253
# File 'lib/ffi_gen.rb', line 251

def name
  Name.new ["array"]
end

#ruby_descriptionObject



287
288
289
# File 'lib/ffi_gen/ruby_output.rb', line 287

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

#ruby_ffi_typeObject



279
280
281
282
283
284
285
# File 'lib/ffi_gen/ruby_output.rb', line 279

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

#ruby_nameObject



275
276
277
# File 'lib/ffi_gen/ruby_output.rb', line 275

def ruby_name
  "array"
end