xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/http2/hpack/decoder/hpack_string_decoder.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2016 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/http2/hpack/decoder/hpack_string_decoder.h"
6 
7 #include "absl/strings/str_cat.h"
8 
9 namespace http2 {
10 
DebugString() const11 std::string HpackStringDecoder::DebugString() const {
12   return absl::StrCat("HpackStringDecoder(state=", StateToString(state_),
13                       ", length=", length_decoder_.DebugString(),
14                       ", remaining=", remaining_,
15                       ", huffman=", huffman_encoded_ ? "true)" : "false)");
16 }
17 
18 // static
StateToString(StringDecoderState v)19 std::string HpackStringDecoder::StateToString(StringDecoderState v) {
20   switch (v) {
21     case kStartDecodingLength:
22       return "kStartDecodingLength";
23     case kDecodingString:
24       return "kDecodingString";
25     case kResumeDecodingLength:
26       return "kResumeDecodingLength";
27   }
28   return absl::StrCat("UNKNOWN_STATE(", static_cast<uint32_t>(v), ")");
29 }
30 
operator <<(std::ostream & out,const HpackStringDecoder & v)31 std::ostream& operator<<(std::ostream& out, const HpackStringDecoder& v) {
32   return out << v.DebugString();
33 }
34 
35 }  // namespace http2
36