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

Method loadBuffer

extras/catch_amalgamated.cpp:2831–2868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2829 namespace Detail {
2830
2831 void TokenStream::loadBuffer() {
2832 m_tokenBuffer.clear();
2833
2834 // Skip any empty strings
2835 while ( it != itEnd && it->empty() ) {
2836 ++it;
2837 }
2838
2839 if ( it != itEnd ) {
2840 StringRef next = *it;
2841 if ( isOptPrefix( next[0] ) ) {
2842 auto delimiterPos = find_first_separator(next);
2843 if ( delimiterPos != StringRef::npos ) {
2844 m_tokenBuffer.push_back(
2845 { TokenType::Option,
2846 next.substr( 0, delimiterPos ) } );
2847 m_tokenBuffer.push_back(
2848 { TokenType::Argument,
2849 next.substr( delimiterPos + 1, next.size() ) } );
2850 } else {
2851 if ( next.size() > 1 && next[1] != '-' && next.size() > 2 ) {
2852 // Combined short args, e.g. "-ab" for "-a -b"
2853 for ( size_t i = 1; i < next.size(); ++i ) {
2854 m_tokenBuffer.push_back(
2855 { TokenType::Option,
2856 next.substr( i, 1 ) } );
2857 }
2858 } else {
2859 m_tokenBuffer.push_back(
2860 { TokenType::Option, next } );
2861 }
2862 }
2863 } else {
2864 m_tokenBuffer.push_back(
2865 { TokenType::Argument, next } );
2866 }
2867 }
2868 }
2869
2870 TokenStream::TokenStream( Args const& args ):
2871 TokenStream( args.m_args.begin(), args.m_args.end() ) {}

Callers

nothing calls this directly

Calls 6

isOptPrefixFunction · 0.70
find_first_separatorFunction · 0.70
clearMethod · 0.45
emptyMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected