Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1294)

Side by Side Diff: net/http2/hpack/hpack_string.h

Issue 2606733004: Add HpackDecoderTables, static and dynamic tables for decoding HPACK. (Closed)
Patch Set: Move random_util.* to test build target. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http2/hpack/hpack_static_table_entries.inc ('k') | net/http2/hpack/hpack_string.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_HTTP2_HPACK_HPACK_STRING_H_ 5 #ifndef NET_HTTP2_HPACK_HPACK_STRING_H_
6 #define NET_HTTP2_HPACK_HPACK_STRING_H_ 6 #define NET_HTTP2_HPACK_HPACK_STRING_H_
7 7
8 // HpackString is currently a very simple container for a string, but allows us 8 // HpackString is currently a very simple container for a string, but allows us
9 // to relatively easily experiment with alternate string storage mechanisms for 9 // to relatively easily experiment with alternate string storage mechanisms for
10 // handling strings to be encoded with HPACK, or decoded from HPACK, such as 10 // handling strings to be encoded with HPACK, or decoded from HPACK, such as
(...skipping 12 matching lines...) Expand all
23 class NET_EXPORT_PRIVATE HpackString { 23 class NET_EXPORT_PRIVATE HpackString {
24 public: 24 public:
25 explicit HpackString(const char* data); 25 explicit HpackString(const char* data);
26 explicit HpackString(base::StringPiece str); 26 explicit HpackString(base::StringPiece str);
27 explicit HpackString(std::string str); 27 explicit HpackString(std::string str);
28 HpackString(const HpackString& other); 28 HpackString(const HpackString& other);
29 29
30 // Not sure yet whether this move ctor is required/sensible. 30 // Not sure yet whether this move ctor is required/sensible.
31 HpackString(HpackString&& other) = default; 31 HpackString(HpackString&& other) = default;
32 32
33 HpackString& operator=(const HpackString& other) = default;
Bence 2016/12/28 14:56:41 I need to explicitly define a copy assignment oper
34
33 ~HpackString(); 35 ~HpackString();
34 36
35 size_t size() const { return str_.size(); } 37 size_t size() const { return str_.size(); }
36 const std::string& ToString() const { return str_; } 38 const std::string& ToString() const { return str_; }
37 operator base::StringPiece() const; 39 operator base::StringPiece() const;
38 40
39 bool operator==(const HpackString& other) const; 41 bool operator==(const HpackString& other) const;
40 42
41 bool operator==(base::StringPiece str) const; 43 bool operator==(base::StringPiece str) const;
42 44
43 private: 45 private:
44 std::string str_; 46 std::string str_;
45 }; 47 };
46 48
47 NET_EXPORT_PRIVATE bool operator==(base::StringPiece a, const HpackString& b); 49 NET_EXPORT_PRIVATE bool operator==(base::StringPiece a, const HpackString& b);
48 NET_EXPORT_PRIVATE bool operator!=(base::StringPiece a, const HpackString& b); 50 NET_EXPORT_PRIVATE bool operator!=(base::StringPiece a, const HpackString& b);
49 NET_EXPORT_PRIVATE bool operator!=(const HpackString& a, const HpackString& b); 51 NET_EXPORT_PRIVATE bool operator!=(const HpackString& a, const HpackString& b);
50 NET_EXPORT_PRIVATE bool operator!=(const HpackString& a, base::StringPiece b); 52 NET_EXPORT_PRIVATE bool operator!=(const HpackString& a, base::StringPiece b);
51 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, 53 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
52 const HpackString& v); 54 const HpackString& v);
53 55
56 struct NET_EXPORT_PRIVATE HpackStringPair {
57 HpackStringPair(const HpackString& name, const HpackString& value);
58 HpackStringPair(base::StringPiece name, base::StringPiece value);
59 ~HpackStringPair();
60
61 // Returns the size of a header entry with this name and value, per the RFC:
62 // http://httpwg.org/specs/rfc7541.html#calculating.table.size
63 size_t size() const { return 32 + name.size() + value.size(); }
64
65 std::string DebugString() const;
66
67 HpackString name;
Bence 2016/12/28 14:56:41 These member cannot be const: it is not possible f
68 HpackString value;
69 };
70
71 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
72 const HpackStringPair& p);
73
54 } // namespace net 74 } // namespace net
55 75
56 #endif // NET_HTTP2_HPACK_HPACK_STRING_H_ 76 #endif // NET_HTTP2_HPACK_HPACK_STRING_H_
OLDNEW
« no previous file with comments | « net/http2/hpack/hpack_static_table_entries.inc ('k') | net/http2/hpack/hpack_string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698