Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Type Testing
[Simple Objects C API]


Detailed Description

Functions for testing the type and class of objects.


Functions

bool sobj_is_nil (struct sobj *sobj)
 Check if the called object is a classless nil object.
bool sobj_is_nil_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a nil object of the specified class.
bool sobj_is_bool (struct sobj *sobj)
 Check if the called object is a classless boolean object.
bool sobj_is_bool_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a boolean object of the specified class.
bool sobj_is_int (struct sobj *sobj)
 Check if the called object is a classless integer object.
bool sobj_is_int_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is an integer object of the specified class.
bool sobj_is_float (struct sobj *sobj)
 Check if the called object is a classless floating point object.
bool sobj_is_float_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a floating point object of the specified class.
bool sobj_is_number (struct sobj *sobj)
 Check if the called object is a classless number.
bool sobj_is_number_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a number of the specified class.
bool sobj_is_string (struct sobj *sobj)
 Check if the called object is a classless object of type string.
bool sobj_is_string_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a string object of the specified class.
bool sobj_is_simple_string (struct sobj *sobj)
 Check if the called object is a classless simple string object.
bool sobj_is_simple_string_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a simple string object of the specified class.
bool sobj_is_binary (struct sobj *sobj)
 Check if the called object is a classless binary object.
bool sobj_is_binary_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a binary object of the specified class.
bool sobj_is_plain_binary (struct sobj *sobj)
 Check if the called object is a plain classless binary object.
bool sobj_is_plain_binary_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain binary object of the specified class.
bool sobj_is_array (struct sobj *sobj)
 Check if the called object is a classless array object.
bool sobj_is_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is an array object of the specified class.
bool sobj_is_plain_array (struct sobj *sobj)
 Check if the called object is a plain classless array object.
bool sobj_is_plain_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain array object of the specified class.
bool sobj_is_int_array (struct sobj *sobj)
 Check if the called object is a plain classless integer array object.
bool sobj_is_int_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain integer array object of the specified class.
bool sobj_is_float_array (struct sobj *sobj)
 Check if the called object is a plain classless floating point array object.
bool sobj_is_float_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain floating point array object of the specified class.
bool sobj_is_number_array (struct sobj *sobj)
 Check if the called object is a plain classless number array object.
bool sobj_is_number_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain number array object of the specified class.
bool sobj_is_string_array (struct sobj *sobj)
 Check if the called object is a plain classless string array object.
bool sobj_is_string_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain string array object of the specified class.
bool sobj_is_simple_string_array (struct sobj *sobj)
 Check if the called object is a plain classless simple string array object.
bool sobj_is_simple_string_array_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a plain simple string array object of the specified class.
bool sobj_is_dict (struct sobj *sobj)
 Check if the called object is a classless dictionary object.
bool sobj_is_dict_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a dictionary object with the specified class name.
bool sobj_is_simple_dict (struct sobj *sobj)
 Check if the called object is a classless simple dictionary object.
bool sobj_is_simple_dict_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a simple dictionary object with the specified class name.
bool sobj_is_expr (struct sobj *sobj)
 Check if the called object is a classless expression object.
bool sobj_is_expr_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is an expression object of the specified class.
bool sobj_is_vref (struct sobj *sobj)
 Check if the called object is a classless vref object.
bool sobj_is_vref_with_cn (struct sobj *sobj, const char *cn)
 Check if the called object is a vref object of the specified class.
int sobj_test (struct sobj *sobj, const char *spec, struct sobj_env *env)
 Check if the called object matches the specified type specification.


Function Documentation

bool sobj_is_array struct sobj sobj  ) 
 

Check if the called object is a classless array object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless array object.
false The called object is not an array object or has a class name.

bool sobj_is_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is an array object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is an array object of the specified class.
false The called object is not an array object of the specified class.

bool sobj_is_binary struct sobj sobj  ) 
 

Check if the called object is a classless binary object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless binary object.
false The called object is not a binary object or has a class name.

bool sobj_is_binary_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a binary object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a binary object of the specified class.
false The called object is not a binary object of the specified class.

bool sobj_is_bool struct sobj sobj  ) 
 

Check if the called object is a classless boolean object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless boolean object.
false The called object is not a boolean or has a classname.

bool sobj_is_bool_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a boolean object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a boolean object of the specified class.
false The called object is not a boolean object of the specified class.

bool sobj_is_dict struct sobj sobj  ) 
 

Check if the called object is a classless dictionary object.

A classless dictionary object is an array object without a class name where all keys are classless strings.

Parameters:
sobj The called object.
Return values:
true The called object is a classless dictionary object.
false The called object is not a classless dictionary object.

