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

Function HandleSubstringCommand

Source/cmStringCommand.cxx:425–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425bool HandleSubstringCommand(std::vector<std::string> const& args,
426 cmExecutionStatus& status)
427{
428 if (args.size() != 5) {
429 status.SetError("sub-command SUBSTRING requires four arguments.");
430 return false;
431 }
432
433 try {
434 std::string const& stringValue = args[1];
435 int begin = atoi(args[2].c_str());
436 int end = atoi(args[3].c_str());
437 std::string const& variableName = args[4];
438
439 cm::CMakeString data{ stringValue };
440 status.GetMakefile().AddDefinition(variableName,
441 data.Substring(begin, end));
442 } catch (std::exception const& e) {
443 status.SetError(e.what());
444 return false;
445 }
446 return true;
447}
448
449bool HandleLengthCommand(std::vector<std::string> const& args,
450 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 7

c_strMethod · 0.80
SubstringMethod · 0.80
sizeMethod · 0.45
SetErrorMethod · 0.45
AddDefinitionMethod · 0.45
GetMakefileMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…