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

#include <OverflowableCharBufferByteSink.h>

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

Public Member Functions

 OverflowableCharBufferByteSink ()
 
virtual void WriteBytes (const u8 *data, const u32 len)
 
virtual s32 CanWrite ()
 
bool Equals (const char *str) const
 
template<u32 OTHER_SIZE>
bool Equals (const OverflowableCharBufferByteSink< OTHER_SIZE > &str) const
 
const char * GetZString ()
 
const char * GetBuffer () const
 
u32 GetLength () const
 
u32 GetCapacity () const
 
void Reset ()
 
bool HasOverflowed () const
 
OverflowableCharBufferByteSink
< BUFSIZE > & 
operator= (const char *zstr)
 
- 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<u32 BUFSIZE>
class MFM::OverflowableCharBufferByteSink< BUFSIZE >

A ByteSink that holds up to BUFSIZE - 2 data bytes. If that limit is reached, an 'X' is appended at the end of the ByteSink, and further data written is discarded.

Constructor & Destructor Documentation

template<u32 BUFSIZE>
MFM::OverflowableCharBufferByteSink< BUFSIZE >::OverflowableCharBufferByteSink ( )
inline

Constructs a new CharBufferByteSink representing the empty string.

Member Function Documentation

template<u32 BUFSIZE>
virtual s32 MFM::OverflowableCharBufferByteSink< BUFSIZE >::CanWrite ( )
inlinevirtual

Gets the number of bytes that can be written to this OverflowableCharBufferByteSink .

Returns
The number of bytes that can be written to this OverflowableCharBufferByteSink .

Implements MFM::ByteSink.

template<u32 BUFSIZE>
bool MFM::OverflowableCharBufferByteSink< BUFSIZE >::Equals ( const char *  str) const
inline

Checks to see if the string represented by this OverflowableCharBufferByteSink is equal to another specified string.

Parameters
strThe string to check for equality against this OverflowableCharBufferByteSink .
Returns
true if the string represented by this OverflowableCharBufferByteSink is equal to the string represented by str , else false .
template<u32 BUFSIZE>
template<u32 OTHER_SIZE>
bool MFM::OverflowableCharBufferByteSink< BUFSIZE >::Equals ( const OverflowableCharBufferByteSink< OTHER_SIZE > &  str) const
inline

Checks to see if the string represented by this OverflowableCharBufferByteSink is equal to another specified OverflowableCharBufferByteSink.

Parameters
strThe OverflowableCharBufferByteSink to check for equality against this OverflowableCharBufferByteSink
Returns
true if the string represented by this OverflowableCharBufferByteSink is equal to the string represented by str , else false .
template<u32 BUFSIZE>
const char* MFM::OverflowableCharBufferByteSink< BUFSIZE >::GetBuffer ( ) const
inline

Gets the immutable char buffer held by this OverflowableCharBufferByteSink . This is NOT guaranteed to be null terminated!

Returns
A pointer to the string representing this OverflowableCharBufferByteSink which may not be null terminated.
template<u32 BUFSIZE>
u32 MFM::OverflowableCharBufferByteSink< BUFSIZE >::GetCapacity ( ) const
inline

Gets the total number of bytes that may be written to this OverflowableCharBufferByteSink before it overflows.

Returns
The total number of bytes that may be written to this OverflowableCharBufferByteSink before it overflows.
template<u32 BUFSIZE>
u32 MFM::OverflowableCharBufferByteSink< BUFSIZE >::GetLength ( ) const
inline

Gets the length of the string represented by this OverflowableCharBufferByteSink in bytes .

Returns
The length of the string represented by this OverflowableCharBufferByteSink in bytes .
template<u32 BUFSIZE>
const char* MFM::OverflowableCharBufferByteSink< BUFSIZE >::GetZString ( )
inline

Gets the immutable char buffer held by this OverflowableCharBufferByteSink . It is guaranteed to be null terminated.

Returns
A null terminated string representing this OverflowableCharBufferByteSink .
template<u32 BUFSIZE>
bool MFM::OverflowableCharBufferByteSink< BUFSIZE >::HasOverflowed ( ) const
inline

Checks to see whether or not this OverflowableCharBufferByteSink has overflowed, i.e. had more bytes written to it than it can hold.

Returns
true if this OverflowableCharBufferByteSink has overflowed before, else false .
template<u32 BUFSIZE>
OverflowableCharBufferByteSink<BUFSIZE>& MFM::OverflowableCharBufferByteSink< BUFSIZE >::operator= ( const char *  zstr)
inline

An operator overload which copies the bytes held at a specified null terminated string to this OverflowableCharBufferByteSink . After this is called, and if there is enough room in this OverflowableCharBufferByteSink , it will represent the specified string.

Parameters
zstrThe null terminated string which is wished to be represented by this OverflowableCharBufferByteSink .
template<u32 BUFSIZE>
void MFM::OverflowableCharBufferByteSink< BUFSIZE >::Reset ( )
inline

Resets the internal state of this OverflowableCharBufferByteSink , making it equivalent to the empty string.

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

Writes a series of bytes to this OveflowableCharBufferByteSink . If overflow occurs, will append an 'X' to the end of this internal string.

Parameters
bytesA pointer to the bytes which will be written to this OverflowableCharBufferByteSink .
lenThe number of bytes which will be attempted to be written to this OverflowableCharBufferByteSink .

Implements MFM::ByteSink.


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