116 void write(
const char* content,
size_t size)
118 streambuf_.
sputn(content, size);
132 streambuf_.
sputn(str);
144 void write(
const flash::FlashStorage* str)
146 streambuf_.
sputn(str);
162 convert(streambuf_, uint16_t(ptr));
177 convert(streambuf_, value);
192 convert(streambuf_, ch);
207 justify(streambuf_, str,
false,
nullptr);
222 justify(streambuf_, str);
239 convert(streambuf_, value);
256 convert(streambuf_, value);
273 convert(streambuf_, value);
290 convert(streambuf_, value);
307 convert(streambuf_, value);
340 void after_insertion()
347 void check_overflow()
352 ostreambuf& streambuf_;
430 if (ch == delim)
break;
450 if (ch == delim)
break;
466 bool forever = (n == 0);
467 while (forever || (n > 0))
470 if (
get() == delim)
break;
482 while (n--) *str++ =
get();
527 convert(scan(buffer,
sizeof buffer), value);
565 char buffer[
sizeof(int) * 8 + 1];
566 convert(scan(buffer,
sizeof buffer), value);
585 char buffer[
sizeof(int) * 8 + 1];
586 convert(scan(buffer,
sizeof buffer), value);
605 char buffer[
sizeof(long) * 8 + 1];
606 convert(scan(buffer,
sizeof buffer), value);
625 char buffer[
sizeof(long) * 8 + 1];
626 convert(scan(buffer,
sizeof buffer), value);
647 char buffer[DOUBLE_BUFFER_SIZE];
648 convert(scan(buffer,
sizeof buffer), value);
681 void skipws_if_needed()
686 void skip_whitespace()
691 char* scan(
char* str,
size_t max);
693 istreambuf& streambuf_;
695 template<
typename FSTREAM>
friend void ws(FSTREAM&);
708 template<
typename FSTREAM>
inline void ws(FSTREAM& stream)
710 stream.skip_whitespace();
716 template<
typename FSTREAM>
inline void flush(FSTREAM& stream)
725 template<
typename FSTREAM>
inline void endl(FSTREAM& stream)
Base class for formatted streams.
fmtflags flags() const
Return the format flags currently selected in this stream.
void width(uint8_t width)
Set minimum width used for displaying values.
static constexpr fmtflags skipws
Skip leading spaces on certain extraction (read) operations.
uint8_t width() const
Get the current minimum width value (default = 0) used for formatted output.
static constexpr iostate badbit
This bit is set when an irrecoverable stream error has occurred, e.g.
void setstate(iostate state)
Set the stream error flags state in addition to currently set flags.
static constexpr fmtflags unitbuf
Flush output after each insertion operation.
Input stream wrapper to provide formatted input API, a la C++.
istream & operator>>(long &value)
Input and interpret next word from buffer as a signed long integer value.
istream & ignore(size_t n=1, int delim=istreambuf::EOF)
Extract characters from this input stream and discards them, until either n characters have been extr...
istream & read(char *str, size_t n)
Read a block of data from this input stream.
int get()
Extract a single character from this input stream.
istream(istreambuf &streambuf)
Construct a formatted input wrapper of streambuf.
istream & operator>>(bool &value)
Input and interpret next character from buffer as a boolean value.
istream & getline(char *str, size_t n, char delim='\n')
Extract characters from this input stream and stores them as a C-string, until either (n - 1) charact...
void(*)(istream &) MANIPULATOR
General type of a manipulator function applicable to this input stream.
istream & operator>>(char *buf)
Read characters from buffer into buf until one of these conditions happen:
istreambuf & rdbuf() const
Return the stream buffer associated with this stream.
istream & operator>>(double &value)
Input and interpret next word from buffer as a floating point value.
istream & operator>>(unsigned int &value)
Input and interpret next word from buffer as an unsigned integer value.
istream & operator>>(unsigned long &value)
Input and interpret next word from buffer as an unsigned long integer value.
istream & operator>>(MANIPULATOR func)
Apply a MANIPULATOR to this input stream.
istream & get(char &ch)
Extract a single character from this input stream.
friend void ws(FSTREAM &)
Manipulator for an input stream, which will swallow all white spaces from that stream.
istream & operator>>(int &value)
Input and interpret next word from buffer as a signed integer value.
istream & operator>>(char &value)
Input next character from buffer.
istream & get(char *str, size_t n, char delim='\n')
Extract characters from this input stream and stores them as a C-string, until either (n - 1) charact...
int peek()
Return the next character in this input stream, without extracting it.
Input API based on a ring buffer.
static const int EOF
Special value returned by sbumpc() when buffer is empty.
QUEUE & queue()
Return the underlying queue.
Output stream wrapper to provide formatted output API, a la C++.
void write(const char *content, size_t size)
Write a block of data to this stream.
void flush()
Flush this ostream and blocks until all its buffer has been written to the underlying device.
ostream & operator<<(double value)
Output a floating point number, using the current minimum width() and precision().
ostream & operator<<(const void *ptr)
Output the address of a pointer.
ostream & operator<<(bool value)
Output a boolean value.
ostream & operator<<(long value)
Output a signed long integral number, represented within the current base(), using the current minimu...
void write(const flash::FlashStorage *str)
Write a flash-stored string (null-terminated) to this stream.
ostream & operator<<(const flash::FlashStorage *str)
Output a C-string (\0 terminated) that is stored in flash memory.
ostream & operator<<(char ch)
Output a single character.
ostream & operator<<(MANIPULATOR func)
Apply a MANIPULATOR to this output stream.
ostream & operator<<(unsigned int value)
Output an unsigned integral number, represented within the current base(), using the current minimum ...
ostreambuf & rdbuf() const
Return the stream buffer associated with this stream.
ostream & operator<<(const char *str)
Output a C-string (\0 terminated).
void put(char c)
Insert character c into this stream.
void write(const char *str)
Write a string (null-terminated) to this stream.
ostream(ostreambuf &streambuf)
Construct a formatted output wrapper of streambuf.
ostream & operator<<(unsigned long value)
Output an unsigned long integral number, represented within the current base(), using the current min...
void(*)(ostream &) MANIPULATOR
General type of a manipulator function applicable to this output stream.
ostream & operator<<(int value)
Output a signed integral number, represented within the current base(), using the current minimum wid...
Output API based on a ring buffer.
void pubsync()
Wait until all buffer content has been pulled by a consumer.
bool overflow() const
Indicate if a buffer overflow has occurred since last time pubsync() or reset_overflow() was called.
void sputc(char c)
Append a character to the buffer.
void sputn(const char *content, size_t size)
Append several characters to the buffer.
C++-like std::iostream facilities.
T peek(Queue< T, TREF > &queue)
Peek an item from the beginning of queue.
T pull(Queue< T, TREF > &queue)
Pull an item from the beginning of queue.
Defines C++-like streams API, based on circular buffers for input or output.
void flush(FSTREAM &stream)
Manipulator for an output stream, which will flush the stream buffer.
void endl(FSTREAM &stream)
Manipulator for an output stream, which will insert a new-line character and flush the stream buffer.
void ws(FSTREAM &stream)
Manipulator for an input stream, which will swallow all white spaces from that stream.
void yield()
Utility method used by many FastArduino API in order to "yield" some processor time; concretely it ju...
Utility API to handle ring-buffer queue containers.
C++-like std::iostream facilities.