MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::Modules Namespace Reference

Namespace for utilities handling Unreal modules. More...

Data Structures

struct  FObserveModuleListener
 A record for the module event listeners. More...
 
class  IObservableModule
 Add this interface to your module class if other things can listen to module startup or shutdown. More...
 
struct  TModuleBoundObject
 A wrapper around a given object which lifespan is bound to given module. More...
 
struct  TObserveModule
 Use this in global variables to automatically do things on module startup or shutdown. More...
 

Concepts

concept  CObservableModule
 

Functions

template<CDerivedFrom< IModuleInterface > M>
FString InferModuleName ()
 Infer the module name from an input type. This exists because there's a very reliable naming convention for class names representing modules. The inference is removing the first letter Hungarian type notation and removing "Module" or "ModuleInterface" from the end.
 
template<CDerivedFrom< IModuleInterface > M>
TMaybe< M * > TryLoadUnrealModule ()
 Try to load a module and return an IError when that fails for any reason. Module name is inferred from type described in.
 
template<CDerivedFrom< IModuleInterface > M>
M & LoadUnrealModule ()
 Load a module or crash with IError if it cannot be done for any reason Module name is inferred from type described in.
 
template<CDerivedFrom< IModuleInterface > M>
M * GetUnrealModulePtr ()
 Shorthand for FModuleManager::GetModulePtr with the name inferred from given type.
 
template<CDerivedFrom< IModuleInterface > M>
M & GetUnrealModule ()
 Get an already loaded unreal module. If for any reason it's not loaded, crash the app.
 

Detailed Description

Namespace for utilities handling Unreal modules.

Function Documentation

◆ GetUnrealModule()

template<CDerivedFrom< IModuleInterface > M>
M & Mcro::Modules::GetUnrealModule ( )

Get an already loaded unreal module. If for any reason it's not loaded, crash the app.

See also
InferModuleName

Definition at line 94 of file Modules.h.

◆ GetUnrealModulePtr()

template<CDerivedFrom< IModuleInterface > M>
M * Mcro::Modules::GetUnrealModulePtr ( )

Shorthand for FModuleManager::GetModulePtr with the name inferred from given type.

See also
InferModuleName

Definition at line 87 of file Modules.h.

◆ InferModuleName()

template<CDerivedFrom< IModuleInterface > M>
FString Mcro::Modules::InferModuleName ( )

Infer the module name from an input type. This exists because there's a very reliable naming convention for class names representing modules. The inference is removing the first letter Hungarian type notation and removing "Module" or "ModuleInterface" from the end.

Template Parameters
Mthe supposed type of the module
Returns
The module name inferrable from its type name

Definition at line 42 of file Modules.h.

◆ LoadUnrealModule()

template<CDerivedFrom< IModuleInterface > M>
M & Mcro::Modules::LoadUnrealModule ( )

Load a module or crash with IError if it cannot be done for any reason Module name is inferred from type described in.

See also
InferModuleName.

Definition at line 76 of file Modules.h.

◆ TryLoadUnrealModule()

template<CDerivedFrom< IModuleInterface > M>
TMaybe< M * > Mcro::Modules::TryLoadUnrealModule ( )

Try to load a module and return an IError when that fails for any reason. Module name is inferred from type described in.

See also
InferModuleName.

Definition at line 56 of file Modules.h.