15 #ifndef RAPIDJSON_READER_H_
16 #define RAPIDJSON_READER_H_
26 #if defined(RAPIDJSON_SIMD) && defined(_MSC_VER)
28 #pragma intrinsic(_BitScanForward)
30 #ifdef RAPIDJSON_SSE42
31 #include <nmmintrin.h>
32 #elif defined(RAPIDJSON_SSE2)
33 #include <emmintrin.h>
38 RAPIDJSON_DIAG_OFF(4127)
39 RAPIDJSON_DIAG_OFF(4702)
44 RAPIDJSON_DIAG_OFF(effc++)
48 #define RAPIDJSON_NOTHING
49 #ifndef RAPIDJSON_PARSE_ERROR_EARLY_RETURN
50 #define RAPIDJSON_PARSE_ERROR_EARLY_RETURN(value) \
51 RAPIDJSON_MULTILINEMACRO_BEGIN \
52 if (HasParseError()) { return value; } \
53 RAPIDJSON_MULTILINEMACRO_END
55 #define RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID \
56 RAPIDJSON_PARSE_ERROR_EARLY_RETURN(RAPIDJSON_NOTHING)
89 #ifndef RAPIDJSON_PARSE_ERROR_NORETURN
90 #define RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode, offset) \
91 RAPIDJSON_MULTILINEMACRO_BEGIN \
92 RAPIDJSON_ASSERT(!HasParseError()); \
93 SetParseError(parseErrorCode, offset); \
94 RAPIDJSON_MULTILINEMACRO_END
108 #ifndef RAPIDJSON_PARSE_ERROR
109 #define RAPIDJSON_PARSE_ERROR(parseErrorCode, offset) \
110 RAPIDJSON_MULTILINEMACRO_BEGIN \
111 RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode, offset); \
112 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; \
113 RAPIDJSON_MULTILINEMACRO_END
129 #ifndef RAPIDJSON_PARSE_DEFAULT_FLAGS
130 #define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseNoFlags
180 template<
typename Encoding = UTF8<>,
typename Derived =
void>
182 typedef typename Encoding::Ch
Ch;
187 bool Null() {
return static_cast<Override&
>(*this).Default(); }
188 bool Bool(
bool) {
return static_cast<Override&
>(*this).Default(); }
189 bool Int(
int) {
return static_cast<Override&
>(*this).Default(); }
190 bool Uint(
unsigned) {
return static_cast<Override&
>(*this).Default(); }
191 bool Int64(
int64_t) {
return static_cast<Override&
>(*this).Default(); }
193 bool Double(
double) {
return static_cast<Override&
>(*this).Default(); }
194 bool String(
const Ch*,
SizeType,
bool) {
return static_cast<Override&
>(*this).Default(); }
195 bool StartObject() {
return static_cast<Override&
>(*this).Default(); }
196 bool Key(
const Ch* str,
SizeType len,
bool copy) {
return static_cast<Override&
>(*this).String(str, len, copy); }
198 bool StartArray() {
return static_cast<Override&
>(*this).Default(); }
207 template<typename Stream, int = StreamTraits<Stream>::copyOptimization>
211 template<
typename Stream>
226 template<
typename Stream>
246 template<
typename InputStream>
249 InputStream& s(copy.s);
251 while (s.Peek() ==
' ' || s.Peek() ==
'\n' || s.Peek() ==
'\r' || s.Peek() ==
'\t')
255 #ifdef RAPIDJSON_SSE42
256 inline const char *SkipWhitespace_SIMD(
const char* p) {
259 if (*p ==
' ' || *p ==
'\n' || *p ==
'\r' || *p ==
'\t')
265 const char* nextAligned =
reinterpret_cast<const char*
>((
reinterpret_cast<size_t>(p) + 15) & ~15);
266 while (p != nextAligned)
267 if (*p ==
' ' || *p ==
'\n' || *p ==
'\r' || *p ==
'\t')
273 static const char whitespace[16] =
" \n\r\t";
274 const __m128i w = _mm_load_si128((
const __m128i *)&whitespace[0]);
277 const __m128i s = _mm_load_si128((
const __m128i *)p);
278 const unsigned r = _mm_cvtsi128_si32(_mm_cmpistrm(w, s, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_BIT_MASK | _SIDD_NEGATIVE_POLARITY));
280 #ifdef _MSC_VER // Find the index of first non-whitespace
281 unsigned long offset;
282 _BitScanForward(&offset, r);
285 return p + __builtin_ffs(r) - 1;
291 #elif defined(RAPIDJSON_SSE2)
294 inline const char *SkipWhitespace_SIMD(
const char* p) {
296 if (*p ==
' ' || *p ==
'\n' || *p ==
'\r' || *p ==
'\t')
302 const char* nextAligned =
reinterpret_cast<const char*
>((
reinterpret_cast<size_t>(p) + 15) & ~15);
303 while (p != nextAligned)
304 if (*p ==
' ' || *p ==
'\n' || *p ==
'\r' || *p ==
'\t')
310 static const char whitespaces[4][17] = {
312 "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
313 "\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r",
314 "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"};
316 const __m128i w0 = _mm_loadu_si128((
const __m128i *)&whitespaces[0][0]);
317 const __m128i w1 = _mm_loadu_si128((
const __m128i *)&whitespaces[1][0]);
318 const __m128i w2 = _mm_loadu_si128((
const __m128i *)&whitespaces[2][0]);
319 const __m128i w3 = _mm_loadu_si128((
const __m128i *)&whitespaces[3][0]);
322 const __m128i s = _mm_load_si128((
const __m128i *)p);
323 __m128i
x = _mm_cmpeq_epi8(s, w0);
324 x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w1));
325 x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w2));
326 x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w3));
327 unsigned short r = (
unsigned short)~_mm_movemask_epi8(x);
329 #ifdef _MSC_VER // Find the index of first non-whitespace
330 unsigned long offset;
331 _BitScanForward(&offset, r);
334 return p + __builtin_ffs(r) - 1;
340 #endif // RAPIDJSON_SSE2
342 #ifdef RAPIDJSON_SIMD
345 is.
src_ =
const_cast<char*
>(SkipWhitespace_SIMD(is.
src_));
350 is.
src_ = SkipWhitespace_SIMD(is.
src_);
352 #endif // RAPIDJSON_SIMD
373 template <
typename SourceEncoding,
typename TargetEncoding,
typename StackAllocator = CrtAllocator>
376 typedef typename SourceEncoding::Ch
Ch;
392 template <
unsigned parseFlags,
typename InputStream,
typename Handler>
395 return IterativeParse<parseFlags>(is, handler);
399 ClearStackOnExit scope(*
this);
403 if (is.Peek() ==
'\0') {
408 ParseValue<parseFlags>(is, handler);
414 if (is.Peek() !=
'\0') {
431 template <
typename InputStream,
typename Handler>
433 return Parse<kParseDefaultFlags>(is, handler);
466 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
471 if (!handler.StartObject())
476 if (is.Peek() ==
'}') {
478 if (!handler.EndObject(0))
484 if (is.Peek() !=
'"')
487 ParseString<parseFlags>(is, handler,
true);
488 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
492 if (is.Take() !=
':')
497 ParseValue<parseFlags>(is, handler);
498 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
507 if (!handler.EndObject(memberCount))
516 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
521 if (!handler.StartArray())
526 if (is.Peek() ==
']') {
528 if (!handler.EndArray(0))
534 ParseValue<parseFlags>(is, handler);
535 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
543 if (!handler.EndArray(elementCount))
551 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
556 if (is.Take() ==
'u' && is.Take() ==
'l' && is.Take() ==
'l') {
564 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
569 if (is.Take() ==
'r' && is.Take() ==
'u' && is.Take() ==
'e') {
570 if (!handler.Bool(
true))
577 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
582 if (is.Take() ==
'a' && is.Take() ==
'l' && is.Take() ==
's' && is.Take() ==
'e') {
583 if (!handler.Bool(
false))
591 template<
typename InputStream>
593 unsigned codepoint = 0;
594 for (
int i = 0; i < 4; i++) {
597 codepoint +=
static_cast<unsigned>(c);
598 if (c >=
'0' && c <=
'9')
600 else if (c >=
'A' && c <=
'F')
601 codepoint -=
'A' - 10;
602 else if (c >=
'a' && c <=
'f')
603 codepoint -=
'a' - 10;
606 RAPIDJSON_PARSE_ERROR_EARLY_RETURN(0);
612 template <
typename CharType>
618 RAPIDJSON_FORCEINLINE
void Put(Ch c) {
619 *
stack_.template Push<Ch>() = c;
636 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
637 void ParseString(InputStream& is, Handler& handler,
bool isKey =
false) {
639 InputStream& s(copy.s);
641 bool success =
false;
643 typename InputStream::Ch *head = s.PutBegin();
644 ParseStringToStream<parseFlags, SourceEncoding, SourceEncoding>(s, s);
645 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
646 size_t length = s.PutEnd(head) - 1;
648 const typename TargetEncoding::Ch*
const str = (
typename TargetEncoding::Ch*)head;
649 success = (isKey ? handler.Key(str,
SizeType(length),
false) : handler.String(str,
SizeType(length),
false));
652 StackStream<typename TargetEncoding::Ch> stackStream(
stack_);
653 ParseStringToStream<parseFlags, SourceEncoding, TargetEncoding>(s, stackStream);
654 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
656 const typename TargetEncoding::Ch*
const str = stackStream.Pop();
657 success = (isKey ? handler.Key(str, length,
true) : handler.String(str, length,
true));
665 template<
unsigned parseFlags,
typename SEncoding,
typename TEncoding,
typename InputStream,
typename OutputStream>
668 #define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
669 static const char escape[256] = {
670 Z16,
Z16, 0, 0,
'\"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'/',
671 Z16,
Z16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'\\', 0, 0, 0,
672 0, 0,
'\b', 0, 0, 0,
'\f', 0, 0, 0, 0, 0, 0, 0,
'\n', 0,
673 0, 0,
'\r', 0,
'\t', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
687 if ((
sizeof(Ch) == 1 ||
unsigned(e) < 256) && escape[(
unsigned char)e]) {
688 os.Put(escape[(
unsigned char)e]);
692 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
693 if (codepoint >= 0xD800 && codepoint <= 0xDBFF) {
695 if (is.Take() !=
'\\' || is.Take() !=
'u')
698 RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID;
699 if (codepoint2 < 0xDC00 || codepoint2 > 0xDFFF)
701 codepoint = (((codepoint - 0xD800) << 10) | (codepoint2 - 0xDC00)) + 0x10000;
703 TEncoding::Encode(os, codepoint);
715 else if ((
unsigned)c < 0x20)
726 template<
typename InputStream,
bool backup>
729 template<
typename InputStream>
735 RAPIDJSON_FORCEINLINE Ch
Peek()
const {
return is.Peek(); }
736 RAPIDJSON_FORCEINLINE Ch
TakePush() {
return is.Take(); }
737 RAPIDJSON_FORCEINLINE Ch
Take() {
return is.Take(); }
738 size_t Tell() {
return is.Tell(); }
740 const char*
Pop() {
return 0; }
748 template<
typename InputStream>
756 stackStream.Put((
char)Base::is.Peek());
757 return Base::is.Take();
760 size_t Length() {
return stackStream.Length(); }
763 stackStream.Put(
'\0');
764 return stackStream.Pop();
771 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
774 NumberStream<InputStream, (parseFlags & kParseFullPrecisionFlag) != 0> s(*
this, copy.s);
778 if (s.Peek() ==
'-') {
786 bool use64bit =
false;
787 int significandDigit = 0;
788 if (s.Peek() ==
'0') {
792 else if (s.Peek() >=
'1' && s.Peek() <=
'9') {
793 i =
static_cast<unsigned>(s.TakePush() -
'0');
796 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
797 if (i >= 214748364) {
798 if (i != 214748364 || s.Peek() >
'8') {
804 i = i * 10 +
static_cast<unsigned>(s.TakePush() -
'0');
808 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
809 if (i >= 429496729) {
810 if (i != 429496729 || s.Peek() >
'5') {
816 i = i * 10 +
static_cast<unsigned>(s.TakePush() -
'0');
824 bool useDouble =
false;
828 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
835 i64 = i64 * 10 +
static_cast<unsigned>(s.TakePush() -
'0');
839 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
846 i64 = i64 * 10 +
static_cast<unsigned>(s.TakePush() -
'0');
853 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
854 if (d >= 1.7976931348623157e307)
856 d = d * 10 + (s.TakePush() -
'0');
862 size_t decimalPosition;
863 if (s.Peek() ==
'.') {
865 decimalPosition = s.Length();
867 if (!(s.Peek() >=
'0' && s.Peek() <=
'9'))
876 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
880 i64 = i64 * 10 +
static_cast<unsigned>(s.TakePush() -
'0');
890 d = use64bit ? (double)i64 : (
double)i;
895 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
896 if (significandDigit < 17) {
897 d = d * 10.0 + (s.TakePush() -
'0');
907 decimalPosition = s.Length();
911 if (s.Peek() ==
'e' || s.Peek() ==
'E') {
913 d = use64bit ? i64 : i;
918 bool expMinus =
false;
921 else if (s.Peek() ==
'-') {
926 if (s.Peek() >=
'0' && s.Peek() <=
'9') {
927 exp = s.Take() -
'0';
929 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
930 exp = exp * 10 + (s.Take() -
'0');
931 if (exp >= 214748364) {
932 while (s.Peek() >=
'0' && s.Peek() <=
'9')
938 int maxExp = 308 - expFrac;
939 while (s.Peek() >=
'0' && s.Peek() <=
'9') {
940 exp = exp * 10 + (s.Take() -
'0');
955 size_t length = s.Length();
956 const char* decimal = s.Pop();
959 int p = exp + expFrac;
965 cont = handler.Double(minus ? -d : d);
970 cont = handler.Int64(-(
int64_t)i64);
972 cont = handler.Uint64(i64);
976 cont = handler.Int(-(
int)i);
978 cont = handler.Uint(i);
986 template<
unsigned parseFlags,
typename InputStream,
typename Handler>
989 case 'n': ParseNull <parseFlags>(is, handler);
break;
990 case 't': ParseTrue <parseFlags>(is, handler);
break;
991 case 'f': ParseFalse <parseFlags>(is, handler);
break;
992 case '"': ParseString<parseFlags>(is, handler);
break;
993 case '{': ParseObject<parseFlags>(is, handler);
break;
994 case '[': ParseArray <parseFlags>(is, handler);
break;
995 default : ParseNumber<parseFlags>(is, handler);
1050 #define N NumberToken
1051 #define N16 N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
1053 static const unsigned char tokenMap[256] = {
1056 N, N,
StringToken, N, N, N, N, N, N, N, N, N,
CommaToken, N, N, N,
1057 N, N, N, N, N, N, N, N, N, N,
ColonToken, N, N, N, N, N,
1059 N, N, N, N, N, N, N, N, N, N, N,
LeftBracketToken, N,
RightBracketToken, N, N,
1060 N, N, N, N, N, N,
FalseToken, N, N, N, N, N, N, N,
NullToken, N,
1061 N, N, N, N,
TrueToken, N, N, N, N, N, N,
LeftCurlyBracketToken, N,
RightCurlyBracketToken, N, N,
1062 N16, N16, N16, N16, N16, N16, N16, N16
1068 if (
sizeof(Ch) == 1 ||
unsigned(c) < 256)
1069 return (
Token)tokenMap[(
unsigned char)c];
1089 IterativeParsingValueState
1095 IterativeParsingErrorState
1101 IterativeParsingErrorState
1115 IterativeParsingErrorState
1129 IterativeParsingErrorState
1143 IterativeParsingMemberValueState
1157 IterativeParsingErrorState
1171 IterativeParsingErrorState
1177 IterativeParsingErrorState
1191 IterativeParsingElementState
1205 IterativeParsingErrorState
1219 IterativeParsingElementState
1225 IterativeParsingErrorState
1231 IterativeParsingErrorState
1240 template <
unsigned parseFlags,
typename InputStream,
typename Handler>
1259 *
stack_.template Push<SizeType>(1) = n;
1261 *
stack_.template Push<SizeType>(1) = 0;
1276 ParseString<parseFlags>(is, handler,
true);
1289 ParseValue<parseFlags>(is, handler);
1297 ParseValue<parseFlags>(is, handler);
1307 *
stack_.template Top<SizeType>() = *
stack_.template Top<SizeType>() + 1;
1323 bool hr = handler.EndObject(c);
1348 bool hr = handler.EndArray(c);
1374 ParseValue<parseFlags>(is, handler);
1382 template <
typename InputStream>
1401 template <
unsigned parseFlags,
typename InputStream,
typename Handler>
1404 ClearStackOnExit scope(*
this);
1408 while (is.Peek() !=
'\0') {
1452 #endif // RAPIDJSON_READER_H_
bool Default()
Definition: reader.h:186
Quat exp(const Quat &q)
Definition: Quat.h:729
RAPIDJSON_FORCEINLINE void ParseStringToStream(InputStream &is, OutputStream &os)
Definition: reader.h:666
StreamLocalCopy(Stream &original)
Definition: reader.h:214
bool StartArray()
Definition: reader.h:198
SizeType length_
Definition: reader.h:632
Definition: reader.h:1036
Encoding conversion.
Definition: encodings.h:586
void HandleError(IterativeParsingState src, InputStream &is)
Definition: reader.h:1383
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:393
Definition: reader.h:1017
void ClearStack()
Definition: reader.h:453
Invalid value.
Definition: error.h:65
Encoding::Ch Ch
Definition: reader.h:182
Definition: reader.h:1033
double StrtodFullPrecision(double d, int p, const char *decimals, size_t length, size_t decimalPosition, int exp)
Definition: strtod.h:225
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:322
Iterative(constant complexity in terms of function call stack size) parsing.
Definition: reader.h:140
~StreamLocalCopy()
Definition: reader.h:215
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
Parsing was terminated.
Definition: error.h:83
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.
Definition: error.h:111
Missing a comma or '}' after an object member.
Definition: error.h:69
ParseResult parseResult_
Definition: reader.h:1436
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:261
bool Int64(int64_t)
Definition: reader.h:191
Default implementation of Handler.
Definition: reader.h:181
Definition: reader.h:1009
RAPIDJSON_FORCEINLINE IterativeParsingState Transit(IterativeParsingState src, Token token, IterativeParsingState dst, InputStream &is, Handler &handler)
Definition: reader.h:1241
Read-only string stream.
Definition: rapidjson.h:571
StackStream(internal::Stack< StackAllocator > &stack)
Definition: reader.h:617
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:119
GenericReader< UTF8<>, UTF8<> > Reader
Reader with UTF8 encoding and default allocator.
Definition: reader.h:1440
The document is empty.
Definition: error.h:62
Missing a comma or ']' after an array element.
Definition: error.h:71
RAPIDJSON_FORCEINLINE IterativeParsingState Predict(IterativeParsingState state, Token token)
Definition: reader.h:1074
Definition: reader.h:1008
bool Uint64(uint64_t)
Definition: reader.h:192
bool EndObject(SizeType)
Definition: reader.h:197
bool Uint(unsigned)
Definition: reader.h:190
bool String(const Ch *, SizeType, bool)
Definition: reader.h:194
ParseErrorCode GetParseErrorCode() const
Get the ParseErrorCode of last parsing.
Definition: reader.h:440
RAPIDJSON_FORCEINLINE Token Tokenize(Ch c)
Definition: reader.h:1047
const Ch * src_
Current read position.
Definition: rapidjson.h:585
No flags are set.
Definition: reader.h:137
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text (with kParseDefaultFlags)
Definition: reader.h:432
bool EndArray(SizeType)
Definition: reader.h:199
bool StartObject()
Definition: reader.h:195
Definition: reader.h:1032
void SetParseError(ParseErrorCode code, size_t offset)
Definition: reader.h:446
#define false
Definition: CascPort.h:18
Definition: reader.h:1029
void ParseString(InputStream &is, Handler &handler, bool isKey=false)
Definition: reader.h:637
RAPIDJSON_FORCEINLINE void Put(Ch c)
Definition: reader.h:618
GenericReader & operator=(const GenericReader &)
Definition: reader.h:1012
Missing a name for object member.
Definition: error.h:67
StackStream & operator=(const StackStream &)
Result of parsing (wraps ParseErrorCode)
Definition: error.h:101
Definition: reader.h:1044
void ParseValue(InputStream &is, Handler &handler)
Definition: reader.h:987
void ParseArray(InputStream &is, Handler &handler)
Definition: reader.h:517
void Clear()
Definition: stack.h:84
signed __int64 int64_t
Definition: stdint.h:89
Definition: reader.h:1035
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:116
bool Int(int)
Definition: reader.h:189
Definition: reader.h:1013
Definition: reader.h:1042
internal::SelectIf< internal::IsSame< Derived, void >, BaseReaderHandler, Derived >::Type Override
Definition: reader.h:184
#define RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode, offset)
Macro to indicate a parse error.
Definition: reader.h:90
CharType Ch
Definition: reader.h:615
size_t Length() const
Definition: reader.h:622
Stream s
Definition: reader.h:217
internal::Stack< StackAllocator > & stack_
Definition: reader.h:631
A read-write string stream.
Definition: rapidjson.h:605
Number too big to be stored in double.
Definition: error.h:79
After parsing a complete JSON root from stream, stop further processing the rest of stream...
Definition: reader.h:141
SourceEncoding::Ch Ch
SourceEncoding character type.
Definition: reader.h:376
#define true
Definition: CascPort.h:17
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS. ...
Definition: reader.h:143
Parse number in full precision (but slower).
Definition: reader.h:142
UTF-8 encoding.
Definition: encodings.h:96
Definition: reader.h:1040
Ch * src_
Definition: rapidjson.h:625
void ParseTrue(InputStream &is, Handler &handler)
Definition: reader.h:565
void Set(ParseErrorCode code, size_t offset=0)
Update error code and offset.
Definition: error.h:125
SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.
Definition: reader.h:374
bool HasParseError() const
Whether a parse error has occured in the last parsing.
Definition: reader.h:437
double StrtodNormalPrecision(double d, int p)
Definition: strtod.h:36
static RAPIDJSON_FORCEINLINE bool Transcode(InputStream &is, OutputStream &os)
Take one Unicode codepoint from source encoding, convert it to target encoding and put it to the outp...
Definition: encodings.h:589
bool Key(const Ch *str, SizeType len, bool copy)
Definition: reader.h:196
ParseFlag
Combination of parseFlags.
Definition: reader.h:136
ClearStackOnExit & operator=(const ClearStackOnExit &)
ParseErrorCode
Error code of parsing.
Definition: error.h:59
unsigned __int64 uint64_t
Definition: stdint.h:90
static const size_t kDefaultStackCapacity
Default stack capacity in bytes for storing a single decoded string.
Definition: reader.h:1434
IterativeParsingState
Definition: reader.h:1002
Definition: reader.h:1038
Token
Definition: reader.h:1028
#define RAPIDJSON_PARSE_DEFAULT_FLAGS
Definition: reader.h:130
ParseErrorCode Code() const
Get the error code.
Definition: error.h:109
Vector2int16 & operator=(const Any &a)
Definition: reader.h:1011
Miss exponent in number.
Definition: error.h:81
void ParseFalse(InputStream &is, Handler &handler)
Definition: reader.h:578
Invalid escape character in string.
Definition: error.h:75
Invalid encoding in string.
Definition: error.h:77
void ParseNumber(InputStream &is, Handler &handler)
Definition: reader.h:772
Definition: reader.h:1005
GenericReader & r_
Definition: reader.h:460
bool Bool(bool)
Definition: reader.h:188
float length(float v)
Definition: vectorMath.h:208
Definition: reader.h:1039
Definition: inftrees.h:24
unsigned ParseHex4(InputStream &is)
Definition: reader.h:592
Stream & original_
Definition: reader.h:222
Definition: document.h:390
void SkipWhitespace(InputStream &is)
Skip the JSON white spaces in a stream.
Definition: reader.h:247
bool IsError() const
Whether the result is an error.
Definition: error.h:116
void ParseObject(InputStream &is, Handler &handler)
Definition: reader.h:467
Stream & s
Definition: reader.h:231
Definition: reader.h:1016
bool Double(double)
Definition: reader.h:193
static std::string escape(const std::string &string)
Definition: TextOutput.cpp:77
Definition: reader.h:1004
Validate encoding of JSON strings.
Definition: reader.h:139
Definition: reader.h:1010
common definitions and configuration
Miss fraction part in number.
Definition: error.h:80
size_t GetErrorOffset() const
Get the position of last parsing error in input, 0 otherwise.
Definition: reader.h:443
Incorrect hex digit after \u escape in string.
Definition: error.h:73
internal::Stack< StackAllocator > stack_
A stack for storing decoded string temporarily during non-destructive parsing.
Definition: reader.h:1435
Definition: reader.h:1024
#define RAPIDJSON_PARSE_ERROR(parseErrorCode, offset)
(Internal) macro to indicate and handle a parse error.
Definition: reader.h:109
void Clear()
Reset error code.
Definition: error.h:123
Unspecific syntax error.
Definition: error.h:84
Ch * Pop()
Definition: reader.h:623
Definition: reader.h:1019
G3D::int16 x
Definition: Vector2int16.h:37
The surrogate pair in string is invalid.
Definition: error.h:74
void ParseNull(InputStream &is, Handler &handler)
Definition: reader.h:552
bool Null()
Definition: reader.h:187
Missing a colon after a name of object member.
Definition: error.h:68
ParseResult IterativeParse(InputStream &is, Handler &handler)
Definition: reader.h:1402
Definition: reader.h:1030
Type
Type of JSON value.
Definition: rapidjson.h:642
StreamLocalCopy(Stream &original)
Definition: reader.h:229
GenericReader(StackAllocator *stackAllocator=0, size_t stackCapacity=kDefaultStackCapacity)
Constructor.
Definition: reader.h:382
ClearStackOnExit(GenericReader &r)
Definition: reader.h:457
Missing a closing quotation mark in string.
Definition: error.h:76
Definition: reader.h:1041
Definition: reader.h:1003
The document root must not follow by other values.
Definition: error.h:63
In-situ(destructive) parsing.
Definition: reader.h:138
Definition: reader.h:1022
~ClearStackOnExit()
Definition: reader.h:458
Definition: reader.h:1018