33 json_utf8_exception::json_utf8_exception(
exception_type et,
const string &s) noexcept :
36 snprintf(m_message, max_message_length,
"%s : %s", get_main_message(), s.c_str());
39 json_utf8_exception::json_utf8_exception(
exception_type et,
char c) noexcept :
42 snprintf(m_message, max_message_length,
"%s : 0x%02x", get_main_message(), c);
45 json_utf8_exception::json_utf8_exception(
exception_type et,
unsigned int i) noexcept :
48 snprintf(m_message, max_message_length,
"%s : %d", get_main_message(), i);
51 void json_utf8_exception::add_byte_index(
size_t byte_index) noexcept
53 snprintf(m_message, max_message_length,
"%s at or near byte %ld", get_main_message(), byte_index);
56 size_t json_utf8_exception::get_byte_index() const noexcept
61 const char *json_utf8_exception::get_main_message()
65 case invalid_string_escape_e:
66 return "invalid escape character found in string";
67 case invalid_string_encoding_e:
68 return "string encoding is invalid";
69 case invalid_unicode_e:
70 return "invalid unicode value";
71 case invalid_utf8_sequence_length_e:
72 return "invalid UTF-8 sequence length";
73 case invalid_hex_char_e:
74 return "invalid hex character";
75 case invalid_hex_number_e:
76 return "invalid hex number (must be 0-15)";
77 case invalid_utf8_char_e:
78 return "0 byte detected in UTF-8 sequence other than code point 0";
Base class for all exceptions thrown by the library.
#define NAMESPACE
You can change the namespace of the whole library by changing this value.
Common defs needed everywhere and, as far as is possible, platform specific changes.
The json_utf8_exception class.