improve C header compatibility

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2025-01-05 18:48:24 +01:00
parent 8fbb891024
commit 1a339f0a57
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
9 changed files with 151 additions and 165 deletions

View file

@ -4,6 +4,7 @@
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
#include <ikarus/macros.h> #include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \addtogroup errors Errors /// \addtogroup errors Errors
/// \brief Error handling within libikarus /// \brief Error handling within libikarus
@ -116,11 +117,11 @@ IKA_API char const * ikarus_error_info_get_name(enum IkarusErrorInfo info);
/// \brief Checks if an error data is a success. /// \brief Checks if an error data is a success.
/// \param data The error data to check. /// \param data The error data to check.
/// \return True if the error data is a success, false otherwise. /// \return True if the error data is a success, false otherwise.
IKA_API bool ikarus_error_data_is_success(IkarusErrorData const * data); IKA_API bool ikarus_error_data_is_success(struct IkarusErrorData const * data);
/// \brief Checks if an error data is an error. /// \brief Checks if an error data is an error.
/// \param data The error data to check. /// \param data The error data to check.
/// \return True if the error data is an error, false otherwise. /// \return True if the error data is an error, false otherwise.
IKA_API bool ikarus_error_data_is_error(IkarusErrorData const * data); IKA_API bool ikarus_error_data_is_error(struct IkarusErrorData const * data);
IKARUS_END_HEADER IKARUS_END_HEADER

View file

