| 1 | /* |
| 2 | * This is the source code of tgnet library v. 1.1 |
| 3 | * It is licensed under GNU GPL v. 2 or later. |
| 4 | * You should have received a copy of the license in this archive (see LICENSE). |
| 5 | * |
| 6 | * Copyright Nikolai Kudashov, 2015-2018. |
| 7 | */ |
| 8 | |
| 9 | #ifndef BYTESTREAM_H |
| 10 | #define BYTESTREAM_H |
| 11 | |
| 12 | #include <vector> |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | class NativeByteBuffer; |
| 16 | |
| 17 | class ByteStream { |
| 18 | |
| 19 | public: |
| 20 | ByteStream(); |
| 21 | ~ByteStream(); |
| 22 | void append(NativeByteBuffer *buffer); |
| 23 | bool hasData(); |
| 24 | void get(NativeByteBuffer *dst); |
| 25 | void discard(uint32_t count); |
| 26 | void clean(); |
| 27 | |
| 28 | private: |
| 29 | std::vector<NativeByteBuffer *> buffersQueue; |
| 30 | }; |
| 31 | |
| 32 | #endif |
| 33 | |