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

Method Has

common/values/parsed_map_field_value.cc:372–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372absl::Status ParsedMapFieldValue::Has(
373 const Value& key,
374 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
375 google::protobuf::MessageFactory* absl_nonnull message_factory,
376 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
377 ABSL_DCHECK(*this);
378 if (ABSL_PREDICT_FALSE(field_ == nullptr)) {
379 *result = BoolValue(false);
380 return absl::OkStatus();
381 }
382 const google::protobuf::FieldDescriptor* absl_nonnull key_field =
383 field_->message_type()->map_key();
384 std::string proto_key_scratch;
385 google::protobuf::MapKey proto_key;
386 bool bool_result;
387 if (ValueToProtoMapKey(key, key_field->cpp_type(), &proto_key,
388 proto_key_scratch)) {
389 google::protobuf::MapValueConstRef proto_value;
390 bool_result = extensions::protobuf_internal::LookupMapValue(
391 *GetReflection(), *message_, *field_, proto_key, &proto_value);
392 } else {
393 bool_result = false;
394 }
395 *result = BoolValue(bool_result);
396 return absl::OkStatus();
397}
398
399absl::Status ParsedMapFieldValue::ListKeys(
400 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,

Callers

nothing calls this directly

Calls 3

ValueToProtoMapKeyFunction · 0.85
BoolValueClass · 0.70
LookupMapValueFunction · 0.50

Tested by

no test coverage detected