|
resonance 1.0.1
|
Seekable data source interface, unrelated to IBStream and OBStream. More...
#include <hxstream.h>

Public Member Functions | |
| virtual | ~HxStream () |
| Close the stream. | |
| virtual void | SetMarker (int nOffset, int nWhence) |
| Move the read position. | |
| virtual int | GetMarker () |
| Report the read position. | |
| virtual int | Size () |
| Report the length of the data. | |
| virtual HxStream & | Write (const void *pSrc, int nSize) |
| Move nSize bytes out of pSrc. | |
| virtual HxStream & | ReadData (void *pDest, int nSize) |
| Move nSize bytes into pDest. | |
| virtual HxStream * | UnderlyingStream () |
| Report the stream this one reads through, if any. | |
| HxStream & | ReadNum (void *pDest, int nSize) |
| Move nSize bytes into pDest, reversing their order when the stream swaps bytes. | |
| HxStream & | WriteNum (const void *pSrc, int nSize) |
| Move nSize bytes out of pSrc, reversing their order when the stream swaps bytes. | |
| HxStream & | ReadStr (char *pszDest, int nDestSize) |
| Read a string with a variable-length size prefix into a fixed buffer. | |
| HxStream & | ReadString (HxStr &str) |
| Read a string with a variable-length size prefix into an HxStr. | |
| HxStream * | GetRootStream () |
| Follow UnderlyingStream() from this stream until a stream reports none, and report that stream. | |
Public Attributes | |
| int | mSwapBytes |
| Non-zero when multi-byte values on the stream are in the opposite byte order. | |
Static Public Attributes | |
| static const int | goodbit |
| Status value of a stream with nothing wrong. | |
| static const int | kStatusEnd |
| Status value of a stream whose read position arrived at the end of its data. | |
| static const int | failbit |
| Status bit a seek outside a chunk's bounds would set. | |
| static const int | badbit |
| Second status bit GetMarker() and SetMarker() of HxIDataChunk test. | |
Protected Member Functions | |
| HxStream () | |
| Construct a stream with a zeroed state. | |
Protected Attributes | |
| int | mStatus |
| int | mFatalOnEnd |
Seekable data source interface, unrelated to IBStream and OBStream.
Its RTTI descriptor is at 0x0086f6c8. It has no base. The class has three data words and stores its vtable pointer after them at +0x0c, the position for a class with no base. The object is 0x10 bytes. Its vtable is at 0x00816d60, emitted once per translation unit that needs it, and the seven slots below are the whole interface.
Every slot has a body here, and each does nothing beyond producing a neutral result, so the class is an interface with defaults rather than an abstract one. Two subclasses are attested, HxMemStream and HxIDataChunk. HxIDataChunk is a RIFF chunk reader and belongs to a different subsystem.
Only HxIDataChunk's two constructors write mFatalOnEnd, each setting it on the chunk itself. No HxMemStream ever has it set. The diagnostic HxMemStream::ReadData() guards on it is therefore unreachable in the shipped build.
|
virtual |
Close the stream.
Vtable slot 1, which is the first of the interface, because the destructor is declared ahead of the transfer virtuals.
|
protected |
Construct a stream with a zeroed state.
|
virtual |
Move the read position.
Vtable slot 2. The return type is void rather than a stream reference, which the two instruction body here and HxMemStream's override both establish.
| nOffset | The signed distance to move. |
| nWhence | The origin, one of the HxStreamSeekOrigin values. |
Reimplemented in HxIDataChunk, and HxMemStream.
|
virtual |
Report the read position.
Vtable slot 3. The default reports 0.
Reimplemented in HxIDataChunk, and HxMemStream.
|
virtual |
Report the length of the data.
Vtable slot 4. The default reports 0.
Reimplemented in HxIDataChunk, and HxMemStream.
|
virtual |
Move nSize bytes out of pSrc.
Vtable slot 5. The default discards the request.
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |
Reimplemented in HxMemStream.
|
virtual |
Move nSize bytes into pDest.
Vtable slot 6. The default discards the request.
| pDest | The destination buffer. |
| nSize | The number of bytes to move. |
Reimplemented in HxIDataChunk, and HxMemStream.
|
virtual |
Report the stream this one reads through, if any.
Vtable slot 7. The default reports null and HxMemStream retains it. HxIDataChunk overrides it at 0x00145fd8 and reports the stream its chunk lies in.
Reimplemented in HxIDataChunk.
| HxStream & HxStream::ReadNum | ( | void * | pDest, |
| int | nSize ) |
Move nSize bytes into pDest, reversing their order when the stream swaps bytes.
With mSwapBytes clear, or for a single byte, this is one ReadData(). Otherwise it reads one byte at a time from the last position of pDest to the first. Mid::Reader reads every header and track field through it, and HxChunkHeader reads chunk sizes through it.
| pDest | The destination buffer. |
| nSize | The number of bytes to move. |
| HxStream & HxStream::WriteNum | ( | const void * | pSrc, |
| int | nSize ) |
Move nSize bytes out of pSrc, reversing their order when the stream swaps bytes.
The writing counterpart of ReadNum(). With mSwapBytes clear, or for a single byte, this is one Write(). Otherwise it writes one byte at a time from the last position of pSrc to the first. The shipped program calls it only from HxVarLenNumber::Write().
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |
| HxStream & HxStream::ReadStr | ( | char * | pszDest, |
| int | nDestSize ) |
Read a string with a variable-length size prefix into a fixed buffer.
The length comes from HxVarLenNumber::Read(). A string shorter than nDestSize is read whole and terminated. A longer one is cut to nDestSize - 1 bytes and terminated, and the read position then skips the rest of the string. The shipped program does not call it.
| pszDest | The destination buffer. |
| nDestSize | The size of pszDest in bytes, terminator included. |
Read a string with a variable-length size prefix into an HxStr.
The bytes are read into a temporary untagged block one byte longer than the string, which is terminated, assigned to str, and released. The shipped program does not call it. The title is inferred.
| str | Receives the string. |
| HxStream * HxStream::GetRootStream | ( | ) |
Follow UnderlyingStream() from this stream until a stream reports none, and report that stream.
The shipped program does not call it.
|
static |
Status value of a stream with nothing wrong.
HxIDataChunk loads the four status values from memory rather than as immediates. The memory loads place them as class constants defined in this class's translation unit. HxMemStream writes the same two values, 0 and 1, as immediates. The name of kStatusEnd is inferred.
|
static |
Status value of a stream whose read position arrived at the end of its data.
|
static |
Status bit a seek outside a chunk's bounds would set.
GetMarker() reports -1 while it is set.
|
static |
Second status bit GetMarker() and SetMarker() of HxIDataChunk test.
No writer is recovered.
| int HxStream::mSwapBytes |
Non-zero when multi-byte values on the stream are in the opposite byte order.
ReadNum() tests it and the constructor clears it. Public because HxIDataChunk copies it from another stream object and the image exposes no accessor.
+0x00
|
protected |
|
protected |