| 857 | } |
| 858 | |
| 859 | int 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 | |
| 878 | Json::Value& ResolvePath(Json::Value& json, Args path) |
| 879 | { |
no test coverage detected
searching dependent graphs…