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

Constructor Functions
[Simple Objects C API]


Detailed Description

Constructor functions for creating simple object instances.


Defines

#define sobj_CSTRING(STR, CN)   (sobj_STRING_raw((STR), -1, (CN)))
 Convenience factory macro for creating a string from a C string.
#define sobj_ARRAY0(CN)   (sobj_ARRAY(0, 0, 0, 0, (CN)))
 Convenience factory macro for creating empty arrays.
#define sobj_INT(VALUE, CN)   (sobj_INT_imax((VALUE), (CN)))
 Factory for simple objects of type int.

Functions

sobjsobj_NIL (const char *cn)
 Factory for simple objects of type nil.
sobjsobj_BOOL (bool value, const char *cn)
 Factory for simple objects of type bool.
sobjsobj_INT_i (int value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_l (long value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_ll (long long value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_i8 (int8_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_i16 (int16_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_i32 (int32_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_i64 (int64_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_imax (intmax_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_u (unsigned value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_ul (unsigned long value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_ull (unsigned long long value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_u8 (uint8_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_u16 (uint16_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_u32 (uint32_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_u64 (uint64_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_umax (uintmax_t value, const char *cn)
 Factory for simple objects of type int.
sobjsobj_INT_time_t (const void *value)
 Factory for simple objects of type int.
sobjsobj_INT_timeval (const void *value)
 Factory for simple objects of type int.
sobjsobj_INT_timespec (const void *value)
 Factory for simple objects of type int.
sobjsobj_INT_iso8601_time (const void *value)
 Factory for simple objects of type int.
sobjsobj_INT_time_now (void)
 Factory for simple objects of type int.
sobjsobj_FLOAT (double value, const char *cn)
 Factory for simple objects of type float.
sobjsobj_FLOAT_nan (const char *cn)
 Factory for simple objects of type float with the value NAN (Not A Number).
sobjsobj_FLOAT_inf (const char *cn)
 Factory for simple objects of type float with the value INF (positive infinity).
sobjsobj_FLOAT_neginf (const char *cn)
 Factory for simple objects of type float with the value -INF (negative infinity).
sobjsobj_STRING (const char *string, const char *cn, struct sobj_env *env)
 String factory creating a string object from a text serialization in string context.
sobjsobj_STRING_raw (const char *raw, ptrdiff_t raw_len, const char *cn)
 String factory creating a string object from a raw UNICODE UTF-8 string.
sobjsobj_STRING_ucx (const char *ucx, ptrdiff_t ucx_size, const char *cn)
 String factory creating a string object from an extended UNICODE string.
sobjsobj_BINARY (struct sobj *id, const unsigned char *body, size_t body_length, const char *cn)
 Factory creating simple objects of type binary.
sobjsobj_ARRAY (int key_n, struct sobj **key, int value_n, struct sobj **value, const char *cn)
 Factory for creating simple objects of type array.
sobjsobj_ARRAY1 (struct sobj *key, struct sobj *value, const char *cn)
 Convenience factory function for creating one-element arrays.
sobjsobj_ARRAY2 (struct sobj *key1, struct sobj *value1, struct sobj *key2, struct sobj *value2, const char *cn)
 Convenience factory function for creating two-element arrays.
sobjsobj_ARRAY_str (int key_n, const char **key, int value_n, const char **value, const char *cn)
 Convenience factory function for creating an array of strings.
sobjsobj_VREF (const char *ref, const char *cn)
 Factory function for creating simple objects of type vref.
sobjsobj_VREF_raw (const char *ref, const char *cn)
 Factory function for creating simple objects of type vref.
sobjsobj_VREF_ucx (const char *ref, const char *cn)
 Factory function for creating simple objects of type vref.
sobjsobj_EXPR (enum sobj_expr_type type, struct sobj *op1, struct sobj *op2, struct sobj *op3, const char *cn)
 Factory function for creating simple objects of type expr.


Define Documentation

#define sobj_ARRAY0 CN   )     (sobj_ARRAY(0, 0, 0, 0, (CN)))
 

Convenience factory macro for creating empty arrays.

Parameters:
CN The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.

#define sobj_CSTRING STR,
CN   )     (sobj_STRING_raw((STR), -1, (CN)))
 

Convenience factory macro for creating a string from a C string.

This macro calls sobj_STRING_raw() with the raw_len parameter set to -1.

Parameters:
STR The C string. This is a string terminated with a null-character.
CN The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The string simple object instance.

#define sobj_INT VALUE,
CN   )     (sobj_INT_imax((VALUE), (CN)))
 

Factory for simple objects of type int.

This macro calls the constructor function sobj_INT_imax().

Parameters:
VALUE The integer value of the new simple object.
CN The class name of the new simple object.
Returns:
The simple object instance.


Function Documentation

struct sobj* sobj_ARRAY int  key_n,
struct sobj **  key,
int  value_n,
struct sobj **  value,
const char *  cn
 

Factory for creating simple objects of type array.

Parameters:
key_n The number of keys specified.
key Pointer to a vector of keys. This may be a null-pointer if key_n is 0. If the vector contains null-pointers, these are interpreted as NIL objects.
value_n The number of values specified.
value Pointer to a vector of values. This may be a null-pointer if value_n is null.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
The number of elements in the resulting array object is determined by the parameter value_n. If key_n is smaller than value_n, the missing keys are interpreted as NIL objects. If key_n is larger than value_n, the extra keys specified are ignored.

Returns:
The array simple object instance.
See also:
sobj_ARRAY0(), sobj_ARRAY1(), sobj_ARRAY2().

struct sobj* sobj_ARRAY1 struct sobj key,
struct sobj value,
const char *  cn
 

Convenience factory function for creating one-element arrays.

Parameters:
key The key of the element. A null-pointer is interpreted as a NIL object.
value The value of the element.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.

struct sobj* sobj_ARRAY2 struct sobj key1,
struct sobj value1,
struct sobj key2,
struct sobj value2,
const char *  cn
 

Convenience factory function for creating two-element arrays.

Parameters:
key1 The key of the first element. A null-pointer is interpreted as a NIL object.
value1 The value of the first element.
key2 The key of the second element. A null-pointer is interpreted as a NIL object.
value2 The value of the second element.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.

struct sobj* sobj_ARRAY_str int  key_n,
const char **  key,
int  value_n,
const char **  value,
const char *  cn
 

Convenience factory function for creating an array of strings.

Parameters:
key_n The number of keys specified.
key Pointer to a vector of keys. All keys are interpreted as raw, null-terminated strings. This may be a null-pointer if key_n is 0. If the vector contains null-pointers, these are interpreted as NIL objects.
value_n The number of values specified.
value Pointer to a vector of values All values are interpreted as raw, null-terminated strings. This may be a null-pointer if value_n is null.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
The number of elements in the resulting array object is determined by the parameter value_n. If key_n is smaller than value_n, the missing keys are interpreted as NIL objects. If key_n is larger than value_n, the extra keys specified are ignored.

Returns:
The array simple object instance.

struct sobj* sobj_BINARY struct sobj id,
const unsigned char *  body,
size_t  body_length,
const char *  cn
 

Factory creating simple objects of type binary.

Parameters:
id The ID object of the binary object. A null-pointer is eqivalent to a NIL object.
body Buffer holding the binary data for the object body. If the length of the body is 0 bytes, this may be a null-pointer.
body_length The length of the binary data body (specified in bytes).
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The binary simple object instance.

struct sobj* sobj_BOOL bool  value,
const char *  cn
 

Factory for simple objects of type bool.

Parameters:
value The boolean value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_EXPR enum sobj_expr_type  type,
struct sobj op1,
struct sobj op2,
struct sobj op3,
const char *  cn
 

Factory function for creating simple objects of type expr.

Parameters:
type The expression type.
op1 The first operand of the expression.
op2 The second operand. This must be a null-pointer if the expression type requires only one operand.
op3 The third operand. This must be a null-pointer if the expression type requires less that tree operands.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The expression simple object instance.

struct sobj* sobj_FLOAT double  value,
const char *  cn
 

Factory for simple objects of type float.

Parameters:
value The floating point value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_FLOAT_inf const char *  cn  ) 
 

Factory for simple objects of type float with the value INF (positive infinity).

Parameters:
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_FLOAT_nan const char *  cn  ) 
 

Factory for simple objects of type float with the value NAN (Not A Number).

Parameters:
cn The class name of the new simple object.
Returns:
The simple object instance.
Note:
On platforms without support for quiet NaN, the function returns a simple object with the value INF (positive infinity).

struct sobj* sobj_FLOAT_neginf const char *  cn  ) 
 

Factory for simple objects of type float with the value -INF (negative infinity).

Parameters:
cn The class name of the new simple object.
Returns:
The simple object instance.
Note:
On platforms without support for negative infinity, the function returns a simple object with the value INF (positive infinity).

struct sobj* sobj_INT_i int  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_i16 int16_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_i32 int32_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_i64 int64_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_i8 int8_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_imax intmax_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_iso8601_time const void *  value  ) 
 

Factory for simple objects of type int.

This factory creates a {time} object (in epoch representation) from a struct iso8601_time.

Parameters:
value Pointer to the struct timespec value.
Returns:
The simple object instance. The returned instance is always of class {time}. If the time object can not be created (e.g. because some of the time fields are undefined), then a null-pointer is returned.

struct sobj* sobj_INT_l long  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_ll long long  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_time_now void   ) 
 

Factory for simple objects of type int.

This factory creates a {time} object (in epoch representation) from the current time of day. On UNIX systems, the current time is obtained by calling the gettimeofday() system function.

Note:
The maximum time resolution representable as a simple object is 0.001 sec.
Returns:
The simple object instance. The returned instance is always of class {time}.

struct sobj* sobj_INT_time_t const void *  value  ) 
 

Factory for simple objects of type int.

This factory creates a {time} object (in epoch representation) from a time_t value.

Parameters:
value Pointer to the time_t value.
Returns:
The simple object instance. The returned instance is always of class {time}.

struct sobj* sobj_INT_timespec const void *  value  ) 
 

Factory for simple objects of type int.

This factory creates a {time} object (in epoch representation) from a struct timespec.

Note:
The maximum time resolution representable as a simple object is 0.001 sec.
Parameters:
value Pointer to the struct timespec value. The time is interpreted as UTC.
Returns:
The simple object instance. The returned instance is always of class {time}.

struct sobj* sobj_INT_timeval const void *  value  ) 
 

Factory for simple objects of type int.

This factory creates a {time} object (in epoch representation) from a struct timeval.

Note:
The maximum time resolution representable as a simple object is 0.001 sec.
Parameters:
value Pointer to the struct timeval value. The time is interpreted as UTC.
Returns:
The simple object instance. The returned instance is always of class {time}.

struct sobj* sobj_INT_u unsigned  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_u16 uint16_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_u32 uint32_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_u64 uint64_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance or a null-pointer if the specified number can't be represented as a simple object.
Note:
The current simple object implementation represents integer numbers as signed 64bit integers. Integers of arbitrary precision are planned for version 1.0.

struct sobj* sobj_INT_u8 uint8_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_ul unsigned long  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_INT_ull unsigned long long  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance or a null-pointer if the specified number can't be represented as a simple object.
Note:
The current simple object implementation represents integer numbers as signed 64bit integers. Integers of arbitrary precision are planned for version 1.0.

struct sobj* sobj_INT_umax uintmax_t  value,
const char *  cn
 

Factory for simple objects of type int.

Parameters:
value The integer value of the new simple object.
cn The class name of the new simple object.
Returns:
The simple object instance or a null-pointer if the specified number can't be represented as a simple object.
Note:
The current simple object implementation represents integer numbers as signed 64bit integers. Integers of arbitrary precision are planned for version 1.0.

struct sobj* sobj_NIL const char *  cn  ) 
 

Factory for simple objects of type nil.

Parameters:
cn The class name of the new simple object.
Returns:
The simple object instance.

struct sobj* sobj_STRING const char *  string,
const char *  cn,
struct sobj_env env
 

String factory creating a string object from a text serialization in string context.

Parameters:
string The string context text serialization of the string.
cn The class name of the new simple object.
env The environment. This may be a null-pointer.
Returns:
The function returns a simple object instance representing the specified string.

struct sobj* sobj_STRING_raw const char *  raw,
ptrdiff_t  raw_len,
const char *  cn
 

String factory creating a string object from a raw UNICODE UTF-8 string.

Parameters:
raw The raw UNICODE UTF-8 string. The length of the string is specified through the parameter raw_len, so the string does not have to be null-terminated. The string may not contain null-characters. A null-character is treated as the end of the string.
raw_len The length if the raw UNICODE string, specified in bytes. If the size is unknown and the string is null-terminated, -1 (or an upper bound) may be specified instead.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The function returns a simple object instance representing the specified string.

struct sobj* sobj_STRING_ucx const char *  ucx,
ptrdiff_t  ucx_size,
const char *  cn
 

String factory creating a string object from an extended UNICODE string.

Parameters:
ucx The extended UNICODE string.
ucx_size The length of the extended UNICODE string in bytes (-1 if ucx_string is null-terminated).
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The function returns a simple object instance representing the specified string.

struct sobj* sobj_VREF const char *  ref,
const char *  cn
 

Factory function for creating simple objects of type vref.

Parameters:
ref The reference string of the variable reference. The specified string is converted to UTF8 and interpreted as a text serialization in string context. The represented string is taken as the reference string of the new object.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.
See also:
sobj_VREF_raw(), sobj_VREF_ucx().

struct sobj* sobj_VREF_raw const char *  ref,
const char *  cn
 

Factory function for creating simple objects of type vref.

Parameters:
ref The reference string of the variable reference. This is an UTF-8 encoded UNICODE string. Note that this is not an extended UNICODE string and hence may not contain variable references. Use the function sobj_VREF_ucx() for creating vref objects from extended strings.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.

struct sobj* sobj_VREF_ucx const char *  ref,
const char *  cn
 

Factory function for creating simple objects of type vref.

Parameters:
ref The reference string of the variable reference. This is an extended UNICODE string that may contain variable references. The function checks if this is a correct UCX string. It is a runtime error if the UCX string contains errors.
cn The class name of the resulting simple object. A null-pointer or an empty string indicate no class name.
Returns:
The array simple object instance.


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