25#ifndef __JOIN_JSON_HPP__
26#define __JOIN_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) {
data[i] =
'u'; }
79 void operator () (locale_t loc) noexcept
114 virtual const char*
name ()
const noexcept;
121 virtual std::string
message (
int code)
const;
157 , _indentation (indentation)
229 virtual int setInt (int32_t value)
override
285 memcpy (&bits, &value,
sizeof (bits));
286 const bool neg = (bits >> 63) != 0;
287 const uint64_t exp = (bits >> 52) & 0x7FFULL;
288 const uint64_t frac = bits & 0x000FFFFFFFFFFFFFULL;
324 virtual int setString (
const std::string& value)
override
328 if (writeEscaped (value) == -1)
342 virtual int startArray ([[maybe_unused]] uint32_t size = 0)
override
346 _tab.append (_indentation,
' ');
358 _tab.erase (_tab.size () - _indentation);
375 virtual int startObject ([[maybe_unused]] uint32_t size = 0)
override
379 _tab.append (_indentation,
' ');
396 if (writeEscaped (
key) == -1)
413 _tab.erase (_tab.size () - _indentation);
432 if (value == std::numeric_limits <int32_t>::min ())
435 writeUint64 (
static_cast <uint64_t
> (std::numeric_limits <int32_t>::max ()) + 1);
442 writeUint64 (
static_cast <uint64_t
> (-value));
446 writeUint64 (
static_cast <uint64_t
> (value));
455 writeUint64 (
static_cast <uint64_t
> (value));
464 if (value == std::numeric_limits <int64_t>::min ())
467 writeUint64 (
static_cast <uint64_t
> (std::numeric_limits <int64_t>::max ()) + 1);
474 writeUint64 (
static_cast <uint64_t
> (-value));
478 writeUint64 (
static_cast <uint64_t
> (value));
494 char* ptr = buffer + 20;
498 uint64_t r = value % 100;
511 *--ptr =
'0' +
static_cast <char> (value);
514 size_t length = (buffer + 20) - ptr;
515 append (ptr, length);
526 append (buf, end - buf);
536 virtual int utf8Codepoint (std::string::const_iterator& cur, std::string::const_iterator& end, uint32_t& codepoint)
538 uint8_t u0 =
static_cast <uint8_t
> (*cur);
550 uint8_t u1 =
static_cast <uint8_t
> (*cur);
553 codepoint = ((u0 & 0x1F) << 6) | (u1 & 0x3F);
554 if (codepoint < 0x80)
566 uint8_t u2 =
static_cast <uint8_t
> (*cur);
569 codepoint = ((u0 & 0x0F) << 12) | ((u1 & 0x3F) << 6) | (u2 & 0x3F);
570 if ((codepoint > 0xD7FF) && (codepoint < 0xE000))
574 if (codepoint < 0x800)
586 uint8_t u3 =
static_cast <uint8_t
> (*cur);
589 codepoint = ((u0 & 0x07) << 18) | ((u1 & 0x3F) << 12) | ((u2 & 0x3F) << 6) | (u3 & 0x3F);
590 if (codepoint < 0x10000)
607 auto cur = value.cbegin ();
608 auto end = value.cend ();
621 append (&(*beg), cur - beg);
629 uint8_t ch =
static_cast <uint8_t
> (*cur);
633 uint32_t codepoint = 0;
636 if (utf8Codepoint (cur, end, codepoint) == -1)
642 if (codepoint <= 0xFFFF)
645 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (codepoint));
650 codepoint -= 0x10000;
652 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (0xD800 + ((codepoint >> 10) & 0x3FF)));
655 snprintf (hex,
sizeof (hex),
"%04x", uint16_t (0xDC00 + (codepoint & 0x3FF)));
661 char escapeSeq[2] = {
'\\',
static_cast <char> (esc)};
676 if (!_stack.empty () && !_first)
689 append (_tab.c_str (), _tab.size ());
721 if (!_stack.empty () && _stack.top ())
795 if (std::isfinite (value))
797 if ((std::trunc (value) == value) &&
799 (value <
static_cast <double> (std::numeric_limits <uint64_t>::max ())))
803 else if ((std::trunc (value) == value) &&
804 (value >=
static_cast <double> (std::numeric_limits <int64_t>::min ())) &&
805 (value <
static_cast <double> (std::numeric_limits <int64_t>::max ())))
831 std::vector <const Member *> members;
832 std::transform (
object.begin (),
object.end (), std::back_inserter (members), [] (
const Member &member) {
return &member;});
833 std::sort (members.begin (), members.end (), [] (
const Member *a,
const Member *b) {
834 std::wstring_convert <std::codecvt_utf8_utf16 <char16_t>, char16_t> cvt_utf8_utf16;
835 std::u16string wa = cvt_utf8_utf16.from_bytes (a->first.data ());
836 std::u16string wb = cvt_utf8_utf16.from_bytes (b->first.data ());
839 for (
auto const& member : members)
856 for (
char* pos = beg; pos < end; ++pos)
859 if ((*pos ==
'e') && (*(pos + 1) !=
'-'))
885 {
return JsonReadMode (
static_cast <int> (a) &
static_cast <int> (b)); }
894 {
return JsonReadMode (
static_cast <int> (a) |
static_cast <int> (b)); }
903 {
return a = a & b; }
912 {
return a = a | b; }
966 template <JsonReadMode ReadMode = JsonReadMode::None>
990 template <JsonReadMode ReadMode = JsonReadMode::None>
1013 template <JsonReadMode ReadMode = JsonReadMode::None>
1016 StringView in (document.c_str (), document.size ());
1035 template <JsonReadMode ReadMode = JsonReadMode::None>
1057 template <JsonReadMode ReadMode = JsonReadMode::None>
1079 template <JsonReadMode ReadMode = JsonReadMode::None>
1101 template <JsonReadMode ReadMode = JsonReadMode::None>
1123 template <JsonReadMode ReadMode = JsonReadMode::None>
1145 template <JsonReadMode ReadMode = JsonReadMode::None>
1168 template <JsonReadMode ReadMode,
typename ViewType>
1191 if (document.peek () != std::char_traits <char>::eof ())
1205 template <JsonReadMode ReadMode,
typename ViewType>
1208 int ch = document.peek ();
1239 template <
typename ViewType>
1242 if (
JOIN_UNLIKELY ((document.get () !=
'u') || (document.get () !=
'l') || (document.get () !=
'l')))
1256 template <
typename ViewType>
1259 if (
JOIN_UNLIKELY ((document.get () !=
'r') || (document.get () !=
'u') || (document.get () !=
'e')))
1273 template <
typename ViewType>
1276 if (
JOIN_UNLIKELY ((document.get () !=
'a') || (document.get () !=
'l') || (document.get () !=
's') || (document.get () !=
'e')))
1290 template <
typename ViewType>
1293 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'n') && document.getIfNoCase (
'f'))))
1299 if (
JOIN_UNLIKELY (document.getIfNoCase (
'i') && !(document.getIfNoCase (
'n') && document.getIfNoCase (
'i') && document.getIfNoCase (
't') && document.getIfNoCase (
'y'))))
1305 return setDouble (negative ? -std::numeric_limits <double>::infinity () : std::numeric_limits <double>::infinity ());
1313 template <
typename ViewType>
1316 if (
JOIN_UNLIKELY (!(document.getIfNoCase (
'a') && document.getIfNoCase (
'n'))))
1322 return setDouble (negative ? -std::numeric_limits <double>::quiet_NaN () : std::numeric_limits <double>::quiet_NaN ());
1334 inline void umul192 (uint64_t hi, uint64_t lo, uint64_t significand, uint64_t& high, uint64_t& middle, uint64_t& low)
noexcept
1336 #if defined(__SIZEOF_INT128__)
1337 __uint128_t h =
static_cast <__uint128_t
> (hi) * significand;
1338 __uint128_t l =
static_cast <__uint128_t
> (lo) * significand;
1339 __uint128_t s = h + (l >> 64);
1341 high =
static_cast <uint64_t
> (s >> 64);
1342 middle =
static_cast <uint64_t
> (s);
1343 low =
static_cast <uint64_t
> (l);
1345 uint64_t hi_hi, hi_lo, lo_hi, lo_lo;
1347 uint64_t m_lo =
static_cast <uint32_t
> (significand);
1348 uint64_t m_hi = significand >> 32;
1349 uint64_t p0 = (hi & 0xFFFFFFFF) * m_lo;
1350 uint64_t p1 = (hi >> 32) * m_lo;
1351 uint64_t p2 = (hi & 0xFFFFFFFF) * m_hi;
1352 uint64_t p3 = (hi >> 32) * m_hi;
1353 uint64_t carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1354 hi_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1355 hi_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1357 p0 = (lo & 0xFFFFFFFF) * m_lo;
1358 p1 = (lo >> 32) * m_lo;
1359 p2 = (lo & 0xFFFFFFFF) * m_hi;
1360 p3 = (lo >> 32) * m_hi;
1361 carry = (p0 >> 32) + (p1 & 0xFFFFFFFF) + (p2 & 0xFFFFFFFF);
1362 lo_lo = (carry << 32) | (p0 & 0xFFFFFFFF);
1363 lo_hi = (carry >> 32) + (p1 >> 32) + (p2 >> 32) + p3;
1366 middle = hi_lo + lo_hi;
1367 high = hi_hi + (middle < hi_lo ? 1 : 0);
1378 inline bool strtodFast (uint64_t significand, int64_t exponent,
double &value)
1380 constexpr double pow10[] = {
1381 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10,
1382 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21,
1386 value =
static_cast <double> (significand);
1388 if (
JOIN_UNLIKELY ((exponent > 22) && (exponent < (22 + 16))))
1390 value *= pow10[exponent - 22];
1394 if (
JOIN_LIKELY ((exponent >= -22) && (exponent <= 22) && (value <= 9007199254740991.0)))
1396 value = (exponent < 0) ? (value / pow10[-exponent]) : (value * pow10[exponent]);
1410 uint64_t high, middle, low;
1412 umul192 (power.
hi, power.
lo, significand, high, middle, low);
1413 int64_t exp = ((exponent * 217706) >> 16) + 1087;
1418 lz = __builtin_clzll (high);
1423 lz = __builtin_clzll (middle);
1438 high = middle << lz;
1443 high = (high << lz) | (middle >> (64 - lz));
1447 middle |= (low != 0);
1449 uint64_t mant = (high >> 11) & 0xFFFFFFFFFFFFF;
1450 uint64_t bits = (
static_cast <uint64_t
> (exp) << 52) | mant;
1451 uint64_t frac = high & 0x7FF;
1453 bool roundUp = ((frac > 0x400) |
1454 ((frac == 0x400) && ((middle != 0) || (mant & 1))) |
1455 ((frac == 0x3FF) && ((middle != 0))));
1458 std::memcpy (&value, &bits,
sizeof (
double));
1471 static LocalePtr locale (newlocale (LC_ALL_MASK,
"C",
nullptr));
1472 char* end =
nullptr;
1473 d = strtod_l (num.c_str (), &end, locale.get ());
1474 return (end && (*end ==
'\0'));
1482 template <
typename ViewType>
1485 BufferingView <ViewType> view (document);
1487 bool negative = view.getIf (
'-');
1489 uint64_t max64 = std::numeric_limits <uint64_t>::max ();
1492 max64 =
static_cast <uint64_t
> (std::numeric_limits <int64_t>::max ()) + 1;
1495 uint64_t digits = 0;
1496 bool isDouble =
false;
1509 u = view.get () -
'0';
1514 int digit = view.peek () -
'0';
1522 u = (u * 10) + (view.get () -
'0');
1526 else if (
JOIN_LIKELY (document.getIfNoCase (
'i')))
1528 return readInf (document, negative);
1530 else if (
JOIN_LIKELY (document.getIfNoCase (
'n')))
1532 return readNan (document, negative);
1544 u = (u * 10) + (view.get () -
'0');
1550 if (view.getIf (
'.'))
1556 u = (u * 10) + (view.get () -
'0');
1565 int64_t exponent = 0;
1566 if (view.getIf (
'e') || view.getIf (
'E'))
1570 bool negExp =
false;
1571 if (
isSign (view.peek ()))
1573 negExp = (view.get () ==
'-');
1578 exponent = (view.get () -
'0');
1582 int digit = view.get () -
'0';
1584 if (
JOIN_LIKELY (exponent <= ((std::numeric_limits <int>::max () - digit) / 10)))
1586 exponent = (exponent * 10) + digit;
1598 exponent = -exponent;
1617 view.snapshot (number);
1635 template <
typename ViewType>
1636 inline int readHex (ViewType& document, uint32_t& u)
1638 for (
int i = 0; i < 4; ++i)
1640 char c = document.get ();
1673 if (codepoint < 0x80)
1675 output.push_back (
static_cast <char> (codepoint));
1677 else if (codepoint < 0x800)
1680 buf[0] =
static_cast <char> (0xC0 | (codepoint >> 6));
1681 buf[1] =
static_cast <char> (0x80 | (codepoint & 0x3F));
1682 output.append (buf, 2);
1684 else if (codepoint < 0x10000)
1687 buf[0] =
static_cast <char> (0xE0 | (codepoint >> 12));
1688 buf[1] =
static_cast <char> (0x80 | ((codepoint >> 6) & 0x3F));
1689 buf[2] =
static_cast <char> (0x80 | (codepoint & 0x3F));
1690 output.append (buf, 3);
1695 buf[0] =
static_cast <char> (0xF0 | (codepoint >> 18));
1696 buf[1] =
static_cast <char> (0x80 | ((codepoint >> 12) & 0x3F));
1697 buf[2] =
static_cast <char> (0x80 | ((codepoint >> 6) & 0x3F));
1698 buf[3] =
static_cast <char> (0x80 | (codepoint & 0x3F));
1699 output.append (buf, 4);
1709 template <
typename ViewType>
1714 if (
readHex (document, u) == -1)
1719 if (u >= 0xDC00 && u <= 0xDFFF)
1725 if (u >= 0xD800 && u <= 0xDBFF)
1727 if ((document.get () !=
'\\') || (document.get () !=
'u'))
1735 if (
readHex (document, v) == -1)
1741 if (v < 0xDC00 || v > 0xDFFF)
1747 u = 0x10000 + (((u - 0xD800) << 10) | (v - 0xDC00));
1767 template <
typename ViewType>
1770 int ch = document.get ();
1773 case '"': output.push_back (
'"');
break;
1774 case '\\': output.push_back (
'\\');
break;
1775 case '/': output.push_back (
'/');
break;
1776 case 'b': output.push_back (
'\b');
break;
1777 case 'f': output.push_back (
'\f');
break;
1778 case 'n': output.push_back (
'\n');
break;
1779 case 'r': output.push_back (
'\r');
break;
1780 case 't': output.push_back (
'\t');
break;
1847 template <
typename ViewType>
1850 thread_local std::string output;
1852 output.reserve (64);
1856 document.readUntilEscaped (output);
1857 int ch = document.peek ();
1899 template <JsonReadMode ReadMode,
typename ViewType>
1912 if (document.getIf (
']'))
1924 int ch = document.get ();
1932 ch = document.get ();
1961 template <JsonReadMode ReadMode,
typename ViewType>
1974 if (document.getIf (
'}'))
1992 if (document.peek () !=
':')
2016 int ch = document.get ();
2024 ch = document.get ();
2053 template <JsonReadMode ReadMode,
typename ViewType>
2057 return document.skipWhitespaces ();
2065 template <JsonReadMode ReadMode,
typename ViewType>
2069 return document.skipWhitespacesAndComments ();
2079 return static_cast <unsigned char> (c -
'A') <= 5u;
2089 return static_cast <unsigned char> (c -
'a') <= 5u;
2099 return static_cast <unsigned char> (c -
'0') <= 9u;
2109 return ((c ^
'+') & (c ^
'-')) == 0;
2117 template <>
struct is_error_condition_enum <
join::JsonErrc> :
public true_type {};
basic stream view.
Definition view.hpp:368
JSON canonicalizer class.
Definition json.hpp:745
virtual void writeDouble(double value) noexcept override
write real value.
Definition json.hpp:852
JsonCanonicalizer(std::ostream &document)
create instance.
Definition json.hpp:751
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:828
virtual ~JsonCanonicalizer()=default
destroy instance.
virtual int setDouble(double value) override
set real value.
Definition json.hpp:792
JSON error category.
Definition json.hpp:108
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:918
bool strtodSlow(const std::string &num, double &d)
convert double using strtod.
Definition json.hpp:1469
constexpr bool isSign(char c) noexcept
check if sign.
Definition json.hpp:2107
JsonReader(const JsonReader &other)=delete
copy constructor.
int readValue(ViewType &document)
parse a JSON value.
Definition json.hpp:1206
int deserialize(std::istringstream &document) override
deserialize a document.
Definition json.hpp:1069
constexpr bool isUpperAlpha(char c) noexcept
check if upper case alphanumeric character.
Definition json.hpp:2077
int deserialize(const char *first, const char *last) override
deserialize a document.
Definition json.hpp:1003
int readInf(ViewType &document, bool negative)
parse an infinity value.
Definition json.hpp:1291
int deserialize(const char *document, size_t length)
deserialize a document.
Definition json.hpp:967
int readUnicode(ViewType &document, std::string &output)
parse unicode.
Definition json.hpp:1710
int deserialize(std::stringstream &document) override
deserialize a document.
Definition json.hpp:1047
int readHex(ViewType &document, uint32_t &u)
parse a 4-digit hexadecimal sequence..
Definition json.hpp:1636
int readEscaped(ViewType &document, std::string &output)
parse escaped sequence.
Definition json.hpp:1768
int deserialize(const char *document, size_t length) override
deserialize a document.
Definition json.hpp:979
int readString(ViewType &document, bool isKey=false)
parse UTF8.
Definition json.hpp:1848
std::enable_if<!(ReadMode &JsonReadMode::ParseComments), int >::type skipWhitespaces(ViewType &document)
skip whitespaces.
Definition json.hpp:2055
int deserialize(const char *first, const char *last)
deserialize a document.
Definition json.hpp:991
JsonReader(JsonReader &&other)=delete
move constructor.
int readObject(ViewType &document)
parse an object value.
Definition json.hpp:1962
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:1334
int read(ViewType &document)
parse a document.
Definition json.hpp:1169
int deserialize(std::iostream &document)
deserialize a document.
Definition json.hpp:1124
int deserialize(std::fstream &document)
deserialize a document.
Definition json.hpp:1080
int readNan(ViewType &document, bool negative)
parse a nan value.
Definition json.hpp:1314
void encodeUtf8(uint32_t codepoint, std::string &output)
encode a Unicode codepoint to UTF-8.
Definition json.hpp:1671
JsonReader & operator=(const JsonReader &other)=delete
copy assignment.
int readNull(ViewType &document)
parse a null value.
Definition json.hpp:1240
int deserialize(std::istream &document) override
deserialize a document.
Definition json.hpp:1157
int deserialize(const std::string &document) override
deserialize a document.
Definition json.hpp:1025
int deserialize(std::ifstream &document) override
deserialize a document.
Definition json.hpp:1113
constexpr bool isLowerAlpha(char c) noexcept
check if lower case alphanumeric character.
Definition json.hpp:2087
int deserialize(std::iostream &document) override
deserialize a document.
Definition json.hpp:1135
constexpr bool isDigit(char c) noexcept
check if digit.
Definition json.hpp:2097
int deserialize(const std::string &document)
deserialize a document.
Definition json.hpp:1014
JsonReader(Value &root)
default constructor.
Definition json.hpp:924
int deserialize(std::istringstream &document)
deserialize a document.
Definition json.hpp:1058
int readNumber(ViewType &document)
parse a number value.
Definition json.hpp:1483
int readArray(ViewType &document)
parse an array value.
Definition json.hpp:1900
int deserialize(std::istream &document)
deserialize a document.
Definition json.hpp:1146
int deserialize(std::fstream &document) override
deserialize a document.
Definition json.hpp:1091
int readFalse(ViewType &document)
parse a false value.
Definition json.hpp:1274
int readTrue(ViewType &document)
parse a true value.
Definition json.hpp:1257
int deserialize(std::ifstream &document)
deserialize a document.
Definition json.hpp:1102
int deserialize(std::stringstream &document)
deserialize a document.
Definition json.hpp:1036
bool strtodFast(uint64_t significand, int64_t exponent, double &value)
convert double using fast path.
Definition json.hpp:1378
JSON writer class.
Definition json.hpp:148
std::string _tab
tabulation.
Definition json.hpp:735
virtual void writeUint(uint32_t value)
write unsigned integer value.
Definition json.hpp:453
void indent() noexcept
write indentation.
Definition json.hpp:685
size_t _indentation
indentation.
Definition json.hpp:732
virtual int utf8Codepoint(std::string::const_iterator &cur, std::string::const_iterator &end, uint32_t &codepoint)
get UTF8 codepoint.
Definition json.hpp:536
virtual int setInt(int32_t value) override
set integer value.
Definition json.hpp:229
virtual int setInt64(int64_t value) override
set 64 bits integer value.
Definition json.hpp:255
virtual void writeDouble(double value)
write real value.
Definition json.hpp:522
JsonWriter(std::ostream &document, size_t indentation=0)
create instance.
Definition json.hpp:155
virtual int stopArray() override
stop array.
Definition json.hpp:356
virtual ~JsonWriter()=default
destroy instance.
virtual int startArray(uint32_t size=0) override
start array.
Definition json.hpp:342
virtual void writeInt(int32_t value)
write integer value.
Definition json.hpp:430
virtual int setKey(const std::string &key) override
set key.
Definition json.hpp:390
void comma() noexcept
write comma.
Definition json.hpp:674
virtual int stopObject() override
stop object.
Definition json.hpp:411
virtual void writeUint64(uint64_t value)
write 64 bits unsigned integer value.
Definition json.hpp:485
void array() noexcept
add comma, go to line and indent if in array.
Definition json.hpp:718
virtual int setUint(uint32_t value) override
set unsigned integer value.
Definition json.hpp:242
virtual void writeInt64(int64_t value)
write 64 bits integer value.
Definition json.hpp:462
virtual int writeEscaped(const std::string &value)
escape string value.
Definition json.hpp:605
virtual int setDouble(double value) override
set real value.
Definition json.hpp:281
virtual int startObject(uint32_t size=0) override
start object.
Definition json.hpp:375
std::stack< bool > _stack
array stack.
Definition json.hpp:729
virtual int setNull() override
set null value.
Definition json.hpp:196
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:268
virtual int setString(const std::string &value) override
set string value.
Definition json.hpp:324
void space() noexcept
write space.
Definition json.hpp:696
bool _first
is first element.
Definition json.hpp:738
void endLine() noexcept
write end of line.
Definition json.hpp:707
virtual int setBool(bool value) override
set boolean value.
Definition json.hpp:209
stream deserializer abstract class.
Definition sax.hpp:443
virtual int stopObject() override
stop object.
Definition sax.hpp:734
virtual int startArray(uint32_t size=0) override
start array.
Definition sax.hpp:636
virtual int setInt64(int64_t value) override
set 64 bits integer value.
Definition sax.hpp:596
virtual int setNull() override
set null value.
Definition sax.hpp:556
virtual int setUint64(uint64_t value) override
set unsigned 64 bits integer value.
Definition sax.hpp:606
virtual int setKey(const std::string &key) override
set key.
Definition sax.hpp:724
virtual int startObject(uint32_t size=0) override
start object.
Definition sax.hpp:687
virtual int setBool(bool value) override
set boolean value.
Definition sax.hpp:566
virtual int stopArray() override
stop array.
Definition sax.hpp:672
virtual int setDouble(double value) override
set real value.
Definition sax.hpp:616
virtual int setString(const std::string &value) override
set string value.
Definition sax.hpp:626
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:373
void append4(const char *data) noexcept
append 4-character literal to output stream in batch.
Definition sax.hpp:403
string view.
Definition view.hpp:78
value class.
Definition value.hpp:63
const std::string key(65, 'a')
key.
constexpr UnescapedTable unescapedLookup
Definition json.hpp:72
constexpr char digitPairs[201]
Definition json.hpp:42
constexpr WhitespaceTable whitespaceLookup
Definition view.hpp:71
constexpr Power atodpow[]
Definition atodpow.hpp:40
Definition acceptor.hpp:32
std::pair< std::string, Value > Member
object member.
Definition value.hpp:54
std::unique_ptr< std::remove_pointer_t< locale_t >, LocaleDelete > LocalePtr
Definition json.hpp:85
std::error_code make_error_code(join::Errc code)
Create an std::error_code object.
Definition error.cpp:154
char * dtoa(char *buffer, double value)
double to string conversion.
Definition dtoa.hpp:215
constexpr const JsonReadMode & operator&=(JsonReadMode &a, JsonReadMode b) noexcept
perform binary AND on JsonReadMode.
Definition json.hpp:902
IpAddress operator&(const IpAddress &a, const IpAddress &b)
perform AND operation on IP address.
Definition ipaddress.cpp:1666
const std::error_category & jsonCategory() noexcept
get error category.
Definition json.cpp:77
constexpr const JsonReadMode & operator|=(JsonReadMode &a, JsonReadMode b) noexcept
perform binary OR on JsonReadMode.
Definition json.hpp:911
JsonReadMode
JSON deserialization mode.
Definition json.hpp:871
@ StopParsingOnDone
Definition json.hpp:875
@ ParseComments
Definition json.hpp:873
@ ValidateEncoding
Definition json.hpp:874
@ None
Definition json.hpp:872
std::vector< Member > Object
object.
Definition value.hpp:57
IpAddress operator|(const IpAddress &a, const IpAddress &b)
perform OR operation on IP address.
Definition ipaddress.cpp:1693
thread_local std::error_code lastError
last error.
Definition error.cpp:32
std::error_condition make_error_condition(join::Errc code)
Create an std::error_condition object.
Definition error.cpp:163
JsonErrc
JSON error codes.
Definition json.hpp:91
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:57
constexpr UnescapedTable()
Definition json.hpp:59
#define JOIN_LIKELY(x)
Definition utils.hpp:46
#define JOIN_UNLIKELY(x)
Definition utils.hpp:47