0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-30 02:18:58 +01:00
construct/include/ircd/json/object_member.h
Jason Volk c4d041d1ae ircd::json: Inline object::const_iterator comparison suite.
ircd::json: Split object::const_iterator from object header.

ircd::json: Split object::member related from object header.
2020-04-03 11:02:49 -07:00

86 lines
2.5 KiB
C++

// 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 &);
bool sorted(const object::member *const &, const object::member *const &);
size_t serialized(const object::member *const &, const object::member *const &);
size_t serialized(const object::member &);
string_view stringify(mutable_buffer &, const object::member *const &, const object::member *const &);
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;
}