finalize schema/data setup
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
98cb7a44ef
commit
a49912337d
89 changed files with 2324 additions and 6271 deletions
|
|
@ -1,61 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
/// \file value.h
|
||||
/// \author Folling <folling@ikarus.world>
|
||||
|
||||
/// \defgroup values Values
|
||||
/// \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>
|
||||
#include <ikarus/macros.h>
|
||||
#include <ikarus/stdtypes.h>
|
||||
|
||||
/// \file value.h
|
||||
/// \author Folling <mail@folling.io>
|
||||
|
||||
/// \defgroup entities Entities
|
||||
/// \brief Entities are the core building blocks of Ikarus.
|
||||
|
||||
IKARUS_BEGIN_HEADER
|
||||
|
||||
/// \brief The common type for all value data.
|
||||
struct IkarusValue;
|
||||
|
||||
/// \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.
|
||||
/// \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(
|
||||
IkarusValue * value,
|
||||
void (*toggle_visitor)(struct IkarusToggleValue *, void *),
|
||||
void (*number_visitor)(struct IkarusNumberValue *, void *),
|
||||
void (*text_visitor)(struct IkarusTextValue *, void *),
|
||||
void * data,
|
||||
IkarusErrorData * error_out
|
||||
);
|
||||
/// \brief Values are data containers for entities.
|
||||
/// \details Values are flexible enough to store any kind of data. They are
|
||||
/// akin to objects in programming languages.
|
||||
/// Each value has a schema that defines the type of the value. \see schema.h
|
||||
/// They also store data appropriate for the schema.
|
||||
///
|
||||
/// Given the complexity of values, they are transferred as json.
|
||||
/// The json representation of a value is a map with the following keys:
|
||||
/// - `schema`: The schema of the value. \see schema.h.
|
||||
/// - `data`: The data of the value. \see data.h.
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue