MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / ckpt_json_object_key

Function ckpt_json_object_key

common/script/json_api.cpp:186–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void ckpt_json_object_key(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs)
187{
188 const ScriptArgs args(Parser, Param, NumArgs, "json_object_key");
189 nlohmann::json* get = tree(args, 0);
190 const int index = args.num(1);
191 if (!get->is_object() || index < 0 || index >= (int)get->size()) {
192 args.fail("argument 2 is index %d, out of range", index);
193 }
194 auto it = get->cbegin();
195 std::advance(it, index);
196 ReturnValue->Val->Pointer = strToRet(it.key());
197}

Callers

nothing calls this directly

Calls 7

treeFunction · 0.85
strToRetFunction · 0.85
numMethod · 0.80
failMethod · 0.80
cbeginMethod · 0.80
sizeMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected