0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-14 22:11:06 +01:00
construct/include/ircd/json/tool.h

44 lines
1.3 KiB
C++

// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2023 Jason Volk <jason@zemos.net>
//
// 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 members &);
strung insert(const object &, const member &);
strung replace(const object &, const members &);
strung replace(const object &, const member &);
}
inline ircd::json::strung
ircd::json::replace(const object &s,
const json::member &m)
{
return replace(s, json::members{m});
}
inline ircd::json::strung
ircd::json::insert(const object &s,
const json::member &m)
{
return insert(s, json::members{m});
}