EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | List of all members
EnigmaConfigLoader Class Reference

Factory class for loading Enigma Machine configurations. Handles the parsing of TOML files and the creation of configuration objects. This class is stateless (static methods) and relies on IAssetProvider for IO. More...

#include <EnigmaConfigLoader.hpp>

Classes

struct  AssetPath
 Strongly typed wrapper for asset paths. Used to distinguish between general file names and base asset directories. More...
 
struct  FileName
 Strongly typed wrapper for file names. Used to distinguish between general file names and base asset directories. More...
 

Static Public Member Functions

static EnigmaMachineConfig load (const IAssetProvider &provider, const FileName &fileName, const AssetPath &assetPath=AssetPath())
 Loads the complete Enigma Machine configuration from a TOML file.
 
static RotorConfig loadRotor (const IAssetProvider &provider, const FileName &fileName)
 Loads a single rotor configuration from a TOML file.
 
static ReflectorConfig loadReflector (const IAssetProvider &provider, const FileName &fileName)
 Loads a single reflector configuration from a TOML file.
 

Detailed Description

Factory class for loading Enigma Machine configurations. Handles the parsing of TOML files and the creation of configuration objects. This class is stateless (static methods) and relies on IAssetProvider for IO.

Definition at line 15 of file EnigmaConfigLoader.hpp.

Member Function Documentation

◆ load()

EnigmaMachineConfig EnigmaConfigLoader::load ( const IAssetProvider provider,
const FileName fileName,
const AssetPath assetPath = AssetPath() 
)
static

Loads the complete Enigma Machine configuration from a TOML file.

Parameters
providerThe asset provider to load files from.
fileNameThe path to the main configuration TOML file.
assetPathAn optional base directory path to prepend to relative paths found in the config file.
Returns
EnigmaMachineConfig A fully populated configuration object.
Exceptions
std::runtime_errorIf parsing fails or validation checks fail.

Definition at line 61 of file EnigmaConfigLoader.cpp.

References IAssetProvider::loadAsset(), loadReflector(), loadRotor(), PLUGBOARD_MAX_PAIRS, EnigmaMachineConfig::plugBoardPairs, EnigmaMachineConfig::reflector, EnigmaMachineConfig::rotorCount, EnigmaMachineConfig::rotorPositions, and EnigmaMachineConfig::rotors.

+ Here is the call graph for this function:

◆ loadReflector()

ReflectorConfig EnigmaConfigLoader::loadReflector ( const IAssetProvider provider,
const FileName fileName 
)
static

Loads a single reflector configuration from a TOML file.

Parameters
providerThe asset provider to load files from.
fileNameThe path to the reflector configuration file.
Returns
ReflectorConfig The parsed reflector configuration.

Definition at line 51 of file EnigmaConfigLoader.cpp.

References IAssetProvider::loadAsset(), and ReflectorConfig::wiring.

Referenced by EnigmaMachine::EnigmaMachine(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRotor()

RotorConfig EnigmaConfigLoader::loadRotor ( const IAssetProvider provider,
const FileName fileName 
)
static

Loads a single rotor configuration from a TOML file.

Parameters
providerThe asset provider to load files from.
fileNameThe path to the rotor configuration file.
Returns
RotorConfig The parsed rotor configuration.

Definition at line 39 of file EnigmaConfigLoader.cpp.

References IAssetProvider::loadAsset(), RotorConfig::notchPosition, and RotorConfig::wiring.

Referenced by EnigmaMachine::EnigmaMachine(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: