OLD | NEW |
(Empty) | |
| 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 "net/http2/hpack/decoder/hpack_string_decoder.h" |
| 6 |
| 7 #include <sstream> |
| 8 |
| 9 namespace net { |
| 10 |
| 11 std::string HpackStringDecoder::DebugString() const { |
| 12 std::stringstream ss; |
| 13 ss << "HpackStringDecoder(state=" << StateToString(state_) |
| 14 << ", length=" << length_decoder_.DebugString() |
| 15 << ", remaining=" << remaining_ |
| 16 << ", huffman=" << (huffman_encoded_ ? "true)" : "false)"); |
| 17 return ss.str(); |
| 18 } |
| 19 |
| 20 // static |
| 21 std::string HpackStringDecoder::StateToString(StringDecoderState v) { |
| 22 switch (v) { |
| 23 case kStartDecodingLength: |
| 24 return "kStartDecodingLength"; |
| 25 case kDecodingString: |
| 26 return "kDecodingString"; |
| 27 case kResumeDecodingLength: |
| 28 return "kResumeDecodingLength"; |
| 29 } |
| 30 std::stringstream ss; |
| 31 ss << "UNKNOWN_STATE(" << static_cast<uint32_t>(v) << ")"; |
| 32 return ss.str(); |
| 33 } |
| 34 |
| 35 std::ostream& operator<<(std::ostream& out, const HpackStringDecoder& v) { |
| 36 return out << v.DebugString(); |
| 37 } |
| 38 |
| 39 } // namespace net |
OLD | NEW |