#pragma once /// \file toggle_value.h /// \author Folling #include #include /// \addtogroup values Values /// @{ IKARUS_BEGIN_HEADER /// \brief A true/false boolean-esque value. For example "Is Dead". struct IkarusToggleValue; /// \brief Creates a toggle value from booleans. /// \return The value or null if an error occurs. /// \remark Must be freed with #ikarus_free. IKA_API IkarusToggleValue * ikarus_toggle_value_create(); /// \brief Fetches the underlying data of a number value at a specific index. /// \param value The number value. /// \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. 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. IKA_API size_t ikarus_toggle_value_get_size(IkarusToggleValue const * value); /// \brief Sets the data of a toggle value at a specific index. /// \param value The toggle value. /// \pre \li Must not be null. /// \param idx The index of the data to set. /// \pre \li Must be less than the size of the value. /// \param new_data The new data. IKA_API void ikarus_toggle_value_set(IkarusToggleValue * value, size_t idx, bool new_data); /// \brief Removes a data from a toggle value. /// \param value The toggle value. /// \pre \li Must not be null. /// \param idx The index of the data to remove. /// \pre \li Must be less than the size of the value. IKA_API void ikarus_toggle_value_remove(IkarusToggleValue * value, size_t idx); /// \brief Inserts a data into a toggle value. /// \param value The toggle value. /// \pre \li Must not be null. /// \param idx The index of the data to insert. /// \pre \li Must be less than or equal to the size of the value. /// \param new_data The new data. IKA_API void ikarus_toggle_value_insert(IkarusToggleValue * value, size_t idx, bool new_data); /// \brief Clears a toggle value. /// \param value The toggle value. /// \remark Noop if the value is indeterminate. IKA_API void ikarus_toggle_value_clear(IkarusToggleValue * value); /// \brief Converts a toggle value to an entity value. /// \param value The toggle value to convert. /// \return The converted entity value. IKA_API struct IkarusValue * ikarus_toggle_value_to_value(IkarusToggleValue * value); IKARUS_END_HEADER /// @}