This commit is contained in:
Mars 2024-06-05 19:04:53 -04:00
parent 693fa17d10
commit 500138ce67
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
331 changed files with 12348 additions and 60593 deletions

View file

@ -1,9 +1,3 @@
#include <fmt/core.h>
#include <rfl.hpp>
#include <rfl/toml.hpp>
#include <toml++/toml.h>
#include <unistd.h>
#include "config.h"
#define DEFINE_GETTER(class_name, type, name) \
@ -21,9 +15,11 @@ DEFINE_GETTER(Weather, const string, ApiKey)
DEFINE_GETTER(Weather, const string, Units)
const Config& Config::getInstance() {
static const Config& INSTANCE =
*new Config(rfl::toml::load<Config>("./config.toml").value());
return INSTANCE;
static const auto* INSTANCE =
new Config(rfl::toml::load<Config>("./config.toml").value());
static std::once_flag Flag;
std::call_once(Flag, [] { std::atexit([] { delete INSTANCE; }); });
return *INSTANCE;
}
Config::Config(General general, NowPlaying now_playing, Weather weather)