Class: IDL::Type::String
Constant Summary
Constants inherited
from IDL::Type
Long, LongLong, Octet, Short, TinyShort, ULong, ULongLong, UShort, UTinyShort
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from IDL::Type
#is_complete?, #is_local?, #is_node?, #resolved_node, #resolved_type, #typeerror, #typename
Constructor Details
#initialize(size = nil) ⇒ String
Returns a new instance of String.
306
307
308
|
# File 'lib/ridl/type.rb', line 306
def initialize(size = nil)
@size = size
end
|
Instance Attribute Details
Returns the value of attribute size.
300
301
302
|
# File 'lib/ridl/type.rb', line 300
def size
@size
end
|
Instance Method Details
#instantiate(instantiation_context) ⇒ Object
333
334
335
|
# File 'lib/ridl/type.rb', line 333
def instantiate(instantiation_context)
self.is_template? ? (Type::String.new(@size.instantiate(instantiation_context).value)) : self
end
|
#is_anonymous? ⇒ Boolean
321
322
323
|
# File 'lib/ridl/type.rb', line 321
def is_anonymous?
@size ? true : false
end
|
#is_template? ⇒ Boolean
325
326
327
|
# File 'lib/ridl/type.rb', line 325
def is_template?
(@size && @size.is_a?(IDL::Expression) && @size.is_template?)
end
|
302
303
304
|
# File 'lib/ridl/type.rb', line 302
def length
@size
end
|
#matches?(idltype) ⇒ Boolean
329
330
331
|
# File 'lib/ridl/type.rb', line 329
def matches?(idltype)
super && self.size == idltype.size
end
|
#narrow(obj) ⇒ Object
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/ridl/type.rb', line 310
def narrow(obj)
typeerror(obj) unless ::String === obj
if @size.nil?
obj
elsif @size < obj.size
typeerror(obj)
else
obj
end
end
|