libikarus/include/ikarus/objects/object.h
Folling dc8b7712b0
add src/ikarus subdir and make names unique for objects per scope
Signed-off-by: Folling <mail@folling.io>
2025-04-15 12:08:06 +02:00

50 lines
1.8 KiB
C

#pragma once
/// \file object.h
/// \author Folling <folling@ikarus.world>
#include <ikarus/errors.h>
#include <ikarus/macros.h>
/// \defgroup object Objects
/// \brief Objects are a compound type of all types of objects in the database.
/// \details The following objects currently exist:
/// - \ref blueprint.h "Blueprints"
/// - \ref property.h "Properties"
/// - \ref entity.h "Entities"
/// @{
IKARUS_BEGIN_HEADER
/// \brief A generic object. Wraps all types of objects, including folders.
struct IkarusObject;
/// \brief Visits an object. Calling the appropriate function for the object's type.
/// \param object The object to visit.
/// \param blueprint_visitor The function to call if the object is a blueprint. Skipped if null.
/// \param property_visitor The function to call if the object is a property. Skipped if null.
/// \param entity_visitor The function to call if the object is an entity. Skipped if null.
/// \param data The data passed to the visitor functions.
/// \param error_out \see errors.h
IKA_API void ikarus_object_visit(
IkarusObject * object,
void (*blueprint_visitor)(struct IkarusBlueprint *, IkarusErrorData * error_out, void *),
void (*property_visitor)(struct IkarusProperty *, IkarusErrorData * error_out, void *),
void (*entity_visitor)(struct IkarusEntity *, IkarusErrorData * error_out, void *),
void * data,
IkarusErrorData * error_out
);
/// \see ikarus_object_visit
IKA_API void ikarus_object_visit_const(
IkarusObject const * object,
void (*blueprint_visitor)(struct IkarusBlueprint const *, IkarusErrorData * error_out, void *),
void (*property_visitor)(struct IkarusProperty const *, IkarusErrorData * error_out, void *),
void (*entity_visitor)(struct IkarusEntity const *, IkarusErrorData * error_out, void *),
void * data,
IkarusErrorData * error_out
);
IKARUS_END_HEADER
/// @}