#include <userver/dump/operations.hpp>
A general interface for binary data input.
Definition at line 48 of file operations.hpp.
|
template<typename T> |
T | Read () |
| Reads binary data.
|
|
virtual void | Finish ()=0 |
| Must be called once all data has been read.
|
|
|
virtual std::string_view | ReadRaw (std::size_t max_size)=0 |
| Reads binary data.
|
|
virtual void | BackUp (std::size_t size) |
| Moves the internal cursor back by size bytes so that the next call to ReadRaw returns the same data again.
|
|
◆ BackUp()
virtual void dump::Reader::BackUp |
( |
std::size_t | size | ) |
|
|
protectedvirtual |
Moves the internal cursor back by size
bytes so that the next call to ReadRaw returns the same data again.
- Note
- If there has been no previous call to ReadRaw, or
size
is greater than the number of bytes returned from that call, the behavior is undefined.
◆ Finish()
virtual void dump::Reader::Finish |
( |
| ) |
|
|
pure virtual |
◆ Read()
Reads binary data.
Calls ADL-found Read(reader, To<T>)
- Exceptions
-
`Error` | and any user-thrown std::exception |
Definition at line 124 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 |
◆ BackUpReadUnsafe
void BackUpReadUnsafe |
( |
Reader & | reader, |
|
|
std::size_t | size ) |
|
friend |
Moves the internal cursor back by size
bytes so that the next call to ReadUnsafeAtMost returns the same data again.
- Note
- If there has been no previous call to ReadUnsafeAtMost, or the last read operation was performed using something except ReadUnsafeAtMost, or
size
is greater than the number of bytes returned, then the behavior is undefined.
◆ 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: