1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef STREAM_H
- #define STREAM_H
- #include "common/utils/Types.h"
- #include "common/utils/DataVector.h"
- class Stream {
- public:
- Stream();
- Stream(size_t capacity);
- bool readSocket(int socket);
- void sendToSocket(int socket) const;
- bool hasData() const;
- bool hasError() const;
- void clearError();
- void write(const void* writeData, size_t length);
- void write(const char* writeData);
- void writeUnsignedChar(u8 uc);
- void writeUnsignedShort(u16 us);
- void writeUnsignedInt(u32 ui);
- void read(void* buffer, size_t length);
- u8 readUnsignedChar();
- u16 readUnsignedShort();
- u32 readUnsignedInt();
- private:
- DataVector data;
- bool error;
- size_t writeIndex;
- size_t readIndex;
- };
- #endif
|