Skip to content

Commit

Permalink
Include string_view in overload set.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 548240332
  • Loading branch information
ckennelly authored and copybara-github committed Jul 14, 2023
1 parent 871fd27 commit cf304cb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/google/protobuf/wire_format_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cf304cb

Please sign in to comment.