split property & values into separate classes and files

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2023-11-21 15:10:43 +01:00 committed by Folling
parent 424bd22aa5
commit 9e63219bf9
No known key found for this signature in database
28 changed files with 700 additions and 269 deletions

View file

@ -50,12 +50,7 @@ struct IkarusEntity;
/// \return The created entity or null if an error occurs.
/// \remark Must be freed using #ikarus_free.
IKA_API IkarusEntity * ikarus_entity_create(
struct IkarusProject * project,
struct IkarusEntityFolder * parent,
size_t position,
char const * name,
struct IkarusBlueprint ** blueprints,
size_t blueprints_count
struct IkarusProject * project, char const * name, struct IkarusBlueprint ** blueprints, size_t blueprints_count
);
/// \brief Deletes an entity.
@ -67,16 +62,6 @@ IKA_API void ikarus_entity_delete(IkarusEntity * entity);
IKA_API bool ikarus_entity_is_linked_to_blueprint(IkarusEntity const * entity, struct IkarusBlueprint const * blueprint);
/// \brief Checks if an entity has a specific property.
/// \param entity The entity to check.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param property The property to check.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \return True if the entity has the property, false otherwise.
IKA_API bool ikarus_entity_has_property(IkarusEntity const * entity, struct IkarusProperty const * property);
/// \brief Links an entity to a blueprint.
/// \param entity The entity to link.
/// \pre \li Must not be null.
@ -98,6 +83,16 @@ 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);
/// \brief Checks if an entity has a specific property.
/// \param entity The entity to check.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param property The property to check.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \return True if the entity has the property, false otherwise.
IKA_API bool ikarus_entity_has_property(IkarusEntity const * entity, struct IkarusProperty const * property);
/// \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.
@ -126,7 +121,7 @@ IKA_API void ikarus_entity_get_properties(
/// \pre \li Must exist.
/// \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 * get_value(IkarusEntity const * entity, struct IkarusProperty const * property);
IKA_API struct IkarusEntityValue * ikarus_entity_get_value(IkarusEntity const * entity, struct IkarusProperty const * property);
/// \brief Sets the value of a property of an entity.
/// \param entity The entity to set the value of.
@ -138,11 +133,10 @@ IKA_API struct IkarusEntityValue * get_value(IkarusEntity const * entity, struct
/// \param value The new value of the property.
/// \pre \li Must not be null.
/// \pre \li Must be of the same type as the property.
/// \param validate_settings If set, this function fails not only if the type of the value is invalid, but also if it's not
/// valid under the properties settings. \see property.h
/// \pre \li Must be valid for the property's settings.
/// \remark If the entity does not have the property, this function fails.
IKA_API void ikarus_entity_set_value(
IkarusEntity * entity, struct IkarusProperty const * property, struct IkarusValue * value, bool validate_settings
IkarusEntity * entity, struct IkarusProperty const * property, struct IkarusValue const * value
);
/// \brief Casts an entity to an object.
@ -151,7 +145,10 @@ IKA_API void ikarus_entity_set_value(
/// \pre \li Must exist.
/// \return The entity represented as an object or null if an error occurs.
/// \remark This operation is guaranteed to be very fast and is intended to be used frequently.
IKA_API struct IkarusObject * ikarus_entity_to_object(IkarusEntity const * entity);
IKA_API struct IkarusObject * ikarus_entity_to_object(IkarusEntity * entity);
/// \see ikarus_entity_to_object
IKA_API struct IkarusObject const * ikarus_entity_to_object_const(IkarusEntity const * entity);
IKARUS_END_HEADER