MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <ByteSource.h>
Public Member Functions | |
ByteSource () | |
s32 | Read () |
void | Unread () |
s32 | Peek () |
virtual int | ReadByte ()=0 |
virtual | ~ByteSource () |
u32 | GetBytesRead () |
bool | Scan (u64 &result) |
bool | Scan (s32 &result, Format::Type code=Format::DEC, u32 fieldWidth=U32_MAX) |
bool | Scan (u32 &result, Format::Type code=Format::DEC, u32 fieldWidth=U32_MAX) |
bool | Scan (ByteSerializable &byteSerializable, s32 argument=0) |
bool | ScanLexDigits (u32 &digits) |
bool | Scan (ByteSink &result, const u32 fieldWidth) |
s32 | ScanSet (ByteSink &result, const char *setSpec) |
s32 | SkipSet (const char *setSpec) |
s32 | ScanSetFormat (ByteSink &result, const char *&setSpec) |
bool | ScanIdentifier (ByteSink &result) |
bool | ScanHex (ByteSink &result) |
bool | ScanBinary (ByteSink &result) |
bool | ScanCamelIdentifier (ByteSink &result) |
s32 | SkipWhitespace () |
s32 | Scanf (const char *format,...) |
s32 | Vscanf (const char *format, va_list &ap) |
Static Public Attributes | |
static const char * | WHITESPACE_CHARS = " \n\t\v" |
static const char * | WHITESPACE_SET = "[ \n\t\v]" |
static const char * | NON_WHITESPACE_SET = "[^ \n\t\v]" |
An abstract source where bytes may be read from.
|
inline |
Constructs a new ByteSource in an unread state.
|
inlinevirtual |
Deconstructs this ByteSource. Default implementation does nothing.
|
inline |
Gets the number of bytes that have currently been read from this ByteSource. If a byte has been Unread()
, it is treated by this method as never having been read.
The | number of bytes that have currently been read from this ByteSource . |
|
inline |
Gets the next 32-bit character from the front of this ByteSource without consuming it.
Read()
from this ByteSource.
|
inline |
Gets the next logical single 32-bit character from this ByteSource. If there was an Unread()
operation on this ByteSource before this Read()
operation, the last character returned by Read()
will be returned.
|
pure virtual |
Gets the next 32-bit character from this ByteSource , regardless of whether or not Unread()
has been called.
Implemented in MFM::LineCountingByteSource, MFM::FileByteSource, and MFM::CharBufferByteSource.
bool MFM::ByteSource::Scan | ( | u64 & | result | ) |
Performs a binary read of the next 64 bits to come out of this ByteSource . These bytes are stored in the specified u64 , where the first bytes read are stored in its MSB end.
result | The location to store the next 64 bits to come out of this ByteSource. |
true
if the next 64 bits are read successfully from this ByteSource, else false
. bool MFM::ByteSource::Scan | ( | s32 & | result, |
Format::Type | code = Format::DEC , |
||
u32 | fieldWidth = U32_MAX |
||
) |
Performs several types of reads of a 32-bit number, depending on the provided format.
result | The location to store the read binary formatted 32-bit number. |
code | The format to treat the next bytes read from this ByteSource as, including various numeric bases (such as binary, octal, decimal, hexadecimal) and network-order binary representations. |
fieldWidth | The maximum number of characters which will be read during this call. |
true
if a number of code
formatting can be read from the next read bytes. bool MFM::ByteSource::Scan | ( | u32 & | result, |
Format::Type | code = Format::DEC , |
||
u32 | fieldWidth = U32_MAX |
||
) |
Performs several types of reads of a 32-bit number, depending on the provided format.
result | The location to store the read binary formatted 32-bit number . |
code | The format to treat the next bytes read from this ByteSource as, be it binary or ascii in nature. |
fieldWidth | The maximum number of characters which will be read during this call. |
true
if a number of code
formatting can be read from the next read bytes. bool MFM::ByteSource::Scan | ( | ByteSerializable & | byteSerializable, |
s32 | argument = 0 |
||
) |
Reads a ByteSerializable from the front of this ByteSource.
byteSerializable | The ByteSerializable which is to be expected during this Scan. The ByteSerializable itself defines whether or not these bytes may represent it. |
argument | An argument which may be passed to byteSerializable to help determine whether or not is is being read correctly. Again, this is determined by the particular ByteSerializable used in this call. |
true
if byteSerializable
may be represented by the following read bytes, else false
.
|
inline |
Scans this ByteSource for a binary string, i.e. a string consisting only of the binary characters '1' and '0' .
result | The ByteSink which collects the all characters that match the rules for being a binary string. |
true
if the next characters of this ByteSource (excluding whitespace) can be treated as a binary string.
|
inline |
Scans this ByteSource for a camelcase identifier, i.e. an alphanumeric string which starts with a capital letter.
result | The ByteSink which collects the all characters that match the rules for being an camelcase identifier. |
true
if the next characters of this ByteSource (excluding whitespace) can be treated as a camelcase identifier.
|
inline |
Scans this ByteSource for a hexadecimal string, i.e. a string consisting of both upper and lowercase hexadecimal digits.
result | The ByteSink which collects the all characters that match the rules for being a hexadecimal string. |
true
if the next characters of this ByteSource (excluding whitespace) can be treated as a hexadecimal string.
|
inline |
Scans this ByteSource for an Identifier, i.e. an alphanumeric string which does not start with a number.
result | The ByteSink which collects the all characters that match the rules for being an identifier. |
true
if the next characters of this ByteSource (excluding whitespace) can be treated as an identifier.
|
inline |
Scans a set of characters, defined by a specified descriptor, consuming them as they are scanned.
setSpec | The descriptor of the characters to be consumed. |
|
inline |
Consumes and destroys all whitespace characters at the front of this ByteSource.
|
inline |
Puts the last read character back into this ByteSource. This is useful for situations where the character on top of this ByteSource is needed to be regurgitated; for instance, when using the Peek()
method.
s32 MFM::ByteSource::Vscanf | ( | const char * | format, |
va_list & | ap | ||
) |
NYI: u8 padChar;
|
static |
A char* representing a Scanf()
formatted set of all chars which are not included in WHITESPACE_CHARS
. This is to be used when scanning for anything that is not whitespace.
|
static |
A char* consisting only of all unique characters treated as Whitespace by this ByteSource. This set includes:
' ' Space '
' Newline '' Tab '' Vertical Tab
|
static |
A char* representing a Scanf()
formatted set of all chars in WHITESPACE_CHARS
. This is to be used when scanning for whitespace.