Symisc Systems

Libcox C/C++ API Reference - Libcox Object Value Type


Star Follow @symisc

Syntax

int libcox_value_is_int(libcox_value *pVal);

int libcox_value_is_float(libcox_value *pVal);

int libcox_value_is_bool(libcox_value *pVal);

int libcox_value_is_string(libcox_value *pVal);

int libcox_value_is_null(libcox_value *pVal);

int libcox_value_is_numeric(libcox_value *pVal);

int libcox_value_is_scalar(libcox_value *pVal);

int libcox_value_is_array(libcox_value *pVal);


Check if the given libcox object value is of the expected type.

Description

As their name suggests, these routines returns TRUE (1) if the given libcox_value is of the expected type. For example libcox_value_is_int() return TRUE only if the given libcox_value is of type integer, libcox_value_is_string() return TRUE only if the given libcox_value is of type string and so forth.

Note that these routines does not perform any conversion. If such behavior is wanted, use libcox_value_to_string(), libcox_value_to_int(), etc. instead.

These routines are useful inside foreign commands to make sure that the given arguments are of the expected type.


Parameters

pVal

A pointer to a libcox value.


Return value

These routines returns 1 (TRUE) if the given libcox_value is of the expected type. 0 (FALSE) otherwise.


See also

Obtaining Libcox Object Values, Populating Object Values, Setting the Result of a Foreign Command.