0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::json: Remerge tool header with index header; use value argument.

This commit is contained in:
Jason Volk 2020-10-26 23:57:16 -07:00
parent 17ca084d45
commit ed5875c869
3 changed files with 17 additions and 31 deletions

View file

@ -39,8 +39,19 @@ namespace ircd::json
#include "strung.h" #include "strung.h"
#include "tuple/tuple.h" #include "tuple/tuple.h"
#include "stack.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 namespace ircd
{ {
using json::operator ""_; using json::operator ""_;

View file

@ -1,25 +0,0 @@
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2019 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
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 &);
}

View file

@ -629,7 +629,7 @@ ircd::json::parser::throws_exceeded()
// //
ircd::json::strung ircd::json::strung
ircd::json::replace(const strung &s, ircd::json::replace(const object &s,
const json::members &r) const json::members &r)
{ {
static const auto in static const auto in
@ -667,7 +667,7 @@ ircd::json::replace(const strung &s,
} }
ircd::json::strung ircd::json::strung
ircd::json::replace(const strung &s, ircd::json::replace(const object &s,
const json::member &m_) const json::member &m_)
{ {
if(!empty(s) && type(s) != type::OBJECT) if(!empty(s) && type(s) != type::OBJECT)
@ -691,7 +691,7 @@ ircd::json::replace(const strung &s,
} }
ircd::json::strung ircd::json::strung
ircd::json::insert(const strung &s, ircd::json::insert(const object &s,
const json::member &m) const json::member &m)
{ {
if(!empty(s) && type(s) != type::OBJECT) if(!empty(s) && type(s) != type::OBJECT)
@ -714,7 +714,7 @@ ircd::json::insert(const strung &s,
} }
ircd::json::strung ircd::json::strung
ircd::json::remove(const strung &s, ircd::json::remove(const object &s,
const string_view &key) const string_view &key)
{ {
if(empty(s)) if(empty(s))
@ -741,7 +741,7 @@ ircd::json::remove(const strung &s,
} }
ircd::json::strung ircd::json::strung
ircd::json::remove(const strung &s, ircd::json::remove(const object &s,
const size_t &idx) const size_t &idx)
{ {
if(empty(s)) if(empty(s))