| 1208 | } |
| 1209 | |
| 1210 | bool StreamWriterBuilder::validate(Json::Value* invalid) const { |
| 1211 | static const auto& valid_keys = *new std::set<String>{ |
| 1212 | "indentation", |
| 1213 | "commentStyle", |
| 1214 | "enableYAMLCompatibility", |
| 1215 | "dropNullPlaceholders", |
| 1216 | "useSpecialFloats", |
| 1217 | "emitUTF8", |
| 1218 | "precision", |
| 1219 | "precisionType", |
| 1220 | }; |
| 1221 | for (auto si = settings_.begin(); si != settings_.end(); ++si) { |
| 1222 | auto key = si.name(); |
| 1223 | if (valid_keys.count(key)) |
| 1224 | continue; |
| 1225 | if (invalid) |
| 1226 | (*invalid)[key] = *si; |
| 1227 | else |
| 1228 | return false; |
| 1229 | } |
| 1230 | return invalid ? invalid->empty() : true; |
| 1231 | } |
| 1232 | |
| 1233 | Value& StreamWriterBuilder::operator[](const String& key) { |
| 1234 | return settings_[key]; |