0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd::json: Add specific extern undefined number.

This commit is contained in:
Jason Volk 2018-05-19 22:10:58 -07:00
parent df348bccaf
commit 208a0198c0
3 changed files with 9 additions and 2 deletions

View file

@ -133,7 +133,7 @@ ircd::db::_assign_invalid(tuple &t,
if(is_integer)
{
json::set(t, cell.col(), 0L);
json::set(t, cell.col(), json::undefined_number);
return;
}
}

View file

@ -28,6 +28,7 @@ namespace ircd::json
extern const string_view empty_string;
extern const string_view empty_object;
extern const string_view empty_array;
extern const int64_t undefined_number;
size_t serialized(const string_view &);
string_view stringify(mutable_buffer &, const string_view &);

View file

@ -1733,6 +1733,12 @@ const ircd::string_view ircd::json::empty_string { "\"\"" };
const ircd::string_view ircd::json::empty_object { "{}" };
const ircd::string_view ircd::json::empty_array { "[]" };
decltype(ircd::json::undefined_number)
ircd::json::undefined_number
{
std::numeric_limits<decltype(ircd::json::undefined_number)>::max()
};
std::ostream &
ircd::json::operator<<(std::ostream &s, const value &v)
{
@ -2411,7 +2417,7 @@ const
switch(type)
{
case NUMBER:
return integer == std::numeric_limits<decltype(integer)>::max();
return integer == undefined_number;
case STRING:
return string_view{string, len}.undefined();