FastArduino
v1.8
C++ library to build fast but small Arduino/AVR projects
|
Go to the documentation of this file.
113 void write(
const char* content,
size_t size)
115 streambuf_.
sputn(content, size);
129 streambuf_.
sputn(str);
141 void write(
const flash::FlashStorage* str)
143 streambuf_.
sputn(str);
159 convert(streambuf_, uint16_t(ptr));
174 convert(streambuf_, value);
189 convert(streambuf_, ch);
204 justify(streambuf_, str,
false,
nullptr);
219 justify(streambuf_, str);
236 convert(streambuf_, value);
253 convert(streambuf_, value);
270 convert(streambuf_, value);
287 convert(streambuf_, value);
304 convert(streambuf_, value);
337 void after_insertion()
344 void check_overflow()
349 ostreambuf& streambuf_;
427 if (ch == delim)
break;
447 if (ch == delim)
break;
463 bool forever = (n == 0);
464 while (forever || (n > 0))
467 if (
get() == delim)
break;
479 while (n--) *str++ =
get();
524 convert(scan(buffer,
sizeof buffer), value);
562 char buffer[
sizeof(int) * 8 + 1];
563 convert(scan(buffer,
sizeof buffer), value);
582 char buffer[
sizeof(int) * 8 + 1];
583 convert(scan(buffer,
sizeof buffer), value);
602 char buffer[
sizeof(long) * 8 + 1];
603 convert(scan(buffer,
sizeof buffer), value);
622 char buffer[
sizeof(long) * 8 + 1];
623 convert(scan(buffer,
sizeof buffer), value);
644 char buffer[DOUBLE_BUFFER_SIZE];
645 convert(scan(buffer,
sizeof buffer), value);
678 void skipws_if_needed()
683 void skip_whitespace()
688 char* scan(
char* str,
size_t max);
690 istreambuf& streambuf_;
692 template<
typename FSTREAM>
friend void ws(FSTREAM&);
705 template<
typename FSTREAM>
inline void ws(FSTREAM& stream)
707 stream.skip_whitespace();
713 template<
typename FSTREAM>
inline void flush(FSTREAM& stream)
722 template<
typename FSTREAM>
inline void endl(FSTREAM& stream)
ostream & operator<<(MANIPULATOR func)
Apply a MANIPULATOR to this output stream.
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...
ostream & operator<<(bool value)
Output a boolean value.
ostream & operator<<(unsigned int value)
Output an unsigned integral number, represented within the current base(), using the current minimum ...
Output stream wrapper to provide formatted output API, a la C++.
istream & operator>>(unsigned int &value)
Input and interpret next word from buffer as an unsigned integer value.
Input API based on a ring buffer.
istream & operator>>(MANIPULATOR func)
Apply a MANIPULATOR to this input stream.
istream & operator>>(char &value)
Input next character from buffer.
void(*)(ostream &) MANIPULATOR
General type of a manipulator function applicable to this output stream.
void put(char c)
Insert character c into this stream.
void write(const flash::FlashStorage *str)
Write a flash-stored string (null-terminated) to this stream.
istream & operator>>(char *buf)
Read characters from buffer into buf until one of these conditions happen:
friend void ws(FSTREAM &)
Manipulator for an input stream, which will swallow all white spaces from that stream.
Output API based on a ring buffer.
void yield()
Utility method used by many FastArduino API in order to "yield" some processor time; concretely it ju...
int peek()
Return the next character in this input stream, without extracting it.
ostream(ostreambuf &streambuf)
Construct a formatted output wrapper of streambuf.
void setstate(iostate state)
Set the stream error flags state in addition to currently set flags.
static constexpr iostate badbit
This bit is set when an irrecoverable stream error has occurred, e.g.
void sputn(const char *content, size_t size)
Append several characters to the buffer.
void endl(FSTREAM &stream)
Manipulator for an output stream, which will insert a new-line character and flush the stream buffer.
istream(istreambuf &streambuf)
Construct a formatted input wrapper of streambuf.
ostream & operator<<(char ch)
Output a single character.
fmtflags flags() const
Return the format flags currently selected in this stream.
uint8_t width() const
Get the current minimum width value (default = 0) used for formatted output.
istreambuf & rdbuf() const
Return the stream buffer associated with this stream.
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...
ostream & operator<<(double value)
Output a floating point number, using the current minimum width() and precision().
ostream & operator<<(const char *str)
Output a C-string (\0 terminated).
Base class for formatted streams.
istream & read(char *str, size_t n)
Read a block of data from this input stream.
ostream & operator<<(int value)
Output a signed integral number, represented within the current base(), using the current minimum wid...
istream & operator>>(bool &value)
Input and interpret next character from buffer as a boolean value.
int get()
Extract a single character from this input stream.
Input stream wrapper to provide formatted input API, a la C++.
T peek(Queue< T, TREF > &queue)
Peek an item from the beginning of queue.
void ws(FSTREAM &stream)
Manipulator for an input stream, which will swallow all white spaces from that stream.
static constexpr fmtflags skipws
Skip leading spaces on certain extraction (read) operations.
ostream & operator<<(unsigned long value)
Output an unsigned long integral number, represented within the current base(), using the current min...
Utility API to handle ring-buffer queue containers.
istream & get(char &ch)
Extract a single character from this input stream.
T pull(Queue< T, TREF > &queue)
Pull an item from the beginning of queue.
ostream & operator<<(const flash::FlashStorage *str)
Output a C-string (\0 terminated) that is stored in flash memory.
void write(const char *str)
Write a string (null-terminated) to this stream.
C++-like std::iostream facilities.
static constexpr fmtflags unitbuf
Flush output after each insertion operation.
Defines C++-like streams API, based on circular buffers for input or output.
void flush()
Flush this ostream and blocks until all its buffer has been written to the underlying device.
void write(const char *content, size_t size)
Write a block of data to this stream.
istream & operator>>(unsigned long &value)
Input and interpret next word from buffer as an unsigned long integer value.
void pubsync()
Wait until all buffer content has been pulled by a consumer.
static const int EOF
Special value returned by sbumpc() when buffer is empty.
void sputc(char c)
Append a character to the buffer.
istream & operator>>(double &value)
Input and interpret next word from buffer as a floating point value.
ostream & operator<<(const void *ptr)
Output the address of a pointer.
QUEUE & queue()
Return the underlying queue.
ostreambuf & rdbuf() const
Return the stream buffer associated with this stream.
istream & operator>>(int &value)
Input and interpret next word from buffer as a signed integer value.
bool overflow() const
Indicate if a buffer overflow has occurred since last time pubsync() or reset_overflow() was called.
C++-like std::iostream facilities.
istream & operator>>(long &value)
Input and interpret next word from buffer as a signed long integer value.
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...
ostream & operator<<(long value)
Output a signed long integral number, represented within the current base(), using the current minimu...
void flush(FSTREAM &stream)
Manipulator for an output stream, which will flush the stream buffer.
void(*)(istream &) MANIPULATOR
General type of a manipulator function applicable to this input stream.