OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http2/hpack/hpack_string.h" | 5 #include "net/http2/hpack/hpack_string.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/logging.h" |
| 10 |
9 using base::StringPiece; | 11 using base::StringPiece; |
10 using std::string; | 12 using std::string; |
11 | 13 |
12 namespace net { | 14 namespace net { |
13 | 15 |
14 HpackString::HpackString(const char* data) : str_(data) {} | 16 HpackString::HpackString(const char* data) : str_(data) {} |
15 HpackString::HpackString(StringPiece str) : str_(str.as_string()) {} | 17 HpackString::HpackString(StringPiece str) : str_(str.as_string()) {} |
16 HpackString::HpackString(string str) : str_(std::move(str)) {} | 18 HpackString::HpackString(string str) : str_(std::move(str)) {} |
17 HpackString::HpackString(const HpackString& other) : str_(other.str_) {} | 19 HpackString::HpackString(const HpackString& other) : str_(other.str_) {} |
18 HpackString::~HpackString() {} | 20 HpackString::~HpackString() {} |
(...skipping 18 matching lines...) Expand all Loading... |
37 bool operator!=(const HpackString& a, const HpackString& b) { | 39 bool operator!=(const HpackString& a, const HpackString& b) { |
38 return !(a == b); | 40 return !(a == b); |
39 } | 41 } |
40 bool operator!=(const HpackString& a, StringPiece b) { | 42 bool operator!=(const HpackString& a, StringPiece b) { |
41 return !(a == b); | 43 return !(a == b); |
42 } | 44 } |
43 std::ostream& operator<<(std::ostream& out, const HpackString& v) { | 45 std::ostream& operator<<(std::ostream& out, const HpackString& v) { |
44 return out << v.ToString(); | 46 return out << v.ToString(); |
45 } | 47 } |
46 | 48 |
| 49 HpackStringPair::HpackStringPair(const HpackString& name, |
| 50 const HpackString& value) |
| 51 : name(name), value(value) { |
| 52 DVLOG(3) << DebugString() << " ctor"; |
| 53 } |
| 54 |
| 55 HpackStringPair::HpackStringPair(StringPiece name, StringPiece value) |
| 56 : name(name), value(value) { |
| 57 DVLOG(3) << DebugString() << " ctor"; |
| 58 } |
| 59 |
| 60 HpackStringPair::~HpackStringPair() { |
| 61 DVLOG(3) << DebugString() << " dtor"; |
| 62 } |
| 63 |
| 64 string HpackStringPair::DebugString() const { |
| 65 string debug_string("HpackStringPair(name="); |
| 66 debug_string.append(name.ToString()); |
| 67 debug_string.append(", value="); |
| 68 debug_string.append(value.ToString()); |
| 69 debug_string.append(")"); |
| 70 return debug_string; |
| 71 } |
| 72 |
| 73 std::ostream& operator<<(std::ostream& os, const HpackStringPair& p) { |
| 74 os << p.DebugString(); |
| 75 return os; |
| 76 } |
| 77 |
47 } // namespace net | 78 } // namespace net |
OLD | NEW |