0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::json: Towards uniform defined().

This commit is contained in:
Jason Volk 2017-10-11 18:07:47 -07:00
parent 6ba6cb1e7f
commit 723cd3440b
2 changed files with 14 additions and 0 deletions

View file

@ -58,6 +58,7 @@ struct ircd::json::member
friend bool operator!=(const member &a, const string_view &b);
friend bool operator<(const member &a, const string_view &b);
friend bool defined(const member &);
friend size_t serialized(const member &);
friend string_view stringify(mutable_buffer &, const member &);
friend std::ostream &operator<<(std::ostream &, const member &);
@ -132,3 +133,9 @@ ircd::json::operator==(const member &a, const string_view &b)
{
return string_view{a.first.string, a.first.len} == b;
}
inline bool
ircd::json::defined(const member &a)
{
return defined(a.second);
}

View file

@ -129,6 +129,7 @@ struct ircd::json::value
friend bool operator>(const value &a, const value &b);
friend enum type type(const value &a);
friend bool defined(const value &);
friend size_t serialized(const value &);
friend string_view stringify(mutable_buffer &, const value &);
friend std::ostream &operator<<(std::ostream &, const value &);
@ -332,6 +333,12 @@ noexcept
return *this;
}
inline bool
ircd::json::defined(const value &a)
{
return !a.undefined();
}
inline enum ircd::json::type
ircd::json::type(const value &a)
{