@ -3,13 +3,17 @@
/// \file blueprint.h /// \file blueprint.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \defgroup blueprints Blueprints
/// \brief Blueprints are templates for entities.
/// @{
#include <ikarus/errors.h> #include <ikarus/errors.h>
#include <ikarus/macros.h> #include <ikarus/macros.h>
#include <ikarus/stdtypes.h> #include <ikarus/stdtypes.h>
/// \defgroup blueprints Blueprints struct IkarusProject;
/// \brief Blueprints are templates for entities. struct IkarusEntity;
/// @{ struct IkarusProperty;
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
@ -25,7 +29,7 @@ struct IkarusBlueprint;
/// \pre \li Must not be null. /// \pre \li Must not be null.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the blueprint exists, false otherwise or if an error occurs. /// \return True if the blueprint exists, false otherwise or if an error occurs.
IKA_API bool ikarus_blueprint_exists(IkarusBlueprint * blueprint, IkarusErrorData * error_out); IKA_API bool ikarus_blueprint_exists(struct IkarusBlueprint * blueprint, struct IkarusErrorData * error_out);
/// \brief Flags for creating a blueprint. /// \brief Flags for creating a blueprint.
enum IkarusBlueprintCreateFlags { enum IkarusBlueprintCreateFlags {
@ -44,10 +48,10 @@ enum IkarusBlueprintCreateFlags {
/// \return The created blueprint or null if an error occurs. /// \return The created blueprint or null if an error occurs.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \remark Ownership remains with libikarus. /// \remark Ownership remains with libikarus.
IKA_API IkarusBlueprint * ikarus_blueprint_create( IKA_API struct IkarusBlueprint * ikarus_blueprint_create(
struct IkarusProject * project, struct IkarusProject * project,
char const * name, char const * name,
IkarusBlueprintCreateFlags flags, enum IkarusBlueprintCreateFlags flags,
struct IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
@ -68,10 +72,10 @@ enum IkarusBlueprintCreateFromEntityFlags {
/// \param flags Flags for creating the blueprint. /// \param flags Flags for creating the blueprint.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The created blueprint or null if an error occurs. /// \return The created blueprint or null if an error occurs.
IKA_API IkarusBlueprint * ikarus_blueprint_create_from_entity( IKA_API struct IkarusBlueprint * ikarus_blueprint_create_from_entity(
struct IkarusEntity * entity, struct IkarusEntity * entity,
char const * name, char const * name,
IkarusBlueprintCreateFromEntityFlags flags, enum IkarusBlueprintCreateFromEntityFlags flags,
struct IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
@ -90,7 +94,7 @@ enum IkarusBlueprintCopyFlags {
/// \return The copied blueprint or null if an error occurs. /// \return The copied blueprint or null if an error occurs.
IKA_API struct IkarusBlueprint * ikarus_blueprint_copy( IKA_API struct IkarusBlueprint * ikarus_blueprint_copy(
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
IkarusBlueprintCopyFlags flags, enum IkarusBlueprintCopyFlags flags,
struct IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
@ -109,8 +113,8 @@ enum IkarusBlueprintDeleteFlags {
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_blueprint_delete( IKA_API void ikarus_blueprint_delete(
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
IkarusBlueprintDeleteFlags flags, enum IkarusBlueprintDeleteFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets the project a blueprint belongs to. /// \brief Gets the project a blueprint belongs to.
@ -150,7 +154,7 @@ enum IkarusBlueprintSetNameFlags {
IKA_API void ikarus_blueprint_set_name( IKA_API void ikarus_blueprint_set_name(
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
char const * name, char const * name,
IkarusBlueprintSetNameFlags flags, enum IkarusBlueprintSetNameFlags flags,
struct IkarusErrorData * error_out struct IkarusErrorData * error_out
); );

View file

@ -1,15 +1,19 @@
#pragma once #pragma once
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \file entity.h /// \file entity.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \defgroup entities Entities /// \defgroup entities Entities
/// \brief Entities are the core building blocks of Ikarus. /// \brief Entities are the core building blocks of Ikarus.
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
struct IkarusProject;
struct IkarusEntity;
struct IkarusProperty;
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
/// \brief Entities are the core building blocks of Ikarus. /// \brief Entities are the core building blocks of Ikarus.
@ -38,8 +42,7 @@ enum IkarusEntityCreateFlags {
/// \pre \li Must not be null. /// \pre \li Must not be null.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the entity exists, false otherwise or if an error occurs. /// \return True if the entity exists, false otherwise or if an error occurs.
IKA_API bool IKA_API bool ikarus_entity_exists(struct IkarusEntity * entity, struct IkarusErrorData * error_out);
ikarus_entity_exists(IkarusEntity * entity, IkarusErrorData * error_out);
/// \brief Creates a new entity. /// \brief Creates a new entity.
/// \param project The project to create the entity in. /// \param project The project to create the entity in.
@ -51,11 +54,11 @@ ikarus_entity_exists(IkarusEntity * entity, IkarusErrorData * error_out);
/// \param flags Flags for creating the entity. /// \param flags Flags for creating the entity.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The created entity or null if an error occurs. /// \return The created entity or null if an error occurs.
IKA_API IkarusEntity * ikarus_entity_create( IKA_API struct IkarusEntity * ikarus_entity_create(
struct IkarusProject * project, struct IkarusProject * project,
char const * name, char const * name,
IkarusEntityCreateFlags flags, enum IkarusEntityCreateFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for deleting an entity. /// \brief Flags for deleting an entity.
@ -71,9 +74,9 @@ enum IkarusEntityDeleteFlags {
/// \param flags Flags for deleting the entity. /// \param flags Flags for deleting the entity.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_delete( IKA_API void ikarus_entity_delete(
IkarusEntity * entity, struct IkarusEntity * entity,
IkarusEntityDeleteFlags flags, enum IkarusEntityDeleteFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for copying an entity. /// \brief Flags for copying an entity.
@ -89,11 +92,8 @@ enum IkarusEntityCopyFlags {
/// \param flags Flags for copying the entity. /// \param flags Flags for copying the entity.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The copied entity or null if an error occurs. /// \return The copied entity or null if an error occurs.
IKA_API IkarusEntity * ikarus_entity_copy( IKA_API struct IkarusEntity *
IkarusEntity * entity, ikarus_entity_copy(struct IkarusEntity * entity, enum IkarusEntityCopyFlags flags, struct IkarusErrorData * error_out);
IkarusEntityCopyFlags flags,
IkarusErrorData * error_out
);
/// \brief Gets the project an entity belongs to. /// \brief Gets the project an entity belongs to.
/// \param entity The entity to get the project of. /// \param entity The entity to get the project of.
@ -102,7 +102,7 @@ IKA_API IkarusEntity * ikarus_entity_copy(
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The project the entity belongs to. /// \return The project the entity belongs to.
IKA_API struct IkarusProject * IKA_API struct IkarusProject *
ikarus_entity_get_project(IkarusEntity * entity, IkarusErrorData * error_out); ikarus_entity_get_project(struct IkarusEntity * entity, struct IkarusErrorData * error_out);
/// \brief Gets the name of an entity. /// \brief Gets the name of an entity.
/// \param entity The entity to get the name of. /// \param entity The entity to get the name of.
@ -110,8 +110,7 @@ ikarus_entity_get_project(IkarusEntity * entity, IkarusErrorData * error_out);
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The name of the entity. /// \return The name of the entity.
IKA_API char const * IKA_API char const * ikarus_entity_get_name(struct IkarusEntity * entity, struct IkarusErrorData * error_out);
ikarus_entity_get_name(IkarusEntity * entity, IkarusErrorData * error_out);
/// \brief Flags for setting the name of an entity. /// \brief Flags for setting the name of an entity.
enum IkarusEntitySetNameFlags { enum IkarusEntitySetNameFlags {
@ -129,10 +128,10 @@ enum IkarusEntitySetNameFlags {
/// \param flags Flags for setting the name of the entity. /// \param flags Flags for setting the name of the entity.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_set_name( IKA_API void ikarus_entity_set_name(
IkarusEntity * entity, struct IkarusEntity * entity,
char const * name, char const * name,
IkarusEntitySetNameFlags flags, enum IkarusEntitySetNameFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets whether an entity is linked to a blueprint. /// \brief Gets whether an entity is linked to a blueprint.
@ -146,9 +145,9 @@ IKA_API void ikarus_entity_set_name(
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the entity is linked to the blueprint, false otherwise or if an error occurs. /// \return True if the entity is linked to the blueprint, false otherwise or if an error occurs.
IKA_API bool ikarus_entity_is_linked_to_blueprint( IKA_API bool ikarus_entity_is_linked_to_blueprint(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets the blueprints an entity is linked to. /// \brief Gets the blueprints an entity is linked to.
@ -159,9 +158,9 @@ IKA_API bool ikarus_entity_is_linked_to_blueprint(
/// or undefined if an error occurs. /// or undefined if an error occurs.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API struct IkarusBlueprint ** ikarus_entity_get_linked_blueprints( IKA_API struct IkarusBlueprint ** ikarus_entity_get_linked_blueprints(
IkarusEntity * entity, struct IkarusEntity * entity,
size_t * size_out, size_t * size_out,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets the number of blueprints an entity is linked to. /// \brief Gets the number of blueprints an entity is linked to.
@ -170,10 +169,8 @@ IKA_API struct IkarusBlueprint ** ikarus_entity_get_linked_blueprints(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The number of linked blueprints or 0 if an error occurs. /// \return The number of linked blueprints or 0 if an error occurs.
IKA_API size_t ikarus_entity_get_linked_blueprints_count( IKA_API size_t
IkarusEntity * entity, ikarus_entity_get_linked_blueprints_count(struct IkarusEntity * entity, struct IkarusErrorData * error_out);
IkarusErrorData * error_out
);
/// \brief Flags for linking an entity to a blueprint. /// \brief Flags for linking an entity to a blueprint.
enum IkarusEntityLinkBlueprintFlags { enum IkarusEntityLinkBlueprintFlags {
@ -195,10 +192,10 @@ enum IkarusEntityLinkBlueprintFlags {
/// \param flags Flags for linking the entity to the blueprint. /// \param flags Flags for linking the entity to the blueprint.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_link_blueprint( IKA_API void ikarus_entity_link_blueprint(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
IkarusEntityLinkBlueprintFlags flags, enum IkarusEntityLinkBlueprintFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for unlinking an entity from a blueprint. /// \brief Flags for unlinking an entity from a blueprint.
@ -220,10 +217,10 @@ enum IkarusEntityUnlinkBlueprintFlags {
/// \param flags Flags for unlinking the entity from the blueprint. /// \param flags Flags for unlinking the entity from the blueprint.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_unlink_blueprint( IKA_API void ikarus_entity_unlink_blueprint(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
IkarusEntityUnlinkBlueprintFlags flags, enum IkarusEntityUnlinkBlueprintFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets whether an entity has a value. /// \brief Gets whether an entity has a value.
@ -234,11 +231,8 @@ IKA_API void ikarus_entity_unlink_blueprint(
/// \pre \li Must not be null. /// \pre \li Must not be null.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the entity has a value with the name, false otherwise or if an error occurs. /// \return True if the entity has a value with the name, false otherwise or if an error occurs.
IKA_API bool ikarus_entity_has_value( IKA_API bool
IkarusEntity * entity, ikarus_entity_has_value(struct IkarusEntity * entity, char const * name, struct IkarusErrorData * error_out);
char const * name,
IkarusErrorData * error_out
);
/// \brief Struct for an entity value. /// \brief Struct for an entity value.
struct IkarusEntityValue { struct IkarusEntityValue {
@ -256,11 +250,8 @@ struct IkarusEntityValue {
/// or undefined if an error occurs. /// or undefined if an error occurs.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The values or null if an error occurs. /// \return The values or null if an error occurs.
IKA_API IkarusEntityValue * ikarus_entity_get_values( IKA_API struct IkarusEntityValue *
IkarusEntity * entity, ikarus_entity_get_values(struct IkarusEntity * entity, size_t * size_out, struct IkarusErrorData * error_out);
size_t * size_out,
IkarusErrorData * error_out
);
/// \brief Gets a value of an entity. /// \brief Gets a value of an entity.
/// \param entity The entity to get the value of. /// \param entity The entity to get the value of.
@ -271,11 +262,8 @@ IKA_API IkarusEntityValue * ikarus_entity_get_values(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The value, in json format of or null if an error occurs. \see value.h /// \return The value, in json format of or null if an error occurs. \see value.h
IKA_API char const * ikarus_entity_get_value( IKA_API char const *
IkarusEntity * entity, ikarus_entity_get_value(struct IkarusEntity * entity, char const * name, struct IkarusErrorData * error_out);
char const * name,
IkarusErrorData * error_out
);
/// \brief Flags for setting a value of an entity. /// \brief Flags for setting a value of an entity.
enum IkarusEntitySetValueFlags { enum IkarusEntitySetValueFlags {
@ -297,11 +285,11 @@ enum IkarusEntitySetValueFlags {
/// \param flags Flags for setting the value. /// \param flags Flags for setting the value.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_set_value( IKA_API void ikarus_entity_set_value(
IkarusEntity * entity, struct IkarusEntity * entity,
char const * name, char const * name,
char const * value, char const * value,
IkarusEntitySetValueFlags flags, enum IkarusEntitySetValueFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for deleting a value of an entity. /// \brief Flags for deleting a value of an entity.
@ -320,10 +308,10 @@ enum IkarusEntityDeleteValueFlags {
/// \param flags Flags for deleting the value. /// \param flags Flags for deleting the value.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_delete_value( IKA_API void ikarus_entity_delete_value(
IkarusEntity * entity, struct IkarusEntity * entity,
char const * name, char const * name,
IkarusEntityDeleteValueFlags flags, enum IkarusEntityDeleteValueFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets whether an entity has a property value. /// \brief Gets whether an entity has a property value.
@ -337,9 +325,9 @@ IKA_API void ikarus_entity_delete_value(
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the entity has a value for the property, false otherwise or if an error occurs. /// \return True if the entity has a value for the property, false otherwise or if an error occurs.
IKA_API bool ikarus_entity_has_property_value( IKA_API bool ikarus_entity_has_property_value(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusProperty * property, struct IkarusProperty * property,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Struct for an entity property value. /// \brief Struct for an entity property value.
@ -358,11 +346,8 @@ struct IkarusEntityPropertyValue {
/// returned array or undefined if an error occurs. /// returned array or undefined if an error occurs.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The property values, or null if an error occurs. /// \return The property values, or null if an error occurs.
IKA_API IkarusEntityPropertyValue * ikarus_entity_get_property_values( IKA_API struct IkarusEntityPropertyValue *
IkarusEntity * entity, ikarus_entity_get_property_values(struct IkarusEntity * entity, size_t * size_out, struct IkarusErrorData * error_out);
size_t * size_out,
IkarusErrorData * error_out
);
/// \brief Gets the value of a property of an entity. /// \brief Gets the value of a property of an entity.
/// \param entity The entity to get the value of. /// \param entity The entity to get the value of.
@ -376,9 +361,9 @@ IKA_API IkarusEntityPropertyValue * ikarus_entity_get_property_values(
/// \return The value, in json format of or null if an error occurs. \see /// \return The value, in json format of or null if an error occurs. \see
/// value.h /// value.h
IKA_API char const * ikarus_entity_get_property_value( IKA_API char const * ikarus_entity_get_property_value(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusProperty * property, struct IkarusProperty * property,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for setting the value of a property of an entity. /// \brief Flags for setting the value of a property of an entity.
@ -403,11 +388,11 @@ enum IkarusEntitySetPropertyValueFlags {
/// \param flags Flags for setting the property value. /// \param flags Flags for setting the property value.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_set_property_value( IKA_API void ikarus_entity_set_property_value(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusProperty * property, struct IkarusProperty * property,
char const * value, char const * value,
IkarusEntitySetPropertyValueFlags flags, enum IkarusEntitySetPropertyValueFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for clearing the value of a property of an entity. /// \brief Flags for clearing the value of a property of an entity.
@ -427,10 +412,10 @@ enum IkarusEntityClearPropertyValueFlags {
/// \param flags Flags for clearing the property value. /// \param flags Flags for clearing the property value.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_entity_clear_property_value( IKA_API void ikarus_entity_clear_property_value(
IkarusEntity * entity, struct IkarusEntity * entity,
struct IkarusProperty * property, struct IkarusProperty * property,
IkarusEntitySetPropertyValueFlags flags, enum IkarusEntitySetPropertyValueFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
IKARUS_END_HEADER IKARUS_END_HEADER

View file

@ -3,13 +3,16 @@
/// \file property.h /// \file property.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \defgroup properties Properties
/// \brief Properties define the structure and types of data.
/// @{
#include <ikarus/errors.h> #include <ikarus/errors.h>
#include <ikarus/macros.h> #include <ikarus/macros.h>
#include <ikarus/stdtypes.h> #include <ikarus/stdtypes.h>
/// \defgroup properties Properties struct IkarusProject;
/// \brief Properties define the structure and types of data. struct IkarusBlueprint;
/// @{
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
@ -41,7 +44,7 @@ struct IkarusProperty;
/// \pre \li Must not be null. /// \pre \li Must not be null.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return True if the property exists, false otherwise or if an error occurs. /// \return True if the property exists, false otherwise or if an error occurs.
IKA_API bool ikarus_property_exists(IkarusProperty * property, IkarusErrorData * error_out); IKA_API bool ikarus_property_exists(struct IkarusProperty * property, struct IkarusErrorData * error_out);
/// \brief Flags for creating a property. /// \brief Flags for creating a property.
enum IkarusPropertyCreateFlags { enum IkarusPropertyCreateFlags {
@ -69,13 +72,13 @@ enum IkarusPropertyCreateFlags {
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The created property or NULL if an error occurred. /// \return The created property or NULL if an error occurred.
/// \remark Must only be deleted with #ikarus_property_delete. /// \remark Must only be deleted with #ikarus_property_delete.
IKA_API IkarusProperty * ikarus_property_create( IKA_API struct IkarusProperty * ikarus_property_create(
struct IkarusBlueprint * blueprint, struct IkarusBlueprint * blueprint,
char const * name, char const * name,
char const * schema, char const * schema,
char const * default_value, char const * default_value,
IkarusPropertyCreateFlags flags, enum IkarusPropertyCreateFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for copying a property. /// \brief Flags for copying a property.
@ -91,8 +94,11 @@ enum IkarusPropertyCopyFlags {
/// \param flags Flags for copying the property. /// \param flags Flags for copying the property.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The copied property or NULL if an error occurred. /// \return The copied property or NULL if an error occurred.
IKA_API IkarusProperty * IKA_API struct IkarusProperty * ikarus_property_copy(
ikarus_property_copy(IkarusProperty * property, IkarusPropertyCopyFlags flags, IkarusErrorData * error_out); struct IkarusProperty * property,
enum IkarusPropertyCopyFlags flags,
struct IkarusErrorData * error_out
);
/// \brief Flags for deleting a property. /// \brief Flags for deleting a property.
enum IkarusPropertyDeleteFlags { enum IkarusPropertyDeleteFlags {
@ -104,8 +110,11 @@ enum IkarusPropertyDeleteFlags {
/// \param property The property to delete. /// \param property The property to delete.
/// \param flags Flags for deleting the property. /// \param flags Flags for deleting the property.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void IKA_API void ikarus_property_delete(
ikarus_property_delete(IkarusProperty * property, IkarusPropertyDeleteFlags flags, IkarusErrorData * error_out); struct IkarusProperty * property,
enum IkarusPropertyDeleteFlags flags,
struct IkarusErrorData * error_out
);
/// \brief Get the project a property belongs to. /// \brief Get the project a property belongs to.
/// \param property The property to get the project of. /// \param property The property to get the project of.
@ -114,7 +123,8 @@ ikarus_property_delete(IkarusProperty * property, IkarusPropertyDeleteFlags flag
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The project the property belongs to or null if an error occurred. /// \return The project the property belongs to or null if an error occurred.
/// \remark Ownership remains with libikarus. /// \remark Ownership remains with libikarus.
IKA_API struct IkarusProject * ikarus_property_get_project(IkarusProperty * property, IkarusErrorData * error_out); IKA_API struct IkarusProject *
ikarus_property_get_project(struct IkarusProperty * property, struct IkarusErrorData * error_out);
/// \brief Get the name of a property. /// \brief Get the name of a property.
/// \param property The property to get the name of. /// \param property The property to get the name of.
@ -123,7 +133,7 @@ IKA_API struct IkarusProject * ikarus_property_get_project(IkarusProperty * prop
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The name of the property or null if an error occurred. /// \return The name of the property or null if an error occurred.
/// \remark Ownership remains with libikarus. /// \remark Ownership remains with libikarus.
IKA_API char const * ikarus_property_get_name(IkarusProperty * property, IkarusErrorData * error_out); IKA_API char const * ikarus_property_get_name(struct IkarusProperty * property, struct IkarusErrorData * error_out);
/// \brief Flags for setting the name of a property. /// \brief Flags for setting the name of a property.
enum IkarusPropertySetNameFlags { enum IkarusPropertySetNameFlags {
@ -142,10 +152,10 @@ enum IkarusPropertySetNameFlags {
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \remark Ownership remains with the caller. /// \remark Ownership remains with the caller.
IKA_API void ikarus_property_set_name( IKA_API void ikarus_property_set_name(
IkarusProperty * property, struct IkarusProperty * property,
char const * name, char const * name,
IkarusPropertySetNameFlags flags, enum IkarusPropertySetNameFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Get the schema of a property. /// \brief Get the schema of a property.
@ -154,7 +164,7 @@ IKA_API void ikarus_property_set_name(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The schema of the property in JSON format or null if an error occurred. \see schema.h /// \return The schema of the property in JSON format or null if an error occurred. \see schema.h
IKA_API char const * ikarus_property_get_schema(IkarusProperty * property, IkarusErrorData * error_out); IKA_API char const * ikarus_property_get_schema(struct IkarusProperty * property, struct IkarusErrorData * error_out);
/// \brief Flags for setting the schema of a property. /// \brief Flags for setting the schema of a property.
enum IkarusPropertySetSchemaFlags { enum IkarusPropertySetSchemaFlags {
@ -176,11 +186,11 @@ enum IkarusPropertySetSchemaFlags {
/// \param flags Flags for setting the schema of the property. /// \param flags Flags for setting the schema of the property.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_property_set_schema( IKA_API void ikarus_property_set_schema(
IkarusProperty * property, struct IkarusProperty * property,
char const * schema, char const * schema,
char const * new_default_value, char const * new_default_value,
IkarusPropertySetSchemaFlags flags, enum IkarusPropertySetSchemaFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Get the default value of a property. /// \brief Get the default value of a property.
@ -189,7 +199,8 @@ IKA_API void ikarus_property_set_schema(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The default value data of the property in JSON format or null if an error occurred. \see data.h /// \return The default value data of the property in JSON format or null if an error occurred. \see data.h
IKA_API char const * ikarus_property_get_default_value(IkarusProperty * property, IkarusErrorData * error_out); IKA_API char const *
ikarus_property_get_default_value(struct IkarusProperty * property, struct IkarusErrorData * error_out);
/// \details The default value must match the schema of the property. /// \details The default value must match the schema of the property.
@ -210,10 +221,10 @@ enum IkarusPropertySetDefaultValueFlags {
/// \param flags Flags for setting the default value of the property. /// \param flags Flags for setting the default value of the property.
/// \param error_out \see errors.h /// \param error_out \see errors.h
IKA_API void ikarus_property_set_default_value( IKA_API void ikarus_property_set_default_value(
IkarusProperty * property, struct IkarusProperty * property,
char const * value, char const * value,
IkarusPropertySetDefaultValueFlags flags, enum IkarusPropertySetDefaultValueFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets all values for a property. /// \brief Gets all values for a property.

View file

@ -3,17 +3,15 @@
/// \file project.h /// \file project.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
#include <cstdint>
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \defgroup projects Projects /// \defgroup projects Projects
/// \brief Projects are the persistence mechanism of Ikarus. Each project contains a set of objects. /// \brief Projects are the persistence mechanism of Ikarus. Each project contains a set of objects.
/// \details Projects are stored on the filesystem. Each project has a name. /// \details Projects are stored on the filesystem. Each project has a name.
/// @{ /// @{
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
/// \brief An Ikarus project. /// \brief An Ikarus project.
@ -44,8 +42,8 @@ enum IkarusProjectCreateFlags {
IKA_API struct IkarusProject * ikarus_project_create( IKA_API struct IkarusProject * ikarus_project_create(
char const * path, char const * path,
char const * name, char const * name,
IkarusProjectCreateFlags flags, enum IkarusProjectCreateFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for creating a project in memory. /// \brief Flags for creating a project in memory.
@ -64,8 +62,8 @@ enum IkarusProjectCreateInMemoryFlags {
/// \remark Must be closed with #ikarus_project_close. /// \remark Must be closed with #ikarus_project_close.
IKA_API struct IkarusProject * ikarus_project_create_in_memory( IKA_API struct IkarusProject * ikarus_project_create_in_memory(
char const * name, char const * name,
IkarusProjectCreateInMemoryFlags flags, enum IkarusProjectCreateInMemoryFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for opening a project. /// \brief Flags for opening a project.
@ -82,11 +80,8 @@ enum IkarusProjectOpenFlags {
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The opened project or null if an error occurs. /// \return The opened project or null if an error occurs.
/// \remark Must be closed with #ikarus_project_close. /// \remark Must be closed with #ikarus_project_close.
IKA_API struct IkarusProject * ikarus_project_open( IKA_API struct IkarusProject *
char const * path, ikarus_project_open(char const * path, enum IkarusProjectOpenFlags flags, struct IkarusErrorData * error_out);
IkarusProjectOpenFlags flags,
IkarusErrorData * error_out
);
/// \brief Flags for closing a project in memory. /// \brief Flags for closing a project in memory.
enum IkarusProjectCloseFlags { enum IkarusProjectCloseFlags {
@ -105,8 +100,8 @@ enum IkarusProjectCloseFlags {
/// \remark Mutually exclusive with #ikarus_project_delete. /// \remark Mutually exclusive with #ikarus_project_delete.
IKA_API void ikarus_project_close( IKA_API void ikarus_project_close(
struct IkarusProject * project, struct IkarusProject * project,
IkarusProjectCloseFlags flags, enum IkarusProjectCloseFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Flags for deleting a project. /// \brief Flags for deleting a project.
@ -125,8 +120,8 @@ enum IkarusProjectDeleteFlags {
/// \remark Mutually exclusive with #ikarus_project_close. /// \remark Mutually exclusive with #ikarus_project_close.
IKA_API void ikarus_project_delete( IKA_API void ikarus_project_delete(
struct IkarusProject * project, struct IkarusProject * project,
IkarusProjectDeleteFlags flags, enum IkarusProjectDeleteFlags flags,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets the name of a project. /// \brief Gets the name of a project.
@ -135,10 +130,7 @@ IKA_API void ikarus_project_delete(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \returns The name of the project or null if an error occurs. /// \returns The name of the project or null if an error occurs.
IKA_API char const * ikarus_project_get_name( IKA_API char const * ikarus_project_get_name(struct IkarusProject const * project, struct IkarusErrorData * error_out);
struct IkarusProject const * project,
IkarusErrorData * error_out
);
/// \brief Gets the path of a project. /// \brief Gets the path of a project.
/// \param project The project to delete. /// \param project The project to delete.
@ -146,10 +138,7 @@ IKA_API char const * ikarus_project_get_name(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \returns The path of the project or null if an error occurs. /// \returns The path of the project or null if an error occurs.
IKA_API char const * ikarus_project_get_path( IKA_API char const * ikarus_project_get_path(struct IkarusProject const * project, struct IkarusErrorData * error_out);
struct IkarusProject const * project,
IkarusErrorData * error_out
);
/// \brief Gets all entities in a project. /// \brief Gets all entities in a project.
/// \param project The project from which to get the entities. /// \param project The project from which to get the entities.
@ -162,7 +151,7 @@ IKA_API char const * ikarus_project_get_path(
IKA_API struct IkarusEntity ** ikarus_project_get_entities( IKA_API struct IkarusEntity ** ikarus_project_get_entities(
struct IkarusProject const * project, struct IkarusProject const * project,
size_t * size_out, size_t * size_out,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets how many entities in a project there are. /// \brief Gets how many entities in a project there are.
@ -171,10 +160,8 @@ IKA_API struct IkarusEntity ** ikarus_project_get_entities(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The count or 0 if an error occurs. /// \return The count or 0 if an error occurs.
IKA_API size_t ikarus_project_get_entities_count( IKA_API size_t
IkarusProject const * project, ikarus_project_get_entities_count(struct IkarusProject const * project, struct IkarusErrorData * error_out);
IkarusErrorData * error_out
);
/// \brief Gets all blueprints from a project. /// \brief Gets all blueprints from a project.
/// \param project The project from which to get the blueprints. /// \param project The project from which to get the blueprints.
@ -187,7 +174,7 @@ IKA_API size_t ikarus_project_get_entities_count(
IKA_API struct IkarusBlueprint ** ikarus_project_get_blueprints( IKA_API struct IkarusBlueprint ** ikarus_project_get_blueprints(
struct IkarusProject const * project, struct IkarusProject const * project,
size_t * size_out, size_t * size_out,
IkarusErrorData * error_out struct IkarusErrorData * error_out
); );
/// \brief Gets how many blueprints in a project there are. /// \brief Gets how many blueprints in a project there are.
@ -196,10 +183,8 @@ IKA_API struct IkarusBlueprint ** ikarus_project_get_blueprints(
/// \pre \li Must exist. /// \pre \li Must exist.
/// \param error_out \see errors.h /// \param error_out \see errors.h
/// \return The count or 0 if an error occurs. /// \return The count or 0 if an error occurs.
IKA_API size_t ikarus_project_get_blueprints_count( IKA_API size_t
IkarusProject const * project, ikarus_project_get_blueprints_count(struct IkarusProject const * project, struct IkarusErrorData * error_out);
IkarusErrorData * error_out
);
IKARUS_END_HEADER IKARUS_END_HEADER

View file

@ -1,14 +1,14 @@
#pragma once #pragma once
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \file data.h /// \file data.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \addtogroup values Values /// \addtogroup values Values
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
/// \brief Data stores the actual information of a value. /// \brief Data stores the actual information of a value.

View file

@ -1,14 +1,14 @@
#pragma once #pragma once
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \file schema.h /// \file schema.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \addtogroup values Values /// \addtogroup values Values
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
/// \brief Schemas define the type of value. /// \brief Schemas define the type of value.

View file

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
/// \file value.h /// \file value.h
/// \author Folling <mail@folling.io> /// \author Folling <mail@folling.io>
/// \defgroup entities Entities /// \defgroup entities Entities
/// \brief Entities are the core building blocks of Ikarus. /// \brief Entities are the core building blocks of Ikarus.
#include <ikarus/errors.h>
#include <ikarus/macros.h>
#include <ikarus/stdtypes.h>
IKARUS_BEGIN_HEADER IKARUS_BEGIN_HEADER
/// \brief Values are data containers for entities. /// \brief Values are data containers for entities.