Class: FFI::Clang::Types::Function
- Includes:
- Enumerable
- Defined in:
- lib/ffi/clang/types/function.rb
Overview
Represents a function type. This includes functions with and without prototypes.
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
-
#arg_type(i) ⇒ Object
Get the type of a specific argument.
-
#arg_types ⇒ Object
Iterate over all argument types or get an enumerator.
-
#args_size ⇒ Object
Get the number of arguments this function takes.
-
#calling_conv ⇒ Object
Get the calling convention of this function.
-
#exception_specification ⇒ Object
Get the exception specification type for this function.
-
#result_type ⇒ Object
Get the return type of this function.
-
#variadic? ⇒ Boolean
Check if this function is variadic.
Methods inherited from Type
#==, #alignof, #canonical, #const_qualified?, create, #declaration, #initialize, #kind, #kind_spelling, #non_reference_type, #pod?, #ref_qualifier, #restrict_qualified?, #sizeof, #spelling, #to_s, #volatile_qualified?
Constructor Details
This class inherits a constructor from FFI::Clang::Types::Type
Instance Method Details
#arg_type(i) ⇒ Object
Get the type of a specific argument.
30 31 32 |
# File 'lib/ffi/clang/types/function.rb', line 30 def arg_type(i) Type.create Lib.get_arg_type(@type, i), @translation_unit end |
#arg_types ⇒ Object
Iterate over all argument types or get an enumerator.
38 39 40 41 42 43 44 45 46 |
# File 'lib/ffi/clang/types/function.rb', line 38 def arg_types return to_enum(:arg_types) unless block_given? self.args_size.times do |i| yield self.arg_type(i) end self end |
#args_size ⇒ Object
Get the number of arguments this function takes.
23 24 25 |
# File 'lib/ffi/clang/types/function.rb', line 23 def args_size Lib.get_num_arg_types(@type) end |
#calling_conv ⇒ Object
Get the calling convention of this function.
56 57 58 |
# File 'lib/ffi/clang/types/function.rb', line 56 def calling_conv Lib.get_fuction_type_calling_conv(@type) end |
#exception_specification ⇒ Object
Get the exception specification type for this function.
62 63 64 |
# File 'lib/ffi/clang/types/function.rb', line 62 def exception_specification Lib.get_exception_specification_type(@type) end |
#result_type ⇒ Object
Get the return type of this function.
50 51 52 |
# File 'lib/ffi/clang/types/function.rb', line 50 def result_type Type.create Lib.get_result_type(@type), @translation_unit end |
#variadic? ⇒ Boolean
Check if this function is variadic.
17 18 19 |
# File 'lib/ffi/clang/types/function.rb', line 17 def variadic? Lib.is_function_type_variadic(@type) != 0 end |