#pragma once #include #include #include #include #include "util/macros.h" #include "weather.h" // TODO: Make config values optional and supply defaults class General { private: std::string m_Name; public: General(std::string name); [[nodiscard]] fn getName() const -> const std::string; }; struct GeneralImpl { std::string name; static fn from_class(const General& general) noexcept -> GeneralImpl; [[nodiscard]] fn to_class() const -> General; }; class NowPlaying { private: bool m_Enabled; public: NowPlaying(bool enabled); [[nodiscard]] fn getEnabled() const -> bool; }; struct NowPlayingImpl { std::optional enabled; static fn from_class(const NowPlaying& now_playing ) noexcept -> NowPlayingImpl; [[nodiscard]] fn to_class() const -> NowPlaying; }; class Config { private: General m_General; NowPlaying m_NowPlaying; Weather m_Weather; public: Config(General general, NowPlaying now_playing, Weather weather); static fn getInstance() -> const Config&; [[nodiscard]] fn getWeather() const -> const Weather; [[nodiscard]] fn getGeneral() const -> const General; [[nodiscard]] fn getNowPlaying() const -> const NowPlaying; }; struct ConfigImpl { General general; NowPlaying now_playing; Weather weather; static fn from_class(const Config& config) noexcept -> ConfigImpl; [[nodiscard]] fn to_class() const -> Config; }; // Parsers for Config classes namespace rfl::parsing { template struct Parser : public CustomParser< ReaderType, WriterType, ProcessorsType, General, GeneralImpl> {}; template struct Parser : public CustomParser< ReaderType, WriterType, ProcessorsType, NowPlaying, NowPlayingImpl> {}; template struct Parser : public CustomParser< ReaderType, WriterType, ProcessorsType, Config, ConfigImpl> {}; }