StaticPrintBuffer< size > Class Template Reference

Write-through buffer using stack only. More...

#include <PrintBuffer.h>

Inheritance diagram for StaticPrintBuffer< size >:
Collaboration diagram for StaticPrintBuffer< size >:

Public Member Functions

 StaticPrintBuffer (Print &output)
 Construct a stack-based buffer. More...
 
- Public Member Functions inherited from BasePrintBuffer
 BasePrintBuffer (Print &output, uint8_t buffer[], size_t bufferSize)
 Create buffer. More...
 
 ~BasePrintBuffer ()
 
size_t write (uint8_t c) override
 Writes a single character to output stream. More...
 
size_t write (const uint8_t *data, size_t size) override
 Writes characters from a buffer to output stream. More...
 
void flush ()
 Write any buffered content to output. More...
 
- Public Member Functions inherited from Print
 Print ()=default
 
 Print (const Print &)=delete
 
 Print (Print &&)=delete
 
virtual ~Print ()=default
 
Printoperator= (const Print &)=delete
 
Printoperator= (Print &&)=delete
 
int getWriteError ()
 Gets last error. More...
 
void clearWriteError ()
 Clears the last write error. More...
 
size_t write (const char *str)
 Writes a c-string 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...
 
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)
 

Additional Inherited Members

- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Detailed Description

template<size_t size>
class StaticPrintBuffer< size >

Write-through buffer using stack only.

Template Parameters
sizeSize of buffer

Example usage:

 FileStream stream("file.txt", File::ReadWrite);
    {
     StaticPrintBuffer<256> buffer(stream);
        writeSomeData(buffer);
    } // Buffer flushed and destroyed when it goes out of scope

Constructor & Destructor Documentation

◆ StaticPrintBuffer()

template<size_t size>
StaticPrintBuffer< size >::StaticPrintBuffer ( Print output)
inline

Construct a stack-based buffer.

Parameters
outputPrint destination

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