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

Method WrapMessageUnsafe

common/value.cc:1436–1466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1434}
1435
1436Value Value::WrapMessageUnsafe(
1437 const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1438 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1439 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1440 google::protobuf::MessageFactory* absl_nonnull message_factory
1441 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1442 google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1443 ABSL_DCHECK(message != nullptr);
1444 ABSL_DCHECK(descriptor_pool != nullptr);
1445 ABSL_DCHECK(message_factory != nullptr);
1446 ABSL_DCHECK(arena != nullptr);
1447
1448 std::string scratch;
1449 absl::StatusOr<well_known_types::Value> adapted_value =
1450 well_known_types::AdaptFromMessage(arena, *message, descriptor_pool,
1451 message_factory, scratch);
1452 if (ABSL_PREDICT_FALSE(!adapted_value.ok())) {
1453 return ErrorValue(std::move(adapted_value).status());
1454 }
1455 return absl::visit(
1456 absl::Overload(BorrowingWellKnownTypesValueVisitor{
1457 /* .message = */ message, /* .arena = */ arena,
1458 /* .scratch = */ &scratch},
1459 [&](absl::monostate) -> Value {
1460 if (message->GetArena() != arena) {
1461 return UnsafeParsedMessageValue(message);
1462 }
1463 return ParsedMessageValue(message, arena);
1464 }),
1465 std::move(adapted_value).value());
1466}
1467
1468namespace {
1469

Callers

nothing calls this directly

Calls 7

AdaptFromMessageFunction · 0.85
ErrorValueFunction · 0.85
UnsafeParsedMessageValueFunction · 0.85
ParsedMessageValueClass · 0.50
okMethod · 0.45
GetArenaMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected