Function wyrd_set_property_typed
Defined in File properties.h
Function Documentation
-
wyrd_error_t wyrd_set_property_typed(struct wyrd_handle *handle, char const *path, wyrd_property_type type, wyrd_merge_strategy strategy, void const *value, size_t value_size, int override_type)
Set a property at a given path to a value.
Paths can be flat names; however, if a dot character (‘.’, U+002E) is encountered, it is considered a path separator. It is thus possible to create structured data by e.g. setting the values of e.g. “foo.bar” and “foo.baz” separately.
Note that empty path segments are ignored, i.e. “.foo.bar” is equivalent to “foo.bar”, and “foo..baz” to “foo.baz”, etc.
When override_type is zero, setting a property value will fail if the property previously had a value, and the type/strategy are other than the provided. This may e.g. trigger if a property “foo” exists, and a property “foo.bar” is to be set, as this would change the type of “foo” to a container. If non-zero values are given, value types are silently overridden.
This function is the most primitive form of the API. Prefer using the simpler versions below.
- Parameters
handle – [in] A handle to an opened resource.
path – [in] Path that names the property in question.
type – [in] The property type; see wyrd_property_type.
strategy – [in] The merge strategy to use; see wyrd_merge_strategy.
value – [in] A pointer to the value; how this is interpreted depends on
type
.value_size – [in] The size of the value; if this does not match expecttions provided by
type
, the function may error.override_type – [in] A boolean value defining whether an existing property value’s type should be overridden by this call (TRUE), or if the function should error when the existing type does not match the requested type (FALSE).
- Return values
WYRD_ERR_SUCCESS – On success.
WYRD_ERR_INVALID_VALUE – If any of the inpurt values are invalid, such as NULL pointers where there should not be any, etc.
WYRD_ERR_BAD_PROPERTY_TYPE – If
override_type
is set to FALSE and the document conditions occur.