change error system & function signatures

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
folling 2024-01-02 15:14:39 +01:00 committed by Folling
parent ee85c53354
commit e17e346768
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
28 changed files with 633 additions and 651 deletions

View file

@ -3,6 +3,7 @@
/// \file blueprint.h
/// \author Folling <folling@ikarus.world>
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
@ -24,16 +25,18 @@ struct IkarusBlueprint;
/// \param name The name of the blueprint.
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
/// \return The created blueprint or null if an error occurs.
/// \remark Must be freed using #ikarus_free.
IKA_API IkarusBlueprint * ikarus_blueprint_create(struct IkarusProject * project, char const * name);
IKA_API IkarusBlueprint * ikarus_blueprint_create(struct IkarusProject * project, char const * name, IkarusErrorData * error_out);
/// \brief Deletes & frees a blueprint.
/// \param blueprint The blueprint to delete.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \remark The blueprint must not be accessed after deletion.
IKA_API void ikarus_blueprint_delete(IkarusBlueprint * blueprint);
IKA_API void ikarus_blueprint_delete(IkarusBlueprint * blueprint, IkarusErrorData * error_out);
/// \brief Gets the properties of a blueprint.
/// \param blueprint The blueprint to get the properties of.
@ -42,16 +45,22 @@ IKA_API void ikarus_blueprint_delete(IkarusBlueprint * blueprint);
/// \param properties_out The buffer to write the properties to.
/// \pre \li Must not be null.
/// \param properties_out_size The size of the buffer.
/// \param error_out \see errors.h
/// \see ikarus_blueprint_get_property_count
IKA_API void
ikarus_blueprint_get_properties(IkarusBlueprint const * blueprint, struct IkarusProperty ** properties_out, size_t properties_out_size);
IKA_API void ikarus_blueprint_get_properties(
IkarusBlueprint const * blueprint,
struct IkarusProperty ** properties_out,
size_t properties_out_size,
IkarusErrorData * error_out
);
/// \brief Gets the number of properties of a blueprint.
/// \param blueprint The blueprint 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_blueprint_get_property_count(IkarusBlueprint const * blueprint);
IKA_API size_t ikarus_blueprint_get_property_count(IkarusBlueprint const * blueprint, IkarusErrorData * error_out);
/// \brief Gets the entities linked to a blueprint.
/// \param blueprint The blueprint to get the linked entities of.
@ -60,27 +69,34 @@ IKA_API size_t ikarus_blueprint_get_property_count(IkarusBlueprint const * bluep
/// \param entities_out The buffer to write the entities to.
/// \pre \li Must not be null.
/// \param entities_out_size The size of the buffer.
/// \param error_out \see errors.h
/// \see ikarus_blueprint_get_linked_entity_count
IKA_API void
ikarus_blueprint_get_linked_entities(IkarusBlueprint const * blueprint, struct IkarusEntity ** entities_out, size_t entities_out_size);
IKA_API void ikarus_blueprint_get_linked_entities(
IkarusBlueprint const * blueprint,
struct IkarusEntity ** entities_out,
size_t entities_out_size,
IkarusErrorData * error_out
);
/// \brief Gets the number of entities linked to a blueprint.
/// \param blueprint The blueprint to get the number of linked entities of.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The number of linked entities or undefined if an error occurs.
IKA_API size_t ikarus_blueprint_get_linked_entity_count(IkarusBlueprint const * blueprint);
IKA_API size_t ikarus_blueprint_get_linked_entity_count(IkarusBlueprint const * blueprint, IkarusErrorData * error_out);
/// \brief Casts a blueprint to an object.
/// \param blueprint The blueprint to cast.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param error_out \see errors.h
/// \return The blueprint 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_blueprint_to_object(IkarusBlueprint * blueprint);
IKA_API struct IkarusObject * ikarus_blueprint_to_object(IkarusBlueprint * blueprint, IkarusErrorData * error_out);
/// \see ikarus_blueprint_to_object
IKA_API struct IkarusObject const * ikarus_blueprint_to_object_const(IkarusBlueprint const * blueprint);
IKA_API struct IkarusObject const * ikarus_blueprint_to_object_const(IkarusBlueprint const * blueprint, IkarusErrorData * error_out);
IKARUS_END_HEADER