RedCore
Loading...
Searching...
No Matches
red::Registrar Class Reference

Per-mod registrar object from which all registrations must be made. More...

#include <Registrar.h>

Public Member Functions

 Registrar (const char *nameSpace)
template<class T>
requires std::derived_from<T, ActorBase>
ProfileCreateBuilder< T > newProfile (const char *name) const
 Register a new profile by string-name.
template<class T, s32 ID>
requires std::derived_from<T, ActorBase>
ProfileReplaceBuilder< T, ID > replaceProfile () const
 Replace a vanilla profile by its numeric ID.
template<s32 ID>
ProfileEditBuilder< ID > editProfile () const
 Partially modify fields on a vanilla profile by its numeric ID.

Detailed Description

Per-mod registrar object from which all registrations must be made.

Every mod should construct and maintain its own global red::Registrar with a unique namespace.

Constructor & Destructor Documentation

◆ Registrar()

red::Registrar::Registrar ( const char * nameSpace)
inlineexplicit

Construct a registrar using a namespace.

Parameters
nameSpaceThe unique namespace for the mod.

Member Function Documentation

◆ newProfile()

template<class T>
requires std::derived_from<T, ActorBase>
ProfileCreateBuilder< T > red::Registrar::newProfile ( const char * name) const
inline

Register a new profile by string-name.

Template Parameters
TTarget actor class that this profile represents and will instantiate.
Parameters
nameThe identifier of this profile, to which the namespace will automatically be prefixed.
Returns
A builder on which additional methods for setting parameters are available.
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.

◆ replaceProfile()

template<class T, s32 ID>
requires std::derived_from<T, ActorBase>
ProfileReplaceBuilder< T, ID > red::Registrar::replaceProfile ( ) const
inline

Replace a vanilla profile by its numeric ID.

Template Parameters
TActor class that this profile will now instantiate.
IDThe target profile ID to replace.
Returns
A builder on which additional methods for setting parameters are available.

◆ editProfile()

template<s32 ID>
ProfileEditBuilder< ID > red::Registrar::editProfile ( ) const
inline

Partially modify fields on a vanilla profile by its numeric ID.

Template Parameters
IDThe target profile ID to modify.
Returns
A builder on which additional methods for setting parameters are available.