diff --git a/include/ircd/json/json.h b/include/ircd/json/json.h index 64fa99008..590595610 100644 --- a/include/ircd/json/json.h +++ b/include/ircd/json/json.h @@ -39,8 +39,19 @@ namespace ircd::json #include "strung.h" #include "tuple/tuple.h" #include "stack.h" -#include "tool.h" +// Convenience toolset for higher level operations. +namespace ircd::json +{ + void merge(stack::object &out, const vector &); + strung remove(const object &, const string_view &key); + strung remove(const object &, const size_t &index); + strung insert(const object &, const member &); + strung replace(const object &, const member &); + strung replace(const object &, const members &); +} + +// Exports to ircd:: namespace ircd { using json::operator ""_; diff --git a/include/ircd/json/tool.h b/include/ircd/json/tool.h deleted file mode 100644 index 5735a20bc..000000000 --- a/include/ircd/json/tool.h +++ /dev/null @@ -1,25 +0,0 @@ -// Matrix Construct -// -// Copyright (C) Matrix Construct Developers, Authors & Contributors -// Copyright (C) 2016-2019 Jason Volk -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice is present in all copies. The -// full license for this software is available in the LICENSE file. - -#pragma once -#define HAVE_IRCD_JSON_TOOL_H - -namespace ircd::json -{ - void merge(stack::object &out, const vector &); - - strung remove(const strung &, const string_view &key); - strung remove(const strung &, const size_t &index); - - strung insert(const strung &, const member &); - - strung replace(const strung &, const member &); - strung replace(const strung &, const members &); -} diff --git a/ircd/json.cc b/ircd/json.cc index df07620f4..95e4b37f9 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -629,7 +629,7 @@ ircd::json::parser::throws_exceeded() // ircd::json::strung -ircd::json::replace(const strung &s, +ircd::json::replace(const object &s, const json::members &r) { static const auto in @@ -667,7 +667,7 @@ ircd::json::replace(const strung &s, } ircd::json::strung -ircd::json::replace(const strung &s, +ircd::json::replace(const object &s, const json::member &m_) { if(!empty(s) && type(s) != type::OBJECT) @@ -691,7 +691,7 @@ ircd::json::replace(const strung &s, } ircd::json::strung -ircd::json::insert(const strung &s, +ircd::json::insert(const object &s, const json::member &m) { if(!empty(s) && type(s) != type::OBJECT) @@ -714,7 +714,7 @@ ircd::json::insert(const strung &s, } ircd::json::strung -ircd::json::remove(const strung &s, +ircd::json::remove(const object &s, const string_view &key) { if(empty(s)) @@ -741,7 +741,7 @@ ircd::json::remove(const strung &s, } ircd::json::strung -ircd::json::remove(const strung &s, +ircd::json::remove(const object &s, const size_t &idx) { if(empty(s))