| 5210 | StreamWriterBuilder::~StreamWriterBuilder() |
| 5211 | {} |
| 5212 | StreamWriter* StreamWriterBuilder::newStreamWriter() const |
| 5213 | { |
| 5214 | JSONCPP_STRING indentation = settings_["indentation"].asString(); |
| 5215 | JSONCPP_STRING cs_str = settings_["commentStyle"].asString(); |
| 5216 | bool eyc = settings_["enableYAMLCompatibility"].asBool(); |
| 5217 | bool dnp = settings_["dropNullPlaceholders"].asBool(); |
| 5218 | bool usf = settings_["useSpecialFloats"].asBool(); |
| 5219 | unsigned int pre = settings_["precision"].asUInt(); |
| 5220 | CommentStyle::Enum cs = CommentStyle::All; |
| 5221 | if (cs_str == "All") { |
| 5222 | cs = CommentStyle::All; |
| 5223 | } else if (cs_str == "None") { |
| 5224 | cs = CommentStyle::None; |
| 5225 | } else { |
| 5226 | throwRuntimeError("commentStyle must be 'All' or 'None'"); |
| 5227 | } |
| 5228 | JSONCPP_STRING colonSymbol = " : "; |
| 5229 | if (eyc) { |
| 5230 | colonSymbol = ": "; |
| 5231 | } else if (indentation.empty()) { |
| 5232 | colonSymbol = ":"; |
| 5233 | } |
| 5234 | JSONCPP_STRING nullSymbol = "null"; |
| 5235 | if (dnp) { |
| 5236 | nullSymbol = ""; |
| 5237 | } |
| 5238 | if (pre > 17) pre = 17; |
| 5239 | JSONCPP_STRING endingLineFeedSymbol = ""; |
| 5240 | return new BuiltStyledStreamWriter( |
| 5241 | indentation, cs, |
| 5242 | colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre); |
| 5243 | } |
| 5244 | static void getValidWriterKeys(std::set<JSONCPP_STRING>* valid_keys) |
| 5245 | { |
| 5246 | valid_keys->clear(); |
no test coverage detected