| 5165 | StreamWriterBuilder::~StreamWriterBuilder() |
| 5166 | {} |
| 5167 | StreamWriter* 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 | } |
| 5199 | static void getValidWriterKeys(std::set<std::string>* valid_keys) |
| 5200 | { |
| 5201 | valid_keys->clear(); |
no test coverage detected