mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-04 10:26:25 -04:00
revert changes, move deprecated to header,
This commit is contained in:
parent
72fa37aeb7
commit
4f41c0f938
@ -116,7 +116,7 @@ CharReaders and StreamWriters are not thread-safe, but they are re-usable.
|
|||||||
\code
|
\code
|
||||||
Json::CharReaderBuilder rbuilder;
|
Json::CharReaderBuilder rbuilder;
|
||||||
cfg >> rbuilder.settings_;
|
cfg >> rbuilder.settings_;
|
||||||
std::unique_ptr<Json::CharReader> const reader = rbuilder.newCharReader();
|
std::unique_ptr<Json::CharReader> const reader = rbuilder.makeCharReader();
|
||||||
reader->parse(start, stop, &value1, &errs);
|
reader->parse(start, stop, &value1, &errs);
|
||||||
// ...
|
// ...
|
||||||
reader->parse(start, stop, &value2, &errs);
|
reader->parse(start, stop, &value2, &errs);
|
||||||
|
@ -22,7 +22,7 @@ int main() {
|
|||||||
reader.parse(rawJson, root);
|
reader.parse(rawJson, root);
|
||||||
} else {
|
} else {
|
||||||
Json::CharReaderBuilder builder;
|
Json::CharReaderBuilder builder;
|
||||||
const std::unique_ptr<Json::CharReader> reader = builder.makeCharReader();
|
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
|
||||||
if (!reader->parse(rawJson.c_str(), rawJson.c_str() + rawJsonLength, &root,
|
if (!reader->parse(rawJson.c_str(), rawJson.c_str() + rawJsonLength, &root,
|
||||||
&err)) {
|
&err)) {
|
||||||
std::cout << "error" << std::endl;
|
std::cout << "error" << std::endl;
|
||||||
|
@ -338,6 +338,9 @@ public:
|
|||||||
CharReaderBuilder();
|
CharReaderBuilder();
|
||||||
~CharReaderBuilder() override;
|
~CharReaderBuilder() override;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \deprecated Use makeCharReader.
|
||||||
|
*/
|
||||||
CharReader* newCharReader() const override;
|
CharReader* newCharReader() const override;
|
||||||
std::unique_ptr<CharReader> makeCharReader() const override;
|
std::unique_ptr<CharReader> makeCharReader() const override;
|
||||||
/** \return true if 'settings' are legal and consistent;
|
/** \return true if 'settings' are legal and consistent;
|
||||||
|
@ -138,7 +138,7 @@ static int parseAndSaveValueTree(const Json::String& input,
|
|||||||
features.allowDroppedNullPlaceholders_;
|
features.allowDroppedNullPlaceholders_;
|
||||||
builder.settings_["allowNumericKeys"] = features.allowNumericKeys_;
|
builder.settings_["allowNumericKeys"] = features.allowNumericKeys_;
|
||||||
|
|
||||||
std::unique_ptr<Json::CharReader> reader = builder.makeCharReader();
|
std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
|
||||||
Json::String errors;
|
Json::String errors;
|
||||||
const bool parsingSuccessful =
|
const bool parsingSuccessful =
|
||||||
reader->parse(input.data(), input.data() + input.size(), root, &errors);
|
reader->parse(input.data(), input.data() + input.size(), root, &errors);
|
||||||
|
@ -1895,9 +1895,6 @@ std::unique_ptr<CharReader> CharReaderBuilder::makeCharReader() const {
|
|||||||
return std::unique_ptr<CharReader>(newCharReader());
|
return std::unique_ptr<CharReader>(newCharReader());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* \deprecated Use makeCharReader.
|
|
||||||
*/
|
|
||||||
CharReader* CharReaderBuilder::newCharReader() const {
|
CharReader* CharReaderBuilder::newCharReader() const {
|
||||||
bool collectComments = settings_["collectComments"].asBool();
|
bool collectComments = settings_["collectComments"].asBool();
|
||||||
OurFeatures features = OurFeatures::all();
|
OurFeatures features = OurFeatures::all();
|
||||||
@ -1994,7 +1991,7 @@ bool parseFromStream(CharReader::Factory const& fact, IStream& sin, Value* root,
|
|||||||
char const* begin = doc.data();
|
char const* begin = doc.data();
|
||||||
char const* end = begin + doc.size();
|
char const* end = begin + doc.size();
|
||||||
// Note that we do not actually need a null-terminator.
|
// Note that we do not actually need a null-terminator.
|
||||||
CharReaderPtr const reader = fact.makeCharReader();
|
CharReaderPtr const reader(fact.newCharReader());
|
||||||
return reader->parse(begin, end, root, errs);
|
return reader->parse(begin, end, root, errs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||||||
builder.settings_["collectComments"] = hash_settings & (1 << 9);
|
builder.settings_["collectComments"] = hash_settings & (1 << 9);
|
||||||
builder.settings_["allowTrailingCommas_"] = hash_settings & (1 << 10);
|
builder.settings_["allowTrailingCommas_"] = hash_settings & (1 << 10);
|
||||||
|
|
||||||
std::unique_ptr<Json::CharReader> reader = builder.makeCharReader();
|
std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
|
||||||
|
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
const auto data_str = reinterpret_cast<const char*>(data);
|
const auto data_str = reinterpret_cast<const char*>(data);
|
||||||
|
@ -2994,7 +2994,7 @@ struct CharReaderTest : JsonTest::TestCase {};
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = R"({ "property" : "value" })";
|
char const doc[] = R"({ "property" : "value" })";
|
||||||
@ -3005,7 +3005,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrorsTestingOffsets) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrorsTestingOffsets) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = "{ \"property\" : [\"value\", \"value2\"], \"obj\" : "
|
char const doc[] = "{ \"property\" : [\"value\", \"value2\"], \"obj\" : "
|
||||||
@ -3018,7 +3018,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrorsTestingOffsets) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseNumber) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseNumber) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
{
|
{
|
||||||
@ -3034,7 +3034,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseNumber) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3090,7 +3090,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
b.settings_["allowSingleQuotes"] = true;
|
b.settings_["allowSingleQuotes"] = true;
|
||||||
CharReaderPtr charreader = b.makeCharReader();
|
CharReaderPtr charreader(b.newCharReader());
|
||||||
char const doc[] = R"({'a': 'x\ty', "b":'x\\y'})";
|
char const doc[] = R"({'a': 'x\ty', "b":'x\\y'})";
|
||||||
bool ok = charreader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = charreader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3103,7 +3103,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseComment) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseComment) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3134,7 +3134,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseComment) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseObjectWithErrors) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseObjectWithErrors) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3157,7 +3157,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseObjectWithErrors) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseArrayWithErrors) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseArrayWithErrors) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3180,7 +3180,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseArrayWithErrors) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithOneError) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithOneError) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = R"({ "property" :: "value" })";
|
char const doc[] = R"({ "property" :: "value" })";
|
||||||
@ -3193,7 +3193,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithOneError) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseChineseWithOneError) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseChineseWithOneError) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = "{ \"pr佐藤erty\" :: \"value\" }";
|
char const doc[] = "{ \"pr佐藤erty\" :: \"value\" }";
|
||||||
@ -3206,7 +3206,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseChineseWithOneError) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = R"({ "property" : "v\alue" })";
|
char const doc[] = R"({ "property" : "v\alue" })";
|
||||||
@ -3223,7 +3223,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithStackLimit) {
|
|||||||
char const doc[] = R"({ "property" : "value" })";
|
char const doc[] = R"({ "property" : "value" })";
|
||||||
{
|
{
|
||||||
b.settings_["stackLimit"] = 2;
|
b.settings_["stackLimit"] = 2;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3232,7 +3232,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithStackLimit) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
b.settings_["stackLimit"] = 1;
|
b.settings_["stackLimit"] = 1;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
JSONTEST_ASSERT_THROWS(
|
JSONTEST_ASSERT_THROWS(
|
||||||
reader->parse(doc, doc + std::strlen(doc), &root, &errs));
|
reader->parse(doc, doc + std::strlen(doc), &root, &errs));
|
||||||
@ -3256,7 +3256,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderStrictModeTest, dupKeys) {
|
|||||||
R"({ "property" : "value", "key" : "val1", "key" : "val2" })";
|
R"({ "property" : "value", "key" : "val1", "key" : "val2" })";
|
||||||
{
|
{
|
||||||
b.strictMode(&b.settings_);
|
b.strictMode(&b.settings_);
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(!ok);
|
JSONTEST_ASSERT(!ok);
|
||||||
@ -3275,7 +3275,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
|
|||||||
char const doc[] = R"( "property" : "value" })";
|
char const doc[] = R"( "property" : "value" })";
|
||||||
{
|
{
|
||||||
b.settings_["failIfExtra"] = false;
|
b.settings_["failIfExtra"] = false;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3284,7 +3284,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(!ok);
|
JSONTEST_ASSERT(!ok);
|
||||||
@ -3295,7 +3295,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
b.strictMode(&b.settings_);
|
b.strictMode(&b.settings_);
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(!ok);
|
JSONTEST_ASSERT(!ok);
|
||||||
@ -3307,7 +3307,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
|
|||||||
{
|
{
|
||||||
b.strictMode(&b.settings_);
|
b.strictMode(&b.settings_);
|
||||||
b.settings_["failIfExtra"] = false;
|
b.settings_["failIfExtra"] = false;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(!ok);
|
JSONTEST_ASSERT(!ok);
|
||||||
@ -3325,7 +3325,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue107) {
|
|||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = "1:2:3";
|
char const doc[] = "1:2:3";
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(!ok);
|
JSONTEST_ASSERT(!ok);
|
||||||
@ -3340,7 +3340,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, commentAfterObject) {
|
|||||||
{
|
{
|
||||||
char const doc[] = "{ \"property\" : \"value\" } //trailing\n//comment\n";
|
char const doc[] = "{ \"property\" : \"value\" } //trailing\n//comment\n";
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3353,7 +3353,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, commentAfterArray) {
|
|||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = "[ \"property\" , \"value\" ] //trailing\n//comment\n";
|
char const doc[] = "[ \"property\" , \"value\" ] //trailing\n//comment\n";
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3365,7 +3365,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, commentAfterBool) {
|
|||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] = " true /*trailing\ncomment*/";
|
char const doc[] = " true /*trailing\ncomment*/";
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3376,7 +3376,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, commentAfterBool) {
|
|||||||
JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, parseComment) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, parseComment) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
b.settings_["failIfExtra"] = true;
|
b.settings_["failIfExtra"] = true;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3454,7 +3454,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowDropNullTest, issue178) {
|
|||||||
for (const auto& spec : specs) {
|
for (const auto& spec : specs) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
b.settings_["allowDroppedNullPlaceholders"] = true;
|
b.settings_["allowDroppedNullPlaceholders"] = true;
|
||||||
std::unique_ptr<Json::CharReader> reader = b.makeCharReader();
|
std::unique_ptr<Json::CharReader> reader(b.newCharReader());
|
||||||
|
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
@ -3475,7 +3475,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowNumericKeysTest, allowNumericKeys) {
|
|||||||
b.settings_["allowNumericKeys"] = true;
|
b.settings_["allowNumericKeys"] = true;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
char const doc[] = "{15:true,-16:true,12.01:true}";
|
char const doc[] = "{15:true,-16:true,12.01:true}";
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
JSONTEST_ASSERT(ok);
|
JSONTEST_ASSERT(ok);
|
||||||
@ -3493,7 +3493,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSingleQuotesTest, issue182) {
|
|||||||
b.settings_["allowSingleQuotes"] = true;
|
b.settings_["allowSingleQuotes"] = true;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
{
|
{
|
||||||
char const doc[] = "{'a':true,\"b\":true}";
|
char const doc[] = "{'a':true,\"b\":true}";
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
@ -3521,7 +3521,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowZeroesTest, issue176) {
|
|||||||
b.settings_["allowSingleQuotes"] = true;
|
b.settings_["allowSingleQuotes"] = true;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
{
|
{
|
||||||
char const doc[] = "{'a':true,\"b\":true}";
|
char const doc[] = "{'a':true,\"b\":true}";
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
@ -3546,7 +3546,7 @@ struct CharReaderAllowSpecialFloatsTest : JsonTest::TestCase {};
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, specialFloat) {
|
JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, specialFloat) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
{
|
{
|
||||||
@ -3574,7 +3574,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, issue209) {
|
|||||||
b.settings_["allowSpecialFloats"] = true;
|
b.settings_["allowSpecialFloats"] = true;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
{
|
{
|
||||||
char const doc[] = R"({"a":NaN,"b":Infinity,"c":-Infinity,"d":+Infinity})";
|
char const doc[] = R"({"a":NaN,"b":Infinity,"c":-Infinity,"d":+Infinity})";
|
||||||
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
|
||||||
@ -3655,7 +3655,7 @@ JSONTEST_FIXTURE_LOCAL(EscapeSequenceTest, readerParseEscapeSequence) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE_LOCAL(EscapeSequenceTest, charReaderParseEscapeSequence) {
|
JSONTEST_FIXTURE_LOCAL(EscapeSequenceTest, charReaderParseEscapeSequence) {
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
CharReaderPtr reader = b.makeCharReader();
|
CharReaderPtr reader(b.newCharReader());
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
Json::String errs;
|
Json::String errs;
|
||||||
char const doc[] = "[\"\\\"\",\"\\/\",\"\\\\\",\"\\b\","
|
char const doc[] = "[\"\\\"\",\"\\/\",\"\\\\\",\"\\b\","
|
||||||
|
Loading…
x
Reference in New Issue
Block a user