3
* @author Michael Fetisov (fetisov.michael@bmstu.ru)
8
* @copyright Copyright (c) 2022
12
#include "simodo/setup/Setup.h"
13
#include "simodo/setup/SetupJsonBuilder.h"
17
namespace simodo::setup
19
Setup::Setup(std::string default_setup_file, std::string work_setup_file)
20
: _default_setup_file(default_setup_file)
21
, _work_setup_file(work_setup_file)
23
_builder = std::make_unique<SetupJsonBuilder>();
31
_description = _builder->build(_default_setup_file);
33
return _builder->errors().empty();
36
bool simodo::setup::Setup::loadDefault()
41
bool simodo::setup::Setup::save()
46
SetupStructure Setup::structure(const std::string &id) const
48
const auto it = std::find_if(_description.setup.begin(), _description.setup.end(),
49
[id](const SetupStructure & s){
53
return it == _description.setup.end() ? SetupStructure {} : *it;
56
variable::Value simodo::setup::Setup::value(const std::string &id) const
58
const auto it = std::find_if(_description.setup.begin(), _description.setup.end(),
59
[id](const SetupStructure & s){
63
return it == _description.setup.end() ? variable::Value {} : it->value;
66
void simodo::setup::Setup::setValue(const std::string & /*id*/, const variable::Value & /*value*/)