add flatbuffers support and initial rewrite

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2024-05-12 14:15:42 +02:00 committed by Folling
parent b5852698e3
commit 70820129ae
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
72 changed files with 3929 additions and 1403 deletions

View file

@ -30,7 +30,11 @@ struct IkarusProject;
/// \return The created project or null if an error occurs.
/// \remark Must be freed using #ikarus_free. Freeing does not delete the project from the filesystem. For that, use
/// ikarus_project_delete
IKA_API IkarusProject * ikarus_project_create(char const * path, char const * name, IkarusErrorData * error_out);
IKA_API IkarusProject * ikarus_project_create(
char const * path,
char const * name,
IkarusErrorData * error_out
);
/// \brief Creates a project in memory.
/// \param name The name of the project. Must neither be null nor empty.
@ -40,7 +44,8 @@ IKA_API IkarusProject * ikarus_project_create(char const * path, char const * na
/// \return The created project or null if an error occurs.
/// \remark Must be freed using #ikarus_free. Freeing does not delete the project from the filesystem. For that, use
/// ikarus_project_delete
IKA_API IkarusProject * ikarus_project_create_in_memory(char const * name, IkarusErrorData * error_out);
IKA_API IkarusProject *
ikarus_project_create_in_memory(char const * name, IkarusErrorData * error_out);
/// \brief Opens an existing project.
/// \param path The path to the project.
@ -50,7 +55,8 @@ IKA_API IkarusProject * ikarus_project_create_in_memory(char const * name, Ikaru
/// \return The opened project or null if an error occurs.
/// \remark Must be freed using ikarus_free. Freeing does not delete the project from the filesystem. For that, use
/// ikarus_project_delete
IKA_API IkarusProject * ikarus_project_open(char const * path, IkarusErrorData * error_out);
IKA_API IkarusProject *
ikarus_project_open(char const * path, IkarusErrorData * error_out);
/// \brief Gets the name of a project.
/// \param project The project to get the name of.
@ -59,7 +65,10 @@ IKA_API IkarusProject * ikarus_project_open(char const * path, IkarusErrorData *
/// \param error_out \see errors.h
/// \return The name of the project.
/// \remark Ownership remains with libikarus, must not be freed.
IKA_API char const * ikarus_project_get_name(IkarusProject const * project, IkarusErrorData * error_out);
IKA_API char const * ikarus_project_get_name(
IkarusProject const * project,
IkarusErrorData * error_out
);
/// \brief Sets the name of a project.
/// \param project The project to set the name of.
@ -69,7 +78,11 @@ IKA_API char const * ikarus_project_get_name(IkarusProject const * project, Ikar
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
IKA_API void ikarus_project_set_name(IkarusProject * project, char const * new_name, IkarusErrorData * error_out);
IKA_API void ikarus_project_set_name(
IkarusProject * project,
char const * new_name,
IkarusErrorData * error_out
);
/// \brief Gets the path of a project.
/// \param project The project to get the path of.
@ -78,7 +91,10 @@ IKA_API void ikarus_project_set_name(IkarusProject * project, char const * new_n
/// \param error_out \see errors.h
/// \return The path of the project.
/// \remark Ownership remains with libikarus, must not be freed.
IKA_API char const * ikarus_project_get_path(IkarusProject const * project, IkarusErrorData * error_out);
IKA_API char const * ikarus_project_get_path(
IkarusProject const * project,
IkarusErrorData * error_out
);
/// \brief Gets the entities of a project.
/// \param project The project to get the entities of.
@ -101,7 +117,10 @@ 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 const * project,
IkarusErrorData * error_out
);
/// \brief Gets the blueprints of a project.
/// \param project The project to get the blueprints of.
@ -124,51 +143,11 @@ 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 Finds an entity by a given name.
/// \param project The project to search.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param name The name to search for.
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
/// \return The entity with the given name or null if none was found.
IKA_API struct IkarusEntity * ikarus_project_get_entity_by_name(IkarusProject * project, char const * name, IkarusErrorData * error_out);
/// \brief Finds a property by a given name.
/// \param project The project to search.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param scope The scope of the property.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \remark Property names are unique only within their scope.
/// \param name The name to search for.
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
/// \return The property with the given name or null if none was found.
IKA_API struct IkarusProperty * ikarus_project_get_property_by_name_and_scope(
IkarusProject * project,
struct IkarusPropertyScope * scope,
char const * name,
IKA_API size_t ikarus_project_get_blueprint_count(
IkarusProject const * project,
IkarusErrorData * error_out
);
/// \brief Finds a blueprint by a given name.
/// \param project The project to search.
/// \pre \li Must not be null.
/// \pre \li Must exist.
/// \param name The name to search for.
/// \pre \li Must not be null.
/// \pre \li Must not be empty.
/// \param error_out \see errors.h
/// \return The blueprint with the given name or null if none was found.
IKA_API struct IkarusBlueprint *
ikarus_project_get_blueprint_by_name(IkarusProject * project, char const * name, IkarusErrorData * error_out);
IKARUS_END_HEADER
/// @}