| 2116 | CharReaderBuilder::CharReaderBuilder() { setDefaults(&settings_); } |
| 2117 | CharReaderBuilder::~CharReaderBuilder() = default; |
| 2118 | CharReader* CharReaderBuilder::newCharReader() const { |
| 2119 | bool collectComments = settings_["collectComments"].asBool(); |
| 2120 | OurFeatures features = OurFeatures::all(); |
| 2121 | features.allowComments_ = settings_["allowComments"].asBool(); |
| 2122 | features.allowTrailingCommas_ = settings_["allowTrailingCommas"].asBool(); |
| 2123 | features.strictRoot_ = settings_["strictRoot"].asBool(); |
| 2124 | features.allowDroppedNullPlaceholders_ = |
| 2125 | settings_["allowDroppedNullPlaceholders"].asBool(); |
| 2126 | features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool(); |
| 2127 | features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool(); |
| 2128 | |
| 2129 | // Stack limit is always a size_t, so we get this as an unsigned int |
| 2130 | // regardless of it we have 64-bit integer support enabled. |
| 2131 | features.stackLimit_ = static_cast<size_t>(settings_["stackLimit"].asUInt()); |
| 2132 | features.failIfExtra_ = settings_["failIfExtra"].asBool(); |
| 2133 | features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); |
| 2134 | features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool(); |
| 2135 | features.skipBom_ = settings_["skipBom"].asBool(); |
| 2136 | return new OurCharReader(collectComments, features); |
| 2137 | } |
| 2138 | |
| 2139 | bool CharReaderBuilder::validate(Json::Value* invalid) const { |
| 2140 | static const auto& valid_keys = *new std::set<String>{ |
no test coverage detected