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)
65 data[
static_cast<unsigned char> (
'\b')] =
'b';
66 data[
static_cast<unsigned char> (
'\t')] =
't';
67 data[
static_cast<unsigned char> (
'\n')] =
'n';
68 data[
static_cast<unsigned char> (
'\f')] =
'f';
69 data[
static_cast<unsigned char> (
'\r')] =
'r';
70 data[
static_cast<unsigned char> (
'"')] =
'"';
71 data[
static_cast<unsigned char> (
'\\')] =
'\\';
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#pragma GCC diagnostic push
845#pragma GCC diagnostic ignored
"-Wdeprecated-declarations"
846 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> cvt_utf8_utf16;
847#pragma GCC diagnostic pop
848 std::u16string wa = cvt_utf8_utf16.from_bytes (a->first.getString ().data ());
849 std::u16string wb = cvt_utf8_utf16.from_bytes (b->first.getString ().data ());
852 for (
auto const& member : members)
869 for (
char* pos = beg; pos < end; ++pos)
872 if ((*pos ==
'e') && (*(pos + 1) !=
'-'))
899 return JsonReadMode (
static_cast<int> (a) &
static_cast<int> (b));
910 return JsonReadMode (
static_cast<int> (a) |
static_cast<int> (b));
987 template <JsonReadMode ReadMode = JsonReadMode::None>
1011 template <JsonReadMode ReadMode = JsonReadMode::None>
1034 template <JsonReadMode ReadMode = JsonReadMode::None>
1037 StringView in (document.c_str (), document.size ());
1056 template <JsonReadMode ReadMode = JsonReadMode::None>
1078 template <JsonReadMode ReadMode = JsonReadMode::None>
1100 template <JsonReadMode ReadMode = JsonReadMode::None>
1122 template <JsonReadMode ReadMode = JsonReadMode::None>
1144 template <JsonReadMode ReadMode = JsonReadMode::None>
1166 template <JsonReadMode ReadMode = JsonReadMode::None>
1189 template <JsonReadMode ReadMode,
typename ViewType>
1212 if (document.peek () != std::char_traits<char>::eof ())
1226 template <JsonReadMode ReadMode,
typename ViewType>
1229 int ch = document.peek ();
1260 template <
typename ViewType>
1263 if (
JOIN_UNLIKELY ((document.get () !=
'u') || (document.get () !=
'l') || (document.get () !=
'l')))
1277 template <
typename ViewType>
1280 if (
JOIN_UNLIKELY ((document.get () !=
'r') || (document.get () !=
'u') || (document.get () !=
'e')))
1294 template <
typename ViewType>
1297 if (
JOIN_UNLIKELY ((document.get () !=
'a') || (document.get () !=
'l') || (document.get () !=
's') ||
1298 (document.get () !=
'e')))
1312 template <
typename ViewType>
1315 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'n') && document.getIfNoCase (
'f'))))
1322 !(document.getIfNoCase (
'n') && document.getIfNoCase (
'i') &&
1323 document.getIfNoCase (
't') && document.getIfNoCase (
'y'))))
1329 return setDouble (negative ? -std::numeric_limits<double>::infinity ()
1330 : std::numeric_limits<double>::infinity ());
1338 template <
typename ViewType>
1341 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'a') && document.getIfNoCase (
'n'))))
1347 return setDouble (negative ? -std::numeric_limits<double>::quiet_NaN ()
1348 : std::numeric_limits<double>::quiet_NaN ());
1360 inline void umul192 (uint64_t hi, uint64_t lo, uint64_t significand, uint64_t& high, uint64_t& middle,
1361 uint64_t& low)
noexcept
1363#if defined(__SIZEOF_INT128__)
1364 __uint128_t h =
static_cast<__uint128_t
> (hi) * significand;
1365 __uint128_t l =
static_cast<__uint128_t
> (lo) * significand;
1366 __uint128_t s = h + (l >> 64);
1368 high =
static_cast<uint64_t
> (s >> 64);
1369 middle =
static_cast<uint64_t
> (s);
1370 low =
static_cast<uint64_t
> (l);
1372 uint64_t hi_hi, hi_lo, lo_hi, lo_lo;
1374 uint64_t m_lo =
static_cast<uint32_t
> (significand);
1375 uint64_t m_hi = significand >> 32;
1376 uint64_t p0 = (hi & 0xFFFFFFFF) * m_lo;
1377 uint64_t p1 = (hi >> 32) * m_lo;
1378 uint64_t p2 = (hi & 0xFFFFFFFF) * m_hi;
1379 uint64_t p3 = (hi >> 32) * m_hi;
1380 uint64_t carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1381 hi_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1382 hi_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1384 p0 = (lo & 0xFFFFFFFF) * m_lo;
1385 p1 = (lo >> 32) * m_lo;
1386 p2 = (lo & 0xFFFFFFFF) * m_hi;
1387 p3 = (lo >> 32) * m_hi;
1388 carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1389 lo_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1390 lo_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1393 middle = hi_lo + lo_hi;
1394 high = hi_hi + (middle < hi_lo ? 1 : 0);
1405 inline bool strtodFast (uint64_t significand, int64_t exponent,
double& value)
1407 constexpr double pow10[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11,
1408 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22};
1410 value =
static_cast<double> (significand);
1412 if (
JOIN_UNLIKELY ((exponent > 22) && (exponent < (22 + 16))))
1414 value *= pow10[exponent - 22];
1418 if (
JOIN_LIKELY ((exponent >= -22) && (exponent <= 22) && (value <= 9007199254740991.0)))
1420 value = (exponent < 0) ? (value / pow10[-exponent]) : (value * pow10[exponent]);
1434 uint64_t high, middle, low;
1436 umul192 (power.
hi, power.
lo, significand, high, middle, low);
1437 int64_t exp = ((exponent * 217706) >> 16) + 1087;
1442 lz = __builtin_clzll (high);
1445 else if (middle != 0)
1447 lz = __builtin_clzll (middle);
1462 high = middle << lz;
1467 high = (high << lz) | (middle >> (64 - lz));
1471 middle |= (low != 0);
1473 uint64_t mant = (high >> 11) & 0xFFFFFFFFFFFFF;
1474 uint64_t bits = (
static_cast<uint64_t
> (exp) << 52) | mant;
1475 uint64_t frac = high & 0x7FF;
1477 bool roundUp = ((frac > 0x400) | ((frac == 0x400) && ((middle != 0) || (mant & 1))) |
1478 ((frac == 0x3FF) && ((middle != 0))));
1481 std::memcpy (&value, &bits,
sizeof (
double));
1494 static LocalePtr locale (newlocale (LC_ALL_MASK,
"C",
nullptr));
1495 char* end =
nullptr;
1496 d = strtod_l (num.c_str (), &end, locale.get ());
1497 return (end && (*end ==
'\0'));
1505 template <
typename ViewType>
1510 bool negative = view.getIf (
'-');
1512 uint64_t max64 = std::numeric_limits<uint64_t>::max ();
1515 max64 =
static_cast<uint64_t
> (std::numeric_limits<int64_t>::max ()) + 1;
1518 uint64_t digits = 0;
1519 bool isDouble =
false;
1532 u = view.get () -
'0';
1537 int digit = view.peek () -
'0';
1545 u = (u * 10) + (view.get () -
'0');
1549 else if (
JOIN_LIKELY (document.getIfNoCase (
'i')))
1551 return readInf (document, negative);
1553 else if (
JOIN_LIKELY (document.getIfNoCase (
'n')))
1555 return readNan (document, negative);
1567 u = (u * 10) + (view.get () -
'0');
1573 if (view.getIf (
'.'))
1579 u = (u * 10) + (view.get () -
'0');
1588 int64_t exponent = 0;
1589 if (view.getIf (
'e') || view.getIf (
'E'))
1593 bool negExp =
false;
1594 if (
isSign (view.peek ()))
1596 negExp = (view.get () ==
'-');
1601 exponent = (view.get () -
'0');
1605 int digit = view.get () -
'0';
1607 if (
JOIN_LIKELY (exponent <= ((std::numeric_limits<int>::max () - digit) / 10)))
1609 exponent = (exponent * 10) + digit;
1621 exponent = -exponent;
1640 view.snapshot (number);
1658 template <
typename ViewType>
1659 inline int readHex (ViewType& document, uint32_t& u)
1661 for (
int i = 0; i < 4; ++i)
1663 char c = document.get ();
1696 if (codepoint < 0x80)
1698 output.push_back (
static_cast<char> (codepoint));
1700 else if (codepoint < 0x800)
1703 buf[0] =
static_cast<char> (0xC0 | (codepoint >> 6));
1704 buf[1] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1705 output.append (buf, 2);
1707 else if (codepoint < 0x10000)
1710 buf[0] =
static_cast<char> (0xE0 | (codepoint >> 12));
1711 buf[1] =
static_cast<char> (0x80 | ((codepoint >> 6) & 0x3F));
1712 buf[2] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1713 output.append (buf, 3);
1718 buf[0] =
static_cast<char> (0xF0 | (codepoint >> 18));
1719 buf[1] =
static_cast<char> (0x80 | ((codepoint >> 12) & 0x3F));
1720 buf[2] =
static_cast<char> (0x80 | ((codepoint >> 6) & 0x3F));
1721 buf[3] =
static_cast<char> (0x80 | (codepoint & 0x3F));
1722 output.append (buf, 4);
1732 template <
typename ViewType>
1737 if (
readHex (document, u) == -1)
1742 if (u >= 0xDC00 && u <= 0xDFFF)
1748 if (u >= 0xD800 && u <= 0xDBFF)
1750 if ((document.get () !=
'\\') || (document.get () !=
'u'))
1758 if (
readHex (document, v) == -1)
1764 if (v < 0xDC00 || v > 0xDFFF)
1770 u = 0x10000 + (((u - 0xD800) << 10) | (v - 0xDC00));
1790 template <
typename ViewType>
1793 int ch = document.get ();
1797 output.push_back (
'"');
1800 output.push_back (
'\\');
1803 output.push_back (
'/');
1806 output.push_back (
'\b');
1809 output.push_back (
'\f');
1812 output.push_back (
'\n');
1815 output.push_back (
'\r');
1818 output.push_back (
'\t');
1886 template <
typename ViewType>
1891 output.reserve (64);
1895 document.readUntilEscaped (output.getString ());
1896 int ch = document.peek ();
1907 if (
readEscaped (document, output.getString ()) == -1)
1938 template <JsonReadMode ReadMode,
typename ViewType>
1951 if (document.getIf (
']'))
1963 int ch = document.get ();
1971 ch = document.get ();
2000 template <JsonReadMode ReadMode,
typename ViewType>
2013 if (document.getIf (
'}'))
2031 if (document.peek () !=
':')
2055 int ch = document.get ();
2063 ch = document.get ();
2092 template <JsonReadMode ReadMode,
typename ViewType>
2096 return document.skipWhitespaces ();
2104 template <JsonReadMode ReadMode,
typename ViewType>
2108 return document.skipWhitespacesAndComments ();
2118 return static_cast<unsigned char> (c -
'A') <= 5u;
2128 return static_cast<unsigned char> (c -
'a') <= 5u;
2138 return static_cast<unsigned char> (c -
'0') <= 9u;
2148 return ((c ^
'+') & (c ^
'-')) == 0;
2157 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:865
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:939
bool strtodSlow(const std::string &num, double &d)
convert double using strtod.
Definition json.hpp:1492
constexpr bool isSign(char c) noexcept
check if sign.
Definition json.hpp:2146
JsonReader(const JsonReader &other)=delete
copy constructor.
int readValue(ViewType &document)
parse a JSON value.
Definition json.hpp:1227
int deserialize(std::istringstream &document) override
deserialize a document.
Definition json.hpp:1090
constexpr bool isUpperAlpha(char c) noexcept
check if upper case alphanumeric character.
Definition json.hpp:2116
int deserialize(const char *first, const char *last) override
deserialize a document.
Definition json.hpp:1024
int readInf(ViewType &document, bool negative)
parse an infinity value.
Definition json.hpp:1313
int deserialize(const char *document, size_t length)
deserialize a document.
Definition json.hpp:988
int readUnicode(ViewType &document, std::string &output)
parse unicode.
Definition json.hpp:1733
int deserialize(std::stringstream &document) override
deserialize a document.
Definition json.hpp:1068
int readHex(ViewType &document, uint32_t &u)
parse a 4-digit hexadecimal sequence..
Definition json.hpp:1659
int readEscaped(ViewType &document, std::string &output)
parse escaped sequence.
Definition json.hpp:1791
int deserialize(const char *document, size_t length) override
deserialize a document.
Definition json.hpp:1000
int readString(ViewType &document, bool isKey=false)
parse UTF8.
Definition json.hpp:1887
std::enable_if<!(ReadMode &JsonReadMode::ParseComments), int >::type skipWhitespaces(ViewType &document)
skip whitespaces.
Definition json.hpp:2093
int deserialize(const char *first, const char *last)
deserialize a document.
Definition json.hpp:1012
JsonReader(JsonReader &&other)=delete
move constructor.
int readObject(ViewType &document)
parse an object value.
Definition json.hpp:2001
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:1360
int read(ViewType &document)
parse a document.
Definition json.hpp:1190
int deserialize(std::iostream &document)
deserialize a document.
Definition json.hpp:1145
int deserialize(std::fstream &document)
deserialize a document.
Definition json.hpp:1101
int readNan(ViewType &document, bool negative)
parse a nan value.
Definition json.hpp:1339
void encodeUtf8(uint32_t codepoint, std::string &output)
encode a Unicode codepoint to UTF-8.
Definition json.hpp:1694
JsonReader & operator=(const JsonReader &other)=delete
copy assignment.
int readNull(ViewType &document)
parse a null value.
Definition json.hpp:1261
int deserialize(std::istream &document) override
deserialize a document.
Definition json.hpp:1178
int deserialize(const std::string &document) override
deserialize a document.
Definition json.hpp:1046
int deserialize(std::ifstream &document) override
deserialize a document.
Definition json.hpp:1134
constexpr bool isLowerAlpha(char c) noexcept
check if lower case alphanumeric character.
Definition json.hpp:2126
int deserialize(std::iostream &document) override
deserialize a document.
Definition json.hpp:1156
constexpr bool isDigit(char c) noexcept
check if digit.
Definition json.hpp:2136
int deserialize(const std::string &document)
deserialize a document.
Definition json.hpp:1035
JsonReader(Value &root)
default constructor.
Definition json.hpp:945
int deserialize(std::istringstream &document)
deserialize a document.
Definition json.hpp:1079
int readNumber(ViewType &document)
parse a number value.
Definition json.hpp:1506
int readArray(ViewType &document)
parse an array value.
Definition json.hpp:1939
int deserialize(std::istream &document)
deserialize a document.
Definition json.hpp:1167
int deserialize(std::fstream &document) override
deserialize a document.
Definition json.hpp:1112
int readFalse(ViewType &document)
parse a false value.
Definition json.hpp:1295
int readTrue(ViewType &document)
parse a true value.
Definition json.hpp:1278
int deserialize(std::ifstream &document)
deserialize a document.
Definition json.hpp:1123
int deserialize(std::stringstream &document)
deserialize a document.
Definition json.hpp:1057
bool strtodFast(uint64_t significand, int64_t exponent, double &value)
convert double using fast path.
Definition json.hpp:1405
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:461
virtual int stopObject() override
stop object.
Definition sax.hpp:752
virtual int startArray(uint32_t size=0) override
start array.
Definition sax.hpp:654
virtual int setInt64(int64_t value) override
set 64 bits integer value.
Definition sax.hpp:614
virtual int setNull() override
set null value.
Definition sax.hpp:574
virtual int setUint64(uint64_t value) override
set unsigned 64 bits integer value.
Definition sax.hpp:624
virtual int setKey(const Value &key) override
set key.
Definition sax.hpp:742
virtual int startObject(uint32_t size=0) override
start object.
Definition sax.hpp:705
virtual int setBool(bool value) override
set boolean value.
Definition sax.hpp:584
virtual int stopArray() override
stop array.
Definition sax.hpp:690
virtual int setDouble(double value) override
set real value.
Definition sax.hpp:634
virtual int setString(const std::string &value) override
set string value.
Definition sax.hpp:644
stream serializer abstract class.
Definition sax.hpp:243
int setValue(const Value &value)
set value.
Definition sax.hpp:300
void append(char data) noexcept
append character to output stream in batch.
Definition sax.hpp:391
void append4(const char *data) noexcept
append 4-character literal to output stream in batch.
Definition sax.hpp:421
string view.
Definition view.hpp:83
value class.
Definition value.hpp:63
void clear()
erases all elements in the nested container.
Definition value.hpp:1186
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:919
IpAddress operator&(const IpAddress &a, const IpAddress &b)
perform AND operation on IP address.
Definition ip_address.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:53
constexpr const JsonReadMode & operator|=(JsonReadMode &a, JsonReadMode b) noexcept
perform binary OR on JsonReadMode.
Definition json.hpp:930
JsonReadMode
JSON deserialization mode.
Definition json.hpp:884
@ StopParsingOnDone
Definition json.hpp:888
@ ParseComments
Definition json.hpp:886
@ ValidateEncoding
Definition json.hpp:887
@ None
Definition json.hpp:885
std::error_code make_error_code(join::Errc code) noexcept
Create an std::error_code object.
Definition error.cpp:195
IpAddress operator|(const IpAddress &a, const IpAddress &b)
perform OR operation on IP address.
Definition ip_address.cpp:1692
thread_local std::error_code lastError
last error.
Definition error.cpp:32
std::vector< Member > Object
object.
Definition value.hpp:56
std::error_condition make_error_condition(join::Errc code) noexcept
Create an std::error_condition object.
Definition error.cpp:204
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:45
#define JOIN_UNLIKELY(x)
Definition utils.hpp:46