implement blueprint functionality & streamline API
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
a2b5c573b2
commit
d3e93b6a72
9 changed files with 175 additions and 229 deletions
|
|
@ -58,25 +58,6 @@ IKA_API IkarusEntity * ikarus_entity_create(
|
|||
size_t blueprints_count
|
||||
);
|
||||
|
||||
/// \brief Copies an entity.
|
||||
/// \details Creates a deep copy of the entity including all of its properties & associated values.
|
||||
/// \param entity The entity to copy.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param parent The parent folder of the entity.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param position The position of the entity in the parent folder. \see #FolderPosition
|
||||
/// \pre \li Must be within bounds for the parent folder.
|
||||
/// \param name The name of the entity.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must not be empty.
|
||||
/// \return The created entity or null if an error occurs.
|
||||
/// \remark Must be freed using #ikarus_free.
|
||||
IKA_API IkarusEntity * ikarus_entity_copy(
|
||||
struct IkarusEntity * entity, struct IkarusEntityFolder * parent, size_t position, char const * name
|
||||
);
|
||||
|
||||
/// \brief Deletes an entity.
|
||||
/// \param entity The entity to delete.
|
||||
/// \pre \li Must not be null.
|
||||
|
|
@ -117,43 +98,6 @@ 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 Gets the project of an entity.
|
||||
/// \param entity The entity to get the project of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return The project of the entity or null if an error occurs.
|
||||
IKA_API struct IkarusProject * ikarus_entity_get_project(IkarusEntity const * entity);
|
||||
|
||||
/// \brief Gets the parent folder of an entity.
|
||||
/// \param entity The entity to get the parent folder of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return The parent folder of the entity or null if an error occurs.
|
||||
IKA_API struct IkarusEntityFolder * ikarus_entity_get_parent(IkarusEntity const * entity);
|
||||
|
||||
/// \brief Gets the position of an entity within its parent folder.
|
||||
/// \param entity The entity to get the position of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return The position of the entity or undefined if an error occurs.
|
||||
IKA_API size_t ikarus_entity_get_position(IkarusEntity const * entity);
|
||||
|
||||
/// \brief Gets the name of an entity.
|
||||
/// \param entity The entity to get the name of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return The name of the entity or null if an error occurs.
|
||||
/// \remark The returned pointer is valid until the entity is freed but may be invalidated by other operations.
|
||||
IKA_API char const * ikarus_entity_get_name(IkarusEntity const * entity);
|
||||
|
||||
/// \brief Gets the property root folder of an entity.
|
||||
/// \param entity The entity to get the root folder of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return The root folder of all properties of the entity or null if an error occurs.
|
||||
/// \remark Must be freed using #ikarus_free.
|
||||
IKA_API struct IkarusPropertyFolder * ikarus_entity_get_property_root_folder(IkarusEntity const * entity);
|
||||
|
||||
/// \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.
|
||||
|
|
@ -184,36 +128,6 @@ IKA_API void ikarus_entity_get_properties(
|
|||
/// \remark Must be freed using #ikarus_free.
|
||||
IKA_API struct IkarusEntityValue * get_value(IkarusEntity const * entity, struct IkarusProperty const * property);
|
||||
|
||||
/// \brief Sets the parent folder of an entity.
|
||||
/// \param entity The entity to set the parent folder of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param new_parent The new parent folder of the entity.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param new_position The new position of the entity in the parent folder. \see #FolderPosition
|
||||
/// \pre \li Must be within bounds for the parent folder.
|
||||
/// \remark This adjusts the positions of old and new siblings.
|
||||
IKA_API void ikarus_entity_set_parent(IkarusEntity * entity, struct IkarusEntityFolder * new_parent, size_t new_position);
|
||||
|
||||
/// \brief Sets the position of an entity within its parent folder.
|
||||
/// \param entity The entity to set the position of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param new_position The new position of the entity. \see #FolderPosition
|
||||
/// \pre \li Must be within bounds for the parent folder.
|
||||
/// \remark This adjusts the positions of siblings.
|
||||
IKA_API void ikarus_entity_set_position(IkarusEntity * entity, size_t new_position);
|
||||
|
||||
/// \brief Sets the name of an entity.
|
||||
/// \param entity The entity to set the name of.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param new_name The new name of the entity.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must not be empty.
|
||||
IKA_API void ikarus_entity_set_name(IkarusEntity * entity, char const * new_name);
|
||||
|
||||
/// \brief Sets the value of a property of an entity.
|
||||
/// \param entity The entity to set the value of.
|
||||
/// \pre \li Must not be null.
|
||||
|
|
@ -231,17 +145,13 @@ IKA_API void ikarus_entity_set_value(
|
|||
IkarusEntity * entity, struct IkarusProperty const * property, struct IkarusValue * value, bool validate_settings
|
||||
);
|
||||
|
||||
/// \brief Compares two entities.
|
||||
/// \param left The left entity to compare.
|
||||
/// \brief Casts an entity to an object.
|
||||
/// \param entity The entity to cast.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \param right The right entity to compare.
|
||||
/// \pre \li Must not be null.
|
||||
/// \pre \li Must exist.
|
||||
/// \return True if the two entities are equal, false otherwise.
|
||||
/// \remark This neither performs a pointer comparison nor a deep comparison. When we say "equal" we mean that the two
|
||||
/// entities reference the same entity in the same project.
|
||||
IKA_API bool ikarus_entity_is_equal(IkarusEntity const * left, IkarusEntity const * right);
|
||||
/// \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);
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue