EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
Loading...
Searching...
No Matches
EnigmaConfigLoader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <string_view>
5
7#include "IAssetProvider.hpp"
8
14namespace fs = std::filesystem;
16public:
23 struct FileName : public fs::path {
24 explicit FileName(fs::path path) : fs::path(std::move(path)) {}
25 };
26
34 struct AssetPath : public fs::path {
35 explicit AssetPath(fs::path path) : fs::path(std::move(path)) {}
36 explicit AssetPath() : fs::path("") {}
37 };
38
48 static EnigmaMachineConfig load(const IAssetProvider& provider, const FileName& fileName,
49 const AssetPath& assetPath = AssetPath());
50
58 static RotorConfig loadRotor(const IAssetProvider& provider, const FileName& fileName);
59
67 static ReflectorConfig loadReflector(const IAssetProvider& provider, const FileName& fileName);
68};
Factory class for loading Enigma Machine configurations. Handles the parsing of TOML files and the cr...
static ReflectorConfig loadReflector(const IAssetProvider &provider, const FileName &fileName)
Loads a single reflector configuration from a TOML file.
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.
Interface for providing configuration/asset data. Abstracts the source of assets (filesystem,...
Strongly typed wrapper for asset paths. Used to distinguish between general file names and base asset...
Strongly typed wrapper for file names. Used to distinguish between general file names and base asset ...
Configuration Data Transfer Object (DTO) for the Enigma Machine. Holds the raw configuration data req...
Configuration structure for a Reflector.
Configuration structure for an individual Rotor.