wavelength 1.0.0
Loading...
Searching...
No Matches
bufstream.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/binstream.h"
4
12class BufStream : public BinStream {
13public:
25 BufStream(char *pBuffer, int nSize, bool bLittleEndian);
26
33 ~BufStream() override = default;
34
43#ifdef VIDEO_STANDARD_PAL
44 void ReadImpl(void *pData, int nBytes) override;
45#else
46 void Read(void *pData, int nBytes) override;
47#endif
48
57#ifdef VIDEO_STANDARD_PAL
58 void WriteImpl(const void *pData, int nBytes) override;
59#else
60 void Write(const void *pData, int nBytes) override;
61#endif
62
69 void Flush() override {
70 }
71
80#ifdef VIDEO_STANDARD_PAL
81 void SeekImpl(int nOffset, SeekType eFrom) override;
82#else
83 void Seek(int nOffset, SeekType eFrom) override;
84#endif
85
93 int Tell() override {
94 return mPosition;
95 }
96
104 bool Eof() override {
105 return mPosition == mSize;
106 }
107
115 bool Fail() override {
116 return mFail != 0;
117 }
118
119private:
120 char *mBuffer;
121 int mFail;
122 int mPosition;
123 int mSize;
124};
SeekType
Origins of Seek().
Definition binstream.h:25
BinStream(bool bLittleEndian)
Construct a stream.
Definition binstream.h:38
void Write(const void *pData, int nBytes) override
Write bytes.
~BufStream() override=default
Release the stream.
int Tell() override
Report the position.
Definition bufstream.h:93
BufStream(char *pBuffer, int nSize, bool bLittleEndian)
Construct a stream at the start of a buffer.
void Seek(int nOffset, SeekType eFrom) override
Move the position, failing the stream when it would leave the buffer.
void Flush() override
Do nothing.
Definition bufstream.h:69
void Read(void *pData, int nBytes) override
Read bytes.
bool Eof() override
Report whether the position is at the end of the buffer.
Definition bufstream.h:104
bool Fail() override
Report whether a transfer ran past the end.
Definition bufstream.h:115