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

Method SerializeTo

common/legacy_value.cc:402–429  ·  view source on GitHub ↗

See `ValueInterface::SerializeTo`.

Source from the content-addressed store, hash-verified

400
401// See `ValueInterface::SerializeTo`.
402absl::Status LegacyListValue::SerializeTo(
403 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
404 google::protobuf::MessageFactory* absl_nonnull message_factory,
405 google::protobuf::io::ZeroCopyOutputStream* absl_nonnull output) const {
406 ABSL_DCHECK(descriptor_pool != nullptr);
407 ABSL_DCHECK(message_factory != nullptr);
408 ABSL_DCHECK(output != nullptr);
409
410 const google::protobuf::Descriptor* descriptor =
411 descriptor_pool->FindMessageTypeByName("google.protobuf.ListValue");
412 if (descriptor == nullptr) {
413 return absl::InternalError(
414 "unable to locate descriptor for message type: "
415 "google.protobuf.ListValue");
416 }
417
418 google::protobuf::Arena arena;
419 const google::protobuf::Message* wrapped = MaybeWrapValueToMessage(
420 descriptor, message_factory, CelValue::CreateList(impl_), &arena);
421 if (wrapped == nullptr) {
422 return absl::UnknownError("failed to convert legacy map to JSON");
423 }
424 if (!wrapped->SerializePartialToZeroCopyStream(output)) {
425 return absl::UnknownError(
426 absl::StrCat("failed to serialize message: ", wrapped->GetTypeName()));
427 }
428 return absl::OkStatus();
429}
430
431absl::Status LegacyListValue::ConvertToJson(
432 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,

Callers

nothing calls this directly

Calls 6

MaybeWrapValueToMessageFunction · 0.85
AsMessageWrapperFunction · 0.85
message_ptrMethod · 0.80
CreateListFunction · 0.50
CreateMapFunction · 0.50
GetTypeNameMethod · 0.45

Tested by

no test coverage detected