Class: FFIGen::PrimitiveType
- Inherits:
-
Type
- Object
- Type
- FFIGen::PrimitiveType
show all
- Defined in:
- lib/ffi_gen.rb,
lib/ffi_gen/java_output.rb,
lib/ffi_gen/ruby_output.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Type
#java_description, #ruby_description
Constructor Details
#initialize(clang_type, full_type) ⇒ PrimitiveType
Returns a new instance of PrimitiveType.
207
208
209
210
|
# File 'lib/ffi_gen.rb', line 207
def initialize(clang_type, full_type)
@clang_type = clang_type
@full_type = full_type
end
|
Instance Attribute Details
#clang_type ⇒ Object
Returns the value of attribute clang_type.
279
280
281
|
# File 'lib/ffi_gen/java_output.rb', line 279
def clang_type
@clang_type
end
|
Instance Method Details
#java_jna_type ⇒ Object
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# 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 ⇒ Object
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# 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 ⇒ Object
212
213
214
|
# File 'lib/ffi_gen.rb', line 212
def name
Name.new [@clang_type.to_s]
end
|
#ruby_ffi_type ⇒ Object
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
# 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 ⇒ Object
214
215
216
217
218
219
220
221
222
223
224
225
|
# 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
|