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

Method ForEach

common/values/parsed_repeated_field_value.cc:208–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208absl::Status ParsedRepeatedFieldValue::ForEach(
209 ForEachWithIndexCallback callback,
210 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
211 google::protobuf::MessageFactory* absl_nonnull message_factory,
212 google::protobuf::Arena* absl_nonnull arena) const {
213 ABSL_DCHECK(*this);
214 if (ABSL_PREDICT_FALSE(field_ == nullptr)) {
215 return absl::OkStatus();
216 }
217 const auto* reflection = message_->GetReflection();
218 const int size = reflection->FieldSize(*message_, field_);
219 if (size > 0) {
220 CEL_ASSIGN_OR_RETURN(auto accessor,
221 common_internal::RepeatedFieldAccessorFor(field_));
222 Value scratch;
223 for (int i = 0; i < size; ++i) {
224 (*accessor)(i, message_, field_, reflection, descriptor_pool,
225 message_factory, arena, &scratch);
226 CEL_ASSIGN_OR_RETURN(auto ok, callback(static_cast<size_t>(i), scratch));
227 if (!ok) {
228 break;
229 }
230 }
231 }
232 return absl::OkStatus();
233}
234
235namespace {
236

Callers

nothing calls this directly

Calls 1

GetReflectionMethod · 0.45

Tested by

no test coverage detected