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

Method FromMessage

common/value.cc:1346–1372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1344} // namespace
1345
1346Value Value::FromMessage(
1347 const google::protobuf::Message& message,
1348 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1349 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1350 google::protobuf::MessageFactory* absl_nonnull message_factory
1351 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1352 google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1353 ABSL_DCHECK(descriptor_pool != nullptr);
1354 ABSL_DCHECK(message_factory != nullptr);
1355 ABSL_DCHECK(arena != nullptr);
1356
1357 std::string scratch;
1358 auto status_or_adapted = well_known_types::AdaptFromMessage(
1359 arena, message, descriptor_pool, message_factory, scratch);
1360 if (ABSL_PREDICT_FALSE(!status_or_adapted.ok())) {
1361 return ErrorValue(std::move(status_or_adapted).status());
1362 }
1363 return absl::visit(
1364 absl::Overload(OwningWellKnownTypesValueVisitor{
1365 /* .arena = */ arena, /* .scratch = */ &scratch},
1366 [&](absl::monostate) -> Value {
1367 auto* cloned = message.New(arena);
1368 cloned->CopyFrom(message);
1369 return ParsedMessageValue(cloned, arena);
1370 }),
1371 std::move(status_or_adapted).value());
1372}
1373
1374Value Value::FromMessage(
1375 google::protobuf::Message&& message,

Callers

nothing calls this directly

Calls 9

AdaptFromMessageFunction · 0.85
ErrorValueFunction · 0.85
CopyFromMethod · 0.80
SwapMethod · 0.80
ParsedMessageValueClass · 0.50
okMethod · 0.45
NewMethod · 0.45
valueMethod · 0.45
GetReflectionMethod · 0.45

Tested by

no test coverage detected