Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
| 5196 | |
| 5197 | // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. |
| 5198 | void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream, |
| 5199 | const char* data) { |
| 5200 | const char* segment = data; |
| 5201 | *stream << "<![CDATA["; |
| 5202 | for (;;) { |
| 5203 | const char* const next_segment = strstr(segment, "]]>"); |
| 5204 | if (next_segment != nullptr) { |
| 5205 | stream->write( |
| 5206 | segment, static_cast<std::streamsize>(next_segment - segment)); |
| 5207 | *stream << "]]>]]><![CDATA["; |
| 5208 | segment = next_segment + strlen("]]>"); |
| 5209 | } else { |
| 5210 | *stream << segment; |
| 5211 | break; |
| 5212 | } |
| 5213 | } |
| 5214 | *stream << "]]>"; |
| 5215 | } |
| 5216 | |
| 5217 | void XmlUnitTestResultPrinter::OutputXmlAttribute( |
| 5218 | std::ostream* stream, |
nothing calls this directly
no outgoing calls
no test coverage detected