Class: MilkTea::Types::Primitive
- Inherits:
-
Base
- Object
- Base
- MilkTea::Types::Primitive
show all
- Defined in:
- lib/milk_tea/core/types/types.rb
Constant Summary
collapse
- POINTER_INTEGER_WIDTH =
Fiddle::SIZEOF_VOIDP * 8
- INTEGER_NAMES =
%w[byte short int long ubyte ushort uint ulong ptr_int ptr_uint].freeze
- FLOAT_NAMES =
%w[float double].freeze
- FIXED_SIGNED_INTEGER_WIDTHS =
{
"byte" => 8,
"short" => 16,
"int" => 32,
"long" => 64,
}.freeze
- FIXED_UNSIGNED_INTEGER_WIDTHS =
{
"ubyte" => 8,
"ushort" => 16,
"uint" => 32,
"ulong" => 64,
}.freeze
- FLOAT_WIDTHS =
{
"float" => 32,
"double" => 64,
}.freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#accept, #children, #field_c_name, #sendable?
Constructor Details
#initialize(name) ⇒ Primitive
Returns a new instance of Primitive.
Instance Attribute Details
#float_width ⇒ Object
Returns the value of attribute float_width.
165
166
167
|
# File 'lib/milk_tea/core/types/types.rb', line 165
def float_width
@float_width
end
|
#hash ⇒ Object
Returns the value of attribute hash.
165
166
167
|
# File 'lib/milk_tea/core/types/types.rb', line 165
def hash
@hash
end
|
#integer_width ⇒ Object
Returns the value of attribute integer_width.
165
166
167
|
# File 'lib/milk_tea/core/types/types.rb', line 165
def integer_width
@integer_width
end
|
#name ⇒ Object
Returns the value of attribute name.
135
136
137
|
# File 'lib/milk_tea/core/types/types.rb', line 135
def name
@name
end
|
Instance Method Details
#bitwise? ⇒ Boolean
171
172
173
|
# File 'lib/milk_tea/core/types/types.rb', line 171
def bitwise?
@integer
end
|
#boolean? ⇒ Boolean
195
196
197
|
# File 'lib/milk_tea/core/types/types.rb', line 195
def boolean?
@boolean
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
159
160
161
|
# File 'lib/milk_tea/core/types/types.rb', line 159
def eql?(other)
other.is_a?(Primitive) && other.name == name
end
|
#fixed_width_integer? ⇒ Boolean
191
192
193
|
# File 'lib/milk_tea/core/types/types.rb', line 191
def fixed_width_integer?
@fixed_width_integer
end
|
#float? ⇒ Boolean
179
180
181
|
# File 'lib/milk_tea/core/types/types.rb', line 179
def float?
@float
end
|
#integer? ⇒ Boolean
175
176
177
|
# File 'lib/milk_tea/core/types/types.rb', line 175
def integer?
@integer
end
|
#numeric? ⇒ Boolean
167
168
169
|
# File 'lib/milk_tea/core/types/types.rb', line 167
def numeric?
@numeric
end
|
#signed_integer? ⇒ Boolean
183
184
185
|
# File 'lib/milk_tea/core/types/types.rb', line 183
def signed_integer?
@signed_integer
end
|
#to_s ⇒ Object
203
204
205
|
# File 'lib/milk_tea/core/types/types.rb', line 203
def to_s
name
end
|
#unsigned_integer? ⇒ Boolean
187
188
189
|
# File 'lib/milk_tea/core/types/types.rb', line 187
def unsigned_integer?
@unsigned_integer
end
|
#void? ⇒ Boolean
199
200
201
|
# File 'lib/milk_tea/core/types/types.rb', line 199
def void?
@void
end
|