Class: FFI::Clang::Types::Type
- Inherits:
-
Object
- Object
- FFI::Clang::Types::Type
- Defined in:
- lib/ffi/clang/types/type.rb
Instance Attribute Summary collapse
-
#translation_unit ⇒ Object
readonly
Returns the value of attribute translation_unit.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.create(cxtype, translation_unit) ⇒ Object
Just hard code the types - they are not likely to change.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #alignof ⇒ Object
- #const_qualified? ⇒ Boolean
- #declaration ⇒ Object
-
#initialize(type, translation_unit) ⇒ Type
constructor
A new instance of Type.
- #kind ⇒ Object
- #kind_spelling ⇒ Object
- #non_reference_type ⇒ Object
- #pod? ⇒ Boolean
- #ref_qualifier ⇒ Object
- #restrict_qualified? ⇒ Boolean
- #sizeof ⇒ Object
- #spelling ⇒ Object
- #to_s ⇒ Object
- #volatile_qualified? ⇒ Boolean
Constructor Details
#initialize(type, translation_unit) ⇒ Type
Returns a new instance of Type.
39 40 41 42 |
# File 'lib/ffi/clang/types/type.rb', line 39 def initialize(type, translation_unit) @type = type @translation_unit = translation_unit end |
Instance Attribute Details
#translation_unit ⇒ Object (readonly)
Returns the value of attribute translation_unit.
15 16 17 |
# File 'lib/ffi/clang/types/type.rb', line 15 def translation_unit @translation_unit end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
15 16 17 |
# File 'lib/ffi/clang/types/type.rb', line 15 def type @type end |
Class Method Details
.create(cxtype, translation_unit) ⇒ Object
Just hard code the types - they are not likely to change
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ffi/clang/types/type.rb', line 18 def self.create(cxtype, translation_unit) case cxtype[:kind] when :type_pointer, :type_block_pointer, :type_obj_c_object_pointer, :type_member_pointer Pointer.new(cxtype, translation_unit) when :type_constant_array, :type_incomplete_array, :type_variable_array, :type_dependent_sized_array Array.new(cxtype, translation_unit) when :type_vector Vector.new(cxtype, translation_unit) when :type_function_no_proto, :type_function_proto Function.new(cxtype, translation_unit) when :type_elaborated Elaborated.new(cxtype, translation_unit) when :type_typedef TypeDef.new(cxtype, translation_unit) when :type_record Record.new(cxtype, translation_unit) else Type.new(cxtype, translation_unit) end end |
Instance Method Details
#==(other) ⇒ Object
92 93 94 |
# File 'lib/ffi/clang/types/type.rb', line 92 def ==(other) Lib.equal_types(@type, other.type) != 0 end |
#alignof ⇒ Object
72 73 74 |
# File 'lib/ffi/clang/types/type.rb', line 72 def alignof Lib.type_get_align_of(@type) end |
#const_qualified? ⇒ Boolean
60 61 62 |
# File 'lib/ffi/clang/types/type.rb', line 60 def const_qualified? Lib.is_const_qualified_type(@type) != 0 end |
#declaration ⇒ Object
84 85 86 |
# File 'lib/ffi/clang/types/type.rb', line 84 def declaration Cursor.new Lib.get_type_declaration(@type), @translation_unit end |
#kind ⇒ Object
44 45 46 |
# File 'lib/ffi/clang/types/type.rb', line 44 def kind @type[:kind] end |
#kind_spelling ⇒ Object
48 49 50 |
# File 'lib/ffi/clang/types/type.rb', line 48 def kind_spelling Lib.extract_string Lib.get_type_kind_spelling @type[:kind] end |
#non_reference_type ⇒ Object
88 89 90 |
# File 'lib/ffi/clang/types/type.rb', line 88 def non_reference_type Type.create Lib.get_non_reference_type(@type),@translation_unit end |
#pod? ⇒ Boolean
56 57 58 |
# File 'lib/ffi/clang/types/type.rb', line 56 def pod? Lib.is_pod_type(@type) != 0 end |
#ref_qualifier ⇒ Object
80 81 82 |
# File 'lib/ffi/clang/types/type.rb', line 80 def ref_qualifier Lib.type_get_cxx_ref_qualifier(@type) end |
#restrict_qualified? ⇒ Boolean
68 69 70 |
# File 'lib/ffi/clang/types/type.rb', line 68 def restrict_qualified? Lib.is_restrict_qualified_type(@type) != 0 end |
#sizeof ⇒ Object
76 77 78 |
# File 'lib/ffi/clang/types/type.rb', line 76 def sizeof Lib.type_get_size_of(@type) end |
#spelling ⇒ Object
52 53 54 |
# File 'lib/ffi/clang/types/type.rb', line 52 def spelling Lib.extract_string Lib.get_type_spelling(@type) end |
#to_s ⇒ Object
96 97 98 |
# File 'lib/ffi/clang/types/type.rb', line 96 def to_s "#{self.class.name} <#{self.kind}: #{self.spelling}>" end |
#volatile_qualified? ⇒ Boolean
64 65 66 |
# File 'lib/ffi/clang/types/type.rb', line 64 def volatile_qualified? Lib.is_volatile_qualified_type(@type) != 0 end |