wavelength 1.0.0
Loading...
Searching...
No Matches
memstream.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "os/binstream.h"
6
13class MemStream : public BinStream {
14public:
21 ~MemStream() override = default;
22
30 explicit MemStream(bool bLittleEndian);
31
40#ifdef VIDEO_STANDARD_PAL
41 void ReadImpl(void *pData, int nBytes) override;
42#else
43 void Read(void *pData, int nBytes) override;
44#endif
45
54#ifdef VIDEO_STANDARD_PAL
55 void WriteImpl(const void *pData, int nBytes) override;
56#else
57 void Write(const void *pData, int nBytes) override;
58#endif
59
66 void Flush() override;
67
76#ifdef VIDEO_STANDARD_PAL
77 void SeekImpl(int nOffset, SeekType eFrom) override;
78#else
79 void Seek(int nOffset, SeekType eFrom) override;
80#endif
81
89 int Tell() override;
90
98 bool Eof() override;
99
107 bool Fail() override;
108
110 std::vector<char> &GetBuffer() {
111 return mBuffer;
112 }
113
114private:
115 int mFail;
116 int mTell;
117 std::vector<char> mBuffer;
118};
SeekType
Origins of Seek().
Definition binstream.h:25
BinStream(bool bLittleEndian)
Construct a stream.
Definition binstream.h:38
int Tell() override
Report the position.
void Read(void *pData, int nBytes) override
Copy bytes out from the position.
void Seek(int nOffset, SeekType eFrom) override
Move the position.
bool Eof() override
Report whether the position is at the end of the bytes.
void Flush() override
Do nothing, since the bytes stay in memory.
~MemStream() override=default
Destroy the object.
bool Fail() override
Report whether a transfer failed.
void Write(const void *pData, int nBytes) override
Copy bytes in at the position, growing the buffer.
std::vector< char > & GetBuffer()
Definition memstream.h:110
MemStream(bool bLittleEndian)
Construct an empty stream with room for 4096 bytes.