1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 15:31:47 +02:00

Don't include nlohmann/json.hpp in config.hh

Instead make a separate header with the template implementation of
`BaseSetting<T>::toJSONObj` that can be included where needed
This commit is contained in:
regnat 2020-09-16 09:06:35 +02:00
parent 93c0e14a30
commit e0817cbcdc
4 changed files with 19 additions and 8 deletions

View file

@ -0,0 +1,15 @@
#pragma once
#include <nlohmann/json.hpp>
#include "config.hh"
namespace nix {
template<typename T>
std::map<std::string, nlohmann::json> BaseSetting<T>::toJSONObject()
{
auto obj = AbstractSetting::toJSONObject();
obj.emplace("value", value);
obj.emplace("defaultValue", defaultValue);
return obj;
}
}