MCPcopy Create free account
hub / github.com/apache/singa / OutputXmlCDataSection

Method OutputXmlCDataSection

test/gtest/gtest-all.cc:4730–4747  ·  view source on GitHub ↗

Streams an XML CDATA section, escaping invalid CDATA sequences as needed.

Source from the content-addressed store, hash-verified

4728
4729// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
4730void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
4731 const char* data) {
4732 const char* segment = data;
4733 *stream << "<![CDATA[";
4734 for (;;) {
4735 const char* const next_segment = strstr(segment, "]]>");
4736 if (next_segment != NULL) {
4737 stream->write(
4738 segment, static_cast<std::streamsize>(next_segment - segment));
4739 *stream << "]]>]]&gt;<![CDATA[";
4740 segment = next_segment + strlen("]]>");
4741 } else {
4742 *stream << segment;
4743 break;
4744 }
4745 }
4746 *stream << "]]>";
4747}
4748
4749void XmlUnitTestResultPrinter::OutputXmlAttribute(
4750 std::ostream* stream,

Callers

nothing calls this directly

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected