CHFL_PROPERTY

typedef struct CHFL_PROPERTY CHFL_PROPERTY

This class holds the data used in properties in CHFL_FRAME and CHFL_ATOM. A property can have various types: bool, double, string or chfl_vector3d.

Here is the full list of functions acting on CHFL_PROPERTY:


CHFL_PROPERTY *chfl_property_bool(bool value)

Create a new property holding a boolean value.

The caller of this function should free the allocated memory using chfl_free.

Returns:

A pointer to the property, or NULL in case of error. You can use chfl_last_error to learn about the error.

CHFL_PROPERTY *chfl_property_double(double value)

Create a new property holding a double value.

The caller of this function should free the allocated memory using chfl_free.

Returns:

A pointer to the property, or NULL in case of error. You can use chfl_last_error to learn about the error.

CHFL_PROPERTY *chfl_property_string(const char *value)

Create a new property holding a string value.

The caller of this function should free the allocated memory using chfl_free.

Returns:

A pointer to the property, or NULL in case of error. You can use chfl_last_error to learn about the error.

CHFL_PROPERTY *chfl_property_vector3d(const chfl_vector3d value)

Create a new property holding a 3D vector value.

The caller of this function should free the allocated memory using chfl_free.

Returns:

A pointer to the property, or NULL in case of error. You can use chfl_last_error to learn about the error.

chfl_status chfl_property_get_kind(const CHFL_PROPERTY *property, chfl_property_kind *kind)

Get the type of value held by this property in kind.

Returns:

The operation status code. You can use chfl_last_error to learn about the error if the status code is not CHFL_SUCCESS.

chfl_status chfl_property_get_bool(const CHFL_PROPERTY *property, bool *value)

Get the boolean value held by this property in the location pointed to by value.

This function returns CHFL_PROPERTY_ERROR if the property is not a boolean property.

Returns:

The operation status code. You can use chfl_last_error to learn about the error if the status code is not CHFL_SUCCESS.

chfl_status chfl_property_get_double(const CHFL_PROPERTY *property, double *value)

Get the double value holded by this property in the location pointed to by value.

This function returns CHFL_PROPERTY_ERROR if the property is not a double property.

Returns:

The operation status code. You can use chfl_last_error to learn about the error if the status code is not CHFL_SUCCESS.

chfl_status chfl_property_get_string(const CHFL_PROPERTY *property, char *buffer, uint64_t buffsize)

Get the string value held by this property in the given buffer.

This function returns CHFL_PROPERTY_ERROR if the property is not a string property.

The buffer size must be passed in buffsize. This function will truncate the property to fit in the buffer.

Returns:

The operation status code. You can use chfl_last_error to learn about the error if the status code is not CHFL_SUCCESS.

chfl_status chfl_property_get_vector3d(const CHFL_PROPERTY *property, chfl_vector3d value)

Get the 3D vector value held by this property in the location pointed to by value.

This function returns CHFL_PROPERTY_ERROR if the property is not a 3D vector property.

Returns:

The operation status code. You can use chfl_last_error to learn about the error if the status code is not CHFL_SUCCESS.