16#ifndef RAPIDJSON_ERROR_ERROR_H_
17#define RAPIDJSON_ERROR_ERROR_H_
19#include "../rapidjson.h"
23RAPIDJSON_DIAG_OFF(padded)
39#ifndef RAPIDJSON_ERROR_CHARTYPE
40#define RAPIDJSON_ERROR_CHARTYPE char
52#ifndef RAPIDJSON_ERROR_STRING
53#define RAPIDJSON_ERROR_STRING(x) x
119 size_t Offset()
const {
return offset_; }
126 bool operator==(
const ParseResult& that)
const {
return code_ == that.code_; }
127 bool operator==(
ParseErrorCode code)
const {
return code_ == code; }
130 bool operator!=(
const ParseResult& that)
const {
return !(*
this == that); }
131 bool operator!=(
ParseErrorCode code)
const {
return !(*
this == code); }
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
#define RAPIDJSON_ERROR_CHARTYPE
Character type of error messages.
ParseErrorCode
Error code of parsing.
@ kParseErrorDocumentEmpty
The document is empty.
@ kParseErrorNumberMissFraction
Miss fraction part in number.
@ kParseErrorStringInvalidEncoding
Invalid encoding in string.
@ kParseErrorValueInvalid
Invalid value.
@ kParseErrorDocumentRootNotSingular
The document root must not follow by other values.
@ kParseErrorUnspecificSyntaxError
Unspecific syntax error.
@ kParseErrorObjectMissCommaOrCurlyBracket
Missing a comma or '}' after an object member.
@ kParseErrorObjectMissColon
Missing a colon after a name of object member.
@ kParseErrorStringMissQuotationMark
Missing a closing quotation mark in string.
@ kParseErrorTermination
Parsing was terminated.
@ kParseErrorNumberMissExponent
Miss exponent in number.
@ kParseErrorStringEscapeInvalid
Invalid escape character in string.
@ kParseErrorArrayMissCommaOrSquareBracket
Missing a comma or ']' after an array element.
@ kParseErrorNone
No error.
@ kParseErrorStringUnicodeSurrogateInvalid
The surrogate pair in string is invalid.
@ kParseErrorObjectMissName
Missing a name for object member.
@ kParseErrorNumberTooBig
Number too big to be stored in double.
@ kParseErrorStringUnicodeEscapeInvalidHex
Incorrect hex digit after \u escape in string.
Result of parsing (wraps ParseErrorCode)
ParseErrorCode Code() const
Get the error code.
ParseResult(ParseErrorCode code, size_t offset)
Constructor to set an error.
void Clear()
Reset error code.
bool(ParseResult::* BooleanType)() const
! Unspecified boolean type
void Set(ParseErrorCode code, size_t offset=0)
Update error code and offset.
ParseResult()
Default constructor, no error.
bool IsError() const
Whether the result is an error.
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.