Class: Sfcc::Cim::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/sfcc/type.rb,
ext/sfcc/cim_type.c

Constant Summary collapse

Null =

data on the CIM namespace

INT2FIX(CIMC_null)
SIMPLE =
INT2FIX(CIMC_SIMPLE)
Boolean =
INT2FIX(CIMC_boolean)
Char16 =
INT2FIX(CIMC_char16)
REAL =
INT2FIX(CIMC_REAL)
Real32 =
INT2FIX(CIMC_real32)
Real64 =
INT2FIX(CIMC_real64)
UINT =
INT2FIX(CIMC_UINT)
UInt8 =
INT2FIX(CIMC_uint8)
UInt16 =
INT2FIX(CIMC_uint16)
UInt32 =
INT2FIX(CIMC_uint32)
UInt64 =
INT2FIX(CIMC_uint64)
SINT =
INT2FIX(CIMC_SINT)
SInt8 =
INT2FIX(CIMC_sint8)
SInt16 =
INT2FIX(CIMC_sint16)
SInt32 =
INT2FIX(CIMC_sint32)
SInt64 =
INT2FIX(CIMC_sint64)
INTEGER =
INT2FIX(CIMC_INTEGER)
ENC =
INT2FIX(CIMC_ENC)
Instance =
INT2FIX(CIMC_instance)
Reference =
INT2FIX(CIMC_ref)
Args =
INT2FIX(CIMC_args)
Class =
INT2FIX(CIMC_class)
Filter =
INT2FIX(CIMC_filter)
Enumeration =
INT2FIX(CIMC_enumeration)
String =
INT2FIX(CIMC_string)
Chars =
INT2FIX(CIMC_chars)
DateTime =
INT2FIX(CIMC_dateTime)
Ptr =
INT2FIX(CIMC_ptr)
CharsPtr =
INT2FIX(CIMC_charsptr)
ARRAY =

((1)<<13)

INT2FIX(CIMC_ARRAY)
SIMPLEA =

(CIMC_ARRAY | CIMC_SIMPLE)

INT2FIX(CIMC_SIMPLEA)
BooleanA =

(CIMC_ARRAY | CIMC_boolean)

INT2FIX(CIMC_booleanA)
Char16A =

(CIMC_ARRAY | CIMC_char16)

INT2FIX(CIMC_char16A)
REALA =

(CIMC_ARRAY | CIMC_REAL)

INT2FIX(CIMC_REALA)
Real32A =

(CIMC_ARRAY | CIMC_real32)

INT2FIX(CIMC_real32A)
Real64A =

(CIMC_ARRAY | CIMC_real64)

INT2FIX(CIMC_real64A)
UNITA =

(CIMC_ARRAY | CIMC_UINT)

INT2FIX(CIMC_UINTA)
UInt8A =

(CIMC_ARRAY | CIMC_uint8)

INT2FIX(CIMC_uint8A)
UInt16A =

(CIMC_ARRAY | CIMC_uint16)

INT2FIX(CIMC_uint16A)
UInt32A =

(CIMC_ARRAY | CIMC_uint32)

INT2FIX(CIMC_uint32A)
UInt64A =

(CIMC_ARRAY | CIMC_uint64)

INT2FIX(CIMC_uint64A)
SINTA =

(CIMC_ARRAY | CIMC_SINT)

INT2FIX(CIMC_SINTA)
SInt8A =

(CIMC_ARRAY | CIMC_sint8)

INT2FIX(CIMC_sint8A)
SInt16A =

(CIMC_ARRAY | CIMC_sint16)

INT2FIX(CIMC_sint16A)
SInt32A =

(CIMC_ARRAY | CIMC_sint32)

INT2FIX(CIMC_sint32A)
SInt64A =

(CIMC_ARRAY | CIMC_sint64)

INT2FIX(CIMC_sint64A)
INTEGERA =

(CIMC_ARRAY | CIMC_INTEGER)

INT2FIX(CIMC_INTEGERA)
ENCA =

(CIMC_ARRAY | CIMC_ENC)

INT2FIX(CIMC_ENCA)
StringA =

(CIMC_ARRAY | CIMC_string)

INT2FIX(CIMC_stringA)
CharsA =

(CIMC_ARRAY | CIMC_chars)

INT2FIX(CIMC_charsA)
DataTimeA =

(CIMC_ARRAY | CIMC_dateTime)

INT2FIX(CIMC_dateTimeA)
InstanceA =

(CIMC_ARRAY | CIMC_instance)

INT2FIX(CIMC_instanceA)
ReferenceA =

(CIMC_ARRAY | CIMC_ref)

INT2FIX(CIMC_refA)
PtrA =

(CIMC_ARRAY | CIMC_ptr)

INT2FIX(CIMC_ptrA)
CharsPtrA =

(CIMC_ARRAY | CIMC_charsptr)

INT2FIX(CIMC_charsptrA)
KeyInteger =

(CIMC_sint64)

INT2FIX(CIMC_keyInteger)
KeyString =

(CIMC_string)

INT2FIX(CIMC_keyString)
KeyBoolean =

(CIMC_boolean)

INT2FIX(CIMC_keyBoolean)
KeyReference =

(CIMC_ref)

INT2FIX(CIMC_keyRef)
CharString =

(CIMC_string)

INT2FIX(CIMC_charString)
IntegerString =

(CIMC_string | CIMC_sint64)

INT2FIX(CIMC_integerString)
RealString =

(CIMC_string | CIMC_real64)

INT2FIX(CIMC_realString)
NumericString =

(CIMC_string | CIMC_sint64 | CIMC_real64)

INT2FIX(CIMC_numericString)
BooleanString =

(CIMC_string | CIMC_boolean)

INT2FIX(CIMC_booleanString)
DateTimeString =

(CIMC_string | CIMC_dateTime)

INT2FIX(CIMC_dateTimeString)
ClassNameString =

(CIMC_string | CIMC_class)

INT2FIX(CIMC_classNameString)
NameString =

(CIMC_string | ((16+10)<<8))

INT2FIX(CIMC_nameString)

Instance Method Summary collapse

Instance Method Details

#array?Boolean

Returns:


7
8
9
# File 'lib/sfcc/type.rb', line 7

def array?
  (self.to_i & Type::ARRAY) != 0
end

#integer?Boolean

Returns:


10
11
12
# File 'lib/sfcc/type.rb', line 10

def integer?
  (self.to_i & Type::INTEGER) != 0
end

#string?Boolean

Returns:


13
14
15
# File 'lib/sfcc/type.rb', line 13

def string?
  self.to_i == Type::String
end

#to_iInteger

Integer representation of type

Returns:

  • (Integer)

24
25
26
27
28
29
30
# File 'ext/sfcc/cim_type.c', line 24

static VALUE to_i(VALUE self)
{
  rb_sfcc_type *type;
  Data_Get_Struct(self, rb_sfcc_type, type);

  return INT2FIX(type->type);
}

#to_sString

String representation of type

Returns:


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'ext/sfcc/cim_type.c', line 39

static VALUE to_s(VALUE self)
{
  rb_sfcc_type *type;
  const char *s;
  Data_Get_Struct(self, rb_sfcc_type, type);

  switch (type->type) {
    case CIMC_null: s = "null"; break;
    
    case CIMC_boolean: s = "boolean"; break;
    case CIMC_char16: s = "char16"; break;

    case CIMC_real32: s = "real32"; break;
    case CIMC_real64: s = "real64"; break;

    case CIMC_uint8: s = "uint8"; break;
    case CIMC_uint16: s = "uint16"; break;
    case CIMC_uint32: s = "uint32"; break;
    case CIMC_uint64: s = "uint64"; break;
    case CIMC_sint8: s = "sint8"; break;
    case CIMC_sint16: s = "sint16"; break;
    case CIMC_sint32: s = "sint32"; break;
    case CIMC_sint64: s = "sint64"; break;

    case CIMC_instance: s = "instance"; break;
    case CIMC_ref: s = "ref"; break;
    case CIMC_args: s = "args"; break;
    case CIMC_class: s = "class"; break;
    case CIMC_filter: s = "filter"; break;
    case CIMC_enumeration: s = "enumeration"; break;
    case CIMC_string: s = "string"; break;
    case CIMC_chars: s = "chars"; break;
    case CIMC_dateTime: s = "datetime"; break;
    case CIMC_ptr: s = "ptr"; break;
    case CIMC_charsptr: s = "charsptr"; break;

    /* Array */
    case CIMC_booleanA: s = "boolean[]"; break;
    case CIMC_char16A: s = "char16[]"; break;

    case CIMC_real32A: s = "real32[]"; break;
    case CIMC_real64A: s = "real64[]"; break;

    case CIMC_uint8A: s = "uint8[]"; break;
    case CIMC_uint16A: s = "uint16[]"; break;
    case CIMC_uint32A: s = "uint32[]"; break;
    case CIMC_uint64A: s = "uint64[]"; break;
    case CIMC_sint8A: s = "sint8[]"; break;
    case CIMC_sint16A: s = "sint16[]"; break;
    case CIMC_sint32A: s = "sint32[]"; break;
    case CIMC_sint64A: s = "sint64[]"; break;

    case CIMC_instanceA: s = "instance[]"; break;
    case CIMC_refA: s = "ref[]"; break;
    case CIMC_stringA: s = "string[]"; break;
    case CIMC_charsA: s = "chars[]"; break;
    case CIMC_dateTimeA: s = "datetime[]"; break;
    case CIMC_ptrA: s = "ptr[]"; break;
    case CIMC_charsptrA: s = "charsptr[]"; break;
  default:
    rb_raise(rb_eTypeError, "Unknown Cim::Type");
    break;
  }
  return rb_str_new2(s);
}