MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions
MFM::LineCountingByteSource Class Reference

#include <LineCountingByteSource.h>

Inheritance diagram for MFM::LineCountingByteSource:
MFM::ByteSource

Public Member Functions

 LineCountingByteSource ()
 
void SetByteSource (ByteSource &bs)
 
void SetErrorByteSink (ByteSink &bs)
 
void SetLabel (const char *label)
 
bool Msg (Logger::Level type, const char *format,...)
 
bool VMsg (Logger::Level type, const char *format, va_list &ap)
 
void PrintPosition (ByteSink &b) const
 
u32 GetLineNum () const
 
u32 GetByteNum () const
 
virtual int ReadByte ()
 
- Public Member Functions inherited from MFM::ByteSource
 ByteSource ()
 
s32 Read ()
 
void Unread ()
 
s32 Peek ()
 
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)
 

Additional Inherited Members

- Static Public Attributes inherited from MFM::ByteSource
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]"
 

Detailed Description

A ByteSource that tracks how many lines of text have been read, and what byte of the current line was most recently read. Useful for providing feedback to help pinpoint errors in ByteSources.

Constructor & Destructor Documentation

MFM::LineCountingByteSource::LineCountingByteSource ( )
inline

Construct a new LineCountingByteSource which is not attached to another ByteSource and is notready for use.

Member Function Documentation

u32 MFM::LineCountingByteSource::GetByteNum ( ) const
inline

Gets the number of bytes which have been read from this LineCountingByteSource .

Returns
The number of bytes which have been read from this LineCountingByteSource .
u32 MFM::LineCountingByteSource::GetLineNum ( ) const
inline

Gets the number of lines which have been read from this LineCountingByteSource .

Returns
The number of lines which have been read from this LineCountingByteSource .
bool MFM::LineCountingByteSource::Msg ( Logger::Level  type,
const char *  format,
  ... 
)
inline

Prints a formatted message to the error ByteSink held by this LineCountingByteSource using ... style formatting. This routes control to VMsg() directly.

Parameters
typeThe Logger Level which this formatted message will be printed at.
formatThe formatting string used with the argument list to generate a formatted message.
Returns
true if type is less elevated than the Logger Message Level , else false .
See Also
VMsg()
void MFM::LineCountingByteSource::PrintPosition ( ByteSink b) const
inline

Prints a colon separated formatted message describing this LineCountingByteSink , in the format:

<label>:<linesRead>:<bytesRead>

Parameters
bThe ByteSink to print this formatted message to.
virtual int MFM::LineCountingByteSource::ReadByte ( )
inlinevirtual

Gets the next 32-bit character from this ByteSource , regardless of whether or not Unread() has been called.

Returns
the next 32-bit character from this ByteSource .

Implements MFM::ByteSource.

void MFM::LineCountingByteSource::SetByteSource ( ByteSource bs)
inline

Sets the ByteSource which will be monitored through this LineCountingByteSource .

Parameters
Thenew ByteSource which will be monitored.
void MFM::LineCountingByteSource::SetErrorByteSink ( ByteSink bs)
inline

Sets the ByteSink that this LineCountingByteSource will use to report any errors encountered during its operation.

Parameters
Thenew ByteSink used by this LineCountingByteSource for error reporting.
void MFM::LineCountingByteSource::SetLabel ( const char *  label)
inline

Sets the label of this LineCountingByteSink, which is used during printing for identification.

Parameters
labelThe new string label of this LineCountingByteSink
bool MFM::LineCountingByteSource::VMsg ( Logger::Level  type,
const char *  format,
va_list &  ap 
)
inline

Prints a formatted message to the error ByteSink held by this LineCountingByteSource using a va_list style formatting. First, the position is printed, then the kind of message is printed, then the formatted message is printed.

Parameters
typeThe Logger Level which this formatted message will be printed at.
formatThe formatting string used with the argument list to generate a formatted message.
apThe argument list used with the formatting string to generate a formatted message .
Returns
true if type is less elevated than the Logger Message Level , else false .

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