| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_QUIC_CORE_QUIC_DATA_READER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_DATA_READER_H_ |
| 6 #define NET_QUIC_CORE_QUIC_DATA_READER_H_ | 6 #define NET_QUIC_CORE_QUIC_DATA_READER_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Returns the number of bytes remaining to be read. | 119 // Returns the number of bytes remaining to be read. |
| 120 size_t BytesRemaining() const; | 120 size_t BytesRemaining() const; |
| 121 | 121 |
| 122 // Returns the next byte that to be read. Must not be called when there are no | 122 // Returns the next byte that to be read. Must not be called when there are no |
| 123 // bytes to be read. | 123 // bytes to be read. |
| 124 // | 124 // |
| 125 // DOES NOT forward the internal iterator. | 125 // DOES NOT forward the internal iterator. |
| 126 uint8_t PeekByte() const; | 126 uint8_t PeekByte() const; |
| 127 | 127 |
| 128 void set_endianness(Endianness endianness) { endianness_ = endianness; } |
| 129 |
| 128 private: | 130 private: |
| 129 // Returns true if the underlying buffer has enough room to read the given | 131 // Returns true if the underlying buffer has enough room to read the given |
| 130 // amount of bytes. | 132 // amount of bytes. |
| 131 bool CanRead(size_t bytes) const; | 133 bool CanRead(size_t bytes) const; |
| 132 | 134 |
| 133 // To be called when a read fails for any reason. | 135 // To be called when a read fails for any reason. |
| 134 void OnFailure(); | 136 void OnFailure(); |
| 135 | 137 |
| 136 // The data buffer that we're reading from. | 138 // The data buffer that we're reading from. |
| 137 const char* data_; | 139 const char* data_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 149 | 151 |
| 150 // The endianness to read integers and floating numbers. | 152 // The endianness to read integers and floating numbers. |
| 151 Endianness endianness_; | 153 Endianness endianness_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(QuicDataReader); | 155 DISALLOW_COPY_AND_ASSIGN(QuicDataReader); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace net | 158 } // namespace net |
| 157 | 159 |
| 158 #endif // NET_QUIC_CORE_QUIC_DATA_READER_H_ | 160 #endif // NET_QUIC_CORE_QUIC_DATA_READER_H_ |
| OLD | NEW |