Move json stuff out of util.cc
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
||||
const nlohmann::json * get(const nlohmann::json & map, const std::string & key)
|
||||
{
|
||||
auto i = map.find(key);
|
||||
if (i == map.end()) return nullptr;
|
||||
return &*i;
|
||||
}
|
||||
|
||||
nlohmann::json * get(nlohmann::json & map, const std::string & key)
|
||||
{
|
||||
auto i = map.find(key);
|
||||
if (i == map.end()) return nullptr;
|
||||
return &*i;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1586,23 +1586,8 @@ std::string stripIndentation(std::string_view s)
|
||||
}
|
||||
|
||||
|
||||
const nlohmann::json * get(const nlohmann::json & map, const std::string & key)
|
||||
{
|
||||
auto i = map.find(key);
|
||||
if (i == map.end()) return nullptr;
|
||||
return &*i;
|
||||
}
|
||||
|
||||
nlohmann::json * get(nlohmann::json & map, const std::string & key)
|
||||
{
|
||||
auto i = map.find(key);
|
||||
if (i == map.end()) return nullptr;
|
||||
return &*i;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
static Sync<std::pair<unsigned short, unsigned short>> windowSize{{0, 0}};
|
||||
|
||||
|
||||
|
||||
@@ -558,9 +558,6 @@ typename T::mapped_type * get(T & map, const typename T::key_type & key)
|
||||
return &i->second;
|
||||
}
|
||||
|
||||
const nlohmann::json * get(const nlohmann::json & map, const std::string & key);
|
||||
nlohmann::json * get(nlohmann::json & map, const std::string & key);
|
||||
|
||||
/* Get a value for the specified key from an associate container, or a default value if the key isn't present. */
|
||||
template <class T>
|
||||
const typename T::mapped_type & getOr(T & map,
|
||||
|
||||
Reference in New Issue
Block a user