|
|
|
@ -358,6 +358,17 @@ bool Parse(T& message, absl::string_view bytes) { |
|
|
|
|
arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(T& message, absl::string_view bytes, |
|
|
|
|
const ::protos::ExtensionRegistry& extension_registry) { |
|
|
|
|
_upb_Message_Clear(message.msg(), T::minitable()); |
|
|
|
|
auto* arena = static_cast<upb_Arena*>(message.GetInternalArena()); |
|
|
|
|
return upb_Decode(bytes.data(), bytes.size(), message.msg(), T::minitable(), |
|
|
|
|
/* extreg= */ |
|
|
|
|
::protos::internal::GetUpbExtensions(extension_registry), |
|
|
|
|
/* options= */ 0, arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(Ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
@ -367,6 +378,17 @@ bool Parse(Ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(Ptr<T>& message, absl::string_view bytes, |
|
|
|
|
const ::protos::ExtensionRegistry& extension_registry) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
|
auto* arena = static_cast<upb_Arena*>(message->GetInternalArena()); |
|
|
|
|
return upb_Decode(bytes.data(), bytes.size(), message->msg(), T::minitable(), |
|
|
|
|
/* extreg= */ |
|
|
|
|
::protos::internal::GetUpbExtensions(extension_registry), |
|
|
|
|
/* options= */ 0, arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(std::unique_ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
@ -376,6 +398,17 @@ bool Parse(std::unique_ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(std::unique_ptr<T>& message, absl::string_view bytes, |
|
|
|
|
const ::protos::ExtensionRegistry& extension_registry) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
|
auto* arena = static_cast<upb_Arena*>(message->GetInternalArena()); |
|
|
|
|
return upb_Decode(bytes.data(), bytes.size(), message->msg(), T::minitable(), |
|
|
|
|
/* extreg= */ |
|
|
|
|
::protos::internal::GetUpbExtensions(extension_registry), |
|
|
|
|
/* options= */ 0, arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(std::shared_ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
@ -385,6 +418,17 @@ bool Parse(std::shared_ptr<T>& message, absl::string_view bytes) { |
|
|
|
|
arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
bool Parse(std::shared_ptr<T>& message, absl::string_view bytes, |
|
|
|
|
const ::protos::ExtensionRegistry& extension_registry) { |
|
|
|
|
_upb_Message_Clear(message->msg(), T::minitable()); |
|
|
|
|
auto* arena = static_cast<upb_Arena*>(message->GetInternalArena()); |
|
|
|
|
return upb_Decode(bytes.data(), bytes.size(), message->msg(), T::minitable(), |
|
|
|
|
/* extreg= */ |
|
|
|
|
::protos::internal::GetUpbExtensions(extension_registry), |
|
|
|
|
/* options= */ 0, arena) == kUpb_DecodeStatus_Ok; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
absl::StatusOr<T> Parse(absl::string_view bytes, int options = 0) { |
|
|
|
|
T message; |
|
|
|
|