userver: dump::Reader Class Reference
Loading...
Searching...
No Matches
dump::Reader Class Referenceabstract

#include <userver/dump/operations.hpp>

Detailed Description

A general interface for binary data input.

Definition at line 48 of file operations.hpp.

+ Inheritance diagram for dump::Reader:

Public Member Functions

template<typename T >
Read ()
 Reads binary data.
 
virtual void Finish ()=0
 Must be called once all data has been read.
 

Protected Member Functions

virtual std::string_view ReadRaw (std::size_t max_size)=0
 Reads binary data.
 

Member Function Documentation

◆ Finish()

virtual void dump::Reader::Finish ( )
pure virtual

Must be called once all data has been read.

Warning
This method must not be called from within Write/Read
Exceptions
`Error`on read operation failure or if there is leftover data

Implemented in dump::EncryptedReader, dump::FileReader, and dump::MockReader.

◆ Read()

template<typename T >
T dump::Reader::Read ( )

Reads binary data.

Calls ADL-found Read(reader, To<T>)

Exceptions
`Error`and any user-thrown std::exception

Definition at line 116 of file operations.hpp.

◆ ReadRaw()

virtual std::string_view dump::Reader::ReadRaw ( std::size_t max_size)
protectedpure virtual

Reads binary data.

Note
Invalidates the memory returned by the previous call of ReadRaw
Normally, exactly max_size bytes is returned. On end-of-file, the amount of bytes returned can be less than max_size.
Exceptions
`Error`on read operation failure

Friends And Related Symbol Documentation

◆ ReadUnsafeAtMost

std::string_view ReadUnsafeAtMost ( Reader & reader,
std::size_t size )
friend

Reads a std::string_view

Note
Normally, exactly max_size bytes is returned. On end-of-file, the amount of bytes returned can be less than max_size.
Warning
The string_view will be invalidated on the next Read operation

The documentation for this class was generated from the following file: