Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal/catch_xmlwriter.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-05-29 18:38:07 +0200
committerMartin Hořeňovský2021-05-29 21:23:24 +0200
commitc7241bb76e383e103792b47119ae5e742120e7f4 (patch)
tree3a48e022a442d579f945e709ae7278fc4abed4d0 /src/catch2/internal/catch_xmlwriter.cpp
parent1d04427fcdf81fb13c754c659f4bcde0403a8855 (diff)
downloadcatch3-c7241bb76e383e103792b47119ae5e742120e7f4.tar.gz
Use StringRef in XmLWriter when the text is not stored
Diffstat (limited to 'src/catch2/internal/catch_xmlwriter.cpp')
-rw-r--r--src/catch2/internal/catch_xmlwriter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/catch2/internal/catch_xmlwriter.cpp b/src/catch2/internal/catch_xmlwriter.cpp
index 63e6be1f..9adbfcf7 100644
--- a/src/catch2/internal/catch_xmlwriter.cpp
+++ b/src/catch2/internal/catch_xmlwriter.cpp
@@ -267,18 +267,19 @@ namespace {
return *this;
}
- XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {
+ XmlWriter& XmlWriter::writeAttribute( StringRef name,
+ StringRef attribute ) {
if( !name.empty() && !attribute.empty() )
m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
return *this;
}
- XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {
+ XmlWriter& XmlWriter::writeAttribute( StringRef name, bool attribute ) {
m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
return *this;
}
- XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) {
+ XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) {
if( !text.empty() ){
bool tagWasOpen = m_tagIsOpen;
ensureTagClosed();
@@ -291,7 +292,7 @@ namespace {
return *this;
}
- XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) {
+ XmlWriter& XmlWriter::writeComment( StringRef text, XmlFormatting fmt ) {
ensureTagClosed();
if (shouldIndent(fmt)) {
m_os << m_indent;
@@ -301,7 +302,7 @@ namespace {
return *this;
}
- void XmlWriter::writeStylesheetRef( std::string const& url ) {
+ void XmlWriter::writeStylesheetRef( StringRef url ) {
m_os << R"(<?xml-stylesheet type="text/xsl" href=")" << url << R"("?>)" << '\n';
}