38 explicit BinStream(
bool bLittleEndian) : mLittleEndian(bLittleEndian) {
41#ifdef VIDEO_STANDARD_PAL
58 void Read(
void *pData,
int nBytes);
69 void Write(
const void *pData,
int nBytes);
85 void EnableReadEncryption();
92 void DisableEncryption();
109 virtual void Read(
void *pData,
int nBytes) = 0;
117 virtual void Write(
const void *pData,
int nBytes) = 0;
123#ifndef VIDEO_STANDARD_PAL
163 virtual void Mark(
const char *pszMark) {
220#ifdef VIDEO_STANDARD_PAL
227 virtual void ReadImpl(
void *pData,
int nBytes) = 0;
235 virtual void WriteImpl(
const void *pData,
int nBytes) = 0;
243 virtual void SeekImpl(
int nOffset,
SeekType eFrom) = 0;
248#ifdef VIDEO_STANDARD_PAL
249 std::unique_ptr<Rand> mCrypto;
311 const int nSize =
static_cast<int>(elements.size());
313 for (
const T &element : elements) {
370 elements.resize(nSize, T());
371 for (T &element : elements) {
391 const int nSize =
static_cast<int>(elements.size());
393 for (
const T &element : elements) {
416 elements.resize(nSize, T());
417 for (T &element : elements) {
BinStream & operator>>(BinStream &stream, String &text)
Read text into a string.
BinStream & operator<<(BinStream &stream, const std::vector< T > &elements)
Write a vector as its element count followed by each element.
Definition binstream.h:310
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
void ReadEndian(void *pData, int nBytes)
Read a value of 2, 4, 8, or 16 bytes, reversing its bytes unless the stream is little endian.
virtual void Read(void *pData, int nBytes)=0
Read bytes.
virtual bool Eof()=0
Report whether the position is at the end.
void ReadString(String &text)
Read a length-prefixed string.
void ReadString(char *pszBuffer, int nSize)
Read a length-prefixed string into a buffer and terminate it.
SeekType
Origins of Seek().
Definition binstream.h:25
@ kSeekEnd
Definition binstream.h:28
@ kSeekCurrent
Definition binstream.h:27
@ kSeekBegin
Definition binstream.h:26
virtual int Tell()=0
Report the position.
virtual void Flush()=0
Write out buffered data.
virtual bool Fail()=0
Report whether a transfer failed.
BinStream(bool bLittleEndian)
Construct a stream.
Definition binstream.h:38
virtual void Write(const void *pData, int nBytes)=0
Write bytes.
virtual ~BinStream()
Release the stream.
Definition binstream.h:100
virtual void Mark(const char *pszMark)
Receive a named mark in the data, such as the end of a chunk.
Definition binstream.h:163
BinStream & WriteString(const char *pszText)
Write a string with its length first.
void WriteEndian(const void *pData, int nBytes)
Write a value of 2, 4, 8, or 16 bytes, reversing its bytes unless the stream is little endian.
virtual void Seek(int nOffset, SeekType eFrom)=0
Move the position.
Growable text buffer that is also a PrnStream.
Definition string.h:19