#include <guanaqo/callback-streambuf.hpp>
An implementation of a std::streambuf that calls the given callback function with the characters that are written.
- Note
- Not thread-safe.
Inspired by https://github.com/pybind/pybind11/blob/master/include/pybind11/iostream.h
Definition at line 22 of file callback-streambuf.hpp.
|
| using | write_func_t = std::function<void(std::span<const char>)> |
|
| size_t | utf8_remainder () const |
| | Computes how many bytes at the end of the buffer are part of an incomplete sequence of UTF-8 bytes.
|
| int | sync () override |
| int | overflow (int c) override |
◆ write_func_t
◆ callback_streambuf()
| guanaqo::callback_streambuf::callback_streambuf |
( |
write_func_t | write_func, |
|
|
size_t | buffer_size = 1024 ) |
|
inline |
◆ ~callback_streambuf()
| guanaqo::callback_streambuf::~callback_streambuf |
( |
| ) |
|
|
inlineoverride |
◆ utf8_remainder()
| size_t guanaqo::callback_streambuf::utf8_remainder |
( |
| ) |
const |
|
inlinenodiscardprivate |
Computes how many bytes at the end of the buffer are part of an incomplete sequence of UTF-8 bytes.
- Precondition
- pbase() < pptr()
Definition at line 30 of file callback-streambuf.hpp.
◆ sync()
| int guanaqo::callback_streambuf::sync |
( |
| ) |
|
|
inlineoverrideprivate |
◆ overflow()
| int guanaqo::callback_streambuf::overflow |
( |
int | c | ) |
|
|
inlineoverrideprivate |
◆ write_func
◆ buffer
| std::vector<char> guanaqo::callback_streambuf::buffer |
|
private |
The documentation for this class was generated from the following file: