| 458 | } |
| 459 | |
| 460 | absl::StatusOr<EquatableValue> MapValueAsEquatableValue( |
| 461 | google::protobuf::Arena* absl_nonnull arena, const DescriptorPool* absl_nonnull pool, |
| 462 | MessageFactory* absl_nonnull factory, EquatableValueReflection& reflection, |
| 463 | const google::protobuf::MapValueConstRef& value, |
| 464 | const FieldDescriptor* absl_nonnull field, std::string& scratch, |
| 465 | Unique<Message>& unpacked) { |
| 466 | if (IsAnyField(field)) { |
| 467 | CEL_ASSIGN_OR_RETURN(unpacked, well_known_types::UnpackAnyIfResolveable( |
| 468 | arena, reflection.any_reflection, |
| 469 | value.GetMessageValue(), pool, factory)); |
| 470 | if (unpacked) { |
| 471 | return AsEquatableValue(reflection, *unpacked, unpacked->GetDescriptor(), |
| 472 | scratch); |
| 473 | } |
| 474 | return AsEquatableValue(reflection, value.GetMessageValue(), |
| 475 | value.GetMessageValue().GetDescriptor(), scratch); |
| 476 | } |
| 477 | switch (field->cpp_type()) { |
| 478 | case FieldDescriptor::CPPTYPE_INT32: |
| 479 | return static_cast<int64_t>(value.GetInt32Value()); |
| 480 | case FieldDescriptor::CPPTYPE_INT64: |
| 481 | return value.GetInt64Value(); |
| 482 | case FieldDescriptor::CPPTYPE_UINT32: |
| 483 | return static_cast<uint64_t>(value.GetUInt32Value()); |
| 484 | case FieldDescriptor::CPPTYPE_UINT64: |
| 485 | return value.GetUInt64Value(); |
| 486 | case FieldDescriptor::CPPTYPE_DOUBLE: |
| 487 | return value.GetDoubleValue(); |
| 488 | case FieldDescriptor::CPPTYPE_FLOAT: |
| 489 | return static_cast<double>(value.GetFloatValue()); |
| 490 | case FieldDescriptor::CPPTYPE_BOOL: |
| 491 | return value.GetBoolValue(); |
| 492 | case FieldDescriptor::CPPTYPE_ENUM: |
| 493 | if (field->enum_type()->full_name() == "google.protobuf.NullValue") { |
| 494 | return nullptr; |
| 495 | } |
| 496 | return static_cast<int64_t>(value.GetEnumValue()); |
| 497 | case FieldDescriptor::CPPTYPE_STRING: |
| 498 | if (field->type() == FieldDescriptor::TYPE_BYTES) { |
| 499 | return well_known_types::BytesValue( |
| 500 | absl::string_view(value.GetStringValue())); |
| 501 | } |
| 502 | return well_known_types::StringValue( |
| 503 | absl::string_view(value.GetStringValue())); |
| 504 | case FieldDescriptor::CPPTYPE_MESSAGE: { |
| 505 | const auto& message = value.GetMessageValue(); |
| 506 | return AsEquatableValue(reflection, message, message.GetDescriptor(), |
| 507 | scratch); |
| 508 | } |
| 509 | default: |
| 510 | return absl::InternalError( |
| 511 | absl::StrCat("unexpected field type: ", field->cpp_type_name())); |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | absl::StatusOr<EquatableValue> RepeatedFieldAsEquatableValue( |
| 516 | google::protobuf::Arena* absl_nonnull arena, const DescriptorPool* absl_nonnull pool, |
no test coverage detected