RedCore
Loading...
Searching...
No Matches
Registrar.h
Go to the documentation of this file.
1#pragma once
2
3#include <actor/ActorBase.h>
4#include <red/registry/builder/ProfileCreateBuilder.h>
5#include <red/registry/builder/ProfileReplaceBuilder.h>
6#include <red/registry/builder/ProfileEditBuilder.h>
7#include <concepts>
8
9namespace red {
10
11/**
12 * @brief Per-mod registrar object from which all registrations must be made.
13 * @details Every mod should construct and maintain its own global @c red::Registrar with a unique namespace.
14 */
15class Registrar {
16public:
17 /**
18 * Construct a registrar using a namespace.
19 * @param nameSpace The unique namespace for the mod.
20 */
21 explicit Registrar(const char* nameSpace)
23 { }
24
25 /**
26 * @brief Register a new profile by string-name.
27 * @tparam T Target actor class that this profile represents and will instantiate.
28 * @param name The identifier of this profile, to which the namespace will automatically be prefixed.
29 * @return A builder on which additional methods for setting parameters are available.
30 * @warning One profile per instantiation of T, meaning if two profiles with the same class are desired, a second class that inherits the first is required to force creation of a new template instance.
31 */
32 template <class T> requires std::derived_from<T, ActorBase>
40
41 /**
42 * @brief Replace a vanilla profile by its numeric ID.
43 * @tparam T Actor class that this profile will now instantiate.
44 * @param id The target profile ID to replace.
45 * @return A builder on which additional methods for setting parameters are available.
46 */
47 template <class T> requires std::derived_from<T, ActorBase>
51
52 /**
53 * @brief Partially modify fields on a vanilla profile by its numeric ID.
54 * @param id The target profile ID to modify.
55 * @return A builder on which additional methods for setting parameters are available.
56 */
60
61private:
62 const char* mNamespace; ///< The unique namespace for this mod.
63};
64
65}
Per-mod registrar object from which all registrations must be made.
Definition Registrar.h:15
Registrar(const char *nameSpace)
Definition Registrar.h:21
Definition ActorDonutBlock.h:5