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

Method Contains

common/legacy_value.cc:551–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551absl::Status LegacyListValue::Contains(
552 const Value& other,
553 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
554 google::protobuf::MessageFactory* absl_nonnull message_factory,
555 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
556 CEL_ASSIGN_OR_RETURN(auto legacy_other, LegacyValue(arena, other));
557 const auto* cel_list = impl_;
558 for (int i = 0; i < cel_list->size(); ++i) {
559 auto element = cel_list->Get(arena, i);
560 absl::optional<bool> equal =
561 interop_internal::CelValueEqualImpl(element, legacy_other);
562 // Heterogeneous equality behavior is to just return false if equality
563 // undefined.
564 if (equal.has_value() && *equal) {
565 *result = TrueValue();
566 return absl::OkStatus();
567 }
568 }
569 *result = FalseValue();
570 return absl::OkStatus();
571}
572
573std::string LegacyMapValue::DebugString() const {
574 return CelValue::CreateMap(impl_).DebugString();

Callers

nothing calls this directly

Calls 6

TrueValueFunction · 0.85
FalseValueFunction · 0.85
CelValueEqualImplClass · 0.50
sizeMethod · 0.45
GetMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected