MCPcopy Create free account
hub / github.com/catchorg/Catch2 / writeImpl

Method writeImpl

extras/catch_amalgamated.cpp:4816–4832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4814 }
4815
4816 void JsonValueWriter::writeImpl( Catch::StringRef value, bool quote ) {
4817 if ( quote ) { m_os << '"'; }
4818 size_t current_start = 0;
4819 for ( size_t i = 0; i < value.size(); ++i ) {
4820 if ( needsEscape( value[i] ) ) {
4821 if ( current_start < i ) {
4822 m_os << value.substr( current_start, i - current_start );
4823 }
4824 m_os << makeEscapeStringRef( value[i] );
4825 current_start = i + 1;
4826 }
4827 }
4828 if ( current_start < value.size() ) {
4829 m_os << value.substr( current_start, value.size() - current_start );
4830 }
4831 if ( quote ) { m_os << '"'; }
4832 }
4833
4834} // namespace Catch
4835

Callers

nothing calls this directly

Calls 4

needsEscapeFunction · 0.70
makeEscapeStringRefFunction · 0.70
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected