| 962 | } |
| 963 | |
| 964 | absl::Status LegacyStructValue::ForEachField( |
| 965 | ForEachFieldCallback callback, |
| 966 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
| 967 | google::protobuf::MessageFactory* absl_nonnull message_factory, |
| 968 | google::protobuf::Arena* absl_nonnull arena) const { |
| 969 | auto message_wrapper = AsMessageWrapper(message_ptr_, legacy_type_info_); |
| 970 | const auto* access_apis = |
| 971 | message_wrapper.legacy_type_info()->GetAccessApis(message_wrapper); |
| 972 | if (ABSL_PREDICT_FALSE(access_apis == nullptr)) { |
| 973 | return absl::UnimplementedError( |
| 974 | absl::StrCat("legacy access APIs missing for ", GetTypeName())); |
| 975 | } |
| 976 | auto field_names = access_apis->ListFields(message_wrapper); |
| 977 | Value value; |
| 978 | for (const auto& field_name : field_names) { |
| 979 | CEL_ASSIGN_OR_RETURN( |
| 980 | auto cel_value, |
| 981 | access_apis->GetField(field_name, message_wrapper, |
| 982 | ProtoWrapperTypeOptions::kUnsetNull, |
| 983 | MemoryManagerRef::Pooling(arena))); |
| 984 | CEL_RETURN_IF_ERROR(ModernValue(arena, cel_value, value)); |
| 985 | CEL_ASSIGN_OR_RETURN(auto ok, callback(field_name, value)); |
| 986 | if (!ok) { |
| 987 | break; |
| 988 | } |
| 989 | } |
| 990 | return absl::OkStatus(); |
| 991 | } |
| 992 | |
| 993 | absl::Status LegacyStructValue::Qualify( |
| 994 | absl::Span<const SelectQualifier> qualifiers, bool presence_test, |