xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/spdy/core/hpack/hpack_entry.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "quiche/spdy/core/hpack/hpack_entry.h"
6 
7 #include <cstddef>
8 #include <string>
9 #include <utility>
10 
11 #include "absl/strings/str_cat.h"
12 #include "absl/strings/string_view.h"
13 
14 namespace spdy {
15 
HpackEntry(std::string name,std::string value)16 HpackEntry::HpackEntry(std::string name, std::string value)
17     : name_(std::move(name)), value_(std::move(value)) {}
18 
19 // static
Size(absl::string_view name,absl::string_view value)20 size_t HpackEntry::Size(absl::string_view name, absl::string_view value) {
21   return name.size() + value.size() + kHpackEntrySizeOverhead;
22 }
Size() const23 size_t HpackEntry::Size() const { return Size(name(), value()); }
24 
GetDebugString() const25 std::string HpackEntry::GetDebugString() const {
26   return absl::StrCat("{ name: \"", name_, "\", value: \"", value_, "\" }");
27 }
28 
29 }  // namespace spdy
30