finalize schema/data setup
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
98cb7a44ef
commit
a49912337d
89 changed files with 2324 additions and 6271 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
/// \file blueprint.h
|
||||
/// \author Folling <folling@ikarus.world>
|
||||
/// \author Folling <mail@folling.io>
|
||||
|
||||
#include <ikarus/errors.h>
|
||||
#include <ikarus/macros.h>
|
||||
|
|
@ -13,57 +13,113 @@
|
|||
|
||||
IKARUS_BEGIN_HEADER
|
||||
|
||||
/// \brief Blueprints are templates for managing common properties of entities.
|
||||
/// \details A blueprint is a collection of properties which can be linked to entities.
|
||||
/// Each entity the blueprint is linked to will have values for the blueprints
|
||||
/// properties. Changes in blueprints will be reflected in all linked entities.
|
||||
/// \brief Templates for sharing common properties between entities.
|
||||
/// \details A blueprint allows sharing properties between entities.
|
||||
/// Each entity the blueprint is linked to will have a corresponding value for
|
||||
/// each of the blueprint's properties. Changes in blueprints will be reflected
|
||||
/// in all linked entities.
|
||||
struct IkarusBlueprint;
|
||||
|
||||
/// \brief Creates a blueprint.
|
||||
/// \param project The project the blueprint is part of.
|
||||
/// \brief Flags for creating a blueprint.
|
||||
enum IkarusBlueprintCreateFlags {
|
||||
/// \brief No flags.
|
||||
IkarusBlueprintCreateFlags_None = 0,
|
||||
};
|
||||
|
||||
/// \brief Creates a new blueprint.
|
||||
/// \param project The project to create the blueprint in.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param name The name of the blueprint.
|
||||
/// \pre \li Must not be null.
|
||||
/// \param error_out \see errors.h
|
||||
/// \pre \li Must not be empty.
|
||||
/// \param flags Flags for creating the blueprint.
|
||||
/// \return The created blueprint or null if an error occurs.
|
||||
/// \param error_out \see errors.h
|
||||
/// \remark Ownership remains with libikarus.
|
||||
IKA_API IkarusBlueprint * ikarus_blueprint_create(
|
||||
struct IkarusProject * project,
|
||||
char const * name,
|
||||
IkarusErrorData * error_out
|
||||
struct IkarusProject * project,
|
||||
char const * name,
|
||||
IkarusBlueprintCreateFlags flags,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Deletes a blueprint.
|
||||
/// \brief Flags for creating a blueprint from an entity.
|
||||
enum IkarusBlueprintCreateFromEntityFlags {
|
||||
/// \brief No flags.
|
||||
IkarusBlueprintCreateFromEntityFlags_None = 0,
|
||||
/// \brief The default values of the properties will be set to the values of the source entity.
|
||||
IkarusBlueprintCreateFromEntityFlags_AdoptDefaultValues = 1 << 0,
|
||||
/// \brief The entity will be linked to the blueprint, and all values will be turned into properties.
|
||||
IkarusBlueprintCreateFromEntityFlags_LinkEntity = 1 << 1,
|
||||
};
|
||||
|
||||
/// \brief Creates a new blueprint from an entity.
|
||||
/// \details Each value of the entity will be copied into the blueprint as a property.
|
||||
/// \param entity The entity to create the blueprint from.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param name The name of the blueprint.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must not be empty.
|
||||
/// \param flags Flags for creating the blueprint.
|
||||
/// \param error_out \see errors.h
|
||||
/// \return The created blueprint or null if an error occurs.
|
||||
IKA_API IkarusBlueprint * ikarus_blueprint_create_from_entity(
|
||||
struct IkarusEntity * entity,
|
||||
char const * name,
|
||||
IkarusBlueprintCreateFromEntityFlags flags,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Flags for copying a blueprint.
|
||||
enum IkarusBlueprintCopyFlags {
|
||||
/// \brief No flags.
|
||||
IkarusBlueprintCopyFlags_None = 0,
|
||||
};
|
||||
|
||||
/// \brief Copies a blueprint.
|
||||
/// \param blueprint The blueprint to copy.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param flags Flags for copying the blueprint.
|
||||
/// \param error_out \see errors.h
|
||||
/// \return The copied blueprint or null if an error occurs.
|
||||
IKA_API struct IkarusBlueprint * ikarus_blueprint_copy(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
IkarusBlueprintCopyFlags flags,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Flags for deleting a blueprint.
|
||||
enum IkarusBlueprintDeleteFlags {
|
||||
/// \brief No flags.
|
||||
IkarusBlueprintDeleteFlags_None = 0,
|
||||
};
|
||||
|
||||
/// \brief Deletes a blueprint, all associated properties, and their values.
|
||||
/// \param blueprint The blueprint to delete.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param flags Flags for deleting the blueprint.
|
||||
/// \remark Must not be used after deletion.
|
||||
/// \param error_out \see errors.h
|
||||
/// \remark The blueprint must not be accessed after deletion.
|
||||
IKA_API void ikarus_blueprint_delete(
|
||||
IkarusBlueprint * blueprint,
|
||||
IkarusErrorData * error_out
|
||||
struct IkarusBlueprint * blueprint,
|
||||
IkarusBlueprintDeleteFlags flags,
|
||||
IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the ID of a blueprint.
|
||||
/// \param blueprint The blueprint to get the ID of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param error_out \see errors.h
|
||||
/// \return The ID of the blueprint or 0 if an error occurs.
|
||||
IKA_API int64_t ikarus_blueprint_get_id(
|
||||
IkarusBlueprint const * blueprint,
|
||||
IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the project a blueprint is part of.
|
||||
/// \brief Gets the project a blueprint belongs to.
|
||||
/// \param blueprint The blueprint to get the project of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param error_out \see errors.h
|
||||
/// \return The project or null if an error occurs.
|
||||
IKA_API IkarusProject * ikarus_blueprint_get_project(
|
||||
IkarusBlueprint const * blueprint,
|
||||
IkarusErrorData * error_out
|
||||
/// \return The project the blueprint belongs to.
|
||||
/// \remark Ownership remains with libikarus.
|
||||
IKA_API struct IkarusProject * ikarus_blueprint_get_project(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the name of a blueprint.
|
||||
|
|
@ -71,79 +127,84 @@ IKA_API IkarusProject * ikarus_blueprint_get_project(
|
|||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param error_out \see errors.h
|
||||
/// \return The name or null if an error occurs.
|
||||
/// \return The name of the blueprint.
|
||||
/// \remark Ownership remains with libikarus.
|
||||
IKA_API char const * ikarus_blueprint_get_name(
|
||||
IkarusBlueprint const * blueprint,
|
||||
IkarusErrorData * error_out
|
||||
struct IkarusBlueprint * blueprint,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Flags for setting the name of a blueprint.
|
||||
enum IkarusBlueprintSetNameFlags {
|
||||
/// \brief No flags.
|
||||
IkarusBlueprintSetNameFlags_None = 0,
|
||||
};
|
||||
|
||||
/// \brief Sets the name of a blueprint.
|
||||
/// \param blueprint The blueprint to set the name of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param name The new name of the blueprint.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must not be empty.
|
||||
/// \param flags Flags for setting the name of the blueprint.
|
||||
/// \param error_out \see errors.h
|
||||
IKA_API void ikarus_blueprint_set_name(
|
||||
IkarusBlueprint * blueprint,
|
||||
char const * name,
|
||||
IkarusErrorData * error_out
|
||||
struct IkarusBlueprint * blueprint,
|
||||
char const * name,
|
||||
IkarusBlueprintSetNameFlags flags,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the properties of a blueprint.
|
||||
/// \param blueprint The blueprint to get the properties of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \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 size_out An out parameter for the number of items in the returned array or undefined if an error occurs.
|
||||
/// \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,
|
||||
IkarusErrorData * error_out
|
||||
/// \return The properties of the blueprint or null if an error occurs.
|
||||
IKA_API struct IkarusProperty ** ikarus_blueprint_get_properties(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
size_t * size_out,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the number of properties of a blueprint.
|
||||
/// \param blueprint The blueprint to get the number of properties of.
|
||||
/// \param blueprint The blueprint to get the properties count 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,
|
||||
IkarusErrorData * error_out
|
||||
/// \return The number of properties of the blueprint or 0 if an error occurs.
|
||||
IKA_API size_t ikarus_blueprint_get_properties_count(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
/// \brief Gets the entities linked to a blueprint.
|
||||
/// \param blueprint The blueprint to get the linked entities of.
|
||||
/// \brief Gets all entities linked to a blueprint.
|
||||
/// \param blueprint The blueprint to get the entities of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \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 size_out An out parameter for the number of items in the returned array or undefined if an error occurs.
|
||||
/// \remark Ignore if null.
|
||||
/// \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,
|
||||
IkarusErrorData * error_out
|
||||
/// \return The entities linked to the blueprint or null if an error occurs.
|
||||
IKA_API struct IkarusEntity ** ikarus_blueprint_get_entities(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
size_t * size_out,
|
||||
struct 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.
|
||||
/// \param blueprint The blueprint to get the entities count 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,
|
||||
IkarusErrorData * error_out
|
||||
/// \return The number of entities linked to the blueprint or 0 if an error occurs.
|
||||
IKA_API size_t ikarus_blueprint_get_entities_count(
|
||||
struct IkarusBlueprint * blueprint,
|
||||
struct IkarusErrorData * error_out
|
||||
);
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
||||
// @}
|
||||
/// @}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue