MT Core (C++)
Core library for replacing C++ standard in project usage
|
A writer that writes data to some sort of stream or buffer Note: the data elements written should be trivially constructible, trivially destructible, and trivially copyable. More...
#include <writer.hpp>
Public Types | |
using | WriteElem = typename Impl::WriteElem |
using | ErrType = typename Impl::ErrType |
Public Member Functions | |
Result< size_t, ErrType > | write (const Slice< std::remove_const_t< WriteElem > > &s) |
Will write as much of a Slice as possible. | |
Result< size_t, ErrType > | write (const Slice< std::add_const_t< WriteElem > > &s) |
Will write as much of a Slice as possible. | |
Result< size_t, ErrType > | write (const std::remove_const_t< WriteElem > &one) |
Will write a single element If there is no room, will return the error OUT_OF_ROOM. | |
Result< void, ErrType > | flush () |
Flushes a writer (i.e. | |
void | deinit (Allocator &allocator) |
Cleans up any memory stuff Only usable if the underlying writer has a deinit that takes an allocator. | |
void | deinit () |
Cleans up writer Only usable if the underlying writer has a deinit that takes an allocator. | |
size_t | bytes_written () const |
Gets the number of bytes written. | |
Result< size_t, ErrType > | write_all (const Slice< std::remove_const_t< WriteElem > > &s) |
Will write all the elements in a Slice If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream. | |
size_t | bytes_written () const |
auto | written () const |
void | reset () |
Result< size_t, ErrType > | write_all (const Slice< std::add_const_t< WriteElem > > &s) |
Will write all the elements in a Slice If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream. | |
Result< void, ErrType > | write_n_times (const Slice< std::remove_const_t< WriteElem > > &s, size_t n) |
Will write all the elements in a Slice N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream. | |
Result< size_t, ErrType > | write_n_times (const Slice< std::add_const_t< WriteElem > > &s, size_t n) |
Will write all the elements in a Slice N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream. | |
Result< size_t, ErrType > | write_n_times (const std::remove_const_t< WriteElem > &one, size_t n) |
Will write a single element N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream. | |
Public Attributes | |
Impl | underlying |
A writer that writes data to some sort of stream or buffer Note: the data elements written should be trivially constructible, trivially destructible, and trivially copyable.
Impl | Writer Implementation ( |
Definition at line 51 of file io/writer.hpp.
using mtcore::io::Writer< Impl >::ErrType = typename Impl::ErrType |
Definition at line 53 of file io/writer.hpp.
using mtcore::io::Writer< Impl >::WriteElem = typename Impl::WriteElem |
Definition at line 52 of file io/writer.hpp.
|
inlinenodiscard |
Gets the number of bytes written.
Definition at line 118 of file io/writer.hpp.
|
inlinenodiscard |
Definition at line 134 of file io/writer.hpp.
|
inline |
Cleans up writer Only usable if the underlying writer has a deinit that takes an allocator.
Definition at line 108 of file io/writer.hpp.
|
inline |
Cleans up any memory stuff Only usable if the underlying writer has a deinit that takes an allocator.
allocator | Allocator for any possible memory-related cleanup |
Definition at line 98 of file io/writer.hpp.
|
inline |
Flushes a writer (i.e.
send any buffered output if possible)
Definition at line 86 of file io/writer.hpp.
|
inline |
Definition at line 146 of file io/writer.hpp.
|
inline |
Will write as much of a Slice as possible.
s | Slice to write |
Definition at line 69 of file io/writer.hpp.
|
inline |
Will write as much of a Slice as possible.
s | Slice to write |
Definition at line 62 of file io/writer.hpp.
|
inline |
Will write a single element If there is no room, will return the error OUT_OF_ROOM.
one | Element to write |
Definition at line 77 of file io/writer.hpp.
|
inline |
Will write all the elements in a Slice If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream.
s | Element to write |
Definition at line 159 of file io/writer.hpp.
|
inline |
Will write all the elements in a Slice If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream.
s | Element to write |
Definition at line 127 of file io/writer.hpp.
|
inline |
Will write all the elements in a Slice N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream.
s | Element to write |
n | Number of times to write the Slice |
Definition at line 194 of file io/writer.hpp.
|
inline |
Will write all the elements in a Slice N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream.
s | Element to write |
n | Number of times to write the Slice |
Definition at line 182 of file io/writer.hpp.
|
inline |
Will write a single element N times If there is no room, will return the error OUT_OF_ROOM Note: May Result in a partial write to the output stream.
one | Element to write |
n | Number of times to write the Slice |
Definition at line 212 of file io/writer.hpp.
|
inlinenodiscard |
Definition at line 140 of file io/writer.hpp.
Impl mtcore::io::Writer< Impl >::underlying |
Definition at line 55 of file io/writer.hpp.