Provides formatted output to stream. More...
#include <Print.h>
Classes | |
class | has_printTo |
Public Member Functions | |||||||
virtual | ~Print () | ||||||
int | getWriteError () | ||||||
Gets last error. More... | |||||||
void | clearWriteError () | ||||||
Clears the last write error. More... | |||||||
virtual size_t | write (uint8_t c)=0 | ||||||
Writes a single character to output stream. More... | |||||||
size_t | write (const char *str) | ||||||
Writes a c-string to output stream. More... | |||||||
virtual size_t | write (const uint8_t *buffer, size_t size) | ||||||
Writes characters from a buffer to output stream. More... | |||||||
size_t | write (const char *buffer, size_t size) | ||||||
Writes characters from a buffer to output stream. More... | |||||||
size_t | print (char c) | ||||||
Prints a single character to output stream. More... | |||||||
size_t | print (const char str[]) | ||||||
Prints a c-string to output stream. More... | |||||||
size_t | print (double num, int digits=2) | ||||||
Print a floating-point number to output stream. More... | |||||||
template<typename T > | |||||||
std::enable_if< has_printTo< T >::value, size_t >::type | print (const T &obj) | ||||||
Prints a Printable object to output stream. More... | |||||||
size_t | print (const String &s) | ||||||
Prints a String to output stream. More... | |||||||
template<typename E > | |||||||
std::enable_if< std::is_enum< E >::value &&!std::is_convertible< E, int >::value, size_t >::type | print (E value) | ||||||
enums can be printed as strings provided they have a toString(E) implementation. More... | |||||||
size_t | println () | ||||||
Prints a newline to output stream. More... | |||||||
template<typename... Args> | |||||||
size_t | println (const Args &... args) | ||||||
Print value plus newline to output stream. More... | |||||||
size_t | printf (const char *fmt,...) | ||||||
Prints a formatted c-string to output stream. More... | |||||||
Print an integral number to output stream | |||||||
| |||||||
size_t | print (unsigned long num, uint8_t base=DEC) | ||||||
template<typename... Args> | |||||||
size_t | print (unsigned long num, Args... args) | ||||||
template<typename... Args> | |||||||
size_t | print (const unsigned long long &num, Args... args) | ||||||
size_t | print (long num, uint8_t base=DEC) | ||||||
template<typename... Args> | |||||||
size_t | print (long num, Args... args) | ||||||
template<typename... Args> | |||||||
size_t | print (const long long &num, Args... args) | ||||||
template<typename... Args> | |||||||
size_t | print (unsigned int num, Args... args) | ||||||
template<typename... Args> | |||||||
size_t | print (unsigned char num, Args... args) | ||||||
template<typename... Args> | |||||||
size_t | print (int num, Args... args) | ||||||
Protected Member Functions | |
void | setWriteError (int err=1) |
Detailed Description
Provides formatted output to stream.
Constructor & Destructor Documentation
◆ ~Print()
|
inlinevirtual |
Member Function Documentation
◆ clearWriteError()
|
inline |
Clears the last write error.
◆ getWriteError()
|
inline |
Gets last error.
- Return values
-
int Error number of last write error
◆ print() [1/15]
|
inline |
Prints a single character to output stream.
- Parameters
-
c Character to print
- Return values
-
size_t Quantity of characters written to stream
◆ print() [2/15]
|
inline |
Prints a c-string to output stream.
- Parameters
-
str c-string to print
- Return values
-
size_t Quantity of characters written to output stream
◆ print() [3/15]
|
inline |
◆ print() [4/15]
|
inline |
◆ print() [5/15]
|
inline |
Prints a Printable object to output stream.
- Parameters
-
obj Object to print
- Return values
-
size_t Quantity of characters written to stream
◆ print() [6/15]
|
inline |
◆ print() [7/15]
|
inline |
Print a floating-point number to output stream.
- Parameters
-
num Number to print digits The decimal places to print (Default: 2, e.g. 21.35)
- Return values
-
size_t Quantity of characters written to stream
◆ print() [8/15]
|
inline |
enums can be printed as strings provided they have a toString(E)
implementation.
◆ print() [9/15]
|
inline |
◆ print() [10/15]
|
inline |
◆ print() [11/15]
|
inline |
◆ print() [12/15]
|
inline |
◆ print() [13/15]
|
inline |
◆ print() [14/15]
|
inline |
◆ print() [15/15]
◆ printf()
size_t Print::printf | ( | const char * | fmt, |
... | |||
) |
Prints a formatted c-string to output stream.
- Parameters
-
fmt Pointer to formatted c-string to print ... Parameters for placeholders within formatted string
- Return values
-
size_t Quantity of characters written to stream
- Note
- Use standard printf placeholders, e.g. d for integer, s for c-string, etc.
◆ println() [1/2]
|
inline |
Prints a newline to output stream.
- Return values
-
size_t Quantity of characters written to stream
◆ println() [2/2]
|
inline |
Print value plus newline to output stream.
- Return values
-
size_t Quantity of characters written to stream
◆ setWriteError()
|
inlineprotected |
◆ write() [1/4]
|
inline |
Writes characters from a buffer to output stream.
- Parameters
-
buffer Pointer to character buffer size Quantity of characters to write
- Return values
-
size_t Quantity of characters written to stream
◆ write() [2/4]
|
inline |
Writes a c-string to output stream.
- Parameters
-
str Pointer to c-string
- Return values
-
size_t Quantity of characters written to stream
◆ write() [3/4]
|
virtual |
Writes characters from a buffer to output stream.
- Parameters
-
buffer Pointer to character buffer size Quantity of characters to write
- Return values
-
size_t Quantity of characters written to stream
Reimplemented in OtaUpgrade::EncryptedStream, OtaUpgrade::BasicStream, Ota::UpgradeOutputStream, Graphics::Console, CircularBuffer, ReadWriteStream, USB::VENDOR::Device, USB::CDC::HostDevice, USB::CDC::Device, PartCheckerStream, Graphics::TextBuilder, HardwareSerial, MemoryDataStream, LimitedWriteStream, LimitedMemoryStream, IFS::FileStream, EndlessMemoryStream, Storage::PartitionStream, Hosted::Transport::TcpClientStream, Host::OutputStream, Hosted::Serial, and TwoWire.
◆ write() [4/4]
|
pure virtual |
Writes a single character to output stream.
- Parameters
-
c Character to write to output stream
- Return values
-
size_t Quantity of characters written to output stream
Implemented in TwoWire, ReadWriteStream, IDataSourceStream, CircularBuffer, Graphics::TextBuilder, Graphics::Console, Hosted::Transport::TcpClientStream, Hosted::Serial, and Host::OutputStream.
The documentation for this class was generated from the following file: