Class: FFI::Clang::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi/clang/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, translation_unit) ⇒ Type

Returns a new instance of Type.



27
28
29
30
# File 'lib/ffi/clang/type.rb', line 27

def initialize(type, translation_unit)
	@type = type
	@translation_unit = translation_unit
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



25
26
27
# File 'lib/ffi/clang/type.rb', line 25

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



128
129
130
# File 'lib/ffi/clang/type.rb', line 128

def ==(other)
	Lib.equal_types(@type, other.type) != 0
end

#alignofObject



104
105
106
# File 'lib/ffi/clang/type.rb', line 104

def alignof
	Lib.type_get_align_of(@type)
end

#arg_type(i) ⇒ Object



80
81
82
# File 'lib/ffi/clang/type.rb', line 80

def arg_type(i)
	Type.new Lib.get_arg_type(@type, i), @translation_unit
end

#array_element_typeObject



96
97
98
# File 'lib/ffi/clang/type.rb', line 96

def array_element_type
	Type.new Lib.get_array_element_type(@type), @translation_unit
end

#array_sizeObject



100
101
102
# File 'lib/ffi/clang/type.rb', line 100

def array_size
	Lib.get_array_size(@type)
end

#calling_convObject



120
121
122
# File 'lib/ffi/clang/type.rb', line 120

def calling_conv
	Lib.get_fuction_type_calling_conv(@type)
end

#canonicalObject



60
61
62
# File 'lib/ffi/clang/type.rb', line 60

def canonical
	Type.new Lib.get_canonical_type(@type), @translation_unit
end

#class_typeObject



64
65
66
# File 'lib/ffi/clang/type.rb', line 64

def class_type
	Type.new Lib.type_get_class_type(@type), @translation_unit
end

#const_qualified?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/ffi/clang/type.rb', line 68

def const_qualified?
	Lib.is_const_qualified_type(@type) != 0
end

#declarationObject



124
125
126
# File 'lib/ffi/clang/type.rb', line 124

def declaration
	Cursor.new Lib.get_type_declaration(@type), @translation_unit
end

#element_typeObject



88
89
90
# File 'lib/ffi/clang/type.rb', line 88

def element_type
	Type.new Lib.get_element_type(@type), @translation_unit
end

#kindObject



32
33
34
# File 'lib/ffi/clang/type.rb', line 32

def kind
	@type[:kind]
end

#kind_spellingObject



36
37
38
# File 'lib/ffi/clang/type.rb', line 36

def kind_spelling
	Lib.extract_string Lib.get_type_kind_spelling @type[:kind]
end

#num_arg_typesObject



52
53
54
# File 'lib/ffi/clang/type.rb', line 52

def num_arg_types
	Lib.get_num_arg_types(@type)
end

#num_elementsObject



92
93
94
# File 'lib/ffi/clang/type.rb', line 92

def num_elements
	Lib.get_num_elements(@type)
end

#offsetof(field) ⇒ Object



112
113
114
# File 'lib/ffi/clang/type.rb', line 112

def offsetof(field)
	Lib.type_get_offset_of(@type, field)
end

#pod?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/ffi/clang/type.rb', line 48

def pod?
	Lib.is_pod_type(@type) != 0
end

#pointeeObject



56
57
58
# File 'lib/ffi/clang/type.rb', line 56

def pointee
	Type.new Lib.get_pointee_type(@type), @translation_unit
end

#ref_qualifierObject



116
117
118
# File 'lib/ffi/clang/type.rb', line 116

def ref_qualifier
	Lib.type_get_cxx_ref_qualifier(@type)
end

#restrict_qualified?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/ffi/clang/type.rb', line 76

def restrict_qualified?
	Lib.is_restrict_qualified_type(@type) != 0
end

#result_typeObject



84
85
86
# File 'lib/ffi/clang/type.rb', line 84

def result_type
	Type.new Lib.get_result_type(@type), @translation_unit
end

#sizeofObject



108
109
110
# File 'lib/ffi/clang/type.rb', line 108

def sizeof
	Lib.type_get_size_of(@type)
end

#spellingObject



40
41
42
# File 'lib/ffi/clang/type.rb', line 40

def spelling
	Lib.extract_string Lib.get_type_spelling(@type)
end

#variadic?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/ffi/clang/type.rb', line 44

def variadic?
	Lib.is_function_type_variadic(@type) != 0
end

#volatile_qualified?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/ffi/clang/type.rb', line 72

def volatile_qualified?
	Lib.is_volatile_qualified_type(@type) != 0
end