Class: R2CORBA::CORBA::TypeCode::String

Inherits:
R2CORBA::CORBA::TypeCode show all
Defined in:
lib/corba/cbase/Typecode.rb,
lib/corba/jbase/Typecode.rb,
lib/corba/common/Typecode.rb

Overview

Recursive

Constant Summary

Constants inherited from R2CORBA::CORBA::TypeCode

LongLongRange, LongRange, OctetRange, ShortRange, ULongLongRange, ULongRange, UShortRange

Instance Attribute Summary

Attributes inherited from R2CORBA::CORBA::TypeCode

#tc_

Instance Method Summary collapse

Methods inherited from R2CORBA::CORBA::TypeCode

_tc, _wrap_native, #concrete_base_type, #content_type, #default_index, #discriminator_type, #equal?, #equivalent?, #fixed_digits, #fixed_scale, from_native, #get_compact_typecode, get_primitive_tc, #id, #is_recursive_tc?, #kind, #length, #member_count, #member_label, #member_name, #member_type, #member_visibility, #name, native_kind, register_id_type, #resolved_tc, #type_modifier, typecode_for_id, typecodes_for_name

Constructor Details

#initialize(*args) ⇒ String

Returns a new instance of String.

Raises:

  • (RuntimeError)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/corba/cbase/Typecode.rb', line 48

def initialize(*args)
  if CORBA::Native::TypeCode === args.first
    @tc_ = args.first
  else
    begin
      @tc_ = CORBA::Native::TypeCode.create_tc(TK_STRING, args.shift.to_i)
    rescue ::NativeException
      CORBA::Exception.native2r($!)
    end
  end
end

Instance Method Details

#get_typeObject



425
426
427
# File 'lib/corba/common/Typecode.rb', line 425

def get_type
  ::String
end

#needs_conversion(val) ⇒ Object



439
440
441
# File 'lib/corba/common/Typecode.rb', line 439

def needs_conversion(val)
  !(::String === val)
end

#validate(val) ⇒ Object

Raises:

  • (::CORBA::MARSHAL)


429
430
431
432
433
434
435
436
437
# File 'lib/corba/common/Typecode.rb', line 429

def validate(val)
  return val if val.nil?
  super(val) unless ::String === val || val.respond_to?(:to_str)
  val = ::String === val ? val : val.to_str
  raise ::CORBA::MARSHAL.new(
    "string size exceeds bound: #{self.length.to_s}",
    1, ::CORBA::COMPLETED_NO) unless (self.length==0 || val.size<=self.length)
  val
end