Main Page   Modules   Alphabetical List   Compound List   Compound Members  

Properties


Typedefs

typedef _cpl_property_ cpl_property
 The opaque property data type. More...


Functions

cpl_property * cpl_property_new (const char *name, cpl_type type)
 Create an empty property of a given type. More...

cpl_property * cpl_property_sized_new (const char *name, cpl_type type, int size)
 Create an empty property of a given type and size. More...

cpl_property * cpl_property_duplicate (const cpl_property *property)
 Create a copy of a property. More...

void cpl_property_delete (cpl_property *property)
 Destroy a property. More...

long cpl_property_get_size (cpl_property *property)
 Get the current number of elements a property contains. More...

long cpl_property_max_size (cpl_property *property)
 Get the maximum number of elements possible. More...

cpl_type cpl_property_get_type (cpl_property *property)
 Get the type of a property. More...

int cpl_property_set_name (cpl_property *property, const char *name)
 Modify the name of a property. More...

int cpl_property_set_comment (cpl_property *property, const char *comment)
 Modify a property's comment. More...

int cpl_property_set_char (cpl_property *property, char value)
 Set the value of a character property. More...

int cpl_property_set_bool (cpl_property *property, int value)
 Set the value of a boolean property. More...

int cpl_property_set_int (cpl_property *property, int value)
 Set the value of an integer property. More...

int cpl_property_set_long (cpl_property *property, long value)
 Set the value of a long property. More...

int cpl_property_set_float (cpl_property *property, float value)
 Set the value of a float property. More...

int cpl_property_set_double (cpl_property *property, double value)
 Set the value of a double property. More...

int cpl_property_set_string (cpl_property *property, const char *value)
 Set the value of a string property. More...

const char * cpl_property_get_name (const cpl_property *property)
 Get the property name. More...

const char * cpl_property_get_comment (const cpl_property *property)
 Get the property comment. More...

char cpl_property_get_char (const cpl_property *property)
 Get the value of a character property. More...

int cpl_property_get_bool (const cpl_property *property)
 Get the value of a boolean property. More...

int cpl_property_get_int (const cpl_property *property)
 Get the value of an integer property. More...

long cpl_property_get_long (const cpl_property *property)
 Get the value of a long property. More...

float cpl_property_get_float (const cpl_property *property)
 Get the value of a float property. More...

double cpl_property_get_double (const cpl_property *property)
 Get the value of a double property. More...

const char * cpl_property_get_string (const cpl_property *property)
 Get the value of a string property. More...


Detailed Description

This module implements the property type. The type cpl_property is basically a variable container which consists of a name, a type identifier and a specific value of that type. The type identifier always determines the type of the associated value. A property is similar to an ordinary variable and its current value can be set or retrieved through its name. In addition a property may have a descriptive comment associated. A property can be created for the basic types char, bool (int), int, long, float and double. Also C strings are supported. Support for arrays in general is currently not available.
Synopsis:
   #include <cpl_property.h>

Typedef Documentation

typedef struct _cpl_property_ cpl_property
 

The opaque property data type.


Function Documentation

void cpl_property_delete cpl_property   property
 

Destroy a property.

Parameters:
property  A property.
Returns:
Nothing.
The function destroys a property of any kind. All property members including its value are properly deallocated.

cpl_property* cpl_property_duplicate const cpl_property   property
 

Create a copy of a property.

Parameters:
property  A property.
Returns:
The copy of the given property.
The function returns a copy of the property property. The copy is a deep copy, i.e. all property members are copied.

int cpl_property_get_bool const cpl_property   property
 

Get the value of a boolean property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the boolean value currently stored in the property property.

If the property's type is not CPL_TYPE_BOOL, the returned value is 0 and the error CPL_ERROR_TYPE_MISMATCH is set.

char cpl_property_get_char const cpl_property   property
 

Get the value of a character property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the character value currently stored in the property property.

If the property's type is not CPL_TYPE_CHAR, the returned value is '\0' and the error CPL_ERROR_TYPE_MISMATCH is set.

const char* cpl_property_get_comment const cpl_property   property
 

Get the property comment.

Parameters:
property  A property.
Returns:
The comment of the property if it is present, or NULL.
The function returns a handle for the comment string of property.

double cpl_property_get_double const cpl_property   property
 

Get the value of a double property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the double value currently stored in the property property.

If the property's type is not CPL_TYPE_DOUBLE, the returned value is 0.0 and the error CPL_ERROR_TYPE_MISMATCH is set.

float cpl_property_get_float const cpl_property   property
 

Get the value of a float property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the float value currently stored in the property property.

If the property's type is not CPL_TYPE_FLOAT, the returned value is 0.0 and the error CPL_ERROR_TYPE_MISMATCH is set.

int cpl_property_get_int const cpl_property   property
 

Get the value of an integer property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the integer value currently stored in the property property.

If the property's type is not CPL_TYPE_INT, the returned value is 0 and the error CPL_ERROR_TYPE_MISMATCH is set.

long cpl_property_get_long const cpl_property   property
 

Get the value of a long property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the long value currently stored in the property property.

If the property's type is not CPL_TYPE_LONG, the returned value is 0 and the error CPL_ERROR_TYPE_MISMATCH is set.

const char* cpl_property_get_name const cpl_property   property
 

Get the property name.

Parameters:
property  A property.
Returns:
The name of the property.
The function returns a handle for the identifier string of property.

long cpl_property_get_size cpl_property   property
 

Get the current number of elements a property contains.

Parameters:
property  A property.
Returns:
The current number of elements.
The function returns the current number of elements the property property contains. This is the array size of the property's value and in particular, for a property of the type CPL_TYPE_STRING, it is the length of the string as given by the strlen() function.

const char* cpl_property_get_string const cpl_property   property
 

Get the value of a string property.

Parameters:
property  A property.
Returns:
The current property value.
The function retrieves the string value currently stored in the property property.

If the property's type is not CPL_TYPE_STRING, the returned value is NULL and the error CPL_ERROR_TYPE_MISMATCH is set.

cpl_type cpl_property_get_type cpl_property   property
 

Get the type of a property.

Parameters:
property  A property.
Returns:
The type code of this property.
This function returns the type of the data value stored in the property property.

long cpl_property_max_size cpl_property   property
 

Get the maximum number of elements possible.

Parameters:
property  A property.
Returns:
The maximum number of elements that can be stored in a property.
The function returns the capacity of a property, i.e. the maximum number of elements a property of an array type can have. For a property of type CPL_TYPE_STRING this is the maximum length including the trailing '\0'.

cpl_property* cpl_property_new const char *    name,
cpl_type    type
 

Create an empty property of a given type.

Parameters:
name  Property name.
type  Property type flag.
Returns:
The newly created property, or NULL if it could not be created.
The function allocates memory for a property of type type and assigns the identifier string name to the newly created property.

The returned property must be destroyed using the property destructor cpl_property_delete().

See also:
cpl_property_delete()

int cpl_property_set_bool cpl_property   property,
int    value
 

Set the value of a boolean property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current boolean value of property with a a 0, if value is equal to 0. If value is different from 0 any previous value of property is replaced by a 1.

int cpl_property_set_char cpl_property   property,
char    value
 

Set the value of a character property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current character value of property with a copy of the value value.

int cpl_property_set_comment cpl_property   property,
const char *    comment
 

Modify a property's comment.

Parameters:
property  A property.
comment  New comment.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current comment field of property with a copy of the string comment. The new comment may be NULL. In this case the function effectively deletes the current comment.

int cpl_property_set_double cpl_property   property,
double    value
 

Set the value of a double property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current double value of property with a copy of the value value.

int cpl_property_set_float cpl_property   property,
float    value
 

Set the value of a float property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current float value of property with a copy of the value value.

int cpl_property_set_int cpl_property   property,
int    value
 

Set the value of an integer property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current integer value of property with a copy of the value value.

int cpl_property_set_long cpl_property   property,
long    value
 

Set the value of a long property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current long value of property with a copy of the value value.

int cpl_property_set_name cpl_property   property,
const char *    name
 

Modify the name of a property.

Parameters:
property  A property.
name  New name.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current name of property with a copy of the string name. The function returns an error if name is NULL.

int cpl_property_set_string cpl_property   property,
const char *    value
 

Set the value of a string property.

Parameters:
property  A property.
value  New value.
Returns:
The function returns 0 on success and 1 otherwise.
The function replaces the current string value of property with a copy of the value value.

cpl_property* cpl_property_sized_new const char *    name,
cpl_type    type,
int    size
 

Create an empty property of a given type and size.

Parameters:
name  Property name.
type  Property type flag.
size  Size of the property value.
Returns:
The newly created property, or NULL if it could not be created.
The function allocates memory for a property of type type and assigns the identifier string name to the newly created property. The property value is created such that size elements of type type can be stored.

The returned property must be destroyed using the property destructor cpl_property_delete().

See also:
cpl_property_delete()


Generated on Mon May 24 14:58:05 2004 for Common Pipeline Library Reference Manual by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002