From a10992b8138876d6fed12feaa4774f5057825b2e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 18 Apr 2023 19:35:17 -0700 Subject: [PATCH] ircd::json: Split back into tool.h --- include/ircd/json/json.h | 15 +-------------- include/ircd/json/tool.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 include/ircd/json/tool.h diff --git a/include/ircd/json/json.h b/include/ircd/json/json.h index 0db52bcb4..df64e5bfc 100644 --- a/include/ircd/json/json.h +++ b/include/ircd/json/json.h @@ -39,20 +39,7 @@ namespace ircd::json #include "strung.h" #include "tuple/tuple.h" #include "stack/stack.h" - -// Convenience toolset for higher level operations. -namespace ircd::json -{ - strung append(const array &, const string_view &val); - strung prepend(const array &, const string_view &val); - - 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 &); -} +#include "tool.h" // Exports to ircd:: namespace ircd diff --git a/include/ircd/json/tool.h b/include/ircd/json/tool.h new file mode 100644 index 000000000..429b69cf8 --- /dev/null +++ b/include/ircd/json/tool.h @@ -0,0 +1,29 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2023 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 + +// Convenience toolset for higher level operations. +namespace ircd::json +{ + strung append(const array &, const string_view &val); + strung prepend(const array &, const string_view &val); + + 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 members &); + strung replace(const object &, const member &); +}