finalise interface & documentation
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
c5157bd849
commit
52580a4382
56 changed files with 2074 additions and 780 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
/// \file folder.h
|
||||
/// \author Folling <mail@folling.io>
|
||||
/// \author Folling <folling@ikarus.world>
|
||||
|
||||
#include <ikarus/folders/blueprint_folder.h>
|
||||
#include <ikarus/folders/entity_folder.h>
|
||||
|
|
@ -15,61 +15,23 @@ IKARUS_BEGIN_HEADER
|
|||
/// \brief Folders are used to group objects together.
|
||||
/// @{
|
||||
|
||||
/// \private \brief The data of a folder.
|
||||
union IkarusFolderData {
|
||||
/// \private \brief The blueprint folder data of the folder.
|
||||
IkarusBlueprintFolder blueprint_folder;
|
||||
/// \private \brief The property folder data of the folder.
|
||||
IkarusPropertyFolder property_folder;
|
||||
/// \private \brief The entity folder data of the folder.
|
||||
IkarusEntityFolder entity_folder;
|
||||
};
|
||||
|
||||
/// \brief A generic folder. Similar to how Objects wrap all types of objects, Folders wrap all types of folders.
|
||||
struct IkarusFolder {
|
||||
/// \private \brief The data of the folder.
|
||||
IkarusFolderData data;
|
||||
struct IkarusFolder;
|
||||
|
||||
/// \private \brief The type of the folder.
|
||||
IkarusFolderType type;
|
||||
};
|
||||
|
||||
/// \brief Constructs a folder from a blueprint folder.
|
||||
/// \param blueprint_folder The blueprint folder to construct the folder from.
|
||||
/// \return The constructed folder.
|
||||
IKA_API IkarusFolder ikarus_folder_from_blueprint_folder(IkarusBlueprintFolder blueprint_folder);
|
||||
/// \brief Constructs a folder from a property folder.
|
||||
/// \param property_folder The property folder to construct the folder from.
|
||||
/// \return The constructed folder.
|
||||
IKA_API IkarusFolder ikarus_folder_from_property_folder(IkarusPropertyFolder property_folder);
|
||||
/// \brief Constructs a folder from an entity folder.
|
||||
/// \param entity_folder The entity folder to construct the folder from.
|
||||
/// \return The constructed folder.
|
||||
IKA_API IkarusFolder ikarus_folder_from_entity_folder(IkarusEntityFolder entity_folder);
|
||||
|
||||
/// \brief Fetches the folder type of a folder.
|
||||
/// \param folder The folder to fetch the type of.
|
||||
/// \return The type of the folder.
|
||||
IKA_API IkarusFolderType ikarus_folder_get_type(IkarusFolder folder);
|
||||
|
||||
/// \brief Checks if two folders are equal.
|
||||
/// \details Since ids store the type of the object, this boils down to a simple comparison of the ids.
|
||||
/// \param left The left side of the comparison.
|
||||
/// \param right The right side of the comparison.
|
||||
/// \return True if the folders are equal, false otherwise
|
||||
IKA_API bool ikarus_folder_is_equal(IkarusFolder left, IkarusFolder right);
|
||||
/// \brief Special value for inserting objects at the end of a folder.
|
||||
enum FolderPosition { FolderPosition_EndOfFolder = -1 };
|
||||
|
||||
/// \brief Visits a folder. Calling the appropriate function for the folder's type.
|
||||
/// \param folder The folder to visit.
|
||||
/// \param blueprint The function to call if the folder is a blueprint folder.
|
||||
/// \param property The function to call if the folder is a property folder.
|
||||
/// \param entity The function to call if the folder is an entity folder.
|
||||
/// \param data The data to pass to the functions.
|
||||
/// \param blueprint_visitor The function to call if the folder is a blueprint folder.
|
||||
/// \param property_visitor The function to call if the folder is a property folder.
|
||||
/// \param entity_visitor The function to call if the folder is an entity folder.
|
||||
/// \param data The data passed to the visitor functions.
|
||||
IKA_API void ikarus_folder_visit(
|
||||
IkarusFolder folder,
|
||||
void (*blueprint)(IkarusBlueprintFolder, void *),
|
||||
void (*property)(IkarusPropertyFolder, void *),
|
||||
void (*entity)(IkarusEntityFolder, void *),
|
||||
IkarusFolder * folder,
|
||||
void (*blueprint_visitor)(IkarusBlueprintFolder *, void *),
|
||||
void (*property_visitor)(IkarusPropertyFolder *, void *),
|
||||
void (*entity_visitor)(IkarusEntityFolder *, void *),
|
||||
void * data
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue