| 303 | }; |
| 304 | |
| 305 | absl::StatusOr<EquatableValue> AsEquatableValue( |
| 306 | EquatableValueReflection& reflection, |
| 307 | const Message& message ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 308 | const Descriptor* absl_nonnull descriptor, |
| 309 | Descriptor::WellKnownType well_known_type, |
| 310 | std::string& scratch ABSL_ATTRIBUTE_LIFETIME_BOUND) { |
| 311 | switch (well_known_type) { |
| 312 | case Descriptor::WELLKNOWNTYPE_DOUBLEVALUE: |
| 313 | CEL_RETURN_IF_ERROR( |
| 314 | reflection.double_value_reflection.Initialize(descriptor)); |
| 315 | return reflection.double_value_reflection.GetValue(message); |
| 316 | case Descriptor::WELLKNOWNTYPE_FLOATVALUE: |
| 317 | CEL_RETURN_IF_ERROR( |
| 318 | reflection.float_value_reflection.Initialize(descriptor)); |
| 319 | return static_cast<double>( |
| 320 | reflection.float_value_reflection.GetValue(message)); |
| 321 | case Descriptor::WELLKNOWNTYPE_INT64VALUE: |
| 322 | CEL_RETURN_IF_ERROR( |
| 323 | reflection.int64_value_reflection.Initialize(descriptor)); |
| 324 | return reflection.int64_value_reflection.GetValue(message); |
| 325 | case Descriptor::WELLKNOWNTYPE_UINT64VALUE: |
| 326 | CEL_RETURN_IF_ERROR( |
| 327 | reflection.uint64_value_reflection.Initialize(descriptor)); |
| 328 | return reflection.uint64_value_reflection.GetValue(message); |
| 329 | case Descriptor::WELLKNOWNTYPE_INT32VALUE: |
| 330 | CEL_RETURN_IF_ERROR( |
| 331 | reflection.int32_value_reflection.Initialize(descriptor)); |
| 332 | return static_cast<int64_t>( |
| 333 | reflection.int32_value_reflection.GetValue(message)); |
| 334 | case Descriptor::WELLKNOWNTYPE_UINT32VALUE: |
| 335 | CEL_RETURN_IF_ERROR( |
| 336 | reflection.uint32_value_reflection.Initialize(descriptor)); |
| 337 | return static_cast<uint64_t>( |
| 338 | reflection.uint32_value_reflection.GetValue(message)); |
| 339 | case Descriptor::WELLKNOWNTYPE_STRINGVALUE: |
| 340 | CEL_RETURN_IF_ERROR( |
| 341 | reflection.string_value_reflection.Initialize(descriptor)); |
| 342 | return reflection.string_value_reflection.GetValue(message, scratch); |
| 343 | case Descriptor::WELLKNOWNTYPE_BYTESVALUE: |
| 344 | CEL_RETURN_IF_ERROR( |
| 345 | reflection.bytes_value_reflection.Initialize(descriptor)); |
| 346 | return reflection.bytes_value_reflection.GetValue(message, scratch); |
| 347 | case Descriptor::WELLKNOWNTYPE_BOOLVALUE: |
| 348 | CEL_RETURN_IF_ERROR( |
| 349 | reflection.bool_value_reflection.Initialize(descriptor)); |
| 350 | return reflection.bool_value_reflection.GetValue(message); |
| 351 | case Descriptor::WELLKNOWNTYPE_VALUE: { |
| 352 | CEL_RETURN_IF_ERROR(reflection.value_reflection.Initialize(descriptor)); |
| 353 | const auto kind_case = reflection.value_reflection.GetKindCase(message); |
| 354 | switch (kind_case) { |
| 355 | case google::protobuf::Value::KIND_NOT_SET: |
| 356 | ABSL_FALLTHROUGH_INTENDED; |
| 357 | case google::protobuf::Value::kNullValue: |
| 358 | return nullptr; |
| 359 | case google::protobuf::Value::kBoolValue: |
| 360 | return reflection.value_reflection.GetBoolValue(message); |
| 361 | case google::protobuf::Value::kNumberValue: |
| 362 | return reflection.value_reflection.GetNumberValue(message); |
no test coverage detected