|
wavelength 1.0.0
|
Stream of raw bytes, the base of the memory, file, and network streams. More...
#include <binstream.h>

Public Types | |
| enum | SeekType { kSeekBegin = 0 , kSeekCurrent = 1 , kSeekEnd = 2 , kSeekBegin = 0 , kSeekCurrent = 1 , kSeekEnd = 2 } |
| Origins of Seek(). More... | |
| enum | SeekType { kSeekBegin = 0 , kSeekCurrent = 1 , kSeekEnd = 2 , kSeekBegin = 0 , kSeekCurrent = 1 , kSeekEnd = 2 } |
| The origin of Seek(). More... | |
Public Member Functions | |
| BinStream (bool bLittleEndian) | |
| Construct a stream. | |
| virtual | ~BinStream () |
| Release the stream. | |
| virtual void | Read (void *pData, int nBytes)=0 |
| Read bytes. | |
| virtual void | Write (const void *pData, int nBytes)=0 |
| Write bytes. | |
| virtual void | Flush ()=0 |
| Write out buffered data. | |
| virtual void | Seek (int nOffset, SeekType eFrom)=0 |
| Move the position. | |
| virtual int | Tell ()=0 |
| Report the position. | |
| virtual bool | Eof ()=0 |
| Report whether the position is at the end. | |
| virtual bool | Fail ()=0 |
| Report whether a transfer failed. | |
| virtual void | Mark (const char *pszMark) |
| Receive a named mark in the data, such as the end of a chunk. | |
| void | ReadString (char *pszBuffer, int nSize) |
| Read a length-prefixed string into a buffer and terminate it. | |
| void | ReadString (String &text) |
| Read a length-prefixed string. | |
| BinStream & | WriteString (const char *pszText) |
| Write a string with its length first. | |
| 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. | |
| 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. | |
| BinStream (bool littleEndian) | |
| Set the byte order. | |
| virtual | ~BinStream () |
| Destroy the stream. | |
| virtual void | Read (void *data, int bytes)=0 |
| Read bytes. | |
| virtual void | Write (const void *data, int bytes)=0 |
| Write bytes. | |
| virtual void | Flush ()=0 |
| Write out buffered data. | |
| virtual void | Seek (int offset, SeekType type)=0 |
| Move the position. | |
| virtual int | Tell ()=0 |
| virtual bool | Eof ()=0 |
| virtual bool | Fail ()=0 |
| virtual void | NoOp (int) |
| Do nothing. | |
| void | ReadEndian (void *data, int bytes) |
| Read a value, swapping its bytes into the host order. | |
| void | WriteEndian (const void *data, int bytes) |
| Write a value, swapping its bytes into the stream order. | |
| BinStream & | operator<< (const char *str) |
| Write text as its length followed by its characters, without a terminator. | |
| BinStream & | operator>> (String &str) |
| Read text written by operator<<(const char *). | |
| void | ReadString (char *buffer, int bufSize) |
| Read text written by operator<<(const char *) into a buffer, and terminate it. | |
| BinStream & | operator<< (char c) |
| BinStream & | operator<< (unsigned char c) |
| BinStream & | operator<< (short s) |
| BinStream & | operator<< (unsigned short s) |
| BinStream & | operator<< (int i) |
| BinStream & | operator<< (unsigned int i) |
| BinStream & | operator<< (float f) |
| BinStream & | operator>> (char &c) |
| BinStream & | operator>> (unsigned char &c) |
| BinStream & | operator>> (short &s) |
| BinStream & | operator>> (unsigned short &s) |
| BinStream & | operator>> (int &i) |
| BinStream & | operator>> (unsigned int &i) |
| BinStream & | operator>> (float &f) |
Stream of raw bytes, the base of the memory, file, and network streams.
Base of the streams that read and write binary data.
The RTTI includes the class name. One data word precedes the vptr at +0x04. Read() and Write() are pure in this class. Only the members its callers here use are declared.
In the European release the decryption generator follows that word and the vptr is at +0x08. Read(), Write(), and Seek() there are plain members that call the virtual ReadImpl(), WriteImpl(), and SeekImpl(). In the binary those take the vtable slots of the originals, with SeekImpl() before Flush(). Here they are protected and declared after the public members, and the vtable order differs from the binary's.
The object is 8 bytes. Values wider than a byte are stored least significant byte first when the stream is little-endian, and are byte-swapped otherwise.
| enum BinStream::SeekType |
Origins of Seek().
| enum BinStream::SeekType |
The origin of Seek().
|
inlineexplicit |
Construct a stream.
| bLittleEndian | Whether values are stored in the console's byte order. |
|
inlinevirtual |
Release the stream.
| BinStream::BinStream | ( | bool | littleEndian | ) |
Set the byte order.
| littleEndian | Whether values are stored least significant byte first. |
|
inlinevirtual |
Destroy the stream.
|
pure virtual |
Read bytes.
| pData | The destination. |
| nBytes | The number of bytes. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Write bytes.
| pData | The source. |
| nBytes | The number of bytes. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Write out buffered data.
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Move the position.
| nOffset | The offset in bytes. |
| eFrom | The origin of the offset. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Report the position.
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Report whether the position is at the end.
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Report whether a transfer failed.
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
inlinevirtual |
Receive a named mark in the data, such as the end of a chunk.
The base ignores the mark. ChunkStream ends its block at a mark of g_szChunkMark.
| pszMark | The mark. |
Reimplemented in ChunkStream.
| void BinStream::ReadString | ( | char * | pszBuffer, |
| int | nSize ) |
Read a length-prefixed string into a buffer and terminate it.
The length is not checked against the size of the buffer.
| pszBuffer | Receives the text. The caller provides room for it. |
| nSize | The size of the buffer. |
| void BinStream::ReadString | ( | String & | text | ) |
Read a length-prefixed string.
| text | Receives the text. |
| BinStream & BinStream::WriteString | ( | const char * | pszText | ) |
Write a string with its length first.
| pszText | The text. |
| void BinStream::ReadEndian | ( | void * | pData, |
| int | nBytes ) |
Read a value of 2, 4, 8, or 16 bytes, reversing its bytes unless the stream is little endian.
| pData | The destination. |
| nBytes | The size of the value. |
| void BinStream::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.
| pData | The source. |
| nBytes | The size of the value. |
|
pure virtual |
Read bytes.
| data | Receives the bytes. |
| bytes | The number of bytes. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Write bytes.
| data | The bytes. |
| bytes | The number of bytes. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Write out buffered data.
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Move the position.
| offset | The offset in bytes. |
| type | The origin of the offset. |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
pure virtual |
Implemented in AsyncStream, BufStream, BufStream, ChunkStream, FileStream, FileStream, and MemStream.
|
inlinevirtual |
Do nothing.
No stream of the control overrides or calls this, and its purpose is not known.
| void BinStream::ReadEndian | ( | void * | data, |
| int | bytes ) |
Read a value, swapping its bytes into the host order.
| data | Receives the value. |
| bytes | The size of the value: 2, 4, or 8. |
| void BinStream::WriteEndian | ( | const void * | data, |
| int | bytes ) |
Write a value, swapping its bytes into the stream order.
| data | The value. |
| bytes | The size of the value: 2, 4, or 8. |
| BinStream & BinStream::operator<< | ( | const char * | str | ) |
Write text as its length followed by its characters, without a terminator.
| str | The text. |
Read text written by operator<<(const char *).
| str | Receives the text. |
| void BinStream::ReadString | ( | char * | buffer, |
| int | bufSize ) |
Read text written by operator<<(const char *) into a buffer, and terminate it.
| buffer | Receives the text. |
| bufSize | The size of the buffer, which must exceed the length of the text. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |