mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
stop calling validate() in newReader/Writer()
By not calling validate(), we can add non-invasive features which will be simply ignored when user-code is compiled against an old version. That way, we can often avoid a minor version-bump. The user can call validate() himself if he prefers that behavior.
This commit is contained in:
parent
acbf4eb2ef
commit
3ebba5cea8
@ -1863,9 +1863,6 @@ CharReaderBuilder::~CharReaderBuilder()
|
|||||||
{}
|
{}
|
||||||
CharReader* CharReaderBuilder::newCharReader() const
|
CharReader* CharReaderBuilder::newCharReader() const
|
||||||
{
|
{
|
||||||
if (!validate(NULL)) throw std::runtime_error("invalid settings");
|
|
||||||
// TODO: Maybe serialize the invalid settings into the exception.
|
|
||||||
|
|
||||||
bool collectComments = settings_["collectComments"].asBool();
|
bool collectComments = settings_["collectComments"].asBool();
|
||||||
OurFeatures features = OurFeatures::all();
|
OurFeatures features = OurFeatures::all();
|
||||||
features.allowComments_ = settings_["allowComments"].asBool();
|
features.allowComments_ = settings_["allowComments"].asBool();
|
||||||
|
@ -968,9 +968,6 @@ StreamWriterBuilder::~StreamWriterBuilder()
|
|||||||
{}
|
{}
|
||||||
StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
||||||
{
|
{
|
||||||
if (!validate(NULL)) throw std::runtime_error("invalid settings");
|
|
||||||
// TODO: Maybe serialize the invalid settings into the exception.
|
|
||||||
|
|
||||||
std::string indentation = settings_["indentation"].asString();
|
std::string indentation = settings_["indentation"].asString();
|
||||||
std::string cs_str = settings_["commentStyle"].asString();
|
std::string cs_str = settings_["commentStyle"].asString();
|
||||||
bool eyc = settings_["enableYAMLCompatibility"].asBool();
|
bool eyc = settings_["enableYAMLCompatibility"].asBool();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user