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