ByteStream.h 627 B

1234567891011121314151617181920212223242526272829303132
  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. #ifndef BYTESTREAM_H
  9. #define BYTESTREAM_H
  10. #include <vector>
  11. #include <stdint.h>
  12. class NativeByteBuffer;
  13. class ByteStream {
  14. public:
  15. ByteStream();
  16. ~ByteStream();
  17. void append(NativeByteBuffer *buffer);
  18. bool hasData();
  19. void get(NativeByteBuffer *dst);
  20. void discard(uint32_t count);
  21. void clean();
  22. private:
  23. std::vector<NativeByteBuffer *> buffersQueue;
  24. };
  25. #endif