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

Function EnumHelper

Source/cmInstrumentationQuery.cxx:52–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51template <typename E>
52static std::function<bool(E&, Json::Value const*, cmJSONState*)> EnumHelper(
53 std::vector<std::string> const toString, std::string const& type)
54{
55 return [toString, type](E& out, Json::Value const* value,
56 cmJSONState* state) -> bool {
57 for (size_t i = 0; i < toString.size(); ++i) {
58 if (value->asString() == toString[i]) {
59 out = (E)i;
60 return true;
61 }
62 }
63 state->AddErrorAtValue(
64 cmStrCat("Not a valid ", type, ": \"", value->asString(), '"'), value);
65 return false;
66 };
67}
68static auto const OptionHelper = EnumHelper<cmInstrumentationQuery::Option>(
69 cmInstrumentationQuery::OptionString, "option");
70static auto const OptionListHelper =

Callers

nothing calls this directly

Calls 4

asStringMethod · 0.80
AddErrorAtValueMethod · 0.80
cmStrCatFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…