bool sobj_is_dict_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a dictionary object with the specified class name.

A dictionary object is an array object where all keys are classless strings.

Parameters:
sobj The called object.
cn The expected class name of the object. A null-pointer is equivalent to an empty class name.
Return values:
true The called object is a dictionary object of the specified class.
false The called object is not a dictionary object of the specified class.

bool sobj_is_expr struct sobj sobj  ) 
 

Check if the called object is a classless expression object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless expression object.
false The called object is not an expression object or has a class name.

bool sobj_is_expr_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is an expression object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is an expression object of the specified class.
false The called object is not an expression object of the specified class.

bool sobj_is_float struct sobj sobj  ) 
 

Check if the called object is a classless floating point object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless floating point object.
false The called object is not a floating point object or has a class name.

bool sobj_is_float_array struct sobj sobj  ) 
 

Check if the called object is a plain classless floating point array object.

A plain classless floating point array object is an array object without a class name where all keys are nil and all values are classless floating point number objects.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless floating point array object.
false The called object is not a plain classless floating point array object.

bool sobj_is_float_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain floating point array object of the specified class.

A plain floating point array object is an array object where all keys are nil and all values are classless floating point number objects.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain floating point array object of the specified class.
false The called object is not a plain floating point array object of the specified class.

bool sobj_is_float_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a floating point object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a floating point object of the specified class.
false The called object is not a floating point object of the specified class.

bool sobj_is_int struct sobj sobj  ) 
 

Check if the called object is a classless integer object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless integer object.
false The called object is not an integer or has a class name.

bool sobj_is_int_array struct sobj sobj  ) 
 

Check if the called object is a plain classless integer array object.

A plain classless integer array object is an array object without a class name where all keys are nil and all values are classless integer objects.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless integer array object.
false The called object is not a plain classless integer array object.

bool sobj_is_int_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain integer array object of the specified class.

A plain integer array object is an array object where all keys are nil and all values are classless integer objects.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain integer array object of the specified class.
false The called object is not a plain integer array object of the specified class.

bool sobj_is_int_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is an integer object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is an integer object of the specified class.
false The called object is not an integer object of the specified class.

bool sobj_is_nil struct sobj sobj  ) 
 

Check if the called object is a classless nil object.

The function returns true if a null-pointer is specified.

Parameters:
sobj The called object. This may be a null-pointer.
Return values:
true The called object is of type nil and has no class name or the sobj argument is a null-pointer.
false The called object is not of type nil or has a class name.

bool sobj_is_nil_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a nil object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is of type nil and the class name matches the specified class name.
false The called object is not of type nil or the class name does not match.

bool sobj_is_number struct sobj sobj  ) 
 

Check if the called object is a classless number.

A number is either an integer or a floating point number.

Parameters:
sobj The called object.
Return values:
true The called object is a classless number.
false The called object is not a classless number.

bool sobj_is_number_array struct sobj sobj  ) 
 

Check if the called object is a plain classless number array object.

A plain classless number array object is an array object without a class name where all keys are nil and all values are classless number objects.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless number array object.
false The called object is not a plain classless number array object.
See also:
sobj_is_number().

bool sobj_is_number_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain number array object of the specified class.

A plain number array object is an array object where all keys are nil and all values are classless number objects.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain number array object of the specified class.
false The called object is not a plain number array object of the specified class.
See also:
sobj_is_number().

bool sobj_is_number_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a number of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a number object of the specified class.
false The called object is not a number object of the specified class.

bool sobj_is_plain_array struct sobj sobj  ) 
 

Check if the called object is a plain classless array object.

A plain classless array object is an array object without a class name where all keys are nil.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless array object.
false The called object is not a plain classless array object.

bool sobj_is_plain_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain array object of the specified class.

A plain array object is an array object where all keys are nil.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain array object of the specified class.
false The called object is not a plain array object of the specified class.

bool sobj_is_plain_binary struct sobj sobj  ) 
 

Check if the called object is a plain classless binary object.

A plain classless binary object is an object of type binary without a class name where the type ID is nil.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless binary object.
false The called object is not a plain classless binary object.

bool sobj_is_plain_binary_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain binary object of the specified class.

A plain binary object is an object of type binary where the type ID is nil.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain binary object of the specified class.
false The called object is not a plain binary object of the specified class.

bool sobj_is_simple_dict struct sobj sobj  ) 
 

Check if the called object is a classless simple dictionary object.

A classless simple dictionary object is an array object without a class name where all keys are classless simple strings.

Parameters:
sobj The called object.
Return values:
true The called object is a classless simple dictionary object.
false The called object is not a classless simple dictionary object.

bool sobj_is_simple_dict_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a simple dictionary object with the specified class name.

A simple dictionary object is an array object where all keys are classless simple strings.

Parameters:
sobj The called object.
cn The expected class name of the object. A null-pointer is equivalent to an empty class name.
Return values:
true The called object is a simple dictionary object of the specified class.
false The called object is not a simple dictionary object of the specified class.

bool sobj_is_simple_string struct sobj sobj  ) 
 

Check if the called object is a classless simple string object.

A simple string object is a string without embedded variable references.

Parameters:
sobj The called object.
Return values:
true The called object is a classless simple string object.
false The called object is not a classless simple string object.

bool sobj_is_simple_string_array struct sobj sobj  ) 
 

Check if the called object is a plain classless simple string array object.

A plain classless simple string array object is an array object without a class name where all keys are nil and all values are classless simple string objects.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless simple string array object.
false The called object is not plain a classless simple string array object.
See also:
sobj_is_simple_string().

bool sobj_is_simple_string_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain simple string array object of the specified class.

A plain simple string array object is an array object where all keys are nil and all values are classless simple string objects.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain simple string array object of the specified class.
false The called object is not plain a simple string array object of the specified class.
See also:
sobj_is_simple_string().

bool sobj_is_simple_string_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a simple string object of the specified class.

A simple string object is a string without embedded variable references.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a simple string object of the specified class.
false The called object is not a simple string object of the specified class.

bool sobj_is_string struct sobj sobj  ) 
 

Check if the called object is a classless object of type string.

Parameters:
sobj The called object.
Return values:
true The called object is of type string and has no class name.
false The called object is not of type string or has a class name.

bool sobj_is_string_array struct sobj sobj  ) 
 

Check if the called object is a plain classless string array object.

A plain classless string array object is an array object without a class name where all keys are nil and all values are classless string objects.

Parameters:
sobj The called object.
Return values:
true The called object is a plain classless string array object.
false The called object is not a plain classless string array object.

bool sobj_is_string_array_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a plain string array object of the specified class.

A plain string array object is an array object where all keys are nil and all values are classless string objects.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a plain string array object of the specified class.
false The called object is not a plain string array object of the specified class.

bool sobj_is_string_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a string object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a string object of the specified class.
false The called object is not a string object of the specified class.

bool sobj_is_vref struct sobj sobj  ) 
 

Check if the called object is a classless vref object.

Parameters:
sobj The called object.
Return values:
true The called object is a classless vref object.
false The called object is not a vref object or has a class name.

bool sobj_is_vref_with_cn struct sobj sobj,
const char *  cn
 

Check if the called object is a vref object of the specified class.

Parameters:
sobj The called object.
cn The class name. This may be a null-pointer.
Return values:
true The called object is a vref object of the specified class.
false The called object is not a vref object of the specified class.

int sobj_test struct sobj sobj,
const char *  spec,
struct sobj_env env
 

Check if the called object matches the specified type specification.

A type specification has the following syntax:

 <typespec>('|' <typespec>)*

In words: a type specification is a non-empty list of <typespec> symbols. The called object matches the type specification if it matches at least one of the <typespec>s.

A <typespec> symbol has the following syntax:

 <cn.opt> <type.or.list> <cond.opt>

A <cn.opt> symbol is either empty or a class name enclosed in curly braces. If the class name is omitted, then the class name of the called object is ignored, so there's a differennce between specifying an empty class name and specifying no class name.

A <type.ot.list> symbol is either an array of values or a typename. For an array of values, the called object matches if it is equal to one of the listed values (with the specified class name attached). An empty array always matches. If a typename is specified, then the called object matches if its type matches the specified typename. The special typename "ANY" matches all object types. (As a consequence, an empty array and the typename "ANY" are equivalent.)

A <cond.opt> symbol is either empty or an expression enclosed in parentheses. If an expression is specified, then the expression must evaluate to true for the called object to match the specification. Within the expression, the called object is substituted for the variable $_.

Example:

    {time}[ 'now', 'noon', 'midnight' ] | {time}INT($_ > 0) | {time}STRING

Parameters:
sobj The called object.
spec The type specification string.
env The environment to be used. This may be a null-pointer. The special value SOBJ_ENV_STANDARD indicates that the standard environment should be used.
Return values:
0 The called object does not match the specification string.
1 The called object does match the specification string.
-1 An error occurred.


Generated on Sat Jul 23 16:07:33 2005 for sobject by  doxygen 1.3.9.1