MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / newStreamWriter

Method newStreamWriter

json/jsoncpp.cpp:5338–5378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5336StreamWriterBuilder::StreamWriterBuilder() { setDefaults(&settings_); }
5337StreamWriterBuilder::~StreamWriterBuilder() {}
5338StreamWriter* StreamWriterBuilder::newStreamWriter() const {
5339 JSONCPP_STRING indentation = settings_["indentation"].asString();
5340 JSONCPP_STRING cs_str = settings_["commentStyle"].asString();
5341 JSONCPP_STRING pt_str = settings_["precisionType"].asString();
5342 bool eyc = settings_["enableYAMLCompatibility"].asBool();
5343 bool dnp = settings_["dropNullPlaceholders"].asBool();
5344 bool usf = settings_["useSpecialFloats"].asBool();
5345 unsigned int pre = settings_["precision"].asUInt();
5346 CommentStyle::Enum cs = CommentStyle::All;
5347 if (cs_str == "All") {
5348 cs = CommentStyle::All;
5349 } else if (cs_str == "None") {
5350 cs = CommentStyle::None;
5351 } else {
5352 throwRuntimeError("commentStyle must be 'All' or 'None'");
5353 }
5354 PrecisionType precisionType(significantDigits);
5355 if (pt_str == "significant") {
5356 precisionType = PrecisionType::significantDigits;
5357 } else if (pt_str == "decimal") {
5358 precisionType = PrecisionType::decimalPlaces;
5359 } else {
5360 throwRuntimeError("precisionType must be 'significant' or 'decimal'");
5361 }
5362 JSONCPP_STRING colonSymbol = " : ";
5363 if (eyc) {
5364 colonSymbol = ": ";
5365 } else if (indentation.empty()) {
5366 colonSymbol = ":";
5367 }
5368 JSONCPP_STRING nullSymbol = "null";
5369 if (dnp) {
5370 nullSymbol.clear();
5371 }
5372 if (pre > 17)
5373 pre = 17;
5374 JSONCPP_STRING endingLineFeedSymbol;
5375 return new BuiltStyledStreamWriter(indentation, cs, colonSymbol, nullSymbol,
5376 endingLineFeedSymbol, usf, pre,
5377 precisionType);
5378}
5379static void getValidWriterKeys(std::set<JSONCPP_STRING>* valid_keys) {
5380 valid_keys->clear();
5381 valid_keys->insert("indentation");

Callers 2

writeStringFunction · 0.80
jsoncpp.cppFile · 0.80

Calls 6

throwRuntimeErrorFunction · 0.85
asStringMethod · 0.80
asBoolMethod · 0.80
asUIntMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected