IoAbstraction
Public Member Functions | List of all members
Print Class Referenceabstract

#include <PrintCompat.h>

Inheritance diagram for Print:
MBedLogger PrintfLogger PrintfLogger

Public Member Functions

virtual size_t write (uint8_t ch)=0
 
virtual size_t write (const char *sz)
 
void print (char ch)
 
void println (char ch)
 
void print (const char *sz)
 
void println (const char *sz)
 
void print (int val, int radix=DEC)
 
void println (int val, int radix=DEC)
 
void print (unsigned int val, int radix=DEC)
 
void println (unsigned int val, int radix=DEC)
 
void print (long val, int radix=DEC)
 
void println (long val, int radix=DEC)
 
void print (unsigned long val, int radix=DEC)
 
void println (unsigned long val, int radix=DEC)
 
void print (double dbl, int dp=3)
 
void println (double dbl, int dp=3)
 
void print (bool b)
 
void println (bool b)
 
void println ()
 
size_t write (short t)
 
size_t write (unsigned short t)
 
size_t write (int t)
 
size_t write (unsigned int t)
 
size_t write (long t)
 
size_t write (unsigned long t)
 
size_t write (char c)
 
size_t write (int8_t c)
 

Detailed Description

This is a print interface that is roughly compatible with the Arduino one, supporting printing of characters, strings, integers, float, boolean and double. In order to provide a class that supports Print you must implement at least write(char ch);

Member Function Documentation

◆ write() [1/2]

virtual size_t Print::write ( uint8_t  ch)
pure virtual

this is the minimum that you must implement to provide the write interface. It writes a single character to the underlying stream.

Parameters
chthe character to write.
Returns
returns 1 if written, otherwise 0.

Implemented in PrintfLogger, PrintfLogger, and MBedLogger.

◆ write() [2/2]

virtual size_t Print::write ( const char *  sz)
inlinevirtual

You can optionally override this function, it writes a whole string to the underlying stream, returning the number of characters written

Parameters
szthe string data to write, zero terminated
Returns
the number of characters

Reimplemented in PrintfLogger, PrintfLogger, and MBedLogger.

◆ print() [1/8]

void Print::print ( char  ch)
inline

Prints a characcter to the stream without a newline

Parameters
chthe character to print.

◆ println() [1/9]

void Print::println ( char  ch)
inline

Prints a character to the stream followed by a newline.

Parameters
ch

◆ print() [2/8]

void Print::print ( const char *  sz)
inline

Prints a zero terminated string to the stream

Parameters
szthe string to write.

◆ println() [2/9]

void Print::println ( const char *  sz)
inline

Prints a zero terminated string followed by newline to the stream

Parameters
szthe string to write

◆ print() [3/8]

void Print::print ( int  val,
int  radix = DEC 
)
inline

Prints an integer value, with an optional radix, default DEC, but either DEC, HEX or BIN

Parameters
valthe numeric value to be printed
radixthe base, DEC, HEX or BIN

◆ println() [3/9]

void Print::println ( int  val,
int  radix = DEC 
)
inline

Prints an integer value, with an optional radix, default DEC, but either DEC, HEX or BIN, the integer is followed by a new line character.

Parameters
valthe numeric value to be printed
radixthe base DEC, HEX or BIN

◆ print() [4/8]

void Print::print ( unsigned int  val,
int  radix = DEC 
)
inline

Prints an unsigned integer value, with an optional radix, default DEC, but either DEC, HEX or BIN

Parameters
valthe numeric value to be printed
radixthe base, DEC, HEX or BIN

◆ println() [4/9]

void Print::println ( unsigned int  val,
int  radix = DEC 
)
inline

Prints an integer value, with an optional radix, default DEC, but either DEC, HEX or BIN, the integer is followed by a new line character.

Parameters
valthe numeric value to be printed
radixthe base DEC, HEX or BIN

◆ print() [5/8]

void Print::print ( long  val,
int  radix = DEC 
)
inline

Prints a long value, with an optional radix, default DEC, but either DEC, HEX or BIN

Parameters
valthe numeric value to be printed
radixthe base DEC, HEX or BIN

◆ println() [5/9]

void Print::println ( long  val,
int  radix = DEC 
)
inline

Prints a long value, with an optional radix, default DEC, but either DEC, HEX or BIN, the integer is followed by a new line character.

Parameters
valthe numeric value to be printed
radixthe base DEC, HEX or BIN

◆ print() [6/8]

void Print::print ( unsigned long  val,
int  radix = DEC 
)
inline

Prints an unsigned long value, with an optional radix, default DEC, but either DEC, HEX or BIN

Parameters
valthe numeric value to be printed
radixthe base, DEC, HEX or BIN

◆ println() [6/9]

void Print::println ( unsigned long  val,
int  radix = DEC 
)
inline

Prints an unsigned long value, with an optional radix, default DEC, but either DEC, HEX or BIN

Parameters
valthe numeric value to be printed
radixthe base, DEC, HEX or BIN

◆ print() [7/8]

void Print::print ( double  dbl,
int  dp = 3 
)
inline

Prints a double value to a number of decimal places (maximum supported decimal places is 6).

Parameters
dblthe double value to print
dpthe number of decimal places, default 3. Max 6.

◆ println() [7/9]

void Print::println ( double  dbl,
int  dp = 3 
)
inline

Prints a double value to a number of decimal places (maximum supported decimal places is 19). This is followed by a newline.

Parameters
dblthe double value to print
dpthe number of decimal places, default 3. Max 19.

◆ print() [8/8]

void Print::print ( bool  b)
inline

Prints a boolean value, either true or false.

Parameters
bthe boolean to print.

◆ println() [8/9]

void Print::println ( bool  b)
inline

Prints a boolean value, either true or false, followed by a newline.

Parameters
bthe boolean to print.

◆ println() [9/9]

void Print::println ( )
inline

Print a newline character.


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