|
resonance 1.0.1
|
Byte stream that every renderer object serialises itself through. More...
#include <stream.h>

Public Member Functions | |
| virtual Stream & | Read (void *pDest, int nSize)=0 |
| Move nSize bytes into pDest with no conversion. | |
| virtual Stream & | Write (const void *pSrc, int nSize)=0 |
| Move nSize bytes out of pSrc with no conversion. | |
| virtual Stream & | Flush ()=0 |
| Service the underlying transport. | |
| virtual Stream & | Seek (int nOffset, int nWhence)=0 |
| Move the read and write position. | |
| virtual int | Tell ()=0 |
| Report the current position. | |
| virtual int | Eof ()=0 |
| Test whether the position has arrived at the end. | |
| virtual int | Fail ()=0 |
| Test whether a transfer has failed. | |
| virtual Stream & | ReadLE (void *pDest, int nSize) |
| Move nSize bytes into pDest, correcting the byte order for the host. | |
| virtual Stream & | WriteLE (const void *pSrc, int nSize) |
| Move nSize bytes out of pSrc, correcting the byte order for the file. | |
| virtual | ~Stream () |
| Close the stream. | |
| Stream & | ReadString (HxStr &name) |
| Read a NUL-terminated name and append it to a string. | |
Byte stream that every renderer object serialises itself through.
Its RTTI descriptor is at 0x0086f670. It is a leaf class with no base and no data member. A stream stores its vtable pointer at offset 0 and every field belongs to a subclass. The class does not emit a standalone GetTypeInfo accessor, because each subclass accessor initialises this descriptor inline before its own.
The four subclasses attested by RTTI are Rnd::FileStream, Rnd::MemStream, Rnd::BufStream, and Rnd::ToolStream, all single inheritance at offset 0. Every vtable in the family is eleven entries, and the declaration order below reproduces that order, so the recovery is complete rather than partial.
Read() through Fail() are pure, since all four subclasses supply a distinct body for each. ReadLE() and WriteLE() are the exception: one shared base body appears at slot 8 and slot 9 of all four tables and does nothing beyond forwarding to Read() and Write(). Both pairs are therefore interchangeable on this target, and a caller that wants byte-order correction for a multi-byte scalar still uses the second pair because the file format is big-endian like the EE.
|
virtual |
Close the stream.
Vtable slot 10, which is the last slot rather than the first, because the destructor is declared after the transfer virtuals. Rnd::BufStream stores a null there, so a BufStream destroyed through a base pointer jumps to zero; every other subclass supplies a body.
|
pure virtual |
Move nSize bytes into pDest with no conversion.
Vtable slot 1.
| pDest | The destination buffer. |
| nSize | The number of bytes to move. |
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Move nSize bytes out of pSrc with no conversion.
Vtable slot 2.
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Service the underlying transport.
Vtable slot 3. Rnd::FileStream passes the request to its FILE, Rnd::MemStream and Rnd::BufStream do nothing, and Rnd::ToolStream::Read() invokes this whenever it has drained its buffer, which makes it the refill point for a streamed source.
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Move the read and write position.
Vtable slot 4. An offset that would pass either end is clamped rather than reported.
| nOffset | The signed distance to move. |
| nWhence | The origin, one of the SeekOrigin values. |
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Report the current position.
Vtable slot 5. Rnd::ToolStream always reports 0.
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Test whether the position has arrived at the end.
Vtable slot 6.
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
pure virtual |
Test whether a transfer has failed.
Vtable slot 7. A short read sets this on the memory streams. Rnd::ToolStream never fails.
Implemented in Rnd::BufStream, Rnd::FileStream, Rnd::MemStream, and Rnd::ToolStream.
|
virtual |
Move nSize bytes into pDest, correcting the byte order for the host.
Vtable slot 8. The one shared implementation forwards to Read(), and no subclass overrides it.
| pDest | The destination buffer. |
| nSize | The number of bytes to move. |
|
virtual |
Move nSize bytes out of pSrc, correcting the byte order for the file.
Vtable slot 9. The one shared implementation forwards to Write(), and no subclass overrides it.
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |
Read a NUL-terminated name and append it to a string.
The name arrives one byte at a time through Read() into a 256-byte static buffer at 0x008952e0. The string is emptied through HxStr::Clear() first, so the argument need not start empty. A name of 256 characters or more fills the buffer with no terminator before the flush, and the flush then measures it with strlen, which reads past the buffer.
| name | The string to append the name to. |