Include string_view in overload set.

PiperOrigin-RevId: 548240332
pull/13328/head
Chris Kennelly 2 years ago committed by Copybara-Service
parent 871fd27836
commit cf304cba61
  1. 12
      src/google/protobuf/wire_format_lite.h

@ -47,6 +47,7 @@
#include "google/protobuf/port.h"
#include "absl/base/casts.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/arenastring.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/message_lite.h"
@ -738,6 +739,8 @@ class PROTOBUF_EXPORT WireFormatLite {
static inline size_t StringSize(const absl::Cord& value);
static inline size_t BytesSize(const std::string& value);
static inline size_t BytesSize(const absl::Cord& value);
static inline size_t StringSize(absl::string_view value);
static inline size_t BytesSize(absl::string_view value);
template <typename MessageType>
static inline size_t GroupSize(const MessageType& value);
@ -1835,6 +1838,15 @@ inline size_t WireFormatLite::StringSize(const absl::Cord& value) {
return LengthDelimitedSize(value.size());
}
inline size_t WireFormatLite::StringSize(const absl::string_view value) {
// WARNING: In wire_format.cc, both strings and bytes are handled by
// StringSize() to avoid code duplication. If the implementations become
// different, you will need to update that usage.
return LengthDelimitedSize(value.size());
}
inline size_t WireFormatLite::BytesSize(const absl::string_view value) {
return LengthDelimitedSize(value.size());
}
template <typename MessageType>
inline size_t WireFormatLite::GroupSize(const MessageType& value) {

Loading…
Cancel
Save