summaryrefslogtreecommitdiff
path: root/chromium/net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder.cc
blob: ad5bb547e61fdf75d8379f1169261367539b3c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder.h"

#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"

namespace http2 {

std::string HpackStringDecoder::DebugString() const {
  return quiche::QuicheStrCat(
      "HpackStringDecoder(state=", StateToString(state_),
      ", length=", length_decoder_.DebugString(), ", remaining=", remaining_,
      ", huffman=", huffman_encoded_ ? "true)" : "false)");
}

// static
std::string HpackStringDecoder::StateToString(StringDecoderState v) {
  switch (v) {
    case kStartDecodingLength:
      return "kStartDecodingLength";
    case kDecodingString:
      return "kDecodingString";
    case kResumeDecodingLength:
      return "kResumeDecodingLength";
  }
  return quiche::QuicheStrCat("UNKNOWN_STATE(", static_cast<uint32_t>(v), ")");
}

std::ostream& operator<<(std::ostream& out, const HpackStringDecoder& v) {
  return out << v.DebugString();
}

}  // namespace http2