| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ | 5 #ifndef NET_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ |
| 6 #define NET_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ | 6 #define NET_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "net/base/net_export.h" | |
| 11 #include "net/spdy/core/spdy_pinnable_buffer_piece.h" | 10 #include "net/spdy/core/spdy_pinnable_buffer_piece.h" |
| 11 #include "net/spdy/platform/api/spdy_export.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 // Reader class which simplifies reading contiguously from | 15 // Reader class which simplifies reading contiguously from |
| 16 // from a disjoint buffer prefix & suffix. | 16 // from a disjoint buffer prefix & suffix. |
| 17 class NET_EXPORT_PRIVATE SpdyPrefixedBufferReader { | 17 class SPDY_EXPORT_PRIVATE SpdyPrefixedBufferReader { |
| 18 public: | 18 public: |
| 19 SpdyPrefixedBufferReader(const char* prefix, size_t prefix_length, | 19 SpdyPrefixedBufferReader(const char* prefix, size_t prefix_length, |
| 20 const char* suffix, size_t suffix_length); | 20 const char* suffix, size_t suffix_length); |
| 21 | 21 |
| 22 // Returns number of bytes available to be read. | 22 // Returns number of bytes available to be read. |
| 23 size_t Available(); | 23 size_t Available(); |
| 24 | 24 |
| 25 // Reads |count| bytes, copying into |*out|. Returns true on success, | 25 // Reads |count| bytes, copying into |*out|. Returns true on success, |
| 26 // false if not enough bytes were available. | 26 // false if not enough bytes were available. |
| 27 bool ReadN(size_t count, char* out); | 27 bool ReadN(size_t count, char* out); |
| 28 | 28 |
| 29 // Reads |count| bytes, returned in |*out|. Returns true on success, | 29 // Reads |count| bytes, returned in |*out|. Returns true on success, |
| 30 // false if not enough bytes were available. | 30 // false if not enough bytes were available. |
| 31 bool ReadN(size_t count, SpdyPinnableBufferPiece* out); | 31 bool ReadN(size_t count, SpdyPinnableBufferPiece* out); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 const char* prefix_; | 34 const char* prefix_; |
| 35 const char* suffix_; | 35 const char* suffix_; |
| 36 | 36 |
| 37 size_t prefix_length_; | 37 size_t prefix_length_; |
| 38 size_t suffix_length_; | 38 size_t suffix_length_; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace net | 41 } // namespace net |
| 42 | 42 |
| 43 #endif // NET_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ | 43 #endif // NET_SPDY_CORE_SPDY_PREFIXED_BUFFER_READER_H_ |
| OLD | NEW |