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

Method GetFieldByNumber

common/values/parsed_message_value.cc:201–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201absl::Status ParsedMessageValue::GetFieldByNumber(
202 int64_t number, ProtoWrapperTypeOptions unboxing_options,
203 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
204 google::protobuf::MessageFactory* absl_nonnull message_factory,
205 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
206 ABSL_DCHECK(descriptor_pool != nullptr);
207 ABSL_DCHECK(message_factory != nullptr);
208 ABSL_DCHECK(arena != nullptr);
209 ABSL_DCHECK(result != nullptr);
210
211 const auto* descriptor = GetDescriptor();
212 if (number < std::numeric_limits<int32_t>::min() ||
213 number > std::numeric_limits<int32_t>::max()) {
214 *result = NoSuchFieldError(absl::StrCat(number));
215 return absl::OkStatus();
216 }
217 const auto* field = descriptor->FindFieldByNumber(static_cast<int>(number));
218 if (field == nullptr) {
219 *result = NoSuchFieldError(absl::StrCat(number));
220 return absl::OkStatus();
221 }
222 return GetField(field, unboxing_options, descriptor_pool, message_factory,
223 arena, result);
224}
225
226absl::StatusOr<bool> ParsedMessageValue::HasFieldByName(
227 absl::string_view name) const {

Callers

nothing calls this directly

Calls 2

GetDescriptorFunction · 0.85
NoSuchFieldErrorFunction · 0.85

Tested by

no test coverage detected