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

Method substring

extras/catch_amalgamated.cpp:7954–7969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7952 }
7953
7954 std::string AnsiSkippingString::substring( const_iterator begin,
7955 const_iterator end ) const {
7956 // There's one caveat here to an otherwise simple substring: when
7957 // making a begin iterator we might have skipped ansi sequences at
7958 // the start. If `begin` here is a begin iterator, skipped over
7959 // initial ansi sequences, we'll use the true beginning of the
7960 // string. Lastly: We need to transform any chars we replaced with
7961 // 0xff back to 'm'
7962 auto str = std::string( begin == this->begin() ? m_string.begin()
7963 : begin.m_it,
7964 end.m_it );
7965 std::transform( str.begin(), str.end(), str.begin(), []( char c ) {
7966 return c == AnsiSkippingString::sentinel ? 'm' : c;
7967 } );
7968 return str;
7969 }
7970
7971 void AnsiSkippingString::const_iterator::tryParseAnsiEscapes() {
7972 // check if we've landed on an ansi sequence, and if so read through

Callers 2

TextFlow.tests.cppFile · 0.45
addIndentAndSuffixMethod · 0.45

Calls 2

beginMethod · 0.95
endMethod · 0.45

Tested by

no test coverage detected