25 #ifndef ACE_COMMON_PRINT_STR_H
26 #define ACE_COMMON_PRINT_STR_H
31 namespace ace_common {
66 size_t write(uint8_t c)
override {
67 if (index_ < size_ - 1) {
77 size_t write(
const uint8_t *buf,
size_t size)
override {
78 if (buf ==
nullptr)
return 0;
82 size_t ret =
write(*buf++);
115 #if defined(ARDUINO_AVR_ATTINY1634) \
116 || defined(ARDUINO_AVR_ATTINY828) \
117 || defined(ARDUINO_AVR_ATTINYX313) \
118 || defined(ARDUINO_AVR_ATTINYX4) \
119 || defined(ARDUINO_AVR_ATTINYX41) \
120 || defined(ARDUINO_AVR_ATTINYX43) \
121 || defined(ARDUINO_AVR_ATTINYX5) \
122 || defined(ARDUINO_AVR_ATTINYX61) \
123 || defined(ARDUINO_AVR_ATTINYX7) \
124 || defined(ARDUINO_AVR_ATTINYX8)
174 uint16_t
const size_;
266 template <u
int16_t SIZE>
272 char actualBuf_[SIZE];
Base class for all template instances of the PrintStr<SIZE> class.
char *const buf_
This is the pointer to the character array buffer.
PrintStrBase(uint16_t size, char *buf)
Constructor.
const char * cstr() const
Return the NUL terminated c-string buffer.
size_t write(uint8_t c) override
Write a single character into the internal buffer.
const char * getCstr() const
Backwards compatible version of cstr().
size_t write(const uint8_t *buf, size_t size) override
Write the buf string of size into the internal buffer.
void flush() override
Clear the internal buffer.
size_t length() const
Return the length of the internal c-string buffer, not including the NUL terminator.
An alternate implementation of PrintStr that allocates the character array in the heap,...
PrintStrN(uint16_t size)
Create an instance with an internal buffer of size on the heap.
~PrintStrN()
Delete the internal buffer on the heap.
An implementation of Print that writes to an in-memory buffer supporting strings less than 65535 in l...