make values capable of being a list & add boost
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
08ad2c5c66
commit
733b52575b
16 changed files with 315 additions and 140 deletions
|
|
@ -4,42 +4,57 @@
|
|||
/// \author Folling <folling@ikarus.world>
|
||||
|
||||
#include <ikarus/macros.h>
|
||||
#include <ikarus/stdtypes.h>
|
||||
|
||||
/// \addtogroup values Values
|
||||
/// @{
|
||||
|
||||
IKARUS_BEGIN_HEADER
|
||||
|
||||
/// \brief A true/false boolean-like value. For example "IsDead".
|
||||
/// \brief A true/false boolean-esque value. For example "Is Dead".
|
||||
struct IkarusToggleValue;
|
||||
|
||||
/// \brief Creates a toggle value from a boolean.
|
||||
/// \param value The toggle value.
|
||||
/// \return The entity value.
|
||||
/// \brief Creates a toggle value from doubles.
|
||||
/// \param data The toggle data or null if you wish to clear the data.
|
||||
/// \details LibIkarus does not take ownership of this array.
|
||||
/// \param data_size The size of the data array or 0 if you wish to clear the data.
|
||||
/// \return The value.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusToggleValue * ikarus_toggle_value_create(bool value);
|
||||
IKA_API IkarusToggleValue * ikarus_toggle_value_create(bool * data, size_t data_size);
|
||||
|
||||
/// \brief Creates an indeterminate toggle value.
|
||||
/// \return The entity value.
|
||||
/// \return The value.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusToggleValue * ikarus_toggle_value_create_indeterminate();
|
||||
|
||||
/// \brief Fetches the underlying value of a toggle value.
|
||||
/// \param value The toggle value.
|
||||
/// \return The underlying value.
|
||||
/// \warning Undefined if the value is indeterminate.
|
||||
IKA_API bool ikarus_toggle_value_get(IkarusToggleValue const * value);
|
||||
|
||||
/// \brief Sets the value of a toggle value.
|
||||
/// \brief Fetches the underlying data of a toggle value.
|
||||
/// \details You may adjust the returned data as per your hearts desire.
|
||||
/// If you need to grow the data, use #ikarus_toggle_value_set with a new array.
|
||||
/// Just remember that IkarusValues are plain objects, so changing them won't affect any state.
|
||||
/// They will need to be submitted to other functions such as #ikarus_entity_set_value to have any effect.
|
||||
/// \param value The toggle value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \param new_value The new value.
|
||||
IKA_API void ikarus_toggle_value_set(IkarusToggleValue * value, bool new_value);
|
||||
/// \param data_size_out An out-parameter for the size of the returned array.
|
||||
/// \remark Ignored if null.
|
||||
/// \return The underlying data. Owned by LibIkarus, most not be freed.
|
||||
/// \warning Undefined if the value is indeterminate.
|
||||
IKA_API bool * ikarus_toggle_value_get(IkarusToggleValue * value, size_t * data_size_out);
|
||||
|
||||
/// \see ikarus_toggle_value_get
|
||||
bool const * ikarus_toggle_value_get_const(IkarusToggleValue const * value, size_t * data_size_out);
|
||||
|
||||
/// \brief Sets the data of a toggle value.
|
||||
/// \param value The toggle value.
|
||||
/// \pre \li Must not be null.
|
||||
/// \param new_data The new data or null if you wish to clear the data.
|
||||
/// \details LibIkarus does not take ownership of this array.
|
||||
/// \param new_data_size The size of the new data array or 0 if you wish to clear the data.
|
||||
IKA_API void ikarus_toggle_value_set(IkarusToggleValue * value, bool * new_data, size_t new_data_size);
|
||||
|
||||
/// \brief Converts a toggle value to an entity value.
|
||||
/// \param toggle_value The toggle value to convert.
|
||||
/// \param value The toggle value to convert.
|
||||
/// \return The converted entity value.
|
||||
IKA_API struct IkarusValue * ikarus_toggle_value_to_value(IkarusToggleValue * toggle_value);
|
||||
IKA_API struct IkarusValue * ikarus_toggle_value_to_value(IkarusToggleValue * value);
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue