MCPcopy Index your code
hub / github.com/Kitware/CMake / ParseIndex

Function ParseIndex

Source/cmStringCommand.cxx:859–876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857}
858
859int ParseIndex(
860 std::string const& str, cm::optional<Args> const& progress = cm::nullopt,
861 Json::ArrayIndex max = std::numeric_limits<Json::ArrayIndex>::max())
862{
863 unsigned long lindex;
864 if (!cmStrToULong(str, &lindex)) {
865 throw json_error(cmStrCat("expected an array index, got: '"_s, str, "'"_s),
866 progress);
867 }
868 Json::ArrayIndex index = static_cast<Json::ArrayIndex>(lindex);
869 if (index >= max) {
870 cmAlphaNum sizeStr{ max };
871 throw json_error(cmStrCat("expected an index less than "_s, sizeStr.View(),
872 " got '"_s, str, "'"_s),
873 progress);
874 }
875 return index;
876}
877
878Json::Value& ResolvePath(Json::Value& json, Args path)
879{

Callers 2

HandleJSONCommandFunction · 0.85

Calls 4

cmStrToULongFunction · 0.85
json_errorClass · 0.85
ViewMethod · 0.80
cmStrCatFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…