|
wavelength 1.0.0
|
BinStream over a buffer the caller provides. More...
#include <bufstream.h>


Public Member Functions | |
| BufStream (char *pBuffer, int nSize, bool bLittleEndian) | |
| Construct a stream at the start of a buffer. | |
| ~BufStream () override=default | |
| Release the stream. | |
| void | Read (void *pData, int nBytes) override |
| Read bytes. | |
| void | Write (const void *pData, int nBytes) override |
| Write bytes. | |
| void | Flush () override |
| Do nothing. | |
| void | Seek (int nOffset, SeekType eFrom) override |
| Move the position, failing the stream when it would leave the buffer. | |
| int | Tell () override |
| Report the position. | |
| bool | Eof () override |
| Report whether the position is at the end of the buffer. | |
| bool | Fail () override |
| Report whether a transfer ran past the end. | |
| BufStream (char *buffer, int size, bool littleEndian) | |
| Start a stream at the beginning of a buffer. | |
| virtual | ~BufStream () |
| Destroy the stream. | |
| virtual void | Read (void *data, int bytes) |
| Copy bytes out of the buffer. | |
| virtual void | Write (const void *data, int bytes) |
| Copy bytes into the buffer. | |
| virtual void | Flush () |
| Do nothing; the buffer holds every byte written. | |
| virtual void | Seek (int offset, SeekType type) |
| Move the position, failing the stream when it would leave the buffer. | |
| virtual int | Tell () |
| virtual bool | Eof () |
| virtual bool | Fail () |
| Public Member Functions inherited from BinStream | |
| BinStream (bool bLittleEndian) | |
| Construct a stream. | |
| virtual | ~BinStream () |
| Release the stream. | |
| 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 | 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) |
Additional Inherited Members | |
| Public Types inherited from BinStream | |
| 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... | |
BinStream over a buffer the caller provides.
Stream over a buffer the caller provides.
The RTTI includes the class name and records BinStream as the base. A read past the end of the buffer is shortened to the bytes left and marks the stream failed. Only the members its callers here use are declared.
The RTTI records the class as deriving from BinStream. The object is 0x18 bytes. A transfer that would pass the end is cut to the bytes that remain and marks the stream failed.
| BufStream::BufStream | ( | char * | pBuffer, |
| int | nSize, | ||
| bool | bLittleEndian ) |
Construct a stream at the start of a buffer.
A null buffer starts the stream failed.
| pBuffer | The buffer. The caller retains it. |
| nSize | The size of the buffer in bytes. |
| bLittleEndian | Whether values are stored in the console's byte order. |
|
overridedefault |
Release the stream.
The buffer is not released.
| BufStream::BufStream | ( | char * | buffer, |
| int | size, | ||
| bool | littleEndian ) |
Start a stream at the beginning of a buffer.
A null buffer makes a failed stream.
| buffer | The buffer, or null. |
| size | The size of the buffer in bytes. |
| littleEndian | Whether values are stored least significant byte first. |
|
virtual |
Destroy the stream.
The buffer is not released.
|
overridevirtual |
Read bytes.
| pData | The destination. |
| nBytes | The number of bytes. |
Implements BinStream.
|
overridevirtual |
Write bytes.
| pData | The source. |
| nBytes | The number of bytes. |
Implements BinStream.
|
inlineoverridevirtual |
Do nothing.
Implements BinStream.
|
overridevirtual |
Move the position, failing the stream when it would leave the buffer.
| nOffset | The offset in bytes. |
| eFrom | The origin of the offset. |
Implements BinStream.
|
inlineoverridevirtual |
Report the position.
Implements BinStream.
|
inlineoverridevirtual |
Report whether the position is at the end of the buffer.
Implements BinStream.
|
inlineoverridevirtual |
Report whether a transfer ran past the end.
Implements BinStream.
|
virtual |
Copy bytes out of the buffer.
| data | Receives the bytes. |
| bytes | The number of bytes. |
Implements BinStream.
|
virtual |
Copy bytes into the buffer.
| data | The bytes. |
| bytes | The number of bytes. |
Implements BinStream.
|
inlinevirtual |
Do nothing; the buffer holds every byte written.
Implements BinStream.
|
virtual |
Move the position, failing the stream when it would leave the buffer.
| offset | The offset in bytes. |
| type | The origin of the offset. Another value leaves the position unchanged. |
Implements BinStream.
|
virtual |
|
virtual |
Implements BinStream.
|
virtual |
Implements BinStream.