diff --git a/doc/dom.md b/doc/dom.md index 1083270e2..6c4edd2fc 100644 --- a/doc/dom.md +++ b/doc/dom.md @@ -119,7 +119,7 @@ Parse flags | Meaning `kParseNumbersAsStringsFlag` | Parse numerical type values as strings. `kParseTrailingCommasFlag` | Allow trailing commas at the end of objects and arrays (relaxed JSON syntax). `kParseNanAndInfFlag` | Allow parsing `NaN`, `Inf`, `Infinity`, `-Inf` and `-Infinity` as `double` values (relaxed JSON syntax). -`kParseEscapedApostrophe` | Allow escaped apostrophe in strings(relaxed JSON syntax). +`kParseEscapedApostropheFlag` | Allow escaped apostrophe in strings(relaxed JSON syntax). By using a non-type template parameter, instead of a function parameter, C++ compiler can generate code which is optimized for specified combinations, improving speed, and reducing code size (if only using a single specialization). The downside is the flags needed to be determined in compile-time. diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h index 5f7a94727..2d73b1915 100644 --- a/include/rapidjson/reader.h +++ b/include/rapidjson/reader.h @@ -154,7 +154,7 @@ enum ParseFlag { kParseNumbersAsStringsFlag = 64, //!< Parse all numbers (ints/doubles) as strings. kParseTrailingCommasFlag = 128, //!< Allow trailing commas at the end of objects and arrays. kParseNanAndInfFlag = 256, //!< Allow parsing NaN, Inf, Infinity, -Inf and -Infinity as doubles. - kParseEscapedApostrophe = 512, //!< Allow escaped apostrophe in strings. + kParseEscapedApostropheFlag = 512, //!< Allow escaped apostrophe in strings. kParseDefaultFlags = RAPIDJSON_PARSE_DEFAULT_FLAGS //!< Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS }; @@ -1015,7 +1015,7 @@ class GenericReader { is.Take(); os.Put(static_cast(escape[static_cast(e)])); } - else if ((parseFlags & kParseEscapedApostrophe) && RAPIDJSON_LIKELY(e == '\'')) { // Allow escaped apostrophe + else if ((parseFlags & kParseEscapedApostropheFlag) && RAPIDJSON_LIKELY(e == '\'')) { // Allow escaped apostrophe is.Take(); os.Put('\''); } diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index 5dbd3fb53..2795766c1 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -2215,7 +2215,7 @@ TEST(Reader, EscapedApostrophe) { { StringStream s(json); Reader reader; - ParseResult r = reader.Parse(s, h); + ParseResult r = reader.Parse(s, h); EXPECT_FALSE(reader.HasParseError()); EXPECT_EQ(kParseErrorNone, r.Code()); EXPECT_EQ(0u, r.Offset());