OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DER_INPUT_H_ | 5 #ifndef NET_DER_INPUT_H_ |
6 #define NET_DER_INPUT_H_ | 6 #define NET_DER_INPUT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 explicit Input(const uint8_t(&data)[N]) | 48 explicit Input(const uint8_t(&data)[N]) |
49 : data_(data), len_(N) {} | 49 : data_(data), len_(N) {} |
50 | 50 |
51 // Creates an Input from the given |data| and |len|. | 51 // Creates an Input from the given |data| and |len|. |
52 Input(const uint8_t* data, size_t len); | 52 Input(const uint8_t* data, size_t len); |
53 | 53 |
54 // Returns the length in bytes of an Input's data. | 54 // Returns the length in bytes of an Input's data. |
55 size_t Length() const { return len_; } | 55 size_t Length() const { return len_; } |
56 | 56 |
57 // Return true if the Input's data and |other|'s data are byte-wise equal. | 57 // Return true if the Input's data and |other|'s data are byte-wise equal. |
58 bool Equals(const Input& other) const; | 58 bool Equals(const Input& other) const; |
eroman
2016/02/03 22:54:46
Should delete Equals if introducing operator== so
svaldez
2016/02/04 19:03:25
Splitting out into separate CL.
| |
59 bool operator==(const Input& other) const; | |
59 | 60 |
60 // Returns a pointer to the Input's data. This method is marked as "unsafe" | 61 // Returns a pointer to the Input's data. This method is marked as "unsafe" |
61 // because access to the Input's data should be done through ByteReader | 62 // because access to the Input's data should be done through ByteReader |
62 // instead. This method should only be used where using a ByteReader truly | 63 // instead. This method should only be used where using a ByteReader truly |
63 // is not an option. | 64 // is not an option. |
64 const uint8_t* UnsafeData() const { return data_; } | 65 const uint8_t* UnsafeData() const { return data_; } |
65 | 66 |
66 // Returns a copy of the data represented by this object as a std::string. | 67 // Returns a copy of the data represented by this object as a std::string. |
67 std::string AsString() const; | 68 std::string AsString() const; |
68 | 69 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 explicit Mark(const uint8_t* ptr); | 157 explicit Mark(const uint8_t* ptr); |
157 Mark(); | 158 Mark(); |
158 const uint8_t* ptr_; | 159 const uint8_t* ptr_; |
159 }; | 160 }; |
160 | 161 |
161 } // namespace der | 162 } // namespace der |
162 | 163 |
163 } // namespace net | 164 } // namespace net |
164 | 165 |
165 #endif // NET_DER_INPUT_H_ | 166 #endif // NET_DER_INPUT_H_ |
OLD | NEW |