MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / validate

Method validate

Sources/Dependencies/jsoncpp/reader.cpp:1141–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139 }
1140
1141 bool CharReaderBuilder::validate(Json::Value* invalid) const {
1142#ifdef JSONCPP_HAS_STRING_VIEW
1143 static const auto& valid_keys = *new std::set<std::string_view>
1144#else
1145 static const auto & valid_keys = *new std::set<StringContainer>
1146#endif
1147 {
1148 "collectComments",
1149 "allowComments",
1150 "allowTrailingCommas",
1151 "strictRoot",
1152 "allowDroppedNullPlaceholders",
1153 "allowNumericKeys",
1154 "allowSingleQuotes",
1155 "stackLimit",
1156 "failIfExtra",
1157 "rejectDupKeys",
1158 "allowSpecialFloats",
1159 "skipBom",
1160 };
1161 for (auto si = settings_.begin(); si != settings_.end(); ++si) {
1162 auto key = si.name();
1163 if (valid_keys.count(key))
1164 continue;
1165 if (invalid)
1166 (*invalid)[key] = *si;
1167 else
1168 return false;
1169 }
1170 return invalid ? invalid->empty() : true;
1171 }
1172
1173 Value& CharReaderBuilder::operator[](const StringContainer& key) {
1174 return settings_[key];
1175 }
1176 // static
1177 void CharReaderBuilder::strictMode(Json::Value* settings) {
1178 //! [CharReaderBuilderStrictMode]
1179 (*settings)["allowComments"] = false;
1180 (*settings)["allowTrailingCommas"] = false;
1181 (*settings)["strictRoot"] = true;
1182 (*settings)["allowDroppedNullPlaceholders"] = false;
1183 (*settings)["allowNumericKeys"] = false;
1184 (*settings)["allowSingleQuotes"] = false;
1185 (*settings)["stackLimit"] = 256;
1186 (*settings)["failIfExtra"] = true;
1187 (*settings)["rejectDupKeys"] = true;
1188 (*settings)["allowSpecialFloats"] = false;
1189 (*settings)["skipBom"] = true;
1190 //! [CharReaderBuilderStrictMode]
1191 }
1192 // static
1193 void CharReaderBuilder::setDefaults(Json::Value* settings) {
1194 //! [CharReaderBuilderDefaults]
1195 (*settings)["collectComments"] = true;
1196 (*settings)["allowComments"] = true;
1197 (*settings)["allowTrailingCommas"] = true;
1198 (*settings)["strictRoot"] = false;

Callers

nothing calls this directly

Calls 5

beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45
countMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected