Function _conType() Foundation

Determines the type of a container.

Syntax
XPPAPIRET _conType(ContainerHandle, ULONG *ulType);
Parameters
ContainerHandle ch;
Handle of any container.
ULONG *ulType
Pointer to a ULONG buffer into which the type of the container is written.
Return

If the type of the container could be determined, NULL is returned. Otherwise the error which occurred is indicated by the return value (see the XPP_ERR_... macros).

Description

The function _conType() determines the type of a container.

It should be noted that for some types more then one bit is masked in the return value. Furthermore, the numeric value representing a type may change in future Xbase++ versions. Because of these reasons the return value should be tested with one of the macros defined in the header file xpppar.h. The following table lists the macros and the types for which the macro evaluates to true:

Type checking macros
Macro Type Meaning
XPP_IS_UNDEF() XPP_UNDEF NIL
XPP_IS_CHAR() XPP_CHARACTER or XPP_MEMO Character string
XPP_IS_MEMO() XPP_MEMO Memo character string
XPP_IS_NUM() XPP_NUMERIC or XPP_DOUBLE Numeric
XPP_IS_FLOAT() XPP_DOUBLE Floating point
XPP_IS_LOGIC() XPP_LOGICAL Logical
XPP_IS_DATE() XPP_DATE Date
XPP_IS_ARRAY() XPP_ARRAY Array
XPP_IS_BLOCK() XPP_BLOCK Code block
XPP_IS_OBJECT() XPP_OBJECT Object

Examples
/* 
 Read a parameter which either contains a character string 
 or a number. 
*/ 
#include <xppcon.h> 

ContainerHandle chs; 
BOOL            isRef; 
XPPAPIRET       xr; 
ULONG           type; 


chs = _conParam(<pList>, 1, &isRef); 
xr = _conType(chs, &type); 
if (xr != 0) 
{ 
/* ... error: no parameters were passed. */ 
} 
else 
{ 
/* <type> has the type of Parameter 1 */ 
if ( XPP_IS_CHAR(type) ) 
   if ( XPP_IS_MEMO(type) ) 
      /* 
         parameter is a memo ... 
      */ 
   else 
      /* 
         parameter is a character string (not a memo) ... 
      */ 
else if ( XPP_IS_NUM(type) ) 
   if ( XPP_IS_FLOAT(type) ) 
      /* 
         parameter is numeric and should 
         be read with _conGetND() ... 
      */ 
   else 
      /* 
         parameter is numeric and can be 
         read with _conGetN() ... 
      */ 
else 
   /* a different type ... */ 
} 
/* 
release the parameter container 
(if not passed by reference) 
*/ 
if (!isRef) 
_conRelease(chs); 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.