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

Method Contains

common/values/parsed_repeated_field_value.cc:330–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330absl::Status ParsedRepeatedFieldValue::Contains(
331 const Value& other,
332 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
333 google::protobuf::MessageFactory* absl_nonnull message_factory,
334 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
335 ABSL_DCHECK(*this);
336 if (ABSL_PREDICT_FALSE(field_ == nullptr)) {
337 *result = FalseValue();
338 return absl::OkStatus();
339 }
340 const auto* reflection = message_->GetReflection();
341 const int size = reflection->FieldSize(*message_, field_);
342 if (size > 0) {
343 CEL_ASSIGN_OR_RETURN(auto accessor,
344 common_internal::RepeatedFieldAccessorFor(field_));
345 Value scratch;
346 for (int i = 0; i < size; ++i) {
347 (*accessor)(i, message_, field_, reflection, descriptor_pool,
348 message_factory, arena, &scratch);
349 CEL_RETURN_IF_ERROR(scratch.Equal(other, descriptor_pool, message_factory,
350 arena, result));
351 if (result->IsTrue()) {
352 return absl::OkStatus();
353 }
354 }
355 }
356 *result = FalseValue();
357 return absl::OkStatus();
358}
359
360const google::protobuf::Reflection* absl_nonnull ParsedRepeatedFieldValue::GetReflection()
361 const {

Callers

nothing calls this directly

Calls 4

FalseValueFunction · 0.85
IsTrueMethod · 0.80
GetReflectionMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected