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