1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/components/settings/values.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
861 B
C++
Raw Normal View History

#include "values.hpp"
2023-04-22 18:40:17 +00:00
#include <stdexcept>
namespace Settings
{
std::unique_ptr<Index> StaticValues::sIndex;
std::unique_ptr<Values> StaticValues::sDefaultValues;
std::unique_ptr<Values> StaticValues::sValues;
void StaticValues::initDefaults()
{
if (sDefaultValues != nullptr)
throw std::logic_error("Default settings are already initialized");
sIndex = std::make_unique<Index>();
sDefaultValues = std::make_unique<Values>(*sIndex);
}
2023-04-22 18:40:17 +00:00
void StaticValues::init()
2023-04-22 18:40:17 +00:00
{
if (sDefaultValues == nullptr)
2023-04-22 18:40:17 +00:00
throw std::logic_error("Default settings are not initialized");
sValues = std::make_unique<Values>(std::move(*sDefaultValues));
}
void StaticValues::clear()
{
sValues = nullptr;
sDefaultValues = nullptr;
sIndex = nullptr;
2023-04-22 18:40:17 +00:00
}
}