MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / loadBuffer

Method loadBuffer

src/catch2/catch.hpp:8864–8893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8862 std::vector<Token> m_tokenBuffer;
8863
8864 void loadBuffer() {
8865 m_tokenBuffer.resize( 0 );
8866
8867 // Skip any empty strings
8868 while( it != itEnd && it->empty() )
8869 ++it;
8870
8871 if( it != itEnd ) {
8872 auto const &next = *it;
8873 if( isOptPrefix( next[0] ) ) {
8874 auto delimiterPos = next.find_first_of( " :=" );
8875 if( delimiterPos != std::string::npos ) {
8876 m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );
8877 m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );
8878 } else {
8879 if( next[1] != '-' && next.size() > 2 ) {
8880 std::string opt = "- ";
8881 for( size_t i = 1; i < next.size(); ++i ) {
8882 opt[1] = next[i];
8883 m_tokenBuffer.push_back( { TokenType::Option, opt } );
8884 }
8885 } else {
8886 m_tokenBuffer.push_back( { TokenType::Option, next } );
8887 }
8888 }
8889 } else {
8890 m_tokenBuffer.push_back( { TokenType::Argument, next } );
8891 }
8892 }
8893 }
8894
8895 public:
8896 explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}

Callers

nothing calls this directly

Calls 4

isOptPrefixFunction · 0.85
substrMethod · 0.80
sizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected