MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / newStreamWriter

Method newStreamWriter

Source/JSON/jsoncpp.cpp:4741–4769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4739}
4740StreamWriterBuilder::~StreamWriterBuilder() {}
4741StreamWriter* StreamWriterBuilder::newStreamWriter() const {
4742 std::string indentation = settings_["indentation"].asString();
4743 std::string cs_str = settings_["commentStyle"].asString();
4744 bool eyc = settings_["enableYAMLCompatibility"].asBool();
4745 bool dnp = settings_["dropNullPlaceholders"].asBool();
4746 bool usf = settings_["useSpecialFloats"].asBool();
4747 CommentStyle::Enum cs = CommentStyle::All;
4748 if (cs_str == "All") {
4749 cs = CommentStyle::All;
4750 } else if (cs_str == "None") {
4751 cs = CommentStyle::None;
4752 } else {
4753 throwRuntimeError("commentStyle must be 'All' or 'None'");
4754 }
4755 std::string colonSymbol = " : ";
4756 if (eyc) {
4757 colonSymbol = ": ";
4758 } else if (indentation.empty()) {
4759 colonSymbol = ":";
4760 }
4761 std::string nullSymbol = "null";
4762 if (dnp) {
4763 nullSymbol = "";
4764 }
4765 std::string endingLineFeedSymbol = "";
4766 return new BuiltStyledStreamWriter(
4767 indentation, cs,
4768 colonSymbol, nullSymbol, endingLineFeedSymbol, usf);
4769}
4770static void getValidWriterKeys(std::set<std::string>* valid_keys) {
4771 valid_keys->clear();
4772 valid_keys->insert("indentation");

Callers 2

writeStringFunction · 0.45
jsoncpp.cppFile · 0.45

Calls 4

throwRuntimeErrorFunction · 0.70
asStringMethod · 0.45
asBoolMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected