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

Method ForEach

common/values/parsed_json_list_value.cc:238–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238absl::Status ParsedJsonListValue::ForEach(
239 ForEachWithIndexCallback callback,
240 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
241 google::protobuf::MessageFactory* absl_nonnull message_factory,
242 google::protobuf::Arena* absl_nonnull arena) const {
243 ABSL_DCHECK(descriptor_pool != nullptr);
244 ABSL_DCHECK(message_factory != nullptr);
245 ABSL_DCHECK(arena != nullptr);
246
247 if (value_ == nullptr) {
248 return absl::OkStatus();
249 }
250 Value scratch;
251 const auto reflection =
252 well_known_types::GetListValueReflectionOrDie(value_->GetDescriptor());
253 const int size = reflection.ValuesSize(*value_);
254 for (int i = 0; i < size; ++i) {
255 scratch =
256 common_internal::ParsedJsonValue(&reflection.Values(*value_, i), arena);
257 CEL_ASSIGN_OR_RETURN(auto ok, callback(static_cast<size_t>(i), scratch));
258 if (!ok) {
259 break;
260 }
261 }
262 return absl::OkStatus();
263}
264
265namespace {
266

Callers

nothing calls this directly

Calls 5

ParsedJsonValueFunction · 0.85
ValuesMethod · 0.80
GetDescriptorMethod · 0.45
ValuesSizeMethod · 0.45

Tested by

no test coverage detected