blob: 0b9eb5968350d4bed6ae716aa049a01b253b0f98 [file] [log] [blame]
QUICHE teamfd50a402018-12-07 22:54:05 -05001// 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 "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder.h"
6
7#include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
8
9namespace http2 {
10
11Http2String HpackStringDecoder::DebugString() const {
12 return Http2StrCat("HpackStringDecoder(state=", StateToString(state_),
13 ", length=", length_decoder_.DebugString(),
14 ", remaining=", remaining_,
15 ", huffman=", huffman_encoded_ ? "true)" : "false)");
16}
17
18// static
19Http2String 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 Http2StrCat("UNKNOWN_STATE(", static_cast<uint32_t>(v), ")");
29}
30
31std::ostream& operator<<(std::ostream& out, const HpackStringDecoder& v) {
32 return out << v.DebugString();
33}
34
35} // namespace http2