2020-04-03 19:27:02 +02:00
|
|
|
// The Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) The Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2020 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_OBJECT_MEMBER_H
|
|
|
|
|
|
|
|
namespace ircd::json
|
|
|
|
{
|
|
|
|
bool operator==(const object::member &, const object::member &);
|
|
|
|
bool operator!=(const object::member &, const object::member &);
|
|
|
|
bool operator<=(const object::member &, const object::member &);
|
|
|
|
bool operator>=(const object::member &, const object::member &);
|
|
|
|
bool operator<(const object::member &, const object::member &);
|
|
|
|
bool operator>(const object::member &, const object::member &);
|
|
|
|
|
2023-02-12 05:39:48 +01:00
|
|
|
bool sorted(const object::member *, const object::member *);
|
|
|
|
size_t serialized(const object::member *, const object::member *);
|
2020-04-03 19:27:02 +02:00
|
|
|
size_t serialized(const object::member &);
|
2023-02-12 05:39:48 +01:00
|
|
|
string_view stringify(mutable_buffer &, const object::member *, const object::member *);
|
2020-04-03 19:27:02 +02:00
|
|
|
string_view stringify(mutable_buffer &, const object::member &);
|
|
|
|
std::ostream &operator<<(std::ostream &, const object::member &);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ircd::json::object::member
|
|
|
|
:std::pair<string_view, string_view>
|
|
|
|
{
|
|
|
|
member(const string_view &first = {}, const string_view &second = {});
|
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
ircd::json::object::member::member(const string_view &first,
|
|
|
|
const string_view &second)
|
|
|
|
:std::pair<string_view, string_view>
|
|
|
|
{
|
|
|
|
first, second
|
|
|
|
}
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator==(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first == b.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator!=(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first != b.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator<=(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first <= b.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator>=(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first >= b.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator<(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first < b.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::json::operator>(const object::member &a,
|
|
|
|
const object::member &b)
|
|
|
|
{
|
|
|
|
return a.first > b.first;
|
|
|
|
}
|