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

Method Find

common/legacy_value.cc:716–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714}
715
716absl::StatusOr<bool> LegacyMapValue::Find(
717 const Value& key,
718 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
719 google::protobuf::MessageFactory* absl_nonnull message_factory,
720 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
721 switch (key.kind()) {
722 case ValueKind::kError:
723 ABSL_FALLTHROUGH_INTENDED;
724 case ValueKind::kUnknown:
725 *result = Value{key};
726 return false;
727 case ValueKind::kBool:
728 ABSL_FALLTHROUGH_INTENDED;
729 case ValueKind::kInt:
730 ABSL_FALLTHROUGH_INTENDED;
731 case ValueKind::kUint:
732 ABSL_FALLTHROUGH_INTENDED;
733 case ValueKind::kString:
734 break;
735 default:
736 *result = ErrorValue(InvalidMapKeyTypeError(key.kind()));
737 }
738 CEL_ASSIGN_OR_RETURN(auto cel_key, LegacyValue(arena, key));
739 auto cel_value = impl_->Get(arena, cel_key);
740 if (!cel_value.has_value()) {
741 *result = NullValue{};
742 return false;
743 }
744 CEL_RETURN_IF_ERROR(ModernValue(arena, *cel_value, *result));
745 return true;
746}
747
748absl::Status LegacyMapValue::Has(
749 const Value& key,

Callers

nothing calls this directly

Calls 6

ErrorValueFunction · 0.85
InvalidMapKeyTypeErrorFunction · 0.70
ModernValueFunction · 0.70
kindMethod · 0.45
GetMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected