wavelength 1.0.0
Loading...
Searching...
No Matches
MemStream Class Reference

BinStream that collects the bytes written to it in a growing buffer. More...

#include <memstream.h>

Inheritance diagram for MemStream:
Collaboration diagram for MemStream:

Public Member Functions

 ~MemStream () override=default
 Destroy the object.
 MemStream (bool bLittleEndian)
 Construct an empty stream with room for 4096 bytes.
void Read (void *pData, int nBytes) override
 Copy bytes out from the position.
void Write (const void *pData, int nBytes) override
 Copy bytes in at the position, growing the buffer.
void Flush () override
 Do nothing, since the bytes stay in memory.
void Seek (int nOffset, SeekType eFrom) override
 Move the position.
int Tell () override
 Report the position.
bool Eof () override
 Report whether the position is at the end of the bytes.
bool Fail () override
 Report whether a transfer failed.
std::vector< char > & GetBuffer ()
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...

Detailed Description

BinStream that collects the bytes written to it in a growing buffer.

The RTTI includes the class name and records BinStream as the base, and the vtable is at 0x003d6f68. The object is 0x20 bytes. Only the members its callers here use are declared.

Constructor & Destructor Documentation

◆ ~MemStream()

MemStream::~MemStream ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x003ab1a8
Ghidra address:
PAL: 0x00419f18

◆ MemStream()

MemStream::MemStream ( bool bLittleEndian)
explicit

Construct an empty stream with room for 4096 bytes.

Parameters
bLittleEndianStore values in the console's byte order.
Ghidra address:
NTSC-U/C: 0x0029c9e0
Ghidra address:
PAL: 0x002a6608

Member Function Documentation

◆ Read()

void MemStream::Read ( void * pData,
int nBytes )
overridevirtual

Copy bytes out from the position.

Parameters
pDataThe destination.
nBytesThe number of bytes.
Ghidra address:
NTSC-U/C: 0x0029ca38
Ghidra address:
PAL: 0x002a6660

Implements BinStream.

◆ Write()

void MemStream::Write ( const void * pData,
int nBytes )
overridevirtual

Copy bytes in at the position, growing the buffer.

Parameters
pDataThe source.
nBytesThe number of bytes.
Ghidra address:
NTSC-U/C: 0x0029cab0
Ghidra address:
PAL: 0x002a66d8

Implements BinStream.

◆ Flush()

void MemStream::Flush ( )
overridevirtual

Do nothing, since the bytes stay in memory.

Ghidra address:
NTSC-U/C: 0x003ab218
Ghidra address:
PAL: 0x00419f78

Implements BinStream.

◆ Seek()

void MemStream::Seek ( int nOffset,
SeekType eFrom )
overridevirtual

Move the position.

Parameters
nOffsetThe offset in bytes.
eFromThe origin of the offset.
Ghidra address:
NTSC-U/C: 0x0029cb90
Ghidra address:
PAL: 0x002a67b8

Implements BinStream.

◆ Tell()

int MemStream::Tell ( )
overridevirtual

Report the position.

Returns
The position in bytes.
Ghidra address:
NTSC-U/C: 0x003ab220
Ghidra address:
PAL: 0x00419f80

Implements BinStream.

◆ Eof()

bool MemStream::Eof ( )
overridevirtual

Report whether the position is at the end of the bytes.

Returns
Whether no byte is left.
Ghidra address:
NTSC-U/C: 0x003ab228
Ghidra address:
PAL: 0x00419f88

Implements BinStream.

◆ Fail()

bool MemStream::Fail ( )
overridevirtual

Report whether a transfer failed.

Returns
Whether a transfer failed.
Ghidra address:
NTSC-U/C: 0x003ab248
Ghidra address:
PAL: 0x00419fa8

Implements BinStream.

◆ GetBuffer()

std::vector< char > & MemStream::GetBuffer ( )
inline
Returns
The bytes.

The documentation for this class was generated from the following file: