17 auto current_pos = m_str.tellp();
18 m_str.seekp(0, std::ios::end);
19 if(m_str.tellp() == current_pos) {
22 m_str.seekp(current_pos);
27 m_str.seekp(
static_cast<off_type
>(len), std::ios::cur);
36 auto write_vec = std::vector<char>(len);
37 std::memcpy(write_vec.data(), data, len);
38 return static_cast<bool>(
39 m_str.write(write_vec.data(),
static_cast<off_type
>(len)));
43 m_str.setstate(std::ios::failbit);
auto write(const void *data, size_t len) -> bool final
Attempts to write the given number of bytes from the given memory location to the stream's current po...
void advance_cursor(size_t len) final
Moves the stream forward without writing to the stream.
ostream_serializer(std::ostream &s)
Constructor.
void reset() final
Seeks the stream position to the beginning.
auto end_of_buffer() const -> bool final
Indicates whether the serializer has reached the end of the stream.
auto read(void *data, size_t len) -> bool final
Not implemented for ostream.
Implementation of serializer for std::ios.