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::FileByteSource Class Reference

#include <FileByteSource.h>

Inheritance diagram for MFM::FileByteSource:
MFM::ByteSource

Public Member Functions

 FileByteSource ()
 
 FileByteSource (const char *filename)
 
void Open (const char *filename)
 
bool IsOpen ()
 
void Close ()
 
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 which uses a file descriptor as its reading source.

Constructor & Destructor Documentation

MFM::FileByteSource::FileByteSource ( )
inline

Constructs a new FileByteSource which is not ready for reading from. One must call Open() before using.

MFM::FileByteSource::FileByteSource ( const char *  filename)
inline

Constructs a new FileByteSource which is ready for reading from, given that the provided filename is a legal file to open.

Parameters
filenameThe path to the FILE that is wished to back this FileByteSource and will therefore be read from.

Member Function Documentation

void MFM::FileByteSource::Close ( )
inline

Closes this FileByteSource, disallowing writing. One must call Open() to use this FileByteSource after closing it.

bool MFM::FileByteSource::IsOpen ( )
inline

Checks to see if this FileByteSource is backed by a valid file descriptor and is therefore ready to write to.

Returns
true if this FileByteSource is ready to be written to, else false .
void MFM::FileByteSource::Open ( const char *  filename)
inline

Opens the file at a given path and allows this FileByteSource to begin reading from it. If this FileByteSource is already backed by an open file descriptor, this will do nothing. One should check to see if this FileByteSource IsOpen() before and after calling this method.

Parameters
filenameThe string representing the path to the file wished to back this FileByteSource .
virtual int MFM::FileByteSource::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.


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