add flatbuffers support and initial rewrite

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
folling 2024-05-12 14:15:42 +02:00 committed by Folling
parent 5f7a62ecb7
commit 4d7bf09c4e
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
72 changed files with 3929 additions and 1403 deletions

View file

@ -4,14 +4,27 @@
/// \author Folling <folling@ikarus.world>
/// \defgroup values Values
/// \brief The values of properties.
/// \details Each entity has a value for each property it is associated with.
/// These value classes represent plain objects. They are not associated with any entity.
/// Each value may be undefined. \see IkarusProperty
/// Values are stored as lists. If a property is "singular" then its value is a list of size 1.
/// Values are typed, with types existing for each of the corresponding property types. The data of values starts with the index 0.
/// When setting values for a property the type must match the property type and the value must be valid under the
/// property's settings. \see PropertyType
/// \brief Values are data in entities.
/// \details An entity is made up of any number of values.
/// Each value defines a certain aspect of an entity.
/// Values have a name, a type, and some data.
/// Examples of values would be:
/// - Is Dead (Toggle)
/// - Age (Number)
/// - ISBN (Text)
///
/// Values are either single or multiple.
/// We call this property "Cardinality" (\see IkarusValueCardinality)
/// because it's really hard to find a simpler name.
/// Each piece of data within a value is called a "datapoint".
/// Single values have exactly one datapoint, multiple values have any number of
/// datapoints. For example "Age" would be singular, while "Nicknames" would be
/// multiple. The type is unaffected by this. A pendant in programming languages
/// would be a List<T>. Note that all values are stored as a list of items,
/// even if the value is singular. Single values effectively act as a list with
/// one element. This is enforced by the API at runtime.
///
/// For a comprehensive list of value types, see \ref IkarusValueType.
/// @{
#include <ikarus/errors.h>
@ -19,15 +32,19 @@
IKARUS_BEGIN_HEADER
/// \brief The common type for all values.
/// \brief The common type for all value data.
struct IkarusValue;
/// \brief Visits an entity value, calling the appropriate function for the value's type.
/// \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.
/// \param toggle_visitor The function to call if the value is a toggle value.
/// \remark Skipped if null.
/// \param number_visitor The function to call if the value is a number value.
/// \remark Skipped if null.
/// \param text_visitor The function to call if the value is a text value.
/// \remark Skipped if null.
/// \param data The data passed to the visitor functions.
/// \param error_out \see errors.h
IKA_API void ikarus_value_visit(
@ -39,16 +56,6 @@ IKA_API void ikarus_value_visit(
IkarusErrorData * error_out
);
/// \see ikarus_value_visit
IKA_API void ikarus_value_visit_const(
IkarusValue const * value,
void (*toggle_visitor)(struct IkarusToggleValue const *, void *),
void (*number_visitor)(struct IkarusNumberValue const *, void *),
void (*text_visitor)(struct IkarusTextValue const *, void *),
void * data,
IkarusErrorData * error_out
);
IKARUS_END_HEADER
/// @}