implement remaining logic

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2024-01-03 17:14:26 +01:00 committed by Folling
parent 70f1fe7de0
commit 9ad3d62b14
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
41 changed files with 1393 additions and 408 deletions

View file

@ -4,6 +4,7 @@
/// \author Folling <folling@ikarus.world>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \addtogroup errors Errors
/// \brief Error handling within libikarus
@ -24,94 +25,81 @@ IKARUS_BEGIN_HEADER
enum IkarusErrorInfo {
/// \brief No error occurred.
IkarusErrorInfo_None = 0x0,
/// \brief The error was caused by the client.
IkarusErrorInfo_Client = 0x10100000,
/// \brief The error was caused by a dependency (e.g. boost) of libikarus.
IkarusErrorInfo_Dependency = 0x10200000,
/// \brief The error was caused by the filesystem.
IkarusErrorInfo_Filesystem = 0x10300000,
/// \brief The error was caused by the database.
IkarusErrorInfo_Database = 0x10400000,
/// \brief The error was caused by the underlying OS.
IkarusErrorInfo_OS = 0x10500000,
/// \brief The error was caused by libikarus itself.
IkarusErrorInfo_LibIkarus = 0x10600000,
/// \brief The client misused the API.
/// Example: Accessing a resource that does not exist.
IkarusErrorInfo_Client_Misuse = 0x10100001,
IkarusErrorInfo_Client_Misuse = 0x01000001,
/// \brief The client provided a null value for a parameter that must not be null.
/// Example: Passing null for `ikarus_project_get_name`
IkarusErrorInfo_Client_InvalidNull = 0x10100002,
IkarusErrorInfo_Client_InvalidNull = 0x01000002,
/// \brief The client provided an index that was out of bounds for some array.
/// Example: Passing the index 3 for an `IkarusToggleValue` with size 3.
IkarusErrorInfo_Client_IndexOutOfBounds = 0x10100003,
IkarusErrorInfo_Client_IndexOutOfBounds = 0x01000003,
/// \brief The client provided a numeric value that was out of bounds
/// Example: Passing the value 2^32 to an i32 (might be passed as a string).
IkarusErrorInfo_Client_ValueOutOfBounds = 0x10100004,
IkarusErrorInfo_Client_ValueOutOfBounds = 0x01000004,
/// \brief The client provided invalid input that doesn't fit in any of the other categories.
/// Example: Passing an empty/blank string for a string that must be non-empty/-blank.
IkarusErrorInfo_Client_InvalidInput = 0x10100005,
IkarusErrorInfo_Client_InvalidInput = 0x01000005,
/// \brief The client provided valid data in an invalid format.
/// Example: Passing a malformed JSON string.
IkarusErrorInfo_Client_InvalidFormat = 0x10100006,
IkarusErrorInfo_Client_InvalidFormat = 0x01000006,
/// \brief The client violated a constraint.
/// \details This error is most likely caused by endusers.
/// Example: A user tries to set the age of a character to an value outside of their specified range.
IkarusErrorInfo_Client_ConstraintViolated = 0x10100007,
IkarusErrorInfo_Client_ConstraintViolated = 0x10000007,
// 0x02 reserved for dependency errors
/// \brief A file was not found.
IkarusErrorInfo_Filesystem_NotFound = 0x10300001,
/// \brief A file or directory already exists.
IkarusErrorInfo_Filesystem_AlreadyExists = 0x10300002,
IkarusErrorInfo_Filesystem_AccessIssue = 0x03000001,
/// \brief A file was not found.
IkarusErrorInfo_Filesystem_NotFound = 0x03000002,
/// \brief A file or directory already exists.
IkarusErrorInfo_Filesystem_AlreadyExists = 0x03000003,
/// \brief Missing permissions to access a file or directory.
IkarusErrorInfo_Filesystem_MissingPermissions = 0x10300003,
IkarusErrorInfo_Filesystem_MissingPermissions = 0x03000004,
/// \brief Insufficient space to perform an operation.
IkarusErrorInfo_Filesystem_InsufficientSpace = 0x10300004,
IkarusErrorInfo_Filesystem_InsufficientSpace = 0x03000005,
/// \brief A path is invalid.
IkarusErrorInfo_Filesystem_InvalidPath = 0x10300005,
IkarusErrorInfo_Filesystem_InvalidPath = 0x03000006,
/// \brief A database connection failed.
IkarusErrorInfo_Database_ConnectionFailed = 0x10400001,
IkarusErrorInfo_Database_ConnectionFailed = 0x04000001,
/// \brief A database query failed.
IkarusErrorInfo_Database_QueryFailed = 0x10400002,
IkarusErrorInfo_Database_QueryFailed = 0x04000002,
/// \brief A database migration failed.
IkarusErrorInfo_Database_MigrationFailed = 0x10400003,
IkarusErrorInfo_Database_MigrationFailed = 0x04000003,
/// \brief A database is in an invalid state. This indicates a corrupt project.
/// Example: An entity is linked to a non-existant blueprint.
IkarusErrorInfo_Database_InvalidState = 0x10400004,
IkarusErrorInfo_Database_InvalidState = 0x04000004,
/// \brief A system call failed.
IkarusErrorInfo_OS_SystemCallFailed = 0x10500001,
IkarusErrorInfo_OS_SystemCallFailed = 0x05000001,
/// \brief A system call returned an invalid value.
IkarusErrorInfo_OS_InvalidReturnValue = 0x10500002,
IkarusErrorInfo_OS_InvalidReturnValue = 0x05000002,
/// \brief An OOM error occurred.
IkarusErrorInfo_OS_InsufficientMemory = 0x10500003,
IkarusErrorInfo_OS_InsufficientMemory = 0x05000003,
/// \brief A datapoint within ikarus is invalid for the current state of the system.
/// \details This differs from IkarusErrorInfo_Database_InvalidState in that the latter implies the database itself holds invalid state,
/// whereas the former may imply that the state is ephemeral, e.g. data within a function.
/// Example: The name of an object is found to be invalid UTF8.
IkarusErrorInfo_LibIkarus_InvalidState = 0x20030001,
IkarusErrorInfo_LibIkarus_InvalidState = 0x06000001,
/// \brief libikarus is unable to perform a certain operation that should succeed.
IkarusErrorInfo_LibIkarus_CannotPerformOperation = 0x06000002,
/// \brief libikarus is unable to perform a certain operation within a given timeframe.
/// Example: A query takes longer than the timeout.
IkarusErrorInfo_LibIkarus_Timeout = 0x20030003,
IkarusErrorInfo_LibIkarus_Timeout = 0x06000003,
};
/// \brief The data limits for an error.
enum IkarusErrorDataLimit {
/// \brief The maximum number of error infos that can be stored in an error.
IkarusErrorDataLimit_MaxErrorInfos = 8,
/// \brief The maximum length of an error message.
IkarusErrorDataLimit_MaxMessageLength = 128,
};
size_t const IKARUS_ERROR_DATA_MAX_MESSAGE_LIMIT = 128;
/// \brief The data stored for an error
struct IkarusErrorData {
/// \brief The scope of the error.
/// \details This array may at most hold #IkarusErrorDataLimit_MaxErrorInfos elements.
/// The first occurrence of #IkarusErrorInfo_None signifies the end of the array. If this happens at idx x== 0, no error occurred.
IkarusErrorInfo infos[IkarusErrorDataLimit_MaxErrorInfos];
/// \brief The error type
IkarusErrorInfo info;
char message[IkarusErrorDataLimit_MaxMessageLength];
char message[IKARUS_ERROR_DATA_MAX_MESSAGE_LIMIT];
};
/// \brief Gets the name of an error info.
@ -128,11 +116,6 @@ IKA_API bool ikarus_error_data_is_success(IkarusErrorData const * data);
/// \param data The error data to check.
/// \return True if the error data is an error, false otherwise.
IKA_API bool ikarus_error_data_is_error(IkarusErrorData const * data);
/// \brief Formats the error data in a reasonable but unspecified way.
/// \param data The error data to format.
/// \return The formatted error data.
/// \remark Ownership of the returned pointer is passed to the user and must be freed at their leisure using ikarus_free.
IKA_API char const * ikarus_error_data_pretty_format(IkarusErrorData const * data);
IKARUS_END_HEADER

View file

@ -89,6 +89,30 @@ IKA_API void ikarus_entity_link_to_blueprint(IkarusEntity * entity, struct Ikaru
/// \remark No-op if the entity is not linked to the blueprint.
IKA_API void ikarus_entity_unlink_from_blueprint(IkarusEntity * entity, struct IkarusBlueprint * blueprint, IkarusErrorData * error_out);
/// \brief Gets the blueprints an entity is linked to.
/// \param entity The entity to get the blueprints of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param blueprints_out The buffer to write the blueprints to.
/// \pre \li Must not be null.
/// \param blueprints_out_size The size of the buffer.
/// \param error_out \see errors.h
/// \see ikarus_entity_get_linked_blueprint_count
IKA_API void ikarus_entity_get_linked_blueprints(
IkarusEntity const * entity,
struct IkarusBlueprint ** blueprints_out,
size_t blueprints_out_size,
IkarusErrorData * error_out
);
/// \brief Gets the number of blueprints an entity is linked to.
/// \param entity The entity to get the number of blueprints of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of blueprints or undefined if an error occurs.
IKA_API size_t ikarus_entity_get_linked_blueprint_count(IkarusEntity const * entity, IkarusErrorData * error_out);
/// \brief Checks if an entity has a specific property.
/// \param entity The entity to check.
/// \pre \li Must not be null.
@ -97,17 +121,9 @@ IKA_API void ikarus_entity_unlink_from_blueprint(IkarusEntity * entity, struct I
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return True if the entity has the property, false otherwise.
/// \return False if an error occurs or the entity does not have the property, true otherwise.
IKA_API bool ikarus_entity_has_property(IkarusEntity const * entity, struct IkarusProperty const * property, IkarusErrorData * error_out);
/// \brief Gets the number of properties of an entity.
/// \param entity The entity to get the number of properties of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of properties or undefined if an error occurs.
IKA_API size_t ikarus_entity_get_property_count(IkarusEntity const * entity, IkarusErrorData * error_out);
/// \brief Gets the properties of an entity.
/// \param entity The entity to get the properties of.
/// \pre \li Must not be null.
@ -116,6 +132,7 @@ IKA_API size_t ikarus_entity_get_property_count(IkarusEntity const * entity, Ika
/// \pre \li Must not be null.
/// \param error_out \see errors.h
/// \param properties_out_size The size of the buffer.
/// \see ikarus_entity_get_property_count
IKA_API void ikarus_entity_get_properties(
IkarusEntity const * entity,
struct IkarusProperty ** properties_out,
@ -123,9 +140,16 @@ IKA_API void ikarus_entity_get_properties(
IkarusErrorData * error_out
);
/// \brief Gets the number of properties of an entity.
/// \param entity The entity to get the number of properties of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of properties or undefined if an error occurs.
IKA_API size_t ikarus_entity_get_property_count(IkarusEntity const * entity, IkarusErrorData * error_out);
/// \brief Gets the value of a property of an entity.
/// \details If the entity has never set the value of the property, the default value is returned (which may be
/// undefined).
/// \details If the entity has never set the value of the property, the default value is returned (which may be undefined).
/// \param entity The entity to get the value of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
@ -134,9 +158,8 @@ IKA_API void ikarus_entity_get_properties(
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The value of the property or null if the entity does not have the property or an error occurs.
/// \remark Must be freed using
/// #ikarus_free.
IKA_API struct IkarusEntityValue *
/// \remark Must be freed using #ikarus_free.
IKA_API struct IkarusEntityPropertyValue *
ikarus_entity_get_value(IkarusEntity const * entity, struct IkarusProperty const * property, IkarusErrorData * error_out);
/// \brief Sets the value of a property of an entity.

View file

@ -19,6 +19,13 @@ IKARUS_BEGIN_HEADER
/// \brief A generic object. Wraps all types of objects, including folders.
struct IkarusObject;
/// \brief Fetches the project of an object.
/// \param object The object to fetch the project from.
/// \pre \li Must not be null.
/// \param error_out \see errors.h
/// \return The project of the object or null if an error occurs.
IKA_API struct IkarusProject * ikarus_object_get_project(IkarusObject const * object, IkarusErrorData * error_out);
/// \brief Compares two objects for equality.
/// \details This neither compares the pointers nor does a deep copy. Instead it figures out if the objects _are_ the
/// same object.
@ -35,9 +42,6 @@ IKA_API bool ikarus_object_is_equal(IkarusObject const * lhs, IkarusObject const
/// \param blueprint_visitor The function to call if the object is a blueprint. Skipped if null.
/// \param property_visitor The function to call if the object is a property. Skipped if null.
/// \param entity_visitor The function to call if the object is an entity. Skipped if null.
/// \param blueprint_folder_visitor The function to call if the object is a blueprint folder. Skipped if null.
/// \param property_folder_visitor The function to call if the object is a property folder. Skipped if null.
/// \param entity_folder_visitor The function to call if the object is an entity folder. Skipped if null.
/// \param data The data passed to the visitor functions.
/// \param error_out \see errors.h
IKA_API void ikarus_object_visit(
@ -45,9 +49,6 @@ IKA_API void ikarus_object_visit(
void (*blueprint_visitor)(struct IkarusBlueprint *, void *),
void (*property_visitor)(struct IkarusProperty *, void *),
void (*entity_visitor)(struct IkarusEntity *, void *),
void (*blueprint_folder_visitor)(struct IkarusBlueprintFolder *, void *),
void (*property_folder_visitor)(struct IkarusPropertyFolder *, void *),
void (*entity_folder_visitor)(struct IkarusEntityFolder *, void *),
void * data,
IkarusErrorData * error_out
);
@ -58,9 +59,6 @@ IKA_API void ikarus_object_visit_const(
void (*blueprint_visitor)(struct IkarusBlueprint const *, void *),
void (*property_visitor)(struct IkarusProperty const *, void *),
void (*entity_visitor)(struct IkarusEntity const *, void *),
void (*blueprint_folder_visitor)(struct IkarusBlueprintFolder const *, void *),
void (*property_folder_visitor)(struct IkarusPropertyFolder const *, void *),
void (*entity_folder_visitor)(struct IkarusEntityFolder const *, void *),
void * data,
IkarusErrorData * error_out
);

View file

@ -25,10 +25,9 @@ enum IkarusObjectType {
/// \brief Converts an IkarusObjectType to a string.
/// \param type The type to convert.
/// \param error_out \see errors.h
/// \return The string representation of the type.
/// \remark The returned string must not be freed.
char const * ikarus_object_type_to_string(IkarusObjectType type, IkarusErrorData * error_out);
char const * ikarus_object_type_to_string(IkarusObjectType type);
IKARUS_END_HEADER

View file

@ -46,7 +46,7 @@ ikarus_number_property_get_default_value(struct IkarusNumberProperty * property,
/// \param property The number property.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param default_value The default value.
/// \param new_default_value The default value.
/// \pre \li Must not be null.
/// \pre \li Must be a valid value for the property.
/// \param error_out \see errors.h
@ -54,7 +54,7 @@ ikarus_number_property_get_default_value(struct IkarusNumberProperty * property,
/// default values and other settings.
IKA_API void ikarus_number_property_set_default_value(
struct IkarusNumberProperty * property,
struct IkarusNumberValue * default_value,
struct IkarusNumberValue * new_default_value,
IkarusErrorData * error_out
);

View file

@ -89,7 +89,7 @@ IKA_API struct IkarusPropertySource const * ikarus_property_get_source(IkarusPro
/// \param error_out \see errors.h
/// \return The default value of the property or null if an error occurs.
/// \remark Must be freed using #ikarus_free.
IKA_API struct IkarusValue const * ikarus_property_get_default_value(IkarusProperty const * property, IkarusErrorData * error_out);
IKA_API struct IkarusValue * ikarus_property_get_default_value(IkarusProperty const * property, IkarusErrorData * error_out);
/// \brief Visits a property. Calling the appropriate function for the property's type.
/// \param property The property to visit.

View file

@ -15,11 +15,11 @@ IKARUS_BEGIN_HEADER
/// available.
enum IkarusPropertyType {
/// \brief A true/false boolean-esque value.
IkarusPropertyType_Toggle,
IkarusPropertyType_Toggle = 0x10000000,
/// \brief A numeric value, limited to IEEE 80 bit floating point numbers.
IkarusPropertyType_Number,
IkarusPropertyType_Number = 0x20000000,
/// \brief An arbitrary UTF-8 textual value.
IkarusPropertyType_Text,
IkarusPropertyType_Text = 0x30000000,
};
IKARUS_END_HEADER

View file

@ -45,7 +45,7 @@ IKA_API struct IkarusTextValue * ikarus_text_property_get_default_value(struct I
/// \param property The text property.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param default_value The default value.
/// \param new_default_value The default value.
/// \pre \li Must not be null.
/// \pre \li Must be a valid value for the property.
/// \param error_out \see errors.h
@ -53,7 +53,7 @@ IKA_API struct IkarusTextValue * ikarus_text_property_get_default_value(struct I
/// default values and other settings.
IKA_API void ikarus_text_property_set_default_value(
struct IkarusTextProperty * property,
struct IkarusTextValue * default_value,
struct IkarusTextValue * new_default_value,
IkarusErrorData * error_out
);

View file

@ -46,7 +46,7 @@ ikarus_toggle_property_get_default_value(struct IkarusToggleProperty * property,
/// \param property The toggle property.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param default_value The default value.
/// \param new_default_value The default value.
/// \pre \li Must not be null.
/// \pre \li Must be a valid value for the property.
/// \param error_out \see errors.h
@ -54,7 +54,7 @@ ikarus_toggle_property_get_default_value(struct IkarusToggleProperty * property,
/// default values and other settings.
IKA_API void ikarus_toggle_property_set_default_value(
struct IkarusToggleProperty * property,
struct IkarusToggleValue * default_value,
struct IkarusToggleValue * new_default_value,
IkarusErrorData * error_out
);

View file

@ -51,39 +51,13 @@ IKA_API IkarusProject * ikarus_project_create_in_memory(char const * name, Ikaru
/// ikarus_project_delete
IKA_API IkarusProject * ikarus_project_open(char const * path, IkarusErrorData * error_out);
/// \brief Copies a project to a new location.
/// \details The new project is not opened.
/// \param project The project to copy.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param target_path The new location of the project.
/// \pre \li Must not be null.
/// \pre \li Must point to a valid unused path on the system.
/// \param target_name The name of the new project.
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
/// \remark If successful the project connection remains intact. The previous location will still exist.
IKA_API void
ikarus_project_copy(IkarusProject const * project, char const * target_path, char const * target_name, IkarusErrorData * error_out);
/// \brief Deletes a project and all its associated data from the filesystem.
/// \param project The project to delete.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \remark also frees the project.
/// \remark In-Memory projects will just be freed.
/// \remark If deletion fails, the project pointer remains intact.
IKA_API void ikarus_project_delete(IkarusProject * project, IkarusErrorData * error_out);
/// \brief Gets the name of a project.
/// \param project The project to get the name of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The name of the project.
/// \remark Must be freed using #ikarus_free.
/// \remark Ownership remains with libikarus, must not be freed.
IKA_API char const * ikarus_project_get_name(IkarusProject const * project, IkarusErrorData * error_out);
/// \brief Sets the name of a project.
@ -102,30 +76,9 @@ IKA_API void ikarus_project_set_name(IkarusProject * project, char const * new_n
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The path of the project.
/// \remark Must be freed using #ikarus_free.
/// \remark Ownership remains with libikarus, must not be freed.
IKA_API char const * ikarus_project_get_path(IkarusProject const * project, IkarusErrorData * error_out);
/// \brief Moves a project to a new location.
/// \param project The project to move.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param target_path The new location of the project.
/// \pre \li Must not be null.
/// \pre \li Must point to a valid unused path on the system.
/// \param error_out \see errors.h
/// \remark If successful the project connection remains intact. The previous location will not exist anymore.
/// \remark Due to the nature of filesystems this function may not be atomic.
IKA_API void ikarus_project_move(IkarusProject * project, char const * target_path, IkarusErrorData * error_out);
/// \brief Gets the blueprint root folder of a project.
/// \param project The project to get the blueprint root folder of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The blueprint root folder of the project or null if an error occurs.
/// \remark Must be freed using #ikarus_free.
IKA_API struct IkarusBlueprintFolder * ikarus_project_get_blueprint_root_folder(IkarusProject const * project, IkarusErrorData * error_out);
/// \brief Gets the blueprints of a project.
/// \param project The project to get the blueprints of.
/// \pre \li Must not be null.
@ -135,7 +88,7 @@ IKA_API struct IkarusBlueprintFolder * ikarus_project_get_blueprint_root_folder(
/// \param blueprints_out_size The size of the buffer.
/// \param error_out \see errors.h
IKA_API void ikarus_project_get_blueprints(
IkarusProject const * project,
IkarusProject * project,
struct IkarusBlueprint ** blueprints_out,
size_t blueprints_out_size,
IkarusErrorData * error_out
@ -147,16 +100,7 @@ IKA_API void ikarus_project_get_blueprints(
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of blueprints or undefined if an error occurs.
IKA_API size_t ikarus_project_get_blueprint_count(IkarusProject const * project, IkarusErrorData * error_out);
/// \brief Gets the entity root folder of a project.
/// \param project The project to get the entity root folder of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The entity root folder of the project or null if an error occurs.
/// \remark Must be freed using #ikarus_free.
IKA_API struct IkarusEntityFolder * ikarus_project_get_entity_root_folder(IkarusProject const * project, IkarusErrorData * error_out);
IKA_API size_t ikarus_project_get_blueprint_count(IkarusProject * project, IkarusErrorData * error_out);
/// \brief Gets the entities of a project.
/// \param project The project to get the entities of.
@ -167,7 +111,7 @@ IKA_API struct IkarusEntityFolder * ikarus_project_get_entity_root_folder(Ikarus
/// \param entities_out_size The size of the buffer.
/// \param error_out \see errors.h
IKA_API void ikarus_project_get_entities(
IkarusProject const * project,
IkarusProject * project,
struct IkarusEntity ** entities_out,
size_t entities_out_size,
IkarusErrorData * error_out
@ -179,7 +123,7 @@ IKA_API void ikarus_project_get_entities(
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of entities or undefined if an error occurs.
IKA_API size_t ikarus_project_get_entity_count(IkarusProject const * project, IkarusErrorData * error_out);
IKA_API size_t ikarus_project_get_entity_count(IkarusProject * project, IkarusErrorData * error_out);
IKARUS_END_HEADER

View file

@ -0,0 +1,46 @@
#pragma once
/// \file entity_property_value.h
/// \author Folling <folling@ikarus.world>
/// \defgroup entity_property_values EntityPropertyValue
/// \brief Values in relation to an entity and one of its properties.
/// @{
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/values/entity_property_value.h>
IKARUS_BEGIN_HEADER
/// \brief Like an \ref value.h "IkarusValue", but in relation to an entity and one of its properties
struct IkarusEntityPropertyValue;
/// \brief Fetches the entity of an entity property value.
/// \param value The entity property value.
/// \pre \li Must not be null.
/// \param error_out \see errors.h
/// \return The entity of the entity property value.
/// \remark This value is owned by the entity property value and must not be freed directly.
struct IkarusEntity const * ikarus_entity_property_value_get_entity(IkarusEntityPropertyValue const * value, IkarusErrorData * error_out);
/// \brief Fetches the property of an entity property value.
/// \param value The entity property value.
/// \pre \li Must not be null.
/// \param error_out \see errors.h
/// \return The property of the entity property value.
/// \remark This value is owned by the entity property value and must not be freed directly.
struct IkarusProperty const *
ikarus_entity_property_value_get_property(IkarusEntityPropertyValue const * value, IkarusErrorData * error_out);
/// \brief Fetches the value of an entity property value.
/// \param value The entity property value.
/// \pre \li Must not be null.
/// \param error_out \see errors.h
/// \return The value of the entity property value.
/// \remark This value is owned by the entity property value and must not be freed directly.
struct IkarusValue const * ikarus_entity_property_value_get_value(IkarusEntityPropertyValue const * value, IkarusErrorData * error_out);
IKARUS_END_HEADER
/// @}

View file

@ -3,9 +3,6 @@
/// \file value.h
/// \author Folling <folling@ikarus.world>
#include <ikarus/errors.h>
#include <ikarus/macros.h>
/// \defgroup values Values
/// \brief The values of properties.
/// \details Each entity has a value for each property it is associated with.
@ -17,6 +14,9 @@
/// property's settings. \see PropertyType
/// @{
#include <ikarus/errors.h>
#include <ikarus/macros.h>
IKARUS_BEGIN_HEADER
/// \brief The common type for all values.