implement toggle/number/text values

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2023-11-26 13:55:14 +01:00 committed by Folling
parent da31bbf96a
commit f847d30c06
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
14 changed files with 280 additions and 48 deletions

View file

@ -4,7 +4,6 @@
/// \author Folling <folling@ikarus.world>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \defgroup entity_value Entity Values
/// \brief The values stored in entities.
@ -25,15 +24,22 @@ struct IkarusValue;
/// \return True if the value is indeterminate, false otherwise.
IKA_API bool ikarus_value_is_indeterminate(IkarusValue const * value);
// \brief Converts an entity value to a string.
// \pre \li Must not be null.
// \param value The entity value.
// \return A string representation of the value or null if an error occurred.
// \remark The returned value is a copy and owned by the caller.
/// \brief Sets the indeterminate state of a value.
/// \param value The value.
/// \pre \li Must not be null.
/// \param indeterminate The new indeterminate state.
IKA_API void ikarus_value_set_indeterminate(IkarusValue * value, bool indeterminate);
/// \brief Converts an entity value to a string.
/// \pre \li Must not be null.
/// \param value The entity value.
/// \return A string representation of the value or null if an error occurred.
/// \remark The returned value is owned by the caller.
IKA_API char const * ikarus_value_to_string(IkarusValue const * value);
/// \brief Visits an entity value, calling the appropriate function for the value's type.
/// \param value The entity value to visit.
/// \pre \li Must not be null.
/// \param toggle_visitor The function to call if the value is a toggle value. Skipped if null.
/// \param number_visitor The function to call if the value is a number value. Skipped if null.
/// \param text_visitor The function to call if the value is a text value. Skipped if null.