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

Method Get

common/values/parsed_json_list_value.cc:213–236  ·  view source on GitHub ↗

See ListValueInterface::Get for documentation.

Source from the content-addressed store, hash-verified

211
212// See ListValueInterface::Get for documentation.
213absl::Status ParsedJsonListValue::Get(
214 size_t index, const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
215 google::protobuf::MessageFactory* absl_nonnull message_factory,
216 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
217 ABSL_DCHECK(descriptor_pool != nullptr);
218 ABSL_DCHECK(message_factory != nullptr);
219 ABSL_DCHECK(arena != nullptr);
220 ABSL_DCHECK(result != nullptr);
221
222 if (value_ == nullptr) {
223 *result = IndexOutOfBoundsError(index);
224 return absl::OkStatus();
225 }
226 const auto reflection =
227 well_known_types::GetListValueReflectionOrDie(value_->GetDescriptor());
228 if (ABSL_PREDICT_FALSE(index >=
229 static_cast<size_t>(reflection.ValuesSize(*value_)))) {
230 *result = IndexOutOfBoundsError(index);
231 return absl::OkStatus();
232 }
233 *result = common_internal::ParsedJsonValue(
234 &reflection.Values(*value_, static_cast<int>(index)), arena);
235 return absl::OkStatus();
236}
237
238absl::Status ParsedJsonListValue::ForEach(
239 ForEachWithIndexCallback callback,

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected