Class: IDL::Type::String
Constant Summary
Constants inherited
from IDL::Type
Long, LongLong, Octet, Short, ULong, ULongLong, UShort
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.
248
249
250
|
# File 'lib/ridl/type.rb', line 248
def initialize(size = nil)
@size = size
end
|
Instance Attribute Details
Returns the value of attribute size.
245
246
247
|
# File 'lib/ridl/type.rb', line 245
def size
@size
end
|
Instance Method Details
#instantiate(_context) ⇒ Object
270
271
272
|
# File 'lib/ridl/type.rb', line 270
def instantiate(_context)
self.is_template? ? (Type::String.new(@size.instantiate(_context).value)) : self
end
|
#is_anonymous? ⇒ Boolean
261
262
263
|
# File 'lib/ridl/type.rb', line 261
def is_anonymous?
@size ? true : false
end
|
#is_template? ⇒ Boolean
264
265
266
|
# File 'lib/ridl/type.rb', line 264
def is_template?
(@size && @size.is_a?(IDL::Expression) && @size.is_template?)
end
|
246
|
# File 'lib/ridl/type.rb', line 246
def length; @size; end
|
#matches?(idltype) ⇒ Boolean
267
268
269
|
# File 'lib/ridl/type.rb', line 267
def matches?(idltype)
super && self.size == idltype.size
end
|
#narrow(obj) ⇒ Object
251
252
253
254
255
256
257
258
259
260
|
# File 'lib/ridl/type.rb', line 251
def narrow(obj)
typeerror(obj) unless ::String === obj
if @size.nil?
obj
elsif @size < obj.size
typeerror(obj)
else
obj
end
end
|