Use StringRef instead of std::string in XmlWriter::ScopedElement

This commit is contained in:
Martin Hořeňovský 2021-05-29 21:35:18 +02:00
parent c7241bb76e
commit d9f72868b2
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 8 additions and 3 deletions

View File

@ -211,7 +211,8 @@ namespace {
}
}
XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) {
XmlWriter::ScopedElement&
XmlWriter::ScopedElement::writeText( StringRef text, XmlFormatting fmt ) {
m_writer->writeText( text, fmt );
return *this;
}

View File

@ -56,10 +56,14 @@ namespace Catch {
~ScopedElement();
ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent );
ScopedElement&
writeText( StringRef text,
XmlFormatting fmt = XmlFormatting::Newline |
XmlFormatting::Indent );
template<typename T>
ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
ScopedElement& writeAttribute( StringRef name,
T const& attribute ) {
m_writer->writeAttribute( name, attribute );
return *this;
}