libikarus/include/ikarus/scopes/property_scope.h
Folling 67711a8d39
finalise interface & documentation
Signed-off-by: Folling <mail@folling.io>
2025-04-15 12:07:58 +02:00

48 lines
1.7 KiB
C

#pragma once
/// \file property_scope.h
/// \author Folling <folling@ikarus.world>
#include <ikarus/id.h>
#include <ikarus/macros.h>
/// \addtogroup object_scopes ObjectScopes
/// @{
IKARUS_BEGIN_HEADER
/// \brief The scope of a property
struct IkarusPropertyScope;
/// \brief Creates a property scope from a blueprint.
/// \param blueprint The blueprint the property is scoped to.
/// \return The created property scope.
/// \remark Must be freed with #ikarus_free.
IKA_API IkarusPropertyScope * ikarus_property_scope_create_blueprint(struct IkarusBlueprint * blueprint);
/// \brief Creates a property scope from an entity.
/// \param entity The entity the property is scoped to.
/// \return The created property scope.
/// \remark Must be freed with #ikarus_free.
IKA_API IkarusPropertyScope * ikarus_property_scope_create_entity(struct IkarusEntity * entity);
/// \brief Converts a property scope to an object scope.
/// \param scope The scope to convert.
/// \return The converted scope.
/// \remark Must be freed with #ikarus_free.
IKA_API struct IkarusObjectScope * ikarus_property_scope_to_object_scope(IkarusPropertyScope const * scope);
/// \brief Visits a property scope, calling the appropriate function.
/// \param scope The scope to to visit
/// \param blueprint_visitor The function to call if the property is scoped to a blueprint.
/// \param entity_visitor The function to call if the property is scoped to an entity.
/// \param data The data passed to the visitor functions.
IKA_API void ikarus_property_scope_visit(
IkarusPropertyScope * scope,
void (*blueprint_visitor)(struct IkarusBlueprint *, void *),
void (*entity_visitor)(struct IkarusEntity *, void *),
void * data
);
IKARUS_END_HEADER
// @}