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

Method Get

common/values/parsed_repeated_field_value.cc:182–206  ·  view source on GitHub ↗

See ListValueInterface::Get for documentation.

Source from the content-addressed store, hash-verified

180
181// See ListValueInterface::Get for documentation.
182absl::Status ParsedRepeatedFieldValue::Get(
183 size_t index, const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
184 google::protobuf::MessageFactory* absl_nonnull message_factory,
185 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
186 ABSL_DCHECK(*this);
187 ABSL_DCHECK(message_ != nullptr);
188
189 if (ABSL_PREDICT_FALSE(field_ == nullptr ||
190 index >= std::numeric_limits<int>::max() ||
191 static_cast<int>(index) >=
192 GetReflection()->FieldSize(*message_, field_))) {
193 *result = IndexOutOfBoundsError(index);
194 return absl::OkStatus();
195 }
196 if (arena_ == nullptr) {
197 *result = Value::WrapRepeatedFieldUnsafe(static_cast<int>(index), message_,
198 field_, descriptor_pool,
199 message_factory, arena);
200 } else {
201 *result =
202 Value::WrapRepeatedField(static_cast<int>(index), message_, field_,
203 descriptor_pool, message_factory, arena);
204 }
205 return absl::OkStatus();
206}
207
208absl::Status ParsedRepeatedFieldValue::ForEach(
209 ForEachWithIndexCallback callback,

Callers

nothing calls this directly

Calls 1

IndexOutOfBoundsErrorFunction · 0.70

Tested by

no test coverage detected