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::CharBufferByteSink< BUFSIZE > Class Template Reference

#include <CharBufferByteSink.h>

Inheritance diagram for MFM::CharBufferByteSink< BUFSIZE >:
MFM::ByteSink

Public Member Functions

virtual void WriteBytes (const u8 *data, const u32 len)
 
virtual s32 CanWrite ()
 
bool Equals (const char *str)
 
const char * GetZString ()
 
u32 GetLength () const
 
u32 GetCapacity () const
 
void Reset ()
 
- Public Member Functions inherited from MFM::ByteSink
virtual void WriteByte (u8 ch)
 
virtual void WriteNewline ()
 
void Print (const char *str, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (const u8 *str, u32 len, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s32 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u32 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s64 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u64 decimal, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (u64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (s64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ')
 
void Print (ByteSerializable &byteSerializble, s32 argument=0)
 
void Println ()
 
void Println (u8 byte)
 
void Println (const char *str)
 
void Println (const u8 *str, u32 len)
 
void Println (s32 decimal)
 
void Println (u32 decimal)
 
void Println (u32 decimal, Format::Type code)
 
void Println (ByteSerializable &byteSerializable, s32 argument=0)
 
void Printf (const char *format,...)
 
void Vprintf (const char *format, va_list &ap)
 

Detailed Description

template<int BUFSIZE>
class MFM::CharBufferByteSink< BUFSIZE >

A template class for a ByteSink into a fixed-size char buffer. If the fixed-size buffer overflows, CharBufferByteSink::WriteBytes will FAIL with OUT_OF_ROOM. For an alternative possibly more useful approach, see OverflowableCharBufferByteSink.

Member Function Documentation

template<int BUFSIZE>
virtual s32 MFM::CharBufferByteSink< BUFSIZE >::CanWrite ( )
inlinevirtual

Gets the number of bytes which may be written to this CharBufferByteSink before it calls FAIL(OUT_OF_ROOM) .

Returns
The number of bytes which may be written to this CharBufferByteSink .

Implements MFM::ByteSink.

template<int BUFSIZE>
bool MFM::CharBufferByteSink< BUFSIZE >::Equals ( const char *  str)
inline

Checks to see if the underlying buffer of this CharBufferByteSink contains the same characters of another null-terminated string.

Parameters
strA null-terminated string of characters which may or may not equal the string held by this CharBufferByteSink .
Returns
true if this CharBufferByteSink and str represent the same string, else false.
template<int BUFSIZE>
u32 MFM::CharBufferByteSink< BUFSIZE >::GetCapacity ( ) const
inline

Gets the maximum number of bytes which this CharBufferByteSink may hold.

Returns
The maximum number of bytes which this CharBufferByteSink may hold.
template<int BUFSIZE>
u32 MFM::CharBufferByteSink< BUFSIZE >::GetLength ( ) const
inline

Gets the length of this CharBufferByteSink, in bytes.

Returns
The length of this CharBufferByteSink, in bytes.
template<int BUFSIZE>
const char* MFM::CharBufferByteSink< BUFSIZE >::GetZString ( )
inline

Retreives the underlying buffer of this CharBufferByteSink, usable as a const char* . The returned char* is guaranteed to be null terminated.

Returns
The underlying buffer of this CharBufferByteSink, usable as a const char* .
template<int BUFSIZE>
void MFM::CharBufferByteSink< BUFSIZE >::Reset ( )
inline

Effectively clears this CharBufferByteSink, resulting in it being logically equivalent to the empty string.

template<int BUFSIZE>
virtual void MFM::CharBufferByteSink< BUFSIZE >::WriteBytes ( const u8 *  data,
const u32  len 
)
inlinevirtual

Writes a series of bytes to this CharBufferByteSink. This will FAIL with OUT_OF_ROOM if therre is not enough room for the bytes to be written. One can check the number of bytes which may be written through the CanWrite() function.

Parameters
dataA pointer to the bytes wished to be written to this CharBufferByteSink.
lenThe number of bytes to write to this CharBufferByteSink.

Implements MFM::ByteSink.


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