Lines Matching defs:byte
97 byte array
397 // number of bytes written at the point of the last valid byte
403 const auto byte = static_cast<std::uint8_t>(s[i]);
405 switch (decode(state, codepoint, byte))
484 // copy byte to buffer (all previous bytes
501 // remember the byte position of this accept
507 case UTF8_REJECT: // decode found invalid UTF-8 byte
513 JSON_THROW(type_error::create(316, concat("invalid UTF-8 byte at index ", std::to_string(i), ": 0x", hex_bytes(byte | 0)), nullptr));
520 // would like to read it again, because the byte
576 default: // decode found yet incomplete multi-byte code point
580 // code point will not be escaped - copy byte to buffer
605 JSON_THROW(type_error::create(316, concat("incomplete UTF-8 string; last byte: 0x", hex_bytes(static_cast<std::uint8_t>(s.back() | 0))), nullptr));
673 * @brief convert a byte to a uppercase hex representation
674 * @param[in] byte byte to represent
677 static std::string hex_bytes(std::uint8_t byte)
681 result[0] = nibble_to_hex[byte / 16];
682 result[1] = nibble_to_hex[byte % 16];
751 // account one more byte for the minus sign
760 // spare 1 byte for '\0'
882 The function checks each byte of a string whether it is UTF-8 encoded. The
885 be rejected, because the current byte is not allowed. If the string is
887 prematurely; that is, the last byte indicated more bytes should have
892 @param[in] byte next byte to decode
900 static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep, const std::uint8_t byte) noexcept
922 JSON_ASSERT(byte < utf8d.size());
923 const std::uint8_t type = utf8d[byte];
926 ? (byte & 0x3fu) | (codep << 6u)
927 : (0xFFu >> type) & (byte);