aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/abstract-setting-to-json.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-09-21 18:49:43 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-09-21 18:49:43 +0200
commit0716adaa8b23855bd5e1a59f4115ec933b6a9205 (patch)
treea53cde7c076771a5d7e599f08ff7044b3b7e8bf8 /src/libutil/abstract-setting-to-json.hh
parent340ca382c4de5863f0ecb5c67bae5461ea20c60b (diff)
abstractsettingtojson.hh -> abstract-setting-to-json.hh
Diffstat (limited to 'src/libutil/abstract-setting-to-json.hh')
-rw-r--r--src/libutil/abstract-setting-to-json.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libutil/abstract-setting-to-json.hh b/src/libutil/abstract-setting-to-json.hh
new file mode 100644
index 000000000..b3fbc84f7
--- /dev/null
+++ b/src/libutil/abstract-setting-to-json.hh
@@ -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;
+}
+}