MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / newStreamWriter

Method newStreamWriter

src/jsoncpp.cpp:5167–5198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5165StreamWriterBuilder::~StreamWriterBuilder()
5166{}
5167StreamWriter* StreamWriterBuilder::newStreamWriter() const
5168{
5169 std::string indentation = settings_["indentation"].asString();
5170 std::string cs_str = settings_["commentStyle"].asString();
5171 bool eyc = settings_["enableYAMLCompatibility"].asBool();
5172 bool dnp = settings_["dropNullPlaceholders"].asBool();
5173 bool usf = settings_["useSpecialFloats"].asBool();
5174 unsigned int pre = settings_["precision"].asUInt();
5175 CommentStyle::Enum cs = CommentStyle::All;
5176 if (cs_str == "All") {
5177 cs = CommentStyle::All;
5178 } else if (cs_str == "None") {
5179 cs = CommentStyle::None;
5180 } else {
5181 throwRuntimeError("commentStyle must be 'All' or 'None'");
5182 }
5183 std::string colonSymbol = " : ";
5184 if (eyc) {
5185 colonSymbol = ": ";
5186 } else if (indentation.empty()) {
5187 colonSymbol = ":";
5188 }
5189 std::string nullSymbol = "null";
5190 if (dnp) {
5191 nullSymbol = "";
5192 }
5193 if (pre > 17) pre = 17;
5194 std::string endingLineFeedSymbol = "";
5195 return new BuiltStyledStreamWriter(
5196 indentation, cs,
5197 colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
5198}
5199static void getValidWriterKeys(std::set<std::string>* valid_keys)
5200{
5201 valid_keys->clear();

Callers 2

writeStringFunction · 0.80
jsoncpp.cppFile · 0.80

Calls 5

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

Tested by

no test coverage detected