move sub-functions of value impls to concrete types
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
5d91c89533
commit
7f24d3d064
14 changed files with 339 additions and 119 deletions
|
|
@ -14,7 +14,7 @@ IKARUS_BEGIN_HEADER
|
|||
/// \brief A true/false boolean-esque value. For example "Is Dead".
|
||||
struct IkarusToggleValue;
|
||||
|
||||
/// \brief Creates a toggle value from booleans.
|
||||
/// \brief Creates a toggle.
|
||||
/// \return The value or null if an error occurs.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusToggleValue * ikarus_toggle_value_create();
|
||||
|
|
@ -24,13 +24,13 @@ IKA_API IkarusToggleValue * ikarus_toggle_value_create();
|
|||
/// \pre \li Must not be null.
|
||||
/// \param idx The index of the data to fetch.
|
||||
/// \pre \li Must be less than the size of the value.
|
||||
/// \return The underlying data or null if an error occurs or the value is indeterminate.
|
||||
/// \return The underlying data or null if an error occurs or the value is undefined.
|
||||
IKA_API bool const * ikarus_toggle_value_get(IkarusToggleValue * value, size_t idx);
|
||||
|
||||
/// \brief Fetches the size of the underlying data of a toggle value.
|
||||
/// \param value The toggle value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return The size of the underlying data or 0 if an error occurs or the value is indeterminate.
|
||||
/// \return The size of the underlying data or 0 if an error occurs or the value is undefined.
|
||||
IKA_API size_t ikarus_toggle_value_get_size(IkarusToggleValue const * value);
|
||||
|
||||
/// \brief Sets the data of a toggle value at a specific index.
|
||||
|
|
@ -58,14 +58,57 @@ IKA_API void ikarus_toggle_value_insert(IkarusToggleValue * value, size_t idx, b
|
|||
|
||||
/// \brief Clears a toggle value.
|
||||
/// \param value The toggle value.
|
||||
/// \remark Noop if the value is indeterminate.
|
||||
/// \remark Noop if the value is undefined.
|
||||
IKA_API void ikarus_toggle_value_clear(IkarusToggleValue * value);
|
||||
|
||||
/// \brief Checks if a toggle value is undefined.
|
||||
/// \param value The toggle value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return True if the value is undefined, false otherwise.
|
||||
IKA_API bool ikarus_toggle_value_is_undefined(IkarusToggleValue const * value);
|
||||
|
||||
/// \brief Changes a toggle value's undefined state.
|
||||
/// \param value The toggle value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \param undefined The new undefined state.
|
||||
/// \remark Noop if the value is already undefined.
|
||||
/// \remark If the value is set to undefined, all data will be cleared.
|
||||
/// \remark If the value is set to not undefined, the value is as if newly created.
|
||||
IKA_API void ikarus_toggle_value_set_undefined(IkarusToggleValue * value, bool undefined);
|
||||
|
||||
/// \brief Converts a toggle value to a string.
|
||||
/// \param value The toggle value to convert.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return The converted string.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
/// \remark Undefined if the value is undefined.
|
||||
IKA_API char const * ikarus_toggle_value_to_string(IkarusToggleValue const * value);
|
||||
|
||||
/// \brief Checks if two values are equal.
|
||||
/// \param lhs The left hand side value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \param rhs The right hand side value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return True if the values' data are equal, false otherwise.
|
||||
IKA_API bool ikarus_toggle_value_is_equal(IkarusToggleValue const * lhs, IkarusToggleValue const * rhs);
|
||||
|
||||
/// \brief Creates a copy of a toggle value.
|
||||
/// \param value The value to copy.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return The copied value.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusToggleValue * ikarus_toggle_value_copy(IkarusToggleValue const * value);
|
||||
|
||||
/// \brief Converts a toggle value to an entity value.
|
||||
/// \param value The toggle value to convert.
|
||||
/// \pre \li Must not be null.
|
||||
/// \return The converted entity value.
|
||||
/// \remark This is the same pointer, so freeing it implies freeing the original value.
|
||||
IKA_API struct IkarusValue * ikarus_toggle_value_to_value(IkarusToggleValue * value);
|
||||
|
||||
/// \see ikarus_toggle_value_to_value
|
||||
IKA_API struct IkarusValue const * ikarus_toggle_value_to_value_const(IkarusToggleValue const * value);
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue