|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <BufferWriter.h>


Public Member Functions | |
| FixedBufferWriter (char *buffer, size_t capacity) | |
| FixedBufferWriter (MemSpan< void > const &span) | |
| Construct using the memory span as the buffer. | |
| FixedBufferWriter (MemSpan< char > const &span) | |
| Construct using the memory span as the buffer. | |
| FixedBufferWriter (std::nullptr_t) | |
| FixedBufferWriter (const FixedBufferWriter &)=delete | |
| FixedBufferWriter & | operator= (const FixedBufferWriter &)=delete |
| FixedBufferWriter (FixedBufferWriter &&that) | |
| Move constructor. | |
| FixedBufferWriter & | operator= (FixedBufferWriter &&that) |
| Move assignment. | |
| self_type & | assign (MemSpan< char > const &span) |
| Reset buffer. | |
| FixedBufferWriter & | write (char c) override |
| Write a single character c to the buffer. | |
| FixedBufferWriter & | write (const void *data, size_t length) override |
| Write length bytes, starting at data, to the buffer. | |
| const char * | data () const override |
| Return the output buffer. | |
| bool | error () const override |
| char * | aux_data () override |
| size_t | capacity () const override |
| Get the total capacity of the output buffer. | |
| size_t | extent () const override |
| Get the total output sent to the writer. | |
| bool | commit (size_t n) override |
| Advance the used part of the output buffer. | |
| self_type & | discard (size_t n) override |
| Drop n characters from the end of the buffer. | |
| self_type & | restrict (size_t n) override |
| Reduce the capacity by n. | |
| self_type & | restore (size_t n) override |
| Restore n bytes of the capacity. | |
| FixedBufferWriter & | copy (size_t dst, size_t src, size_t n) override |
| Copy data in the buffer. | |
| self_type & | clear () |
| self_type & | detach () |
| swoc::TextView | view () const |
| operator std::string_view () const | |
Provide a string_view of all successfully written characters as a user conversion. | |
| operator swoc::TextView () const | |
Provide a string_view of all successfully written characters as a user conversion. | |
| std::ostream & | operator>> (std::ostream &stream) const override |
| Output the buffer contents to the stream. | |
| BufferWriter & | write (MemSpan< void const > span) |
Public Member Functions inherited from swoc::BufferWriter | |
| BufferWriter & | write (MemSpan< void const > span) |
| size_t | size () const |
| size_t | remaining () const |
| MemSpan< char > | aux_span () |
| template<typename... Args> | |
| BufferWriter & | print (const TextView &fmt, Args &&...args) |
| template<typename... Args> | |
| BufferWriter & | print_v (const TextView &fmt, const std::tuple< Args... > &args) |
| template<typename... Args> | |
| BufferWriter & | print (const bwf::Format &fmt, Args &&...args) |
| template<typename... Args> | |
| BufferWriter & | print_v (const bwf::Format &fmt, const std::tuple< Args... > &args) |
| template<typename Binding, typename Extractor> | |
| BufferWriter & | print_nfv (Binding &&names, Extractor &&ex, bwf::ArgPack const &args) |
| template<typename Binding, typename Extractor> | |
| BufferWriter & | print_nfv (Binding const &names, Extractor &&ex) |
| template<typename Binding> | |
| BufferWriter & | print_n (Binding const &names, TextView const &fmt) |
| template<typename T> | |
| BufferWriter & | format (bwf::Spec const &spec, T &&t) |
| template<typename T> | |
| BufferWriter & | format (bwf::Spec const &spec, T const &t) |
Protected Member Functions | |
| FixedBufferWriter (char *buffer, size_t capacity, bool noexcept_flag) noexcept | |
Protected Attributes | |
| char *const | _buffer |
| Output buffer. | |
| size_t | _capacity |
| Size of output buffer. | |
| size_t | _attempted = 0 |
| Number of characters written, including those discarded due error condition. | |
A concrete BufferWriter class for a fixed buffer.
Definition at line 302 of file BufferWriter.h.
|
inline |
Construct a buffer writer on a fixed buffer of size capacity.
If writing goes past the end of the buffer, the excess is dropped.
Definition at line 498 of file BufferWriter.h.
|
inline |
Construct using the memory span as the buffer.
Definition at line 507 of file BufferWriter.h.
|
inline |
Construct using the memory span as the buffer.
Definition at line 510 of file BufferWriter.h.
|
inline |
Constructor an empty buffer with no capacity. This can be useful to measure the extent of the output before allocating memory.
Definition at line 512 of file BufferWriter.h.
|
inline |
Move constructor.
Definition at line 522 of file BufferWriter.h.
|
inlineprotectednoexcept |
Definition at line 504 of file BufferWriter.h.
|
inline |
Reset buffer.
Definition at line 528 of file BufferWriter.h.
|
inlineoverridevirtual |
nullptr is there is no remaining unwritten space. Reimplemented from swoc::BufferWriter.
Definition at line 582 of file BufferWriter.h.
|
inlineoverridevirtual |
Get the total capacity of the output buffer.
Implements swoc::BufferWriter.
Definition at line 594 of file BufferWriter.h.
|
inline |
Erase the buffer, reset to empty (no valid data). This is a convenience for reusing a buffer. For instance
This is equivalent to w.discard(w.size()) but clearer for that case.
Definition at line 627 of file BufferWriter.h.
|
inlineoverridevirtual |
Advance the used part of the output buffer.
Implements swoc::BufferWriter.
Definition at line 587 of file BufferWriter.h.
|
inlineoverridevirtual |
Copy data in the buffer.
Implements swoc::BufferWriter.
Definition at line 633 of file BufferWriter.h.
|
inlineoverridevirtual |
Return the output buffer.
Implements swoc::BufferWriter.
Definition at line 572 of file BufferWriter.h.
|
inline |
Definition at line 515 of file BufferWriter.h.
|
inlineoverridevirtual |
Drop n characters from the end of the buffer.
Implements swoc::BufferWriter.
Definition at line 621 of file BufferWriter.h.
|
inlineoverridevirtual |
true if output has been discarded, false otherwise. Implements swoc::BufferWriter.
Definition at line 577 of file BufferWriter.h.
|
inlineoverridevirtual |
Get the total output sent to the writer.
Implements swoc::BufferWriter.
Definition at line 599 of file BufferWriter.h.
|
inline |
Provide a string_view of all successfully written characters as a user conversion.
Definition at line 646 of file BufferWriter.h.
|
inline |
Provide a string_view of all successfully written characters as a user conversion.
Definition at line 650 of file BufferWriter.h.
|
inline |
Move assignment.
Definition at line 536 of file BufferWriter.h.
|
overridevirtual |
Output the buffer contents to the stream.
Implements swoc::BufferWriter.
Definition at line 741 of file bw_format.cc.
|
inlineoverridevirtual |
Restore n bytes of the capacity.
Implements swoc::BufferWriter.
Definition at line 612 of file BufferWriter.h.
|
inlineoverridevirtual |
Reduce the capacity by n.
Implements swoc::BufferWriter.
Definition at line 603 of file BufferWriter.h.
|
inline |
std::string_view. Definition at line 642 of file BufferWriter.h.
|
inlineoverridevirtual |
Write a single character c to the buffer.
Implements swoc::BufferWriter.
Definition at line 545 of file BufferWriter.h.
|
inlineoverridevirtual |
Write length bytes, starting at data, to the buffer.
Reimplemented from swoc::BufferWriter.
Definition at line 555 of file BufferWriter.h.
|
inline |
Write data to the buffer.
| span | Data source. |
Data from span is written directly to the buffer, and clipped to the size of the buffer.
Definition at line 66 of file BufferWriter.h.
|
protected |
Number of characters written, including those discarded due error condition.
Definition at line 414 of file BufferWriter.h.
|
protected |
Output buffer.
Definition at line 412 of file BufferWriter.h.
|
protected |
Size of output buffer.
Definition at line 413 of file BufferWriter.h.