MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ListKeys

Method ListKeys

common/values/parsed_json_map_value.cc:290–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290absl::Status ParsedJsonMapValue::ListKeys(
291 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
292 google::protobuf::MessageFactory* absl_nonnull message_factory,
293 google::protobuf::Arena* absl_nonnull arena, ListValue* absl_nonnull result) const {
294 if (value_ == nullptr) {
295 *result = ListValue();
296 return absl::OkStatus();
297 }
298 const auto reflection =
299 well_known_types::GetStructReflectionOrDie(value_->GetDescriptor());
300 auto builder = NewListValueBuilder(arena);
301 builder->Reserve(static_cast<size_t>(reflection.FieldsSize(*value_)));
302 auto keys_begin = reflection.BeginFields(*value_);
303 const auto keys_end = reflection.EndFields(*value_);
304 for (; keys_begin != keys_end; ++keys_begin) {
305 CEL_RETURN_IF_ERROR(builder->Add(
306 Value::WrapMapFieldKeyString(keys_begin.GetKey(), value_, arena)));
307 }
308 *result = std::move(*builder).Build();
309 return absl::OkStatus();
310}
311
312absl::Status ParsedJsonMapValue::ForEach(
313 ForEachCallback callback,

Callers

nothing calls this directly

Calls 10

GetStructReflectionOrDieFunction · 0.85
GetKeyMethod · 0.80
ListValueClass · 0.70
GetDescriptorMethod · 0.45
ReserveMethod · 0.45
FieldsSizeMethod · 0.45
BeginFieldsMethod · 0.45
EndFieldsMethod · 0.45
AddMethod · 0.45
BuildMethod · 0.45

Tested by

no test coverage detected