Loading...
 

Type

Type

Type, Type(accessExpression), Type(, TRUE), Type(accessExpression, TRUE), Type(STACK), Type(STACK, TRUE)

Parameter: optionally an access printout

Stack Position Description
Stack(In) Top Access expression (when using the 'STACK' keyword)
Top-1 one object
Stack(Out) Top coded type

If no operand is specified, the type of the object on the stack is returned. For NULL and INVALID on the stack -1 is returned.

Example:

 
CX_STRING obj Type = if { "obj is a String!" Attention }

If an access expression is specified, the type of data member reached by means of an access expression is obtained. If this is a pointer p to an object, you get

  • the ClassID of the object to which p points
  • or - 1 (NOTHING), if p = ZERO

NOTHING is also the result if the access path cannot be followed because a pointer or function returns NULL. If the access expression refers to a slot, the following cases are possible:

  • the type of slot or
  • 0 (UNDEFINED) if the slot does not occur in this object instance or
  • - 1 (NOTHING) because a pointer or function returns ZERO

If Type refers to an object of class CX_DESCRIPTIVE_REF or one of its derived classes, Type returns the ClassID of the object the wrapper refers to, i.e. wrappers are "transparent" for Type as well.
If TRUE is specified in the second parameter, the "true" type is obtained, i.e. for CX_DESCRIPTIVE_REF / CX_OVERWRITING_REF the type of these classes.

An access expression can alternatively be taken from the stack top if 'STACK' is specified as a parameter. In this case, it is treated identically to an access expression that is directly specified as a parameter.