wavelength 1.0.0
Loading...
Searching...
No Matches
binstream.h File Reference
#include <list>
#include <memory>
#include <vector>
#include "math/rand.h"
#include "os/string.h"
Include dependency graph for binstream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BinStream
 Stream of raw bytes, the base of the memory, file, and network streams. More...

Functions

BinStream & operator>> (BinStream &stream, String &text)
 Read text into a string.
template<typename T>
BinStream & operator<< (BinStream &stream, const std::vector< T > &elements)
 Write a vector as its element count followed by each element.
template<typename T>
BinStream & operator>> (BinStream &stream, std::vector< T > &elements)
 Read a vector the vector writer wrote.
template<typename T>
BinStream & operator<< (BinStream &stream, const std::list< T > &elements)
 Write a list as its element count followed by each element.
template<typename T>
BinStream & operator>> (BinStream &stream, std::list< T > &elements)
 Read a list the list writer wrote.

Function Documentation

◆ operator>>() [1/3]

BinStream & operator>> ( BinStream & stream,
String & text )

Read text into a string.

In the text mode of the string streams the text is read up to its terminator. Otherwise it is read as BinStream::WriteString() wrote it.

Parameters
streamThe stream to read from.
textReceives the text.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x0029f868
Ghidra address:
PAL: 0x002a9528

◆ operator<<() [1/2]

template<typename T>
BinStream & operator<< ( BinStream & stream,
const std::vector< T > & elements )

Write a vector as its element count followed by each element.

Each element type has its own instance, one address each.

Template Parameters
TThe type of the elements.
Parameters
streamThe stream to write to.
elementsThe elements.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x003875b8
Ghidra address:
PAL: 0x003f5cc0
Ghidra address:
NTSC-U/C: 0x00389208
Ghidra address:
PAL: 0x003f7910
Ghidra address:
NTSC-U/C: 0x00385520
Ghidra address:
PAL: 0x003f3c28
Ghidra address:
NTSC-U/C: 0x00385608
Ghidra address:
PAL: 0x003f3d10
Ghidra address:
NTSC-U/C: 0x003876b0
Ghidra address:
PAL: 0x003f5db8
Ghidra address:
NTSC-U/C: 0x003921d0
Ghidra address:
PAL: 0x004008d8
Ghidra address:
NTSC-U/C: 0x0039d1d8
Ghidra address:
PAL: 0x0040bf00
Ghidra address:
NTSC-U/C: 0x0039d7a0
Ghidra address:
PAL: 0x0040c4c8
Ghidra address:
NTSC-U/C: 0x0038c050
Ghidra address:
PAL: 0x003fa758
Ghidra address:
NTSC-U/C: 0x0038c1e0
Ghidra address:
PAL: 0x003fa8e8
Ghidra address:
NTSC-U/C: 0x0038c3a0
Ghidra address:
PAL: 0x003faaa8
Ghidra address:
NTSC-U/C: 0x003a4a70
Ghidra address:
PAL: 0x00413750
Ghidra address:
NTSC-U/C: 0x00383608
Ghidra address:
PAL: 0x003f1d10
Ghidra address:
NTSC-U/C: 0x003893e0
Ghidra address:
PAL: 0x003f7ae8
Ghidra address:
NTSC-U/C: 0x003894b0
Ghidra address:
PAL: 0x003f7bb8
Ghidra address:
NTSC-U/C: 0x00393dd0
Ghidra address:
PAL: 0x004024d8

◆ operator>>() [2/3]

template<typename T>
BinStream & operator>> ( BinStream & stream,
std::vector< T > & elements )

Read a vector the vector writer wrote.

The vector is resized to the count with default elements, which are then read in place. Each element type has its own instance, one address each.

Template Parameters
TThe type of the elements.
Parameters
streamThe stream to read from.
elementsReceives the elements.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x00387e60
Ghidra address:
PAL: 0x003f6568
Ghidra address:
NTSC-U/C: 0x00389558
Ghidra address:
PAL: 0x003f7c60
Ghidra address:
NTSC-U/C: 0x00385ba8
Ghidra address:
PAL: 0x003f42b0
Ghidra address:
NTSC-U/C: 0x00386058
Ghidra address:
PAL: 0x003f4760
Ghidra address:
NTSC-U/C: 0x00388398
Ghidra address:
PAL: 0x003f6aa0
Ghidra address:
NTSC-U/C: 0x003922d0
Ghidra address:
PAL: 0x004009d8
Ghidra address:
NTSC-U/C: 0x00389670
Ghidra address:
PAL: 0x003f7d78
Ghidra address:
NTSC-U/C: 0x00389768
Ghidra address:
PAL: 0x003f7e70
Ghidra address:
NTSC-U/C: 0x0038a3e8
Ghidra address:
PAL: 0x003f8af0
Ghidra address:
NTSC-U/C: 0x0038a4a0
Ghidra address:
PAL: 0x003f8ba8
Ghidra address:
NTSC-U/C: 0x0038c9c0
Ghidra address:
PAL: 0x003fb0c8
Ghidra address:
NTSC-U/C: 0x0038d1b8
Ghidra address:
PAL: 0x003fb8c0
Ghidra address:
NTSC-U/C: 0x0038d9c0
Ghidra address:
PAL: 0x003fc0c8
Ghidra address:
NTSC-U/C: 0x00393f20
Ghidra address:
PAL: 0x00402610
Ghidra address:
NTSC-U/C: 0x0039d5e8
Ghidra address:
PAL: 0x0040c310
Ghidra address:
NTSC-U/C: 0x0039dbb0
Ghidra address:
PAL: 0x0040c8d8
Ghidra address:
NTSC-U/C: 0x003a4f20
Ghidra address:
PAL: 0x00413c00
Ghidra address:
NTSC-U/C: 0x00383740
Ghidra address:
PAL: 0x003f1e48

◆ operator<<() [2/2]

template<typename T>
BinStream & operator<< ( BinStream & stream,
const std::list< T > & elements )

Write a list as its element count followed by each element.

Each element type has its own instance, one address each.

Template Parameters
TThe type of the elements.
Parameters
streamThe stream to write to.
elementsThe elements.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x0039a878
Ghidra address:
PAL: 0x00409100

◆ operator>>() [3/3]

template<typename T>
BinStream & operator>> ( BinStream & stream,
std::list< T > & elements )

Read a list the list writer wrote.

The list is resized to the count with default elements, which are then read in place. Each element type has its own instance, one address each.

Template Parameters
TThe type of the elements.
Parameters
streamThe stream to read from.
elementsReceives the elements.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x0039aaf8
Ghidra address:
PAL: 0x00409380