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

Function VariableHelper

Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx:174–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 .Bind("value"_s, &CacheVariable::Value, VariableValueHelper);
173
174bool VariableHelper(cm::optional<CacheVariable>& out, Json::Value const* value,
175 cmJSONState* state)
176{
177 if (value->isBool()) {
178 out = CacheVariable{
179 /*Type=*/"BOOL",
180 /*Value=*/value->asBool() ? "TRUE" : "FALSE",
181 };
182 return true;
183 }
184 if (value->isString()) {
185 out = CacheVariable{
186 /*Type=*/"",
187 /*Value=*/value->asString(),
188 };
189 return true;
190 }
191 if (value->isObject()) {
192 out.emplace();
193 return VariableObjectHelper(*out, value, state);
194 }
195 if (value->isNull()) {
196 out = cm::nullopt;
197 return true;
198 }
199 cmCMakePresetsErrors::INVALID_VARIABLE(value, state);
200 return false;
201}
202
203auto const VariablesHelper =
204 JSONHelperBuilder::Map<cm::optional<CacheVariable>>(

Callers

nothing calls this directly

Calls 8

INVALID_VARIABLEFunction · 0.85
isBoolMethod · 0.80
asBoolMethod · 0.80
isStringMethod · 0.80
asStringMethod · 0.80
isObjectMethod · 0.80
emplaceMethod · 0.80
isNullMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…