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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 | 57 |
58 // Creates an Input from a std::string. The lifetimes are a bit subtle when | 58 // Creates an Input from a std::string. The lifetimes are a bit subtle when |
59 // using this function: The constructed Input is only valid so long as |s| is | 59 // using this function: The constructed Input is only valid so long as |s| is |
60 // still alive and not mutated. | 60 // still alive and not mutated. |
61 Input(const std::string* s); | 61 Input(const std::string* s); |
62 | 62 |
63 // Returns the length in bytes of an Input's data. | 63 // Returns the length in bytes of an Input's data. |
64 size_t Length() const { return len_; } | 64 size_t Length() const { return len_; } |
65 | 65 |
66 // Return true if the Input's data and |other|'s data are byte-wise equal. | 66 // Return true if the Input's data and |other|'s data are byte-wise equal. |
67 bool Equals(const Input& other) const; | 67 bool operator==(const Input& other) const; |
mattm
2016/02/04 18:55:29
The style guide said to: "Prefer to define non-mod
svaldez
2016/02/04 19:11:00
Done.
| |
68 | |
69 // Return true if the Input's data and |other|'s data are not byte-wise equal. | |
70 bool operator!=(const Input& other) const; | |
68 | 71 |
69 // Returns a pointer to the Input's data. This method is marked as "unsafe" | 72 // Returns a pointer to the Input's data. This method is marked as "unsafe" |
70 // because access to the Input's data should be done through ByteReader | 73 // because access to the Input's data should be done through ByteReader |
71 // instead. This method should only be used where using a ByteReader truly | 74 // instead. This method should only be used where using a ByteReader truly |
72 // is not an option. | 75 // is not an option. |
73 const uint8_t* UnsafeData() const { return data_; } | 76 const uint8_t* UnsafeData() const { return data_; } |
74 | 77 |
75 // Returns a copy of the data represented by this object as a std::string. | 78 // Returns a copy of the data represented by this object as a std::string. |
76 std::string AsString() const; | 79 std::string AsString() const; |
77 | 80 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 explicit Mark(const uint8_t* ptr); | 179 explicit Mark(const uint8_t* ptr); |
177 Mark(); | 180 Mark(); |
178 const uint8_t* ptr_; | 181 const uint8_t* ptr_; |
179 }; | 182 }; |
180 | 183 |
181 } // namespace der | 184 } // namespace der |
182 | 185 |
183 } // namespace net | 186 } // namespace net |
184 | 187 |
185 #endif // NET_DER_INPUT_H_ | 188 #endif // NET_DER_INPUT_H_ |
OLD | NEW |