25#ifndef JOIN_DATA_JSON_HPP
26#define JOIN_DATA_JSON_HPP
43 "00010203040506070809"
44 "10111213141516171819"
45 "20212223242526272829"
46 "30313233343536373839"
47 "40414243444546474849"
48 "50515253545556575859"
49 "60616263646566676869"
50 "70717273747576777879"
51 "80818283848586878889"
52 "90919293949596979899"};
61 for (
int i = 0; i < 32; ++i)
82 void operator() (locale_t loc) noexcept
117 virtual const char*
name ()
const noexcept;
124 virtual std::string
message (
int code)
const;
160 , _indentation (indentation)
232 virtual int setInt (int32_t value)
override
288 memcpy (&bits, &value,
sizeof (bits));
289 const bool neg = (bits >> 63) != 0;
290 const uint64_t exp = (bits >> 52) & 0x7FFULL;
291 const uint64_t frac = bits & 0x000FFFFFFFFFFFFFULL;
327 virtual int setString (
const std::string& value)
override
331 if (writeEscaped (value) == -1)
345 virtual int startArray ([[maybe_unused]] uint32_t size = 0)
override
349 _tab.append (_indentation,
' ');
361 _tab.erase (_tab.size () - _indentation);
378 virtual int startObject ([[maybe_unused]] uint32_t size = 0)
override
382 _tab.append (_indentation,
' ');
404 if (writeEscaped (
key.getString ()) == -1)
421 _tab.erase (_tab.size () - _indentation);
440 if (value == std::numeric_limits<int32_t>::min ())
443 writeUint64 (
static_cast<uint64_t
> (std::numeric_limits<int32_t>::max ()) + 1);
450 writeUint64 (
static_cast<uint64_t
> (-value));
454 writeUint64 (
static_cast<uint64_t
> (value));
463 writeUint64 (
static_cast<uint64_t
> (value));
472 if (value == std::numeric_limits<int64_t>::min ())
475 writeUint64 (
static_cast<uint64_t
> (std::numeric_limits<int64_t>::max ()) + 1);
482 writeUint64 (
static_cast<uint64_t
> (-value));
486 writeUint64 (
static_cast<uint64_t
> (value));
502 char* ptr = buffer + 20;
506 uint64_t r = value % 100;
519 *--ptr =
'0' +
static_cast<char> (value);
522 size_t length = (buffer + 20) - ptr;
523 append (ptr, length);
534 append (buf, end - buf);
544 virtual int utf8Codepoint (std::string::const_iterator& cur, std::string::const_iterator& end,
547 uint8_t u0 =
static_cast<uint8_t
> (*cur);
559 uint8_t u1 =
static_cast<uint8_t
> (*cur);
562 codepoint = ((u0 & 0x1F) << 6) | (u1 & 0x3F);
563 if (codepoint < 0x80)
575 uint8_t u2 =
static_cast<uint8_t
> (*cur);
578 codepoint = ((u0 & 0x0F) << 12) | ((u1 & 0x3F) << 6) | (u2 & 0x3F);
579 if ((codepoint > 0xD7FF) && (codepoint < 0xE000))
583 if (codepoint < 0x800)
595 uint8_t u3 =
static_cast<uint8_t
> (*cur);
598 codepoint = ((u0 & 0x07) << 18) | ((u1 & 0x3F) << 12) | ((u2 & 0x3F) << 6) | (u3 & 0x3F);
599 if (codepoint < 0x10000)
616 auto cur = value.cbegin ();
617 auto end = value.cend ();
630 append (&(*beg), cur - beg);
638 uint8_t ch =
static_cast<uint8_t
> (*cur);
642 uint32_t codepoint = 0;
645 if (utf8Codepoint (cur, end, codepoint) == -1)
651 if (codepoint <= 0xFFFF)
654 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (codepoint));
659 codepoint -= 0x10000;
661 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (0xD800 + ((codepoint >> 10) & 0x3FF)));
664 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (0xDC00 + (codepoint & 0x3FF)));
670 char escapeSeq[2] = {
'\\',
static_cast<char> (esc)};
685 if (!_stack.empty () && !_first)
698 append (_tab.c_str (), _tab.size ());
730 if (!_stack.empty () && _stack.top ())
804 if (std::isfinite (value))
806 if ((std::trunc (value) == value) && (value >= 0) &&
807 (value <
static_cast<double> (std::numeric_limits<uint64_t>::max ())))
811 else if ((std::trunc (value) == value) &&
812 (value >=
static_cast<double> (std::numeric_limits<int64_t>::min ())) &&
813 (value <
static_cast<double> (std::numeric_limits<int64_t>::max ())))
839 std::vector<const Member*> members;
840 std::transform (
object.begin (),
object.end (), std::back_inserter (members), [] (
const Member& member) {
843 std::sort (members.begin (), members.end (), [] (
const Member* a,
const Member* b) {
844 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> cvt_utf8_utf16;
845 std::u16string wa = cvt_utf8_utf16.from_bytes (a->first.getString ().data ());
846 std::u16string wb = cvt_utf8_utf16.from_bytes (b->first.getString ().data ());
849 for (
auto const& member : members)
866 for (
char* pos = beg; pos < end; ++pos)
869 if ((*pos ==
'e') && (*(pos + 1) !=
'-'))
896 return JsonReadMode (
static_cast<int> (a) &
static_cast<int> (b));
907 return JsonReadMode (
static_cast<int> (a) |
static_cast<int> (b));
984 template <JsonReadMode ReadMode = JsonReadMode::None>
1008 template <JsonReadMode ReadMode = JsonReadMode::None>
1031 template <JsonReadMode ReadMode = JsonReadMode::None>
1034 StringView in (document.c_str (), document.size ());
1053 template <JsonReadMode ReadMode = JsonReadMode::None>
1075 template <JsonReadMode ReadMode = JsonReadMode::None>
1097 template <JsonReadMode ReadMode = JsonReadMode::None>
1119 template <JsonReadMode ReadMode = JsonReadMode::None>
1141 template <JsonReadMode ReadMode = JsonReadMode::None>
1163 template <JsonReadMode ReadMode = JsonReadMode::None>
1186 template <JsonReadMode ReadMode,
typename ViewType>
1209 if (document.peek () != std::char_traits<char>::eof ())
1223 template <JsonReadMode ReadMode,
typename ViewType>
1226 int ch = document.peek ();
1257 template <
typename ViewType>
1260 if (
JOIN_UNLIKELY ((document.get () !=
'u') || (document.get () !=
'l') || (document.get () !=
'l')))
1274 template <
typename ViewType>
1277 if (
JOIN_UNLIKELY ((document.get () !=
'r') || (document.get () !=
'u') || (document.get () !=
'e')))
1291 template <
typename ViewType>
1294 if (
JOIN_UNLIKELY ((document.get () !=
'a') || (document.get () !=
'l') || (document.get () !=
's') ||
1295 (document.get () !=
'e')))
1309 template <
typename ViewType>
1312 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'n') && document.getIfNoCase (
'f'))))
1319 !(document.getIfNoCase (
'n') && document.getIfNoCase (
'i') &&
1320 document.getIfNoCase (
't') && document.getIfNoCase (
'y'))))
1326 return setDouble (negative ? -std::numeric_limits<double>::infinity ()
1327 : std::numeric_limits<double>::infinity ());
1335 template <
typename ViewType>
1338 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'a') && document.getIfNoCase (
'n'))))
1344 return setDouble (negative ? -std::numeric_limits<double>::quiet_NaN ()
1345 : std::numeric_limits<double>::quiet_NaN ());
1357 inline void umul192 (uint64_t hi, uint64_t lo, uint64_t significand, uint64_t& high, uint64_t& middle,
1358 uint64_t& low)
noexcept
1360#if defined(__SIZEOF_INT128__)
1361 __uint128_t h =
static_cast<__uint128_t
> (hi) * significand;
1362 __uint128_t l =
static_cast<__uint128_t
> (lo) * significand;
1363 __uint128_t s = h + (l >> 64);
1365 high =
static_cast<uint64_t
> (s >> 64);
1366 middle =
static_cast<uint64_t
> (s);
1367 low =
static_cast<uint64_t
> (l);
1369 uint64_t hi_hi, hi_lo, lo_hi, lo_lo;
1371 uint64_t m_lo =
static_cast<uint32_t
> (significand);
1372 uint64_t m_hi = significand >> 32;
1373 uint64_t p0 = (hi & 0xFFFFFFFF) * m_lo;
1374 uint64_t p1 = (hi >> 32) * m_lo;
1375 uint64_t p2 = (hi & 0xFFFFFFFF) * m_hi;
1376 uint64_t p3 = (hi >> 32) * m_hi;
1377 uint64_t carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1378 hi_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1379 hi_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1381 p0 = (lo & 0xFFFFFFFF) * m_lo;
1382 p1 = (lo >> 32) * m_lo;
1383 p2 = (lo & 0xFFFFFFFF) * m_hi;
1384 p3 = (lo >> 32) * m_hi;
1385 carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1386 lo_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1387 lo_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1390 middle = hi_lo + lo_hi;
1391 high = hi_hi + (middle < hi_lo ? 1 : 0);
1402 inline bool strtodFast (uint64_t significand, int64_t exponent,
double& value)
1404 constexpr double pow10[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11,
1405 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22};
1407 value =
static_cast<double> (significand);
1409 if (
JOIN_UNLIKELY ((exponent > 22) && (exponent < (22 + 16))))
1411 value *= pow10[exponent - 22];
1415 if (
JOIN_LIKELY ((exponent >= -22) && (exponent <= 22) && (value <= 9007199254740991.0)))
1417 value = (exponent < 0) ? (value / pow10[-exponent]) : (value * pow10[exponent]);
1431 uint64_t high, middle, low;
1433 umul192 (power.
hi, power.
lo, significand, high, middle, low);
1434 int64_t exp = ((exponent * 217706) >> 16) + 1087;
1439 lz = __builtin_clzll (high);
1442 else if (middle != 0)
1444 lz = __builtin_clzll (middle);
1459 high = middle << lz;
1464 high = (high << lz) | (middle >> (64 - lz));
1468 middle |= (low != 0);
1470 uint64_t mant = (high >> 11) & 0xFFFFFFFFFFFFF;
1471 uint64_t bits = (
static_cast<uint64_t
> (exp) << 52) | mant;
1472 uint64_t frac = high & 0x7FF;
1474 bool roundUp = ((frac > 0x400) | ((frac == 0x400) && ((middle != 0) || (mant & 1))) |
1475 ((frac == 0x3FF) && ((middle != 0))));
1478 std::memcpy (&value, &bits,
sizeof (
double));
1491 static LocalePtr locale (newlocale (LC_ALL_MASK,
"C",
nullptr));
1492 char* end =
nullptr;
1493 d = strtod_l (num.c_str (), &end, locale.get ());
1494 return (end && (*end ==
'\0'));
1502 template <
typename ViewType>
1507 bool negative = view.getIf (
'-');
1509 uint64_t max64 = std::numeric_limits<uint64_t>::max ();
1512 max64 =
static_cast<uint64_t
> (std::numeric_limits<int64_t>::max ()) + 1;
1515 uint64_t digits = 0;
1516 bool isDouble =
false;
1529 u = view.get () -
'0';
1534 int digit = view.peek () -
'0';
1542 u = (u * 10) + (view.get () -
'0');
1546 else if (
JOIN_LIKELY (document.getIfNoCase (
'i')))
1548 return readInf (document, negative);
1550 else if (
JOIN_LIKELY (document.getIfNoCase (
'n')))
1552 return readNan (document, negative);
1564 u = (u * 10) + (view.get () -
'0');
1570 if (view.getIf (
'.'))
1576 u = (u * 10) + (view.get () -
'0');
1585 int64_t exponent = 0;
1586 if (view.getIf (
'e') || view.getIf (
'E'))
1590 bool negExp =
false;
1591 if (
isSign (view.peek ()))
1593 negExp = (view.get () ==
'-');
1598 exponent = (view.get () -
'0');
1602 int digit = view.get () -
'0';
1604 if (
JOIN_LIKELY (exponent <= ((std::numeric_limits<int>::max () - digit) / 10)))
1606 exponent = (exponent * 10) + digit;
1618 exponent = -exponent;
1637 view.snapshot (number);
1655 template <
typename ViewType>
1656 inline int readHex (ViewType& document, uint32_t& u)
1658 for (
int i = 0; i < 4; ++i)
1660 char c = document.get ();
1693 if (codepoint < 0x80)
1695 output.push_back (
static_cast<char> (codepoint));
1697 else if (codepoint < 0x800)
1700 buf[0] =
static_cast<char> (0xC0 | (codepoint >> 6));
1701 buf[1] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1702 output.append (buf, 2);
1704 else if (codepoint < 0x10000)
1707 buf[0] =
static_cast<char> (0xE0 | (codepoint >> 12));
1708 buf[1] =
static_cast<char> (0x80 | ((codepoint >> 6) & 0x3F));
1709 buf[2] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1710 output.append (buf, 3);
1715 buf[0] =
static_cast<char> (0xF0 | (codepoint >> 18));
1716 buf[1] =
static_cast<char> (0x80 | ((codepoint >> 12) & 0x3F));
1717 buf[2] =
static_cast<char> (0x80 | ((codepoint >> 6) & 0x3F));
1718 buf[3] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1719 output.append (buf, 4);
1729 template <
typename ViewType>
1734 if (
readHex (document, u) == -1)
1739 if (u >= 0xDC00 && u <= 0xDFFF)
1745 if (u >= 0xD800 && u <= 0xDBFF)
1747 if ((document.get () !=
'\\') || (document.get () !=
'u'))
1755 if (
readHex (document, v) == -1)
1761 if (v < 0xDC00 || v > 0xDFFF)
1767 u = 0x10000 + (((u - 0xD800) << 10) | (v - 0xDC00));
1787 template <
typename ViewType>
1790 int ch = document.get ();
1794 output.push_back (
'"');
1797 output.push_back (
'\\');
1800 output.push_back (
'/');
1803 output.push_back (
'\b');
1806 output.push_back (
'\f');
1809 output.push_back (
'\n');
1812 output.push_back (
'\r');
1815 output.push_back (
'\t');
1883 template <
typename ViewType>
1888 output.reserve (64);
1892 document.readUntilEscaped (output.getString ());
1893 int ch = document.peek ();
1904 if (
readEscaped (document, output.getString ()) == -1)
1935 template <JsonReadMode ReadMode,
typename ViewType>
1948 if (document.getIf (
']'))
1960 int ch = document.get ();
1968 ch = document.get ();
1997 template <JsonReadMode ReadMode,
typename ViewType>
2010 if (document.getIf (
'}'))
2028 if (document.peek () !=
':')
2052 int ch = document.get ();
2060 ch = document.get ();
2089 template <JsonReadMode ReadMode,
typename ViewType>
2093 return document.skipWhitespaces ();
2101 template <JsonReadMode ReadMode,
typename ViewType>
2105 return document.skipWhitespacesAndComments ();
2115 return static_cast<unsigned char> (c -
'A') <= 5u;
2125 return static_cast<unsigned char> (c -
'a') <= 5u;
2135 return static_cast<unsigned char> (c -
'0') <= 9u;
2145 return ((c ^
'+') & (c ^
'-')) == 0;
2154 struct is_error_condition_enum<
join::JsonErrc> :
public true_type
basic stream view.
Definition view.hpp:373
buffering view adapter
Definition view.hpp:646
JSON canonicalizer class.
Definition json.hpp:754
virtual void writeDouble(double value) noexcept override
write real value.
Definition json.hpp:862
JsonCanonicalizer(std::ostream &document)
create instance.
Definition json.hpp:760
JsonCanonicalizer & operator=(const JsonCanonicalizer &other)=delete
copy assignment.
JsonCanonicalizer(JsonCanonicalizer &&other)=delete
move constructor.
JsonCanonicalizer(const JsonCanonicalizer &other)=delete
copy constructor.
virtual int setObject(const Object &object) override
set object value.
Definition json.hpp:836
virtual ~JsonCanonicalizer()=default
destroy instance.
virtual int setDouble(double value) override
set real value.
Definition json.hpp:801
JSON error category.
Definition json.hpp:111
virtual std::string message(int code) const
translate JSON error code to human readable error string.
Definition json.cpp:44
virtual const char * name() const noexcept
get JSON error category name.
Definition json.cpp:35
JSON reader class.
Definition json.hpp:936
bool strtodSlow(const std::string &num, double &d)
convert double using strtod.
Definition json.hpp:1489
constexpr bool isSign(char c) noexcept
check if sign.
Definition json.hpp:2143
JsonReader(const JsonReader &other)=delete
copy constructor.
int readValue(ViewType &document)
parse a JSON value.
Definition json.hpp:1224
int deserialize(std::istringstream &document) override
deserialize a document.
Definition json.hpp:1087
constexpr bool isUpperAlpha(char c) noexcept
check if upper case alphanumeric character.
Definition json.hpp:2113
int deserialize(const char *first, const char *last) override
deserialize a document.
Definition json.hpp:1021
int readInf(ViewType &document, bool negative)
parse an infinity value.
Definition json.hpp:1310
int deserialize(const char *document, size_t length)
deserialize a document.
Definition json.hpp:985
int readUnicode(ViewType &document, std::string &output)
parse unicode.
Definition json.hpp:1730
int deserialize(std::stringstream &document) override
deserialize a document.
Definition json.hpp:1065
int readHex(ViewType &document, uint32_t &u)
parse a 4-digit hexadecimal sequence..
Definition json.hpp:1656
int readEscaped(ViewType &document, std::string &output)
parse escaped sequence.
Definition json.hpp:1788
int deserialize(const char *document, size_t length) override
deserialize a document.
Definition json.hpp:997
int readString(ViewType &document, bool isKey=false)
parse UTF8.
Definition json.hpp:1884
std::enable_if<!(ReadMode &JsonReadMode::ParseComments), int >::type skipWhitespaces(ViewType &document)
skip whitespaces.
Definition json.hpp:2090
int deserialize(const char *first, const char *last)
deserialize a document.
Definition json.hpp:1009
JsonReader(JsonReader &&other)=delete
move constructor.
int readObject(ViewType &document)
parse an object value.
Definition json.hpp:1998
virtual ~JsonReader()=default
destroy instance.
void umul192(uint64_t hi, uint64_t lo, uint64_t significand, uint64_t &high, uint64_t &middle, uint64_t &low) noexcept
multiply 192 bits unsigned integer by 64 bits unsigned integer.
Definition json.hpp:1357
int read(ViewType &document)
parse a document.
Definition json.hpp:1187
int deserialize(std::iostream &document)
deserialize a document.
Definition json.hpp:1142
int deserialize(std::fstream &document)
deserialize a document.
Definition json.hpp:1098
int readNan(ViewType &document, bool negative)
parse a nan value.
Definition json.hpp:1336
void encodeUtf8(uint32_t codepoint, std::string &output)
encode a Unicode codepoint to UTF-8.
Definition json.hpp:1691
JsonReader & operator=(const JsonReader &other)=delete
copy assignment.
int readNull(ViewType &document)
parse a null value.
Definition json.hpp:1258
int deserialize(std::istream &document) override
deserialize a document.
Definition json.hpp:1175
int deserialize(const std::string &document) override
deserialize a document.
Definition json.hpp:1043
int deserialize(std::ifstream &document) override
deserialize a document.
Definition json.hpp:1131
constexpr bool isLowerAlpha(char c) noexcept
check if lower case alphanumeric character.
Definition json.hpp:2123
int deserialize(std::iostream &document) override
deserialize a document.
Definition json.hpp:1153
constexpr bool isDigit(char c) noexcept
check if digit.
Definition json.hpp:2133
int deserialize(const std::string &document)
deserialize a document.
Definition json.hpp:1032
JsonReader(Value &root)
default constructor.
Definition json.hpp:942
int deserialize(std::istringstream &document)
deserialize a document.
Definition json.hpp:1076
int readNumber(ViewType &document)
parse a number value.
Definition json.hpp:1503
int readArray(ViewType &document)
parse an array value.
Definition json.hpp:1936
int deserialize(std::istream &document)
deserialize a document.
Definition json.hpp:1164
int deserialize(std::fstream &document) override
deserialize a document.
Definition json.hpp:1109
int readFalse(ViewType &document)
parse a false value.
Definition json.hpp:1292
int readTrue(ViewType &document)
parse a true value.
Definition json.hpp:1275
int deserialize(std::ifstream &document)
deserialize a document.
Definition json.hpp:1120
int deserialize(std::stringstream &document)
deserialize a document.
Definition json.hpp:1054
bool strtodFast(uint64_t significand, int64_t exponent, double &value)
convert double using fast path.
Definition json.hpp:1402
JSON writer class.
Definition json.hpp:151
std::string _tab
tabulation.
Definition json.hpp:744
virtual void writeUint(uint32_t value)
write unsigned integer value.
Definition json.hpp:461
void indent() noexcept
write indentation.
Definition json.hpp:694
size_t _indentation
indentation.
Definition json.hpp:741
virtual int utf8Codepoint(std::string::const_iterator &cur, std::string::const_iterator &end, uint32_t &codepoint)
get UTF8 codepoint.
Definition json.hpp:544
virtual int setInt(int32_t value) override
set integer value.
Definition json.hpp:232
virtual int setInt64(int64_t value) override
set 64 bits integer value.
Definition json.hpp:258
virtual void writeDouble(double value)
write real value.
Definition json.hpp:530
JsonWriter(std::ostream &document, size_t indentation=0)
create instance.
Definition json.hpp:158
virtual int stopArray() override
stop array.
Definition json.hpp:359
virtual ~JsonWriter()=default
destroy instance.
virtual int startArray(uint32_t size=0) override
start array.
Definition json.hpp:345
virtual void writeInt(int32_t value)
write integer value.
Definition json.hpp:438
void comma() noexcept
write comma.
Definition json.hpp:683
virtual int stopObject() override
stop object.
Definition json.hpp:419
virtual void writeUint64(uint64_t value)
write 64 bits unsigned integer value.
Definition json.hpp:493
void array() noexcept
add comma, go to line and indent if in array.
Definition json.hpp:727
virtual int setUint(uint32_t value) override
set unsigned integer value.
Definition json.hpp:245
virtual void writeInt64(int64_t value)
write 64 bits integer value.
Definition json.hpp:470
virtual int writeEscaped(const std::string &value)
escape string value.
Definition json.hpp:614
virtual int setDouble(double value) override
set real value.
Definition json.hpp:284
virtual int setKey(const Value &key) override
set key.
Definition json.hpp:393
virtual int startObject(uint32_t size=0) override
start object.
Definition json.hpp:378
std::stack< bool > _stack
array stack.
Definition json.hpp:738
virtual int setNull() override
set null value.
Definition json.hpp:199
JsonWriter(const JsonWriter &other)=delete
copy constructor.
JsonWriter(JsonWriter &&other)=delete
move constructor.
virtual int setUint64(uint64_t value) override
set unsigned 64 bits integer value.
Definition json.hpp:271
virtual int setString(const std::string &value) override
set string value.
Definition json.hpp:327
void space() noexcept
write space.
Definition json.hpp:705
bool _first
is first element.
Definition json.hpp:747
void endLine() noexcept
write end of line.
Definition json.hpp:716
virtual int setBool(bool value) override
set boolean value.
Definition json.hpp:212
stream deserializer abstract class.
Definition sax.hpp:462
virtual int stopObject() override
stop object.
Definition sax.hpp:753
virtual int startArray(uint32_t size=0) override
start array.
Definition sax.hpp:655
virtual int setInt64(int64_t value) override
set 64 bits integer value.
Definition sax.hpp:615
virtual int setNull() override
set null value.
Definition sax.hpp:575
virtual int setUint64(uint64_t value) override
set unsigned 64 bits integer value.
Definition sax.hpp:625
virtual int setKey(const Value &key) override
set key.
Definition sax.hpp:743
virtual int startObject(uint32_t size=0) override
start object.
Definition sax.hpp:706
virtual int setBool(bool value) override
set boolean value.
Definition sax.hpp:585
virtual int stopArray() override
stop array.
Definition sax.hpp:691
virtual int setDouble(double value) override
set real value.
Definition sax.hpp:635
virtual int setString(const std::string &value) override
set string value.
Definition sax.hpp:645
stream serializer abstract class.
Definition sax.hpp:244
int setValue(const Value &value)
set value.
Definition sax.hpp:301
void append(char data) noexcept
append character to output stream in batch.
Definition sax.hpp:392
void append4(const char *data) noexcept
append 4-character literal to output stream in batch.
Definition sax.hpp:422
string view.
Definition view.hpp:83
value class.
Definition value.hpp:64
void clear()
erases all elements in the nested container.
Definition value.hpp:1187
const std::string key(65, 'a')
key.
constexpr UnescapedTable unescapedLookup
Definition json.hpp:75
constexpr char digitPairs[201]
Definition json.hpp:42
constexpr WhitespaceTable whitespaceLookup
Definition view.hpp:76
constexpr Power atodpow[]
Definition atodpow.hpp:40
Definition acceptor.hpp:32
constexpr const JsonReadMode & operator&=(JsonReadMode &a, JsonReadMode b) noexcept
perform binary AND on JsonReadMode.
Definition json.hpp:916
IpAddress operator&(const IpAddress &a, const IpAddress &b)
perform AND operation on IP address.
Definition ipaddress.cpp:1665
char * dtoa(char *buffer, double value) noexcept
double to string conversion.
Definition dtoa.hpp:216
const std::error_category & jsonCategory() noexcept
get error category.
Definition json.cpp:77
std::pair< Value, Value > Member
object member.
Definition value.hpp:54
constexpr const JsonReadMode & operator|=(JsonReadMode &a, JsonReadMode b) noexcept
perform binary OR on JsonReadMode.
Definition json.hpp:927
JsonReadMode
JSON deserialization mode.
Definition json.hpp:881
@ StopParsingOnDone
Definition json.hpp:885
@ ParseComments
Definition json.hpp:883
@ ValidateEncoding
Definition json.hpp:884
@ None
Definition json.hpp:882
std::error_code make_error_code(join::Errc code) noexcept
Create an std::error_code object.
Definition error.cpp:150
IpAddress operator|(const IpAddress &a, const IpAddress &b)
perform OR operation on IP address.
Definition ipaddress.cpp:1692
thread_local std::error_code lastError
last error.
Definition error.cpp:32
std::vector< Member > Object
object.
Definition value.hpp:57
std::error_condition make_error_condition(join::Errc code) noexcept
Create an std::error_condition object.
Definition error.cpp:159
std::unique_ptr< std::remove_pointer_t< locale_t >, LocaleDelete > LocalePtr
Definition json.hpp:88
JsonErrc
JSON error codes.
Definition json.hpp:94
constexpr LocaleDelete() noexcept=default
Definition atodpow.hpp:35
uint64_t hi
Definition atodpow.hpp:36
uint64_t lo
Definition atodpow.hpp:37
uint8_t data[256]
Definition json.hpp:56
constexpr UnescapedTable()
Definition json.hpp:58
disambiguation tag to indicate that the contained object should be constructed in-place.
Definition traits.hpp:57
#define JOIN_LIKELY(x)
Definition utils.hpp:46
#define JOIN_UNLIKELY(x)
Definition utils.hpp:47