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

Function TryParseInteger

Source/cmForEachCommand.cxx:384–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384bool TryParseInteger(cmExecutionStatus& status, std::string const& str, int& i)
385{
386 try {
387 i = std::stoi(str);
388 } catch (std::invalid_argument const&) {
389 status.SetError(cmStrCat("Invalid integer: '", str, '\''));
390 cmSystemTools::SetFatalErrorOccurred();
391 return false;
392 } catch (std::out_of_range const&) {
393 status.SetError(cmStrCat("Integer out of range: '", str, '\''));
394 cmSystemTools::SetFatalErrorOccurred();
395 return false;
396 }
397
398 return true;
399}
400
401} // anonymous namespace
402

Callers 1

cmForEachCommandFunction · 0.85

Calls 2

cmStrCatFunction · 0.70
SetErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…