MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleRegexCommand

Function HandleRegexCommand

Source/cmStringCommand.cxx:176–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176bool HandleRegexCommand(std::vector<std::string> const& args,
177 cmExecutionStatus& status)
178{
179 if (args.size() < 2) {
180 status.SetError("sub-command REGEX requires a mode to be specified.");
181 return false;
182 }
183 std::string const& mode = args[1];
184 if (mode == "MATCH") {
185 if (args.size() < 5) {
186 status.SetError("sub-command REGEX, mode MATCH needs "
187 "at least 5 arguments total to command.");
188 return false;
189 }
190 return RegexMatch(args, status);
191 }
192 if (mode == "MATCHALL") {
193 if (args.size() < 5) {
194 status.SetError("sub-command REGEX, mode MATCHALL needs "
195 "at least 5 arguments total to command.");
196 return false;
197 }
198 return RegexMatchAll(args, status);
199 }
200 if (mode == "REPLACE") {
201 if (args.size() < 6) {
202 status.SetError("sub-command REGEX, mode REPLACE needs "
203 "at least 6 arguments total to command.");
204 return false;
205 }
206 return RegexReplace(args, status);
207 }
208 if (mode == "QUOTE") {
209 if (args.size() < 4) {
210 status.SetError("sub-command REGEX, mode QUOTE needs "
211 "at least 4 arguments total to command.");
212 return false;
213 }
214 return RegexQuote(args, status);
215 }
216
217 std::string e = "sub-command REGEX does not recognize mode " + mode;
218 status.SetError(e);
219 return false;
220}
221
222bool RegexMatch(std::vector<std::string> const& args,
223 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 6

RegexMatchFunction · 0.85
RegexMatchAllFunction · 0.85
RegexReplaceFunction · 0.85
RegexQuoteFunction · 0.85
sizeMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…