MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / global_from_json

Function global_from_json

subprojects/llama.cpp/common/jinja/value.cpp:1208–1217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1206
1207template<>
1208void global_from_json(context & ctx, const nlohmann::ordered_json & json_obj, bool mark_input) {
1209 // printf("global_from_json: %s\n" , json_obj.dump(2).c_str());
1210 if (json_obj.is_null() || !json_obj.is_object()) {
1211 throw std::runtime_error("global_from_json: input JSON value must be an object");
1212 }
1213 for (auto it = json_obj.begin(); it != json_obj.end(); ++it) {
1214 JJ_DEBUG("global_from_json: setting key '%s'", it.key().c_str());
1215 ctx.set_val(it.key(), from_json(it.value(), mark_input));
1216 }
1217}
1218
1219// recursively convert value to JSON string
1220// TODO: avoid circular references

Callers 5

test_template_cppFunction · 0.85
fuzz_test_templateFunction · 0.85
applyFunction · 0.85
caps_try_executeFunction · 0.85

Calls 6

from_jsonFunction · 0.85
set_valMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by 3

test_template_cppFunction · 0.68
fuzz_test_templateFunction · 0.68