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 Method Summary
collapse
Methods inherited from Type
#java_description, #ruby_description
Constructor Details
Returns a new instance of PrimitiveType.
207
208
209
|
# File 'lib/ffi_gen.rb', line 207
def initialize(clang_type)
@clang_type = clang_type
end
|
Instance Method Details
#java_jna_type ⇒ Object
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/ffi_gen/java_output.rb', line 199
def java_jna_type
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
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/ffi_gen/java_output.rb', line 186
def java_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
|
#name ⇒ Object
211
212
213
|
# File 'lib/ffi_gen.rb', line 211
def name
Name.new [@clang_type.to_s]
end
|
#ruby_ffi_type ⇒ Object
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'lib/ffi_gen/ruby_output.rb', line 220
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
207
208
209
210
211
212
213
214
215
216
217
218
|
# File 'lib/ffi_gen/ruby_output.rb', line 207
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
|