MCPcopy Create free account
hub / github.com/SOUI2/soui / newStreamWriter

Method newStreamWriter

third-part/jsoncpp/src/lib_json/json_writer.cpp:1143–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141StreamWriterBuilder::~StreamWriterBuilder()
1142{}
1143StreamWriter* StreamWriterBuilder::newStreamWriter() const
1144{
1145 JSONCPP_STRING indentation = settings_["indentation"].asString();
1146 JSONCPP_STRING cs_str = settings_["commentStyle"].asString();
1147 bool eyc = settings_["enableYAMLCompatibility"].asBool();
1148 bool dnp = settings_["dropNullPlaceholders"].asBool();
1149 bool usf = settings_["useSpecialFloats"].asBool();
1150 unsigned int pre = settings_["precision"].asUInt();
1151 CommentStyle::Enum cs = CommentStyle::All;
1152 if (cs_str == "All") {
1153 cs = CommentStyle::All;
1154 } else if (cs_str == "None") {
1155 cs = CommentStyle::None;
1156 } else {
1157 throwRuntimeError("commentStyle must be 'All' or 'None'");
1158 }
1159 JSONCPP_STRING colonSymbol = " : ";
1160 if (eyc) {
1161 colonSymbol = ": ";
1162 } else if (indentation.empty()) {
1163 colonSymbol = ":";
1164 }
1165 JSONCPP_STRING nullSymbol = "null";
1166 if (dnp) {
1167 nullSymbol.clear();
1168 }
1169 if (pre > 17) pre = 17;
1170 JSONCPP_STRING endingLineFeedSymbol;
1171 return new BuiltStyledStreamWriter(
1172 indentation, cs,
1173 colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
1174}
1175static void getValidWriterKeys(std::set<JSONCPP_STRING>* valid_keys)
1176{
1177 valid_keys->clear();

Callers 2

writeStringFunction · 0.80
json_writer.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