MCPcopy Create free account
hub / github.com/SpartanJ/eepp / getReplaceText

Function getReplaceText

src/tools/ecode/globalsearchcontroller.cpp:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56static std::string getReplaceText( const ProjectSearch::ResultData::Result& result,
57 const std::string& replaceText ) {
58 std::string newText( replaceText );
59 LuaPattern ptrn( "$(%d+)" );
60 for ( auto& match : ptrn.gmatch( replaceText ) ) {
61 std::string matchSubStr( match.group( 0 ) ); // $1, $2, etc.
62 std::string matchNum( match.group( 1 ) ); // 1, 2, etc.
63 int num;
64 if ( String::fromString( num, matchNum ) && num > 0 &&
65 num - 1 < static_cast<int>( result.captures.size() ) ) {
66 String::replaceAll( newText, matchSubStr, result.captures[num - 1] );
67 }
68 }
69 return newText;
70}
71
72void GlobalSearchController::processNextReplaceInBuffer(
73 std::string&& replaceText, ProjectSearch::SearchConfig&& searchConfig,

Callers 2

replaceInFilesMethod · 0.85

Calls 4

fromStringFunction · 0.85
gmatchMethod · 0.80
groupMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected