| 423 | } |
| 424 | |
| 425 | bool 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 | |
| 449 | bool HandleLengthCommand(std::vector<std::string> const& args, |
| 450 